felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r1220409 - /felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/LicenseServlet.java
Date Sun, 18 Dec 2011 14:06:56 GMT
Author: fmeschbe
Date: Sun Dec 18 14:06:56 2011
New Revision: 1220409

URL: http://svn.apache.org/viewvc?rev=1220409&view=rev
Log:
FELIX-2708 Prevent NPE in LicenseServlet

Modified:
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/LicenseServlet.java

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/LicenseServlet.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/LicenseServlet.java?rev=1220409&r1=1220408&r2=1220409&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/LicenseServlet.java
(original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/misc/LicenseServlet.java
Sun Dec 18 14:06:56 2011
@@ -295,30 +295,32 @@ public final class LicenseServlet extend
                 }
             }
         }
-
-        // license is in a nested JAR
-        final URL zipResource = bundle.getResource( pathInfo.innerJar );
-        if ( zipResource != null )
+        else
         {
-            final InputStream input = zipResource.openStream();
-            ZipInputStream zin = null;
-            try
-            {
-                zin = new ZipInputStream( input );
-                for ( ZipEntry zentry = zin.getNextEntry(); zentry != null; zentry = zin.getNextEntry()
)
+            // license is in a nested JAR
+            final URL zipResource = bundle.getResource( pathInfo.innerJar );
+            if ( zipResource != null )
+            {
+                final InputStream input = zipResource.openStream();
+                ZipInputStream zin = null;
+                try
                 {
-                    if ( pathInfo.licenseFile.equals( zentry.getName() ) )
+                    zin = new ZipInputStream( input );
+                    for ( ZipEntry zentry = zin.getNextEntry(); zentry != null; zentry =
zin.getNextEntry() )
                     {
-                        IOUtils.copy( zin, response.getWriter() );
-                        return true;
+                        if ( pathInfo.licenseFile.equals( zentry.getName() ) )
+                        {
+                            IOUtils.copy( zin, response.getWriter() );
+                            return true;
+                        }
                     }
                 }
-            }
-            finally
-            {
+                finally
+                {
 
-                IOUtils.closeQuietly( zin );
-                IOUtils.closeQuietly( input );
+                    IOUtils.closeQuietly( zin );
+                    IOUtils.closeQuietly( input );
+                }
             }
         }
 



Mime
View raw message