[ https://jira.codehaus.org/browse/JIBX-479?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=296211#comment-296211 ]
Sergio Ortiz edited comment on JIBX-479 at 4/11/12 5:19 AM: ------------------------------------------------------------ Current code with proper format (without line numbers): {code} public static String serializeDateTime(Date date) { return serializeDateTime(date.getTime(), true); } {code} was (Author: sergioortiz): Current code with proper format (without line numbers): public static String serializeDateTime(Date date) { return serializeDateTime(date.getTime(), true); } > Missing Null check in org.jibx.runtime.Utility.serializeDateTime() > ------------------------------------------------------------------ > > Key: JIBX-479 > URL: https://jira.codehaus.org/browse/JIBX-479 > Project: JiBX > Issue Type: Bug > Components: core > Affects Versions: JiBX 1.2.3 > Reporter: Sergio Ortiz > > Utility.serializeDateTime() throws a NullPointerException when trying to > serialize a null Date (an Object's property of Date type that hasn't been > initialized for whatever reason). > Current code: > 1441 public static String serializeDateTime(Date date) { > 1442 return serializeDateTime(date.getTime(), true); > 1443 } > So if for some reason date is null, line 1442 would throw a > java.lang.NullPointerException. It should include the null check and return > null or an empty string. For example: > public static String serializeDateTime(Date date) { > if(date == null){ > return null; > } > return serializeDateTime(date.getTime(), true); > } > Regards, > Sergio -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira ------------------------------------------------------------------------------ Better than sec? Nothing is better than sec when it comes to monitoring Big Data applications. Try Boundary one-second resolution app monitoring today. Free. http://p.sf.net/sfu/Boundary-dev2dev _______________________________________________ jibx-devs mailing list jibx-devs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-devs