From 89f4086dc297198be50a366b26e18a52b64f041b Mon Sep 17 00:00:00 2001 From: Taeyoung Son Date: Mon, 4 Aug 2014 20:43:09 +0900 Subject: COMMON: Fixed bug in image util. Fixed bug in image util. Change-Id: I4371bf40664c30955a02d332edc3b9ee8101bfd1 Signed-off-by: Taeyoung Son --- .../src/org/tizen/common/util/ImageUtil.java | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/org.tizen.common/src/org/tizen/common/util/ImageUtil.java b/org.tizen.common/src/org/tizen/common/util/ImageUtil.java index b9003e5b7..d8647c472 100644 --- a/org.tizen.common/src/org/tizen/common/util/ImageUtil.java +++ b/org.tizen.common/src/org/tizen/common/util/ImageUtil.java @@ -256,15 +256,15 @@ public class ImageUtil { */ public static List getAWTImages(InputStream is, String iconFilePath) throws IOException { List images = new ArrayList(); - String formatName = getFormatName(iconFilePath); - if ( !StringUtil.isEmpty(formatName) ) { - if (formatName.equalsIgnoreCase(ICO)) { + String extension = FilenameUtil.getExtension(iconFilePath); + if ( !StringUtil.isEmpty(extension) ) { + if (extension.equalsIgnoreCase(ICO)) { images = ICODecoder.read(is); - } else if (formatName.equalsIgnoreCase(BMP)) { + } else if (extension.equalsIgnoreCase(BMP)) { images.add(BMPDecoder.read(is)); - } else if (formatName.equalsIgnoreCase(SVG)) { + } else if (extension.equalsIgnoreCase(SVG)) { SVGUniverse svgUnverse = new SVGUniverse(); - URI iconUri = svgUnverse.loadSVG(is, formatName); + URI iconUri = svgUnverse.loadSVG(is, extension); if (iconUri == null) { return images; } @@ -582,19 +582,19 @@ public class ImageUtil { /** * Writes BufferedImage to OutputStream. * @param bImg BufferedImage - * @param formatName + * @param extension * @param os OutputStream * @throws IOException */ - public static void write(BufferedImage bImg, String formatName, OutputStream os) throws IOException { - if (ICO.equalsIgnoreCase(formatName)) { + public static void write(BufferedImage bImg, String extension, String formatName, OutputStream os) throws IOException { + if (ICO.equalsIgnoreCase(extension)) { ICOEncoder.write(bImg, os); - } else if (BMP.equalsIgnoreCase(formatName)) { + } else if (BMP.equalsIgnoreCase(extension)) { BMPEncoder.write(bImg, os); - } else if (SVG.equalsIgnoreCase(formatName)) { + } else if (SVG.equalsIgnoreCase(extension)) { // INFO:: Don't support svg format } else { - ImageIO.write(bImg, formatName, os); + ImageIO.write(bImg, extension, os); } } -- cgit v1.2.3