File tree Expand file tree Collapse file tree 1 file changed +15
-15
lines changed
src/main/java/gr/gousiosg/javacg/stat Expand file tree Collapse file tree 1 file changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -51,26 +51,26 @@ public static void main(String[] args) {
5151 for (String arg : args ) {
5252
5353 File f = new File (arg );
54-
54+
5555 if (!f .exists ()) {
5656 System .err .println ("Jar file " + arg + " does not exist" );
5757 }
58-
59- JarFile jar = new JarFile (f );
60-
61- Enumeration <JarEntry > entries = jar .entries ();
62- while (entries .hasMoreElements ()) {
63- JarEntry entry = entries .nextElement ();
64- if (entry .isDirectory ())
65- continue ;
6658
67- if (!entry .getName ().endsWith (".class" ))
68- continue ;
59+ try (JarFile jar = new JarFile (f )) {
60+ Enumeration <JarEntry > entries = jar .entries ();
61+ while (entries .hasMoreElements ()) {
62+ JarEntry entry = entries .nextElement ();
63+ if (entry .isDirectory ())
64+ continue ;
65+
66+ if (!entry .getName ().endsWith (".class" ))
67+ continue ;
6968
70- cp = new ClassParser (arg ,entry .getName ());
71- ClassVisitor visitor = new ClassVisitor (cp .parse ());
72- visitor .start ();
73- }
69+ cp = new ClassParser (arg ,entry .getName ());
70+ ClassVisitor visitor = new ClassVisitor (cp .parse ());
71+ visitor .start ();
72+ }
73+ }
7474 }
7575 } catch (IOException e ) {
7676 System .err .println ("Error while processing jar: " + e .getMessage ());
You can’t perform that action at this time.
0 commit comments