portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woon...@apache.org
Subject svn commit: r835870 - /portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/DefaultJPEGImgDecoder.java
Date Fri, 13 Nov 2009 15:01:34 GMT
Author: woonsan
Date: Fri Nov 13 15:01:34 2009
New Revision: 835870

URL: http://svn.apache.org/viewvc?rev=835870&view=rev
Log:
JS2-979: Code clean up

Modified:
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/DefaultJPEGImgDecoder.java

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/DefaultJPEGImgDecoder.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/DefaultJPEGImgDecoder.java?rev=835870&r1=835869&r2=835870&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/DefaultJPEGImgDecoder.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/security/mfa/impl/DefaultJPEGImgDecoder.java
Fri Nov 13 15:01:34 2009
@@ -8,11 +8,17 @@
 
 public class DefaultJPEGImgDecoder implements JPEGImgDecoder
 {
-
+    private static Class jpegCodecClazz;
+    
     public BufferedImage decodeAsBufferedImage(InputStream input) throws Exception
     {
-        Class codecClazz = Class.forName("com.sun.image.codec.jpeg.JPEGCodec");
-        Object decoder = MethodUtils.invokeStaticMethod(codecClazz, "createJPEGDecoder",
input);
+        if (jpegCodecClazz == null)
+        {
+            jpegCodecClazz = Class.forName("com.sun.image.codec.jpeg.JPEGCodec");
+        }
+        
+        Object decoder = MethodUtils.invokeStaticMethod(jpegCodecClazz, "createJPEGDecoder",
input);
+        
         return (BufferedImage) MethodUtils.invokeMethod(decoder, "decodeAsBufferedImage",
null);
     }
     



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message