From: Jochen W. <joc...@gm...> - 2009-03-30 21:34:14
|
Hi, in order to convert the clirr-maven-plugin to 0.7, I would beg to either apply the patch below or to advice me what other solutions I should choose. Thanks, Jochen P.S: What's the equivalent of Repository.storeClass in 0.7? Is it required? -- I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone. -- (Bjarne Stroustrup, http://www.research.att.com/~bs/bs_faq.html#really-say-that My guess: Nokia E50) ### Eclipse Workspace Patch 1.0 #P clirr Index: core/src/java/net/sf/clirr/core/internal/asm/Repository.java =================================================================== RCS file: /cvsroot/clirr/clirr/core/src/java/net/sf/clirr/core/internal/asm/Repository.java,v retrieving revision 1.6 diff -u -r1.6 Repository.java --- core/src/java/net/sf/clirr/core/internal/asm/Repository.java 23 Sep 2008 21:18:06 -0000 1.6 +++ core/src/java/net/sf/clirr/core/internal/asm/Repository.java 30 Mar 2009 21:32:31 -0000 @@ -18,7 +18,7 @@ * * @author lkuehne */ -class Repository +public class Repository { private static final Pattern PRIMITIVE_PATTERN = Pattern.compile("(int|float|long|double|boolean|char|short|byte)"); private static final Pattern ARRAY_PATTERN = Pattern.compile("(\\[\\])+$"); Index: core/src/java/net/sf/clirr/core/internal/asm/AsmTypeArrayBuilder.java =================================================================== RCS file: /cvsroot/clirr/clirr/core/src/java/net/sf/clirr/core/internal/asm/AsmTypeArrayBuilder.java,v retrieving revision 1.2 diff -u -r1.2 AsmTypeArrayBuilder.java --- core/src/java/net/sf/clirr/core/internal/asm/AsmTypeArrayBuilder.java 19 May 2007 12:05:29 -0000 1.2 +++ core/src/java/net/sf/clirr/core/internal/asm/AsmTypeArrayBuilder.java 30 Mar 2009 21:32:30 -0000 @@ -56,7 +56,7 @@ ZipEntry zipEntry = (ZipEntry) enumEntries.nextElement(); if (!zipEntry.isDirectory() && zipEntry.getName().endsWith(".class")) { - final AsmJavaType javaType = extractClass(repository, zipEntry, zip); + final JavaType javaType = extractClass(repository, zipEntry, zip); if (classSelector.isSelected(javaType)) { selected.add(javaType); @@ -70,17 +70,14 @@ return ret; } - - private AsmJavaType extractClass( + + private JavaType extractClass( Repository repository, ZipEntry zipEntry, ZipFile zip) throws CheckerException { - InputStream is = null; try { - is = zip.getInputStream(zipEntry); - - return repository.readJavaTypeFromStream(is); + return extractClass(repository, zip.getInputStream(zipEntry)); } catch (IOException ex) { @@ -88,21 +85,34 @@ "Cannot read " + zipEntry.getName() + " from " + zip.getName(), ex); } + } + + public JavaType extractClass( + Repository repository, InputStream stream) + throws IOException + { + InputStream is = null; + try + { + is = stream; + AsmJavaType result = repository.readJavaTypeFromStream(is); + is = null; + stream.close(); + return result; + } finally { if (is != null) { try { - is.close(); + stream.close(); } catch (IOException ex) { - throw new CheckerException("Cannot close " + zip.getName(), ex); + // Ignore this, throw the inner exception. } } } } - - } |
From: Jochen W. <joc...@gm...> - 2009-05-01 13:19:07
|
Lars, any feedback on this? On Mon, Mar 30, 2009 at 11:34 PM, Jochen Wiedmann <joc...@gm...> wrote: > Hi, > > in order to convert the clirr-maven-plugin to 0.7, I would beg to > either apply the patch below or to advice me what other solutions I > should choose. > > Thanks, > > Jochen > > P.S: What's the equivalent of Repository.storeClass in 0.7? Is it required? > > -- > I have always wished for my computer to be as easy to use as my > telephone; my wish has come true because I can no longer figure out > how to use my telephone. > > -- (Bjarne Stroustrup, > http://www.research.att.com/~bs/bs_faq.html#really-say-that > My guess: Nokia E50) > > > ### Eclipse Workspace Patch 1.0 > #P clirr > Index: core/src/java/net/sf/clirr/core/internal/asm/Repository.java > =================================================================== > RCS file: /cvsroot/clirr/clirr/core/src/java/net/sf/clirr/core/internal/asm/Repository.java,v > retrieving revision 1.6 > diff -u -r1.6 Repository.java > --- core/src/java/net/sf/clirr/core/internal/asm/Repository.java 23 > Sep 2008 21:18:06 -0000 1.6 > +++ core/src/java/net/sf/clirr/core/internal/asm/Repository.java 30 > Mar 2009 21:32:31 -0000 > @@ -18,7 +18,7 @@ > * > * @author lkuehne > */ > -class Repository > +public class Repository > { > private static final Pattern PRIMITIVE_PATTERN = > Pattern.compile("(int|float|long|double|boolean|char|short|byte)"); > private static final Pattern ARRAY_PATTERN = Pattern.compile("(\\[\\])+$"); > Index: core/src/java/net/sf/clirr/core/internal/asm/AsmTypeArrayBuilder.java > =================================================================== > RCS file: /cvsroot/clirr/clirr/core/src/java/net/sf/clirr/core/internal/asm/AsmTypeArrayBuilder.java,v > retrieving revision 1.2 > diff -u -r1.2 AsmTypeArrayBuilder.java > --- core/src/java/net/sf/clirr/core/internal/asm/AsmTypeArrayBuilder.java 19 > May 2007 12:05:29 -0000 1.2 > +++ core/src/java/net/sf/clirr/core/internal/asm/AsmTypeArrayBuilder.java 30 > Mar 2009 21:32:30 -0000 > @@ -56,7 +56,7 @@ > ZipEntry zipEntry = (ZipEntry) enumEntries.nextElement(); > if (!zipEntry.isDirectory() && > zipEntry.getName().endsWith(".class")) > { > - final AsmJavaType javaType = > extractClass(repository, zipEntry, zip); > + final JavaType javaType = > extractClass(repository, zipEntry, zip); > if (classSelector.isSelected(javaType)) > { > selected.add(javaType); > @@ -70,17 +70,14 @@ > return ret; > > } > - > - private AsmJavaType extractClass( > + > + private JavaType extractClass( > Repository repository, ZipEntry zipEntry, ZipFile zip) > throws CheckerException > { > - InputStream is = null; > try > { > - is = zip.getInputStream(zipEntry); > - > - return repository.readJavaTypeFromStream(is); > + return extractClass(repository, zip.getInputStream(zipEntry)); > } > catch (IOException ex) > { > @@ -88,21 +85,34 @@ > "Cannot read " + zipEntry.getName() + " from " + > zip.getName(), > ex); > } > + } > + > + public JavaType extractClass( > + Repository repository, InputStream stream) > + throws IOException > + { > + InputStream is = null; > + try > + { > + is = stream; > + AsmJavaType result = repository.readJavaTypeFromStream(is); > + is = null; > + stream.close(); > + return result; > + } > finally > { > if (is != null) > { > try > { > - is.close(); > + stream.close(); > } > catch (IOException ex) > { > - throw new CheckerException("Cannot close " + > zip.getName(), ex); > + // Ignore this, throw the inner exception. > } > } > } > } > - > - > } > -- Don't trust a government that doesn't trust you. |