diff --git a/ccm-core/src/main/java/org/libreccm/jpa/utils/MimeTypeConverter.java b/ccm-core/src/main/java/org/libreccm/jpa/utils/MimeTypeConverter.java index 885a411fe..342854c4a 100644 --- a/ccm-core/src/main/java/org/libreccm/jpa/utils/MimeTypeConverter.java +++ b/ccm-core/src/main/java/org/libreccm/jpa/utils/MimeTypeConverter.java @@ -18,7 +18,6 @@ */ package org.libreccm.jpa.utils; - import javax.activation.MimeType; import javax.activation.MimeTypeParseException; import javax.persistence.AttributeConverter; @@ -27,7 +26,7 @@ import javax.persistence.Converter; /** * A converter for converting properties of the type {@link MimeType} to * {@code String}. - * + * * @author Jens Pelzetter */ @Converter(autoApply = true) @@ -35,7 +34,11 @@ public class MimeTypeConverter implements AttributeConverter { @Override public String convertToDatabaseColumn(final MimeType attribute) { - return attribute.toString(); + if (attribute == null) { + return null; + } else { + return attribute.toString(); + } } @Override @@ -46,7 +49,5 @@ public class MimeTypeConverter implements AttributeConverter { throw new IllegalArgumentException("Not a valid mime type", ex); } } - - }