Prevented possible NullPointerException's
[jpa-converters] / src / main / java / de / juplo / jpa / converters / MonthDayConverter.java
index 143ced1..9063c33 100644 (file)
@@ -15,12 +15,16 @@ public class MonthDayConverter implements AttributeConverter<MonthDay, String>
   @Override
   public String convertToDatabaseColumn(MonthDay monthday)
   {
+    if (monthday == null)
+      return null;
     return monthday.toString();
   }
 
   @Override
   public MonthDay convertToEntityAttribute(String string)
   {
+    if (string == null)
+      return null;
     return MonthDay.parse(string);
   }
 }