| 
															
																@@ -6,6 +6,8 @@ import org.codehaus.jackson.JsonParseException; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 import org.codehaus.jackson.map.JsonMappingException; 
															 | 
															
															 | 
															
																 import org.codehaus.jackson.map.JsonMappingException; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 import org.codehaus.jackson.map.ObjectMapper; 
															 | 
															
															 | 
															
																 import org.codehaus.jackson.map.ObjectMapper; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 import org.codehaus.jackson.type.TypeReference; 
															 | 
															
															 | 
															
																 import org.codehaus.jackson.type.TypeReference; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+import org.slf4j.Logger; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+import org.slf4j.LoggerFactory; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																 import java.io.IOException; 
															 | 
															
															 | 
															
																 import java.io.IOException; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 import java.util.HashMap; 
															 | 
															
															 | 
															
																 import java.util.HashMap; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -20,6 +22,8 @@ import java.util.Map; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  * @author xuxueli 2015-9-25 18:02:56 
															 | 
															
															 | 
															
																  * @author xuxueli 2015-9-25 18:02:56 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  */ 
															 | 
															
															 | 
															
																  */ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 public class JacksonUtil { 
															 | 
															
															 | 
															
																 public class JacksonUtil { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+	private static Logger logger = LoggerFactory.getLogger(JacksonUtil.class); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     private final static ObjectMapper objectMapper = new ObjectMapper(); 
															 | 
															
															 | 
															
																     private final static ObjectMapper objectMapper = new ObjectMapper(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     public static ObjectMapper getInstance() { 
															 | 
															
															 | 
															
																     public static ObjectMapper getInstance() { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         return objectMapper; 
															 | 
															
															 | 
															
																         return objectMapper; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -36,11 +40,11 @@ public class JacksonUtil { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     	try { 
															 | 
															
															 | 
															
																     	try { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			return getInstance().writeValueAsString(obj); 
															 | 
															
															 | 
															
																 			return getInstance().writeValueAsString(obj); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		} catch (JsonGenerationException e) { 
															 | 
															
															 | 
															
																 		} catch (JsonGenerationException e) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			e.printStackTrace(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+			logger.error(e.getMessage(), e); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		} catch (JsonMappingException e) { 
															 | 
															
															 | 
															
																 		} catch (JsonMappingException e) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			e.printStackTrace(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+			logger.error(e.getMessage(), e); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		} catch (IOException e) { 
															 | 
															
															 | 
															
																 		} catch (IOException e) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			e.printStackTrace(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+			logger.error(e.getMessage(), e); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		} 
															 | 
															
															 | 
															
																 		} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         return null; 
															 | 
															
															 | 
															
																         return null; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     } 
															 | 
															
															 | 
															
																     } 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -57,11 +61,11 @@ public class JacksonUtil { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     	try { 
															 | 
															
															 | 
															
																     	try { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			return getInstance().readValue(jsonStr, clazz); 
															 | 
															
															 | 
															
																 			return getInstance().readValue(jsonStr, clazz); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		} catch (JsonParseException e) { 
															 | 
															
															 | 
															
																 		} catch (JsonParseException e) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			e.printStackTrace(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+			logger.error(e.getMessage(), e); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		} catch (JsonMappingException e) { 
															 | 
															
															 | 
															
																 		} catch (JsonMappingException e) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			e.printStackTrace(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+			logger.error(e.getMessage(), e); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		} catch (IOException e) { 
															 | 
															
															 | 
															
																 		} catch (IOException e) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			e.printStackTrace(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+			logger.error(e.getMessage(), e); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		} 
															 | 
															
															 | 
															
																 		} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     	return null; 
															 | 
															
															 | 
															
																     	return null; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     } 
															 | 
															
															 | 
															
																     } 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -69,11 +73,11 @@ public class JacksonUtil { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     	try { 
															 | 
															
															 | 
															
																     	try { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			return getInstance().readValue(jsonStr, new TypeReference<T>() { }); 
															 | 
															
															 | 
															
																 			return getInstance().readValue(jsonStr, new TypeReference<T>() { }); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		} catch (JsonParseException e) { 
															 | 
															
															 | 
															
																 		} catch (JsonParseException e) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			e.printStackTrace(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+			logger.error(e.getMessage(), e); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		} catch (JsonMappingException e) { 
															 | 
															
															 | 
															
																 		} catch (JsonMappingException e) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			e.printStackTrace(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+			logger.error(e.getMessage(), e); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		} catch (IOException e) { 
															 | 
															
															 | 
															
																 		} catch (IOException e) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			e.printStackTrace(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+			logger.error(e.getMessage(), e); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		} 
															 | 
															
															 | 
															
																 		} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     	return null; 
															 | 
															
															 | 
															
																     	return null; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     } 
															 | 
															
															 | 
															
																     } 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -87,7 +91,7 @@ public class JacksonUtil { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			System.out.println(json); 
															 | 
															
															 | 
															
																 			System.out.println(json); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 			System.out.println(readValue(json, Map.class)); 
															 | 
															
															 | 
															
																 			System.out.println(readValue(json, Map.class)); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		} catch (Exception e) { 
															 | 
															
															 | 
															
																 		} catch (Exception e) { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-			e.printStackTrace(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+			logger.error(e.getMessage(), e); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 		} 
															 | 
															
															 | 
															
																 		} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 	} 
															 | 
															
															 | 
															
																 	} 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 } 
															 | 
															
															 | 
															
																 } 
															 |