ASF Bugzilla – Attachment 32196 Details for
Bug 57173
EOFException during annotation scanning
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
2014-11-08_tc8_57173_test_v2.patch
2014-11-08_tc8_57173_test_v2.patch (text/plain), 2.05 KB, created by
Konstantin Kolinko
on 2014-11-08 01:18:36 UTC
(
hide
)
Description:
2014-11-08_tc8_57173_test_v2.patch
Filename:
MIME Type:
Creator:
Konstantin Kolinko
Created:
2014-11-08 01:18:36 UTC
Size:
2.05 KB
patch
obsolete
>Index: test/org/apache/tomcat/util/bcel/TesterPerformance.java >=================================================================== >--- test/org/apache/tomcat/util/bcel/TesterPerformance.java (revision 1637495) >+++ test/org/apache/tomcat/util/bcel/TesterPerformance.java (working copy) >@@ -17,11 +17,13 @@ > package org.apache.tomcat.util.bcel; > > import java.io.File; >+import java.io.FilterInputStream; > import java.io.IOException; > import java.io.InputStream; > import java.net.URL; > import java.util.HashSet; > import java.util.Locale; >+import java.util.Random; > import java.util.Set; > > import org.junit.Test; >@@ -34,6 +36,36 @@ > > private static final String JAR_LOCATION = "/tmp/jira-libs"; > >+ /** >+ * An InputStream that returns less bytes than a read(byte[]) call asks for. >+ */ >+ private static class SlowInputStream extends FilterInputStream { >+ >+ private final Random r = new Random(); >+ >+ public SlowInputStream(InputStream in) { >+ super(in); >+ } >+ >+ @Override >+ public int read(byte[] b, int off, int len) throws IOException { >+ if (len <= 0) { >+ if (len == 0) { >+ return 0; >+ } >+ throw new IndexOutOfBoundsException(); >+ } >+ int randomLength = 1 + r.nextInt(len); >+ return super.read(b, off, randomLength); >+ } >+ >+ @Override >+ public int available() throws IOException { >+ int result = super.available(); >+ return result > 0 ? 1 : result; >+ } >+ } >+ > @Test > public void testClassParserPerformance() throws IOException { > File libDir = new File(JAR_LOCATION); >@@ -57,6 +89,7 @@ > while (jarEntryName != null) { > if (jarEntryName.endsWith(".class")) { > InputStream is = jar.getEntryInputStream(); >+ is = new SlowInputStream(is); > long start = System.nanoTime(); > ClassParser cp = new ClassParser(is); > cp.parse();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 57173
:
32176
|
32181
|
32195
| 32196