Add more warnings source to 1.6) and fix warnings
[nikiroo-utils.git] / src / be / nikiroo / utils / serial / SerialUtils.java
index c28faeddebd86cd783e4924460aa01cb749f4b83..c222bc3e3d6334a76dcf03ad133a846609aed0b0 100644 (file)
@@ -11,7 +11,7 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.UnknownFormatConversionException;
 
-import be.nikiroo.utils.StringUtils;
+import be.nikiroo.utils.ImageUtils;
 
 /**
  * Small class to help with serialisation.
@@ -88,7 +88,7 @@ public class SerialUtils {
                        @Override
                        protected String toString(Object value) {
                                try {
-                                       return StringUtils.fromImage((BufferedImage) value);
+                                       return ImageUtils.toBase64((BufferedImage) value);
                                } catch (IOException e) {
                                        throw new UnknownFormatConversionException(e.getMessage());
                                }
@@ -102,7 +102,7 @@ public class SerialUtils {
                        @Override
                        protected Object fromString(String content) {
                                try {
-                                       return StringUtils.toImage(content);
+                                       return ImageUtils.fromBase64(content);
                                } catch (IOException e) {
                                        throw new UnknownFormatConversionException(e.getMessage());
                                }
@@ -299,10 +299,9 @@ public class SerialUtils {
                        String type = CustomSerializer.typeOf(encodedValue);
                        if (customTypes.containsKey(type)) {
                                return customTypes.get(type).decode(encodedValue);
-                       } else {
-                               throw new UnknownFormatConversionException(
-                                               "Unknown custom type: " + type);
                        }
+                       throw new UnknownFormatConversionException("Unknown custom type: "
+                                       + type);
                } else if (encodedValue.equals("NULL") || encodedValue.equals("null")) {
                        return null;
                } else if (encodedValue.endsWith("\"")) {