[Bug 56955] Skip some useless information in the class when parsing

2014-09-12 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=56955

--- Comment #6 from Mark Thomas  ---
If you continue to ignore the comments you are given then this issue is going
to get closed as WONTFIX.

Your first patch was 117k and full of irrelevant changes. The second attempt is
worse at 130k.

Starting at the beginning of the patch:
1. The first chunk changes restores an svn keyword the Tomcat team previously
removed. This change has nothing to do with this issue and should not be in
this patch.

2. The second chunk reverts a fix to a constant name the Tomcat team previously
fixed and removes some code necessary for Java 8 support. This change has
nothing to do with this issue and should not be in this patch. Further this
change breaks Java 8 support.

3. The third chunk makes further changes that have nothing to do with this
issue and further breaks Java 8 support.

And so on.

To repeat:
- Patches should be against http://svn.apache.org/viewvc/tomcat/trunk/
- If you'd like to propose changes to back port form there to tc7.0.x/trunk
then provide some revision numbers.

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: Analysis of apache-tomcat-8.0.12 dependency on JDK-Internal APIs

2014-09-12 Thread Rory O'Donnell Oracle, Dublin Ireland

Hi Mark,

Thanks for the feedback, I will follow up on this.

Rgds,Rory
On 11/09/2014 19:50, Mark Thomas wrote:

On 11/09/2014 14:59, Rory O'Donnell Oracle, Dublin Ireland wrote:

Hi Mladen/Mark,

As part of the preparations for JDK 9, Oracle’s engineers have been
analyzing open source projects like yours to understand usage.
One area of concern involves identifying compatibility problems, such as
reliance on JDK-internal APIs.

Our engineers have already prepared guidance on migrating some of the
more common usage patterns of JDK-internal APIs to supported public
interfaces. The list is on the OpenJDK wiki [0], along with instructions
on how to run the jdeps analysis tool yourself .

We have analyzed jar files within apache-tomcat-8.0.12 and found 0 jar
files depending on JDK-Internal APIs.

However, jdeps is a static analysis tool and therefore use of
JDK-internal APIs via reflection or dynamically generated bytecode are
not reported by the tool, while such a dependency should also be replaced.

If you have any feedback please reply either on this list or to me
directly.

We do make use JDK-Internal APIs but we always do it via reflection as
it is nearly always vendor specific.

The protection against JRE triggered memory leaks is a source of a lot
of internal API usage:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java?view=annotate

It would be great of there were public APIs we could use instead or
better still if the various memory leaks could be fixed.

Other than that, I can't think of any off-hand. Use the internal API is
something we try to avoid if at all possible.

Mark


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



--
Rgds,Rory O'Donnell
Quality Engineering Manager
Oracle EMEA , Dublin, Ireland





-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Early Access builds for JDK 9 b29 and JDK 8u40 b05 are available on java.net

2014-09-12 Thread Rory O'Donnell Oracle, Dublin Ireland

Hi Mladen/Mark,

Early Access build for JDK 9 b29   is 
available on java.net, summary of changes are listed here 



Early Access build for JDK 8u40 b05  
is available on java.net, summary of changes are listed here. 



Rgds,Rory

--
Rgds,Rory O'Donnell
Quality Engineering Manager
Oracle EMEA , Dublin, Ireland



[Bug 56953] A improvement for "DataInputStream"

2014-09-12 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=56953

--- Comment #5 from Mark Thomas  ---
If you continue to ignore the comments you are given then this issue is going
to get closed as WONTFIX.

Your first patch was 86k and full of irrelevant changes. The second attempt is
worse at 107k.

Starting at the beginning of the patch:
1. The first chunk changes restores an svn keyword the Tomcat team previously
removed. This change has nothing to do with this issue and should not be in
this patch.

2. The second chunk reverts a fix to a constant name the Tomcat team previously
fixed and removes some code necessary for Java 8 support. This change has
nothing to do with this issue and should not be in this patch. Further this
change breaks Java 8 support.

3. The third chunk makes further changes that have nothing to do with this
issue and further breaks Java 8 support.

And so on.

I have no problem with reviewing a patch that completely replaces
DataInputStream because of final methods. It is all the other irrelevant,
breaking changes in the patch that are the problem.

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624474 - in /tomcat/trunk/test/org/apache/tomcat/util/bcel: ./ TesterPerformance.java

2014-09-12 Thread markt
Author: markt
Date: Fri Sep 12 08:12:53 2014
New Revision: 1624474

URL: http://svn.apache.org/r1624474
Log:
Add a performance test. Useful for judging the benefit (or not) of proposed 
BCEL changes.

Added:
tomcat/trunk/test/org/apache/tomcat/util/bcel/
tomcat/trunk/test/org/apache/tomcat/util/bcel/TesterPerformance.java   
(with props)

Added: tomcat/trunk/test/org/apache/tomcat/util/bcel/TesterPerformance.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/bcel/TesterPerformance.java?rev=1624474&view=auto
==
--- tomcat/trunk/test/org/apache/tomcat/util/bcel/TesterPerformance.java (added)
+++ tomcat/trunk/test/org/apache/tomcat/util/bcel/TesterPerformance.java Fri 
Sep 12 08:12:53 2014
@@ -0,0 +1,70 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tomcat.util.bcel;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Set;
+
+import org.junit.Test;
+
+import org.apache.tomcat.util.bcel.classfile.ClassParser;
+import org.apache.tomcat.util.scan.Jar;
+import org.apache.tomcat.util.scan.JarFactory;
+
+public class TesterPerformance {
+
+private static final String JAR_LOCATION = "/tmp/jira-libs";
+
+@Test
+public void testClassParserPerformance() throws IOException {
+File libDir = new File(JAR_LOCATION);
+String[] libs = libDir.list();
+
+Set jarURLs = new HashSet<>();
+
+for (String lib : libs) {
+if (!lib.toLowerCase(Locale.ENGLISH).endsWith(".jar")) {
+continue;
+}
+jarURLs.add(new URL("jar:" + new File (libDir, 
lib).toURI().toURL().toExternalForm() + "!/"));
+}
+
+long start = System.nanoTime();
+
+for (URL jarURL : jarURLs) {
+Jar jar = JarFactory.newInstance(jarURL);
+jar.nextEntry();
+String jarEntryName = jar.getEntryName();
+while (jarEntryName != null) {
+if (jarEntryName.endsWith(".class")) {
+ClassParser cp = new 
ClassParser(jar.getEntryInputStream(), jarEntryName);
+cp.parse();
+}
+jar.nextEntry();
+jarEntryName = jar.getEntryName();
+}
+}
+
+long duration = System.nanoTime() - start;
+
+System.out.println("ClassParser performance test took: " + duration + 
"ns");
+}
+}

Propchange: tomcat/trunk/test/org/apache/tomcat/util/bcel/TesterPerformance.java
--
svn:eol-style = native



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 56940] Cache mechanism for "ConstantUtf8.java" doesn't have any benefit

2014-09-12 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=56940

Mark Thomas  changed:

   What|Removed |Added

 OS||All

--- Comment #4 from Mark Thomas  ---
The caching has been removed in 8.0.x after testing showed a performance
improvement of between 10-15%.

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624476 - /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantUtf8.java

2014-09-12 Thread markt
Author: markt
Date: Fri Sep 12 08:30:39 2014
New Revision: 1624476

URL: http://svn.apache.org/r1624476
Log:
Remove the cache. Generally, it makes performance worse not better. Testing 
with the jars that ship with Jira, performance was improved by around 10-15% by 
removing the cache.
Based on a suggestion by hzhang9

Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantUtf8.java

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantUtf8.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantUtf8.java?rev=1624476&r1=1624475&r2=1624476&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantUtf8.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantUtf8.java 
Fri Sep 12 08:30:39 2014
@@ -18,9 +18,6 @@ package org.apache.tomcat.util.bcel.clas
 
 import java.io.DataInputStream;
 import java.io.IOException;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.Map;
 
 import org.apache.tomcat.util.bcel.Constants;
 
@@ -37,39 +34,9 @@ public final class ConstantUtf8 extends 
 private static final long serialVersionUID = 8119001312020421976L;
 private final String bytes;
 
-private static final int MAX_CACHE_ENTRIES = 2;
-private static final int INITIAL_CACHE_CAPACITY = 
(int)(MAX_CACHE_ENTRIES/0.75);
-private static HashMap cache;
-
-private static synchronized ConstantUtf8 getCachedInstance(String s) {
-if (s.length() > 200) {
-return  new ConstantUtf8(s);
-}
-if (cache == null)  {
-cache = new LinkedHashMap(INITIAL_CACHE_CAPACITY, 0.75f, true) {
-private static final long serialVersionUID = 1L;
-
-@Override
-protected boolean removeEldestEntry(Map.Entry eldest) {
- return size() > MAX_CACHE_ENTRIES;
-}
-};
-}
-ConstantUtf8 result = cache.get(s);
-if (result != null) {
-return result;
-}
-result = new ConstantUtf8(s);
-cache.put(s, result);
-return result;
-}
-
-private static ConstantUtf8 getInstance(String s) {
-return getCachedInstance(s);
-}
 
 static ConstantUtf8 getInstance(DataInputStream file) throws IOException {
-return getInstance(file.readUTF());
+return new ConstantUtf8(file.readUTF());
 }
 
 



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Use 'length' when swallowing attributes in BCEL

2014-09-12 Thread Konstantin Kolinko
Hi!

Reviewing BCEL method Utility.swallowUnknownAttribute(...),  I think
the same approach can be used for all other attributes that we ignore,
ignoring their internal structure.

That is: we know length of their data. In Attribute.readAttribute():

// Length of data in bytes
length = file.readInt();

I have yet to verify this with specification, but it looks promising.

Best regards,
Konstantin Kolinko

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 56955] Skip some useless information in the class when parsing

2014-09-12 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=56955

--- Comment #7 from hzha...@ebay.com ---
Sorry for any inconvenience. I am now reviewing my code.

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 56974] New: jdbc-pool validation query defaultAutoCommit status

2014-09-12 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=56974

Bug ID: 56974
   Summary: jdbc-pool validation query defaultAutoCommit status
   Product: Tomcat Modules
   Version: unspecified
  Hardware: PC
OS: Linux
Status: NEW
  Severity: normal
  Priority: P2
 Component: jdbc-pool
  Assignee: dev@tomcat.apache.org
  Reporter: denuwanthi.hasanth...@gmail.com

I would like to know wether the validation query made by jdbc pool is done in
defaultAutoCommit=true mode.
Because, it seems like after the validation query, it is not committed. So,
when we try to do some other operation we get an error : "Cannot change
transaction isolation level in the middle of a transaction"
Thus, we have to forcefully commit the validation query, by making
defaultAutoCommit=true in our datasource configuration.
Any insight on this is much appreciated.

Thanks,
Denuwanthi.

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: Use 'length' when swallowing attributes in BCEL

2014-09-12 Thread Mark Thomas
On 12/09/2014 09:36, Konstantin Kolinko wrote:
> Hi!
> 
> Reviewing BCEL method Utility.swallowUnknownAttribute(...),  I think
> the same approach can be used for all other attributes that we ignore,
> ignoring their internal structure.
> 
> That is: we know length of their data. In Attribute.readAttribute():
> 
> // Length of data in bytes
> length = file.readInt();
> 
> I have yet to verify this with specification, but it looks promising.

I did a quick test using the newly added performance test and the Jira
jars. It certainly works - no errors are reported - but there is no
noticeable performance improvement. What it does do is remove a large
chunk of code so, if your specification check confirms this is OK, I am
+1 purely based on the simplification benefits.

Mark


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: Use 'length' when swallowing attributes in BCEL

2014-09-12 Thread Mark Thomas
On 12/09/2014 10:08, Mark Thomas wrote:
> On 12/09/2014 09:36, Konstantin Kolinko wrote:
>> Hi!
>>
>> Reviewing BCEL method Utility.swallowUnknownAttribute(...),  I think
>> the same approach can be used for all other attributes that we ignore,
>> ignoring their internal structure.
>>
>> That is: we know length of their data. In Attribute.readAttribute():
>>
>> // Length of data in bytes
>> length = file.readInt();
>>
>> I have yet to verify this with specification, but it looks promising.
> 
> I did a quick test using the newly added performance test and the Jira
> jars. It certainly works - no errors are reported - but there is no
> noticeable performance improvement. What it does do is remove a large
> chunk of code so, if your specification check confirms this is OK, I am
> +1 purely based on the simplification benefits.

I've tweaked the performance test to focus timing info on the BCEL part
of the code after some profiling showed a lot of time was being spent
reading the class files from the JAR. There is a performance improvement
here (5-10%) so if this change is spec compliant there is an even
stronger reason for doing it.

Mark


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624483 - /tomcat/trunk/test/org/apache/tomcat/util/bcel/TesterPerformance.java

2014-09-12 Thread markt
Author: markt
Date: Fri Sep 12 09:22:36 2014
New Revision: 1624483

URL: http://svn.apache.org/r1624483
Log:
Focus timing on BCEL parts of code.

Modified:
tomcat/trunk/test/org/apache/tomcat/util/bcel/TesterPerformance.java

Modified: tomcat/trunk/test/org/apache/tomcat/util/bcel/TesterPerformance.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/bcel/TesterPerformance.java?rev=1624483&r1=1624482&r2=1624483&view=diff
==
--- tomcat/trunk/test/org/apache/tomcat/util/bcel/TesterPerformance.java 
(original)
+++ tomcat/trunk/test/org/apache/tomcat/util/bcel/TesterPerformance.java Fri 
Sep 12 09:22:36 2014
@@ -18,6 +18,7 @@ package org.apache.tomcat.util.bcel;
 
 import java.io.File;
 import java.io.IOException;
+import java.io.InputStream;
 import java.net.URL;
 import java.util.HashSet;
 import java.util.Locale;
@@ -47,7 +48,7 @@ public class TesterPerformance {
 jarURLs.add(new URL("jar:" + new File (libDir, 
lib).toURI().toURL().toExternalForm() + "!/"));
 }
 
-long start = System.nanoTime();
+long duration = 0;
 
 for (URL jarURL : jarURLs) {
 Jar jar = JarFactory.newInstance(jarURL);
@@ -55,16 +56,17 @@ public class TesterPerformance {
 String jarEntryName = jar.getEntryName();
 while (jarEntryName != null) {
 if (jarEntryName.endsWith(".class")) {
-ClassParser cp = new 
ClassParser(jar.getEntryInputStream(), jarEntryName);
+InputStream is = jar.getEntryInputStream();
+long start = System.nanoTime();
+ClassParser cp = new ClassParser(is, jarEntryName);
 cp.parse();
+duration += System.nanoTime() - start;
 }
 jar.nextEntry();
 jarEntryName = jar.getEntryName();
 }
 }
 
-long duration = System.nanoTime() - start;
-
 System.out.println("ClassParser performance test took: " + duration + 
"ns");
 }
 }



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: Use 'length' when swallowing attributes in BCEL

2014-09-12 Thread Konstantin Kolinko
2014-09-12 13:20 GMT+04:00 Mark Thomas :
> On 12/09/2014 10:08, Mark Thomas wrote:
>> On 12/09/2014 09:36, Konstantin Kolinko wrote:
>>> Hi!
>>>
>>> Reviewing BCEL method Utility.swallowUnknownAttribute(...),  I think
>>> the same approach can be used for all other attributes that we ignore,
>>> ignoring their internal structure.
>>>
>>> That is: we know length of their data. In Attribute.readAttribute():
>>>
>>> // Length of data in bytes
>>> length = file.readInt();
>>>
>>> I have yet to verify this with specification, but it looks promising.
>>
>> I did a quick test using the newly added performance test and the Jira
>> jars. It certainly works - no errors are reported - but there is no
>> noticeable performance improvement. What it does do is remove a large
>> chunk of code so, if your specification check confirms this is OK, I am
>> +1 purely based on the simplification benefits.
>
> I've tweaked the performance test to focus timing info on the BCEL part
> of the code after some profiling showed a lot of time was being spent
> reading the class files from the JAR. There is a performance improvement
> here (5-10%) so if this change is spec compliant there is an even
> stronger reason for doing it.

Yes, it is compliant.

The Java Virtual Machine Specification, Java SE 7 Edition
Chapter 4.7 Attributes
http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.7

The structure is
[[[
attribute_info {
u2 attribute_name_index;
u4 attribute_length;
u1 info[attribute_length];
}
]]]



For reference, JLS/JVM specifications page:
http://docs.oracle.com/javase/specs/

PDF version of the spec may be easier to work with.

Best regards,
Konstantin Kolinko

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624486 - in /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile: Attribute.java ClassParser.java Utility.java

2014-09-12 Thread markt
Author: markt
Date: Fri Sep 12 09:34:25 2014
New Revision: 1624486

URL: http://svn.apache.org/r1624486
Log:
Simplify attribute skipping. Based on an idea by kkolinko.

Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java?rev=1624486&r1=1624485&r2=1624486&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java Fri 
Sep 12 09:34:25 2014
@@ -100,7 +100,7 @@ public abstract class Attribute implemen
 Utility.swallowSourceFile(file);
 return null;
 case Constants.ATTR_CODE:
-Utility.swallowCode(file, constant_pool);
+Utility.swallowCode(file);
 return null;
 case Constants.ATTR_EXCEPTIONS:
 Utility.swallowExceptionTable(file);

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java?rev=1624486&r1=1624485&r2=1624486&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java 
Fri Sep 12 09:34:25 2014
@@ -175,7 +175,7 @@ public final class ClassParser {
 private void readFields() throws IOException, ClassFormatException {
 int fields_count = file.readUnsignedShort();
 for (int i = 0; i < fields_count; i++) {
-Utility.swallowFieldOrMethod(file, constant_pool);
+Utility.swallowFieldOrMethod(file);
 }
 }
 
@@ -218,7 +218,7 @@ public final class ClassParser {
 int methods_count;
 methods_count = file.readUnsignedShort();
 for (int i = 0; i < methods_count; i++) {
-Utility.swallowFieldOrMethod(file, constant_pool);
+Utility.swallowFieldOrMethod(file);
 }
 }
 

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java?rev=1624486&r1=1624485&r2=1624486&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java Fri 
Sep 12 09:34:25 2014
@@ -211,7 +211,7 @@ final class Utility {
 skipFully(file, 2);
 }
 
-static void swallowCode(DataInputStream file, ConstantPool constant_pool) 
throws IOException {
+static void swallowCode(DataInputStream file) throws IOException {
 // file.readUnsignedShort(); // Unused max_stack
 // file.readUnsignedShort(); // Unused max_locals
 skipFully(file, 4);
@@ -227,7 +227,7 @@ final class Utility {
  */
 int attributes_count = file.readUnsignedShort();
 for (int i = 0; i < attributes_count; i++) {
-swallowAttribute(file, constant_pool);
+swallowAttribute(file);
 }
 }
 
@@ -382,7 +382,7 @@ final class Utility {
 }
 }
 
-static void swallowFieldOrMethod(DataInputStream file, ConstantPool 
constant_pool)
+static void swallowFieldOrMethod(DataInputStream file)
 throws IOException {
 // file.readUnsignedShort(); // Unused access flags
 // file.readUnsignedShort(); // name index
@@ -391,98 +391,17 @@ final class Utility {
 
 int attributes_count = file.readUnsignedShort();
 for (int i = 0; i < attributes_count; i++) {
-swallowAttribute(file, constant_pool);
+swallowAttribute(file);
 }
 }
 
-static void swallowAttribute(DataInputStream file, ConstantPool 
constant_pool)
+static void swallowAttribute(DataInputStream file)
 throws IOException {
-byte tag = Constants.ATTR_UNKNOWN;  // Unknown attribute
-// Get class name from constant pool via `name_index' indirection
-int name_index = file.readUnsignedShort();
-ConstantUtf8 c =
-(ConstantUtf8) constant_pool.getConstant(name_index, 
Constants.CONSTANT_Utf8);
-String name = c.getBytes();
+//file.readUnsignedShort();   // Unused name index
+skipFully(file, 2);
 // Length of data in bytes
 int length = file.readInt();
-// Compare strings to find known attr

svn commit: r1624487 - /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java

2014-09-12 Thread markt
Author: markt
Date: Fri Sep 12 09:36:57 2014
New Revision: 1624487

URL: http://svn.apache.org/r1624487
Log:
Don't use DataInputStream where we don't have to

Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java?rev=1624487&r1=1624486&r2=1624487&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java Fri 
Sep 12 09:36:57 2014
@@ -211,7 +211,7 @@ final class Utility {
 skipFully(file, 2);
 }
 
-static void swallowCode(DataInputStream file) throws IOException {
+static void swallowCode(DataInput file) throws IOException {
 // file.readUnsignedShort(); // Unused max_stack
 // file.readUnsignedShort(); // Unused max_locals
 skipFully(file, 4);
@@ -382,7 +382,7 @@ final class Utility {
 }
 }
 
-static void swallowFieldOrMethod(DataInputStream file)
+static void swallowFieldOrMethod(DataInput file)
 throws IOException {
 // file.readUnsignedShort(); // Unused access flags
 // file.readUnsignedShort(); // name index
@@ -395,7 +395,7 @@ final class Utility {
 }
 }
 
-static void swallowAttribute(DataInputStream file)
+static void swallowAttribute(DataInput file)
 throws IOException {
 //file.readUnsignedShort();   // Unused name index
 skipFully(file, 2);



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 56953] A improvement for "DataInputStream"

2014-09-12 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=56953

--- Comment #6 from Konstantin Kolinko  ---
The point of java.io.BufferedInputStream() is that is.read() were fast enough.
I do not see much benefit in re-implementing standard JRE classes.

By the way, is.read() is a blocking method. If you were to use fill() or
is.read(chars[]) there is no guarantee of how many bytes they can actually read
in a single call.

That is why DataInput.readFully() method is there.

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624497 - in /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile: Attribute.java Utility.java

2014-09-12 Thread kkolinko
Author: kkolinko
Date: Fri Sep 12 11:05:52 2014
New Revision: 1624497

URL: http://svn.apache.org/r1624497
Log:
Simplify Attribute.readAttribute()
and remove a lot of swallow methods that are no longer used from Utility class.

Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java?rev=1624497&r1=1624496&r2=1624497&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java Fri 
Sep 12 11:05:52 2014
@@ -90,77 +90,18 @@ public abstract class Attribute implemen
 // Call proper constructor, depending on `tag'
 switch (tag)
 {
-case Constants.ATTR_UNKNOWN:
-Utility.swallowUnknownAttribute(file, length);
-return null;
-case Constants.ATTR_CONSTANT_VALUE:
-Utility.swallowConstantValue(file);
-return null;
-case Constants.ATTR_SOURCE_FILE:
-Utility.swallowSourceFile(file);
-return null;
-case Constants.ATTR_CODE:
-Utility.swallowCode(file);
-return null;
-case Constants.ATTR_EXCEPTIONS:
-Utility.swallowExceptionTable(file);
-return null;
-case Constants.ATTR_LINE_NUMBER_TABLE:
-Utility.swallowLineNumberTable(file);
-return null;
-case Constants.ATTR_LOCAL_VARIABLE_TABLE:
-Utility.swallowLocalVariableTable(file);
-return null;
-case Constants.ATTR_INNER_CLASSES:
-Utility.swallowInnerClasses(file);
-return null;
-case Constants.ATTR_SYNTHETIC:
-Utility.swallowSynthetic(length);
-return null;
-case Constants.ATTR_DEPRECATED:
-Utility.swallowDeprecated(length);
-return null;
-case Constants.ATTR_PMG:
-Utility.swallowPMCClass(file);
-return null;
-case Constants.ATTR_SIGNATURE:
-Utility.swallowSignature(file);
-return null;
-case Constants.ATTR_STACK_MAP:
-Utility.swallowStackMap(file);
-return null;
 case Constants.ATTR_RUNTIME_VISIBLE_ANNOTATIONS:
 return new RuntimeVisibleAnnotations(name_index, length, file,
 constant_pool);
-case Constants.ATTR_RUNTIME_INVISIBLE_ANNOTATIONS:
-Utility.swallowAnnotations(file);
-return null;
 case Constants.ATTR_RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS:
 return new RuntimeVisibleParameterAnnotations(name_index, length,
 file, constant_pool);
-case Constants.ATTR_RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS:
-Utility.swallowParameterAnnotations(file);
-return null;
 case Constants.ATTR_ANNOTATION_DEFAULT:
 return new AnnotationDefault(name_index, length, file,
 constant_pool);
-case Constants.ATTR_LOCAL_VARIABLE_TYPE_TABLE:
-Utility.swallowLocalVariableTypeTable(file);
-return null;
-case Constants.ATTR_ENCLOSING_METHOD:
-Utility.swallowEnclosingMethod(file);
-return null;
-case Constants.ATTR_STACK_MAP_TABLE:
-Utility.swallowStackMapTable(file);
-return null;
-case Constants.ATTR_BOOTSTRAP_METHODS:
-Utility.swallowBootstrapMethods(file);
-return null;
-case Constants.ATTR_METHOD_PARAMETERS:
-Utility.swallowMethodParameters(file);
+default: // All other attributes are skipped
+Utility.skipFully(file, length);
 return null;
-default: // Never reached
-throw new IllegalStateException("Unrecognized attribute type tag 
parsed: " + tag);
 }
 }
 

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java?rev=1624497&r1=1624496&r2=1624497&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java Fri 
Sep 12 11:05:52 2014
@@ -18,12 +18,9 @@
 package org.apache.tomcat.util.bcel.classfile;
 
 import java.io.DataInput;
-import java.io.DataInputStream;
 import java.io.EOFException;
 import java.io.IOException;
 
-import org.apache.tomcat.util.bcel.Constants;
-
 /**
  * Utility functions that do not rea

Re: Analysis of apache-tomcat-8.0.12 dependency on JDK-Internal APIs

2014-09-12 Thread Mark Thomas
On 12/09/2014 11:11, dalibor topic wrote:
> On 11.09.2014 20:50, Mark Thomas wrote:
>>
>> The protection against JRE triggered memory leaks is a source of a lot
>> of internal API usage:
>> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java?view=annotate
>>
>>
>> It would be great of there were public APIs we could use instead or
>> better still if the various memory leaks could be fixed.
>>
>> Other than that, I can't think of any off-hand. Use the internal API is
>> something we try to avoid if at all possible.
> 
> Thanks, Mark - I think this discussion would warrant its own thread on
> the core-libs-dev@openjdk mailing list [1] - can you start a thread there?

Will do.

Mark

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624498 - in /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile: Constant.java Utility.java

2014-09-12 Thread kkolinko
Author: kkolinko
Date: Fri Sep 12 11:15:44 2014
New Revision: 1624498

URL: http://svn.apache.org/r1624498
Log:
Simplify Constant.readConstant()
and remove swallow methods that are no longer used from Utility class.

Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java?rev=1624498&r1=1624497&r2=1624498&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java Fri 
Sep 12 11:15:44 2014
@@ -68,17 +68,10 @@ public abstract class Constant implement
 static Constant readConstant( DataInputStream file ) throws IOException,
 ClassFormatException {
 byte b = file.readByte(); // Read tag byte
+int skipSize;
 switch (b) {
 case Constants.CONSTANT_Class:
 return new ConstantClass(file);
-case Constants.CONSTANT_Fieldref:
-case Constants.CONSTANT_Methodref:
-case Constants.CONSTANT_InterfaceMethodref:
-Utility.swallowConstantCP(file);
-return null;
-case Constants.CONSTANT_String:
-Utility.swallowConstantString(file);
-return null;
 case Constants.CONSTANT_Integer:
 return new ConstantInteger(file);
 case Constants.CONSTANT_Float:
@@ -87,23 +80,27 @@ public abstract class Constant implement
 return new ConstantLong(file);
 case Constants.CONSTANT_Double:
 return new ConstantDouble(file);
-case Constants.CONSTANT_NameAndType:
-Utility.swallowConstantNameAndType(file);
-return null;
 case Constants.CONSTANT_Utf8:
 return ConstantUtf8.getInstance(file);
-case Constants.CONSTANT_MethodHandle:
-Utility.swallowConstantMethodHandle(file);
-return null;
+case Constants.CONSTANT_String:
 case Constants.CONSTANT_MethodType:
-Utility.swallowConstantMethodType(file);
-return null;
+skipSize = 2; // unsigned short
+break;
+case Constants.CONSTANT_MethodHandle:
+skipSize = 3; // unsigned byte, unsigned short
+break;
+case Constants.CONSTANT_Fieldref:
+case Constants.CONSTANT_Methodref:
+case Constants.CONSTANT_InterfaceMethodref:
+case Constants.CONSTANT_NameAndType:
 case Constants.CONSTANT_InvokeDynamic:
-Utility.swallowConstantInvokeDynamic(file);
-return null;
+skipSize = 4; // unsigned short, unsigned short
+break;
 default:
 throw new ClassFormatException("Invalid byte tag in constant 
pool: " + b);
 }
+Utility.skipFully(file, skipSize);
+return null;
 }
 
 

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java?rev=1624498&r1=1624497&r2=1624498&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java Fri 
Sep 12 11:15:44 2014
@@ -52,40 +52,6 @@ final class Utility {
 }
 }
 
-static void swallowConstantCP(DataInput file) throws IOException {
-// file.readUnsignedShort(); // Unused class index
-// file.readUnsignedShort(); // Unused name and type index
-skipFully(file, 4);
-}
-
-static void swallowConstantMethodHandle(DataInput file) throws IOException 
{
-// file.readUnsignedByte();  // Unused reference_kind
-// file.readUnsignedShort(); // Unused reference_index
-skipFully(file, 3);
-}
-
-static void swallowConstantString(DataInput file) throws IOException {
-// file.readUnsignedShort(); // Unused string index
-skipFully(file, 2);
-}
-
-static void swallowConstantNameAndType(DataInput file) throws IOException {
-// file.readUnsignedShort(); // Unused name index
-// file.readUnsignedShort(); // Unused signature index
-skipFully(file, 4);
-}
-
-static void swallowConstantMethodType(DataInput file) throws IOException {
-// file.readUnsignedShort(); // Unused descriptor_index
-skipFully(file, 2);
-}
-
-static

svn commit: r1624500 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/bcel/ java/org/apache/tomcat/util/bcel/classfile/

2014-09-12 Thread markt
Author: markt
Date: Fri Sep 12 11:28:01 2014
New Revision: 1624500

URL: http://svn.apache.org/r1624500
Log:
Merge cosmetic changes from trunk. No functional change.

Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/   (props changed)

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTypeTable.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeInvisibleAnnotations.java

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged /tomcat/trunk:r1609334

Propchange: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/
--
  Merged /tomcat/trunk/java/org/apache/tomcat/util/bcel:r1609334
  Merged 
/commons/proper/bcel/trunk/src/main/java/org/apache/bcel:r1593496-1609331

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java?rev=1624500&r1=1624499&r2=1624500&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java
 Fri Sep 12 11:28:01 2014
@@ -43,7 +43,6 @@ public abstract class ElementValue
 this.cpool = cpool;
 }
 
-
 public abstract String stringifyValue();
 
 public abstract void dump(DataOutputStream dos) throws IOException;

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTypeTable.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTypeTable.java?rev=1624500&r1=1624499&r2=1624500&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTypeTable.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTypeTable.java
 Fri Sep 12 11:28:01 2014
@@ -24,16 +24,16 @@ import org.apache.tomcat.util.bcel.Const
 // The new table is used when generic types are about...
 
 //LocalVariableTable_attribute {
-// u2 attribute_name_index;
-// u4 attribute_length;
-// u2 local_variable_table_length;
-// {  u2 start_pc;
-//u2 length;
-//u2 name_index;
-//u2 descriptor_index;
-//u2 index;
-// } local_variable_table[local_variable_table_length];
-//   }
+//   u2 attribute_name_index;
+//   u4 attribute_length;
+//   u2 local_variable_table_length;
+//   {  u2 start_pc;
+//  u2 length;
+//  u2 name_index;
+//  u2 descriptor_index;
+//  u2 index;
+//   } local_variable_table[local_variable_table_length];
+// }
 
 //LocalVariableTypeTable_attribute {
 //u2 attribute_name_index;

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeInvisibleAnnotations.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeInvisibleAnnotations.java?rev=1624500&r1=1624499&r2=1624500&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeInvisibleAnnotations.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeInvisibleAnnotations.java
 Fri Sep 12 11:28:01 2014
@@ -44,8 +44,8 @@ public class RuntimeInvisibleAnnotations
  *Array of constants
  */
 RuntimeInvisibleAnnotations(int name_index, int length,
-DataInputStream file, ConstantPool 
constant_pool)
-throws IOException
+DataInputStream file, ConstantPool constant_pool)
+throws IOException
 {
 super(Constants.ATTR_RUNTIME_INVISIBLE_ANNOTATIONS, name_index, length,
 file, constant_pool);



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: mirgation guide tomcat 6 -> tomcat 7

2014-09-12 Thread Konstantin Kolinko
2014-09-11 22:34 GMT+04:00 Mark Thomas :
> On 11/09/2014 15:24, Romain Manni-Bucau wrote:
>> Hi guys
>>
>> on tomee jira we got an issue from a user migrating from tomcat 6 to
>> tomee (tomcat 7)
>>
>> his authenticator was not called anymore
>>
>> seems it was due to the change in:
>>
>> boolean authenticate(Request request,
>> HttpServletResponse response,
>> LoginConfig config)
>>
>> it was in tomcat 6:
>>
>> boolean authenticate(Request request,
>> Response response,
>> LoginConfig config)
>>
>> (in form authenticator)
>>
>> He finally asked to add it in http://tomcat.apache.org/migration-7.html
>>
>> Can you have a look please?
>
> That is covered under:
> http://tomcat.apache.org/migration-7.html#Internal_APIs
>
> I don't think we want to even try and enumerate every single change.
>

Just for reference, as Romain did not mention it,
the TomEE JIRA issue discussed here was
https://issues.apache.org/jira/browse/TOMEE-1340

Best regards,
Konstantin Kolinko

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 56970] MaxActive vs. MaxTotal for commons-dbcp and tomcat-jdbc-pool in tomcat 8

2014-09-12 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=56970

--- Comment #1 from Konstantin Kolinko  ---
> http://tomcat.apache.org/migration-8.html#Database_Connection_Pooling
> Documents: The maxActive configuration option has been renamed to maxTotal

The above documentation talks about DBCP pool.

> http://tomcat.apache.org/tomcat-8.0-doc/jdbc-pool.html

The above documentation page is about JDBC pool.


The "Common Attributes" table on JDBC pool page can be improved. It talks about
comparing the tomcat-jdbc pool with commons-dbcp, but Tomcat 8 is bundled with
commons-dbcp2.

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624502 - /tomcat/tc7.0.x/trunk/

2014-09-12 Thread markt
Author: markt
Date: Fri Sep 12 11:45:31 2014
New Revision: 1624502

URL: http://svn.apache.org/r1624502
Log:
BCEL changes that were then reverted

Modified:
tomcat/tc7.0.x/trunk/   (props changed)

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged /tomcat/trunk:r1384051,1384055,1384063



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624503 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/bcel/ java/org/apache/tomcat/util/bcel/classfile/

2014-09-12 Thread markt
Author: markt
Date: Fri Sep 12 11:51:40 2014
New Revision: 1624503

URL: http://svn.apache.org/r1624503
Log:
Port removal of unused code from trunk

Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/   (props changed)

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Code.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/CodeException.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantCP.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantDouble.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantFloat.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInteger.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInvokeDynamic.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantLong.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodHandle.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodType.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantNameAndType.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantString.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantUtf8.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantValue.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Deprecated.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ExceptionTable.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Field.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/InnerClass.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/InnerClasses.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/LineNumber.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/LineNumberTable.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariable.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTable.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTypeTable.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Method.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/PMGClass.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Signature.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/SourceFile.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMap.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapEntry.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTable.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTableEntry.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapType.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Synthetic.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Unknown.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged /tomcat/trunk:r1384068-1384069,1397950

Propchange: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/
--
  Merged /tomcat/trunk/java/org/apache/tomcat/util/bcel:r1384068-1384069,1397950

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEle

svn commit: r1624506 [2/2] - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/bcel/ java/org/apache/tomcat/util/bcel/classfile/ java/org/apache/tomcat/util/bcel/util/

2014-09-12 Thread markt
Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java?rev=1624506&r1=1624505&r2=1624506&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java 
(original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java 
Fri Sep 12 11:59:12 2014
@@ -20,8 +20,6 @@ package org.apache.tomcat.util.bcel.clas
 import java.io.DataInput;
 import java.io.IOException;
 
-import org.apache.tomcat.util.bcel.Constants;
-import org.apache.tomcat.util.bcel.util.ByteSequence;
 
 /**
  * Utility functions that do not really belong to any class in particular.
@@ -30,396 +28,6 @@ import org.apache.tomcat.util.bcel.util.
  */
 public abstract class Utility {
 
-private static int unwrap( ThreadLocal tl ) {
-return tl.get().intValue();
-}
-
-
-private static void wrap( ThreadLocal tl, int value ) {
-tl.set(Integer.valueOf(value));
-}
-
-private static ThreadLocal consumed_chars =
-new ThreadLocal() {
-@Override
-protected Integer initialValue() {
-return Integer.valueOf(0);
-}
-};/* How many chars have been consumed
- * during parsing in signatureToString().
- * Read by methodSignatureToString().
- * Set by side effect,but only internally.
- */
-private static boolean wide = false; /* The `WIDE' instruction is used in 
the
- * byte code to allow 16-bit wide indices
- * for local variables. This opcode
- * precedes an `ILOAD', e.g.. The opcode
- * immediately following takes an extra
- * byte which is combined with the
- * following byte to form a
- * 16-bit value.
- */
-
-
-/**
- * Convert bit field of flags into string such as `static final'.
- *
- * @param  access_flags Access flags
- * @return String representation of flags
- */
-public static final String accessToString( int access_flags ) {
-return accessToString(access_flags, false);
-}
-
-
-/**
- * Convert bit field of flags into string such as `static final'.
- *
- * Special case: Classes compiled with new compilers and with the
- * `ACC_SUPER' flag would be said to be "synchronized". This is
- * because SUN used the same value for the flags `ACC_SUPER' and
- * `ACC_SYNCHRONIZED'. 
- *
- * @param  access_flags Access flags
- * @param  for_class access flags are for class qualifiers ?
- * @return String representation of flags
- */
-public static final String accessToString( int access_flags, boolean 
for_class ) {
-StringBuilder buf = new StringBuilder();
-int p = 0;
-for (int i = 0; p < Constants.MAX_ACC_FLAG; i++) { // Loop through 
known flags
-p = pow2(i);
-if ((access_flags & p) != 0) {
-/* Special case: Classes compiled with new compilers and with 
the
- * `ACC_SUPER' flag would be said to be "synchronized". This is
- * because SUN used the same value for the flags `ACC_SUPER' 
and
- * `ACC_SYNCHRONIZED'.
- */
-if (for_class && ((p == Constants.ACC_SUPER) || (p == 
Constants.ACC_INTERFACE))) {
-continue;
-}
-buf.append(Constants.ACCESS_NAMES[i]).append(" ");
-}
-}
-return buf.toString().trim();
-}
-
-
-/**
- * @param access_flags the class flags
- * 
- * @return "class" or "interface", depending on the ACC_INTERFACE flag
- */
-public static final String classOrInterface( int access_flags ) {
-return ((access_flags & Constants.ACC_INTERFACE) != 0) ? "interface" : 
"class";
-}
-
-
-/**
- * Disassemble a byte array of JVM byte codes starting from code line 
- * `index' and return the disassembled string representation. Decode only
- * `num' opcodes (including their operands), use -1 if you want to
- * decompile everything.
- *
- * @param  code byte code array
- * @param  constant_pool Array of constants
- * @param  index offset in `code' array
- * (number of opcodes, not bytes!)
- * @param  length number of opcodes to decompile, -1 for all
- * @param  verbose be verbose, e.g. print constant pool index
- * @return String representation of byte codes
- */
-public static final String codeToString( byte[] code, ConstantPool 
constant_pool, int index,
-int length, boolean verbose ) {
-StringBuilder buf = new StringBuilder(code.length * 20); // Should be 
sufficient
-ByteSequence stream = new ByteSequence(code);
-try {
-for (int i = 0; i < index; i++) {
-codeToString(stream, constant_pool, 

svn commit: r1624506 [1/2] - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/bcel/ java/org/apache/tomcat/util/bcel/classfile/ java/org/apache/tomcat/util/bcel/util/

2014-09-12 Thread markt
Author: markt
Date: Fri Sep 12 11:59:12 2014
New Revision: 1624506

URL: http://svn.apache.org/r1624506
Log:
Merge removal of unused code from trunk

Removed:
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/util/ByteSequence.java
Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/Constants.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassFormatException.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Code.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/CodeException.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInvokeDynamic.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodHandle.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodType.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantValue.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Deprecated.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/EnclosingMethod.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ExceptionTable.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Field.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/InnerClass.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/InnerClasses.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/LineNumber.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/LineNumberTable.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariable.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTable.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTypeTable.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Method.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/PMGClass.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeInvisibleAnnotations.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeInvisibleParameterAnnotations.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleAnnotations.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleParameterAnnotations.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Signature.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/SourceFile.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMap.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapEntry.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTable.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTableEntry.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Synthetic.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Unknown.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged /tomcat/trunk:r1397953,1397957,1397960

Propchange: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/
--
  Merged /tomcat/trunk/java/org/apache/tomcat/util/bcel:r1397953,1397957,1397960

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/Constants.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/Constants.java?rev=1624506&r1=1624505&r2=1624506&view=diff
==
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/Constants.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/Constants.java Fri 
Sep 12 11:59:12 2014
@@ -541,29 +541,4 @@ public interface Constants {
   public static final byte ITEM_Object = 7;
   publi

svn commit: r1624508 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/bcel/ java/org/apache/tomcat/util/bcel/classfile/

2014-09-12 Thread markt
Author: markt
Date: Fri Sep 12 12:00:17 2014
New Revision: 1624508

URL: http://svn.apache.org/r1624508
Log:
Merge addition of comments from trunk

Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/   (props changed)

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/CodeException.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInvokeDynamic.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodHandle.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodType.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/InnerClass.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/LineNumber.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariable.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/PMGClass.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Signature.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/SourceFile.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapEntry.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTableEntry.java

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged /tomcat/trunk:r1397962,1397964,1397969

Propchange: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/
--
  Merged /tomcat/trunk/java/org/apache/tomcat/util/bcel:r1397962,1397964,1397969

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java?rev=1624508&r1=1624507&r2=1624508&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
 Fri Sep 12 12:00:17 2014
@@ -274,7 +274,7 @@ public final class ClassParser {
  * @throws  ClassFormatException
  */
 private void readVersion() throws IOException, ClassFormatException {
-file.readUnsignedShort();
-file.readUnsignedShort();
+file.readUnsignedShort();   // Unused minor
+file.readUnsignedShort();   // Unused major
 }
 }

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/CodeException.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/CodeException.java?rev=1624508&r1=1624507&r2=1624508&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/CodeException.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/CodeException.java
 Fri Sep 12 12:00:17 2014
@@ -42,10 +42,10 @@ public final class CodeException impleme
  * @throws IOException
  */
 CodeException(DataInput file) throws IOException {
-file.readUnsignedShort();
-file.readUnsignedShort();
-file.readUnsignedShort();
-file.readUnsignedShort();
+file.readUnsignedShort();   // Unused start_pc
+file.readUnsignedShort();   // Unused end_pc
+file.readUnsignedShort();   // Unused handler_pc
+file.readUnsignedShort();   // Unused catch_type
 }
 
 

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInvokeDynamic.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInvokeDynamic.java?rev=1624508&r1=1624507&r2=1624508&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInvokeDynamic.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInvokeDynamic.java
 Fri Sep 12 12:00:17 2014
@@ -42,8 +42,8 @@ public final class ConstantInvokeDynamic
  */
 ConstantInvokeDynamic(DataInput file) throws IOException {
 this();
-file.readUnsignedShort();
-file.readUnsignedShort();
+file.readUnsignedShort();   // Unused bootstrap_method_attr_index
+file.readUnsignedShort();   // Unused name_and_type_index
 }
 
 

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodHandle.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodHandle.java?rev=1624508&r1=1

Re: svn commit: r1619738 - in /tomcat/trunk: java/org/apache/tomcat/websocket/MessagePart.java java/org/apache/tomcat/websocket/PerMessageDeflate.java java/org/apache/tomcat/websocket/WsRemoteEndpoint

2014-09-12 Thread Violeta Georgieva
Hi,

2014-08-22 14:02 GMT+03:00 :
>
> Author: markt
> Date: Fri Aug 22 11:02:19 2014
> New Revision: 1619738
>
> URL: http://svn.apache.org/r1619738
> Log:
> Extend support for the WebSocket permessage-deflate extension to
compression of outgoing messages on the server side.

I would like to back-port this to 7.0.x.
Wdyt?

Regards,
Violeta


> Modified:
> tomcat/trunk/java/org/apache/tomcat/websocket/MessagePart.java
> tomcat/trunk/java/org/apache/tomcat/websocket/PerMessageDeflate.java
>
tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
> tomcat/trunk/webapps/docs/changelog.xml
>
> Modified: tomcat/trunk/java/org/apache/tomcat/websocket/MessagePart.java
> URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/MessagePart.java?rev=1619738&r1=1619737&r2=1619738&view=diff
>
==
> --- tomcat/trunk/java/org/apache/tomcat/websocket/MessagePart.java
(original)
> +++ tomcat/trunk/java/org/apache/tomcat/websocket/MessagePart.java Fri
Aug 22 11:02:19 2014
> @@ -25,15 +25,17 @@ class MessagePart {
>  private final int rsv;
>  private final byte opCode;
>  private final ByteBuffer payload;
> -private final SendHandler handler;
> +private final SendHandler intermediateHandler;
> +private volatile SendHandler endHandler;
>
>  public MessagePart( boolean fin, int rsv, byte opCode, ByteBuffer
payload,
> -SendHandler handler) {
> +SendHandler intermediateHandler, SendHandler endHandler) {
>  this.fin = fin;
>  this.rsv = rsv;
>  this.opCode = opCode;
>  this.payload = payload;
> -this.handler = handler;
> +this.intermediateHandler = intermediateHandler;
> +this.endHandler = endHandler;
>  }
>
>
> @@ -57,8 +59,17 @@ class MessagePart {
>  }
>
>
> -public SendHandler getHandler() {
> -return handler;
> +public SendHandler getIntermediateHandler() {
> +return intermediateHandler;
> +}
> +
> +
> +public SendHandler getEndHandler() {
> +return endHandler;
> +}
> +
> +public void setEndHandler(SendHandler endHandler) {
> +this.endHandler = endHandler;
>  }
>  }
>
>
> Modified:
tomcat/trunk/java/org/apache/tomcat/websocket/PerMessageDeflate.java
> URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/PerMessageDeflate.java?rev=1619738&r1=1619737&r2=1619738&view=diff
>
==
> --- tomcat/trunk/java/org/apache/tomcat/websocket/PerMessageDeflate.java
(original)
> +++ tomcat/trunk/java/org/apache/tomcat/websocket/PerMessageDeflate.java
Fri Aug 22 11:02:19 2014
> @@ -21,10 +21,12 @@ import java.nio.ByteBuffer;
>  import java.util.ArrayList;
>  import java.util.List;
>  import java.util.zip.DataFormatException;
> +import java.util.zip.Deflater;
>  import java.util.zip.Inflater;
>
>  import javax.websocket.Extension;
>  import javax.websocket.Extension.Parameter;
> +import javax.websocket.SendHandler;
>
>  import org.apache.tomcat.util.res.StringManager;
>
> @@ -47,10 +49,15 @@ public class PerMessageDeflate implement
>  private final boolean clientContextTakeover;
>  private final int clientMaxWindowBits;
>  private final Inflater inflater = new Inflater(true);
> -private final ByteBuffer readBuffer = ByteBuffer.allocate(8192);
> +private final ByteBuffer readBuffer =
ByteBuffer.allocate(Constants.DEFAULT_BUFFER_SIZE);
> +private final Deflater deflater = new
Deflater(Deflater.DEFAULT_COMPRESSION, true);
>
>  private volatile Transformation next;
>  private volatile boolean skipDecompression = false;
> +private volatile ByteBuffer writeBuffer =
ByteBuffer.allocate(Constants.DEFAULT_BUFFER_SIZE);
> +private volatile boolean deflaterResetRequired = true;
> +private volatile boolean firstCompressedFrameWritten = false;
> +private volatile byte[] EOM_BUFFER = new byte[EOM_BYTES.length + 1];
>
>  static PerMessageDeflate negotiate(List>
preferences) {
>  // Accept the first preference that the server is able to support
> @@ -288,25 +295,143 @@ public class PerMessageDeflate implement
>
>
>  @Override
> -public List sendMessagePart(List
messageParts) {
> -List compressedParts = new
ArrayList<>(messageParts.size());
> +public List sendMessagePart(List
uncompressedParts) {
> +List allCompressedParts = new ArrayList<>();
>
> -for (MessagePart messagePart : messageParts) {
> -byte opCode = messagePart.getOpCode();
> +for (MessagePart uncompressedPart : uncompressedParts) {
> +byte opCode = uncompressedPart.getOpCode();
>  if (Util.isControl(opCode)) {
>  // Control messages can appear in the middle of other
messages
>  // and must not be compressed. Pass it straight thro

svn commit: r1624509 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/bcel/ java/org/apache/tomcat/util/bcel/classfile/

2014-09-12 Thread markt
Author: markt
Date: Fri Sep 12 12:05:52 2014
New Revision: 1624509

URL: http://svn.apache.org/r1624509
Log:
Merge restoration of necessary code from trunk

Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/Constants.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Code.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapEntry.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTableEntry.java

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged /tomcat/trunk:r1397971-1397972

Propchange: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/
--
  Merged /tomcat/trunk/java/org/apache/tomcat/util/bcel:r1397971-1397972

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/Constants.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/Constants.java?rev=1624509&r1=1624508&r2=1624509&view=diff
==
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/Constants.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/Constants.java Fri 
Sep 12 12:05:52 2014
@@ -541,4 +541,24 @@ public interface Constants {
   public static final byte ITEM_Object = 7;
   public static final byte ITEM_NewObject  = 8;
 
+  /** Constants used to identify StackMapEntry types.
+  *
+  * For those types which can specify a range, the
+  * constant names the lowest value.
+  */
+ public static final int SAME_FRAME = 0;
+ public static final int SAME_LOCALS_1_STACK_ITEM_FRAME = 64;
+ public static final int SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED = 247;
+ public static final int CHOP_FRAME = 248;
+ public static final int SAME_FRAME_EXTENDED = 251;
+ public static final int APPEND_FRAME = 252;
+ public static final int FULL_FRAME = 255;
+
+ /** Constants that define the maximum value of
+  * those constants which store ranges. */
+
+ public static final int SAME_FRAME_MAX = 63;
+ public static final int SAME_LOCALS_1_STACK_ITEM_FRAME_MAX = 127;
+ public static final int CHOP_FRAME_MAX = 250;
+ public static final int APPEND_FRAME_MAX = 254;
 }

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Code.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Code.java?rev=1624509&r1=1624508&r2=1624509&view=diff
==
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Code.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Code.java 
Fri Sep 12 12:05:52 2014
@@ -58,8 +58,10 @@ public final class Code extends Attribut
 Code(int name_index, int length, DataInputStream file, ConstantPool 
constant_pool)
 throws IOException {
 // Initialize with some default values which will be overwritten later
-this(name_index, length, (byte[]) null, (CodeException[]) null,
-(Attribute[]) null, constant_pool);
+this(name_index, length, (byte[]) null,
+(CodeException[]) null, (Attribute[]) null, constant_pool);
+file.readUnsignedShort();   // Unused max_stack
+file.readUnsignedShort();   // Unused max_locals
 code_length = file.readInt();
 code = new byte[code_length]; // Read byte code
 file.readFully(code);

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapEntry.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapEntry.java?rev=1624509&r1=1624508&r2=1624509&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapEntry.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapEntry.java
 Fri Sep 12 12:05:52 2014
@@ -34,9 +34,38 @@ public final class StackMapEntry impleme
 
 private static final long serialVersionUID = 1L;
 
+private int number_of_locals;
+private StackMapType[] types_of_locals;
+private int number_of_stack_items;
+private StackMapType[] types_of_stack_items;
+
+
+/**
+ * Construct object from file stream.
+ * @param file Input stream
+ * @throws IOException
+ */
 StackMapEntry(DataInputStream file) throws IOException {
-file.readShort();   // Unused byte_code_offset
-file.readShort();   // Unused number_of_locals
+this(file.readShort(), file.readShort(), null, -1, null);
+types_of_locals = new StackMapType[number_of_lo

svn commit: r1624510 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/bcel/ java/org/apache/tomcat/util/bcel/classfile/

2014-09-12 Thread markt
Author: markt
Date: Fri Sep 12 12:09:34 2014
New Revision: 1624510

URL: http://svn.apache.org/r1624510
Log:
Back-port of more cleanup from trunk

Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/Constants.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInvokeDynamic.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodHandle.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodType.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantValue.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/PMGClass.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeInvisibleAnnotations.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeInvisibleParameterAnnotations.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleAnnotations.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Signature.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/SourceFile.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapType.java

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged /tomcat/trunk:r1397973-1397974,1397976-1397978

Propchange: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/
--
  Merged 
/tomcat/trunk/java/org/apache/tomcat/util/bcel:r1397973-1397974,1397976-1397978

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/Constants.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/Constants.java?rev=1624510&r1=1624509&r2=1624510&view=diff
==
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/Constants.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/Constants.java Fri 
Sep 12 12:09:34 2014
@@ -40,26 +40,6 @@ public interface Constants {
*/
   public static final short ACC_ANNOTATION   = 0x2000;
 
-  /** One of the access flags for fields, methods, or classes.
-   */
-  public static final short ACC_ENUM = 0x4000;
-
-  // Applies to classes compiled by new compilers only
-  /** One of the access flags for fields, methods, or classes.
-   */
-  public static final short ACC_SUPER= 0x0020;
-
-  /** One of the access flags for fields, methods, or classes.
-   */
-  public static final short MAX_ACC_FLAG = ACC_ENUM;
-
-  /** The names of the access flags. */
-  public static final String[] ACCESS_NAMES = {
-"public", "private", "protected", "static", "final", "synchronized",
-"volatile", "transient", "native", "interface", "abstract", "strictfp",
-"synthetic", "annotation", "enum"
-  };
-
   /** Marks a constant pool entry as type UTF-8.  */
   public static final byte CONSTANT_Utf8   = 1;
 
@@ -111,388 +91,6 @@ public interface Constants {
 "CONSTANT_NameAndType", "", "", "CONSTANT_MethodHandle",
 "CONSTANT_MethodType", "", "CONSTANT_InvokeDynamic" };
   
-  /** Java VM opcode.
-   * @see http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html";>Opcode
 definitions in The Java Virtual Machine Specification */
-  public static final short LDC  = 18;
-  /** Java VM opcode.
-   * @see http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html";>Opcode
 definitions in The Java Virtual Machine Specification */
-  public static final short LDC_W= 19;
-  /** Java VM opcode.
-   * @see http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html";>Opcode
 definitions in The Java Virtual Machine Specification */
-  public static final short LDC2_W   = 20;
-  /** Java VM opcode.
-   * @see http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html";>Opcode
 definitions in The Java Virtual Machine Specification */
-  public static final short ILOAD= 21;
-  /** Java VM opcode.
-   * @see http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html";>Opcode
 definitions in The Java Virtual Machine Specification */
-  public static final short LLOAD= 22;
-  /** Java VM opcode.
-   * @see http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html";>Opcode
 definitions in The Java Virtual Machine Specification */
-  public static final short FLOAD= 23;
-  /** Java VM opcode.
-   * @see http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html";>Opcode
 definitions in The Java Virtual Machine Specification */
-  public stati

svn commit: r1624511 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/bcel/ java/org/apache/tomcat/util/bcel/classfile/Constant.java

2014-09-12 Thread markt
Author: markt
Date: Fri Sep 12 12:10:50 2014
New Revision: 1624511

URL: http://svn.apache.org/r1624511
Log:
Backport fix for stack overflow error from trunk

Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/   (props changed)

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged /tomcat/trunk:r1397979

Propchange: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/
--
  Merged /tomcat/trunk/java/org/apache/tomcat/util/bcel:r1397979

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java?rev=1624511&r1=1624510&r2=1624511&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java 
(original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java 
Fri Sep 12 12:10:50 2014
@@ -129,6 +129,13 @@ public abstract class Constant implement
 }
 
 
+
+@Override
+public String toString() {
+return "[" + tag + "]";
+}
+
+
 /**
  * Return value as defined by given BCELComparator strategy.
  * By default two Constant objects are said to be equal when



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624514 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/bcel/ java/org/apache/tomcat/util/bcel/classfile/

2014-09-12 Thread markt
Author: markt
Date: Fri Sep 12 12:16:03 2014
New Revision: 1624514

URL: http://svn.apache.org/r1624514
Log:
Backport of unused code removal from trunk

Removed:
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Field.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Method.java
Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/   (props changed)

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Code.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/CodeException.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantValue.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Deprecated.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/EnclosingMethod.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ExceptionTable.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/FieldOrMethod.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/InnerClass.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/InnerClasses.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/LineNumber.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/LineNumberTable.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariable.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTable.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTypeTable.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/PMGClass.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeInvisibleAnnotations.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeInvisibleParameterAnnotations.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleAnnotations.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleParameterAnnotations.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Signature.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/SourceFile.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMap.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapEntry.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTable.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTableEntry.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Synthetic.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Unknown.java

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged /tomcat/trunk:r1397980,1397985,1397988

Propchange: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/
--
  Merged /tomcat/trunk/java/org/apache/tomcat/util/bcel:r1397980,1397985,1397988

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java?rev=1624514&r1=1624513&r2=1624514&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java
 Fri Sep 12 12:16:03 2014
@@ -75,11 +75,4 @@ public class AnnotationDefault extends A
 {
 default_value = defaultValue;
 }
-
-
-@Override
-public Attribute copy(ConstantPool _constant_pool)
-{
-throw new RuntimeException("Not implemented yet!");
-}
 }

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java?rev=1624514&r1=1624513&r2=1624514&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java 
(original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java 
Fri Sep 12 12:16:03 2014
@@ -203,9 +203,4 @@ public abstract class Attribute implemen
 }
 return attr;
 }
-
-   

svn commit: r1624520 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/bcel/ java/org/apache/tomcat/util/bcel/classfile/

2014-09-12 Thread markt
Author: markt
Date: Fri Sep 12 12:31:01 2014
New Revision: 1624520

URL: http://svn.apache.org/r1624520
Log:
Merge more unused code removal from trunk

Removed:

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AttributeReader.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/CodeException.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/InnerClass.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/LineNumber.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariable.java
Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/   (props changed)

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassElementValue.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Code.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValuePair.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/EnumElementValue.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/InnerClasses.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/LineNumberTable.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTable.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTypeTable.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Unknown.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged /tomcat/trunk:r1397989,1398089,1398107,1398109-1398110,1398112

Propchange: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/
--
  Merged 
/tomcat/trunk/java/org/apache/tomcat/util/bcel:r1398089,1398107,1398109-1398110,1398112

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java?rev=1624520&r1=1624519&r2=1624520&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java
 Fri Sep 12 12:31:01 2014
@@ -17,9 +17,6 @@
  */
 package org.apache.tomcat.util.bcel.classfile;
 
-import java.io.DataOutputStream;
-import java.io.IOException;
-
 public class AnnotationElementValue extends ElementValue
 {
 // For annotation element values, this is the annotation
@@ -37,13 +34,6 @@ public class AnnotationElementValue exte
 }
 
 @Override
-public void dump(DataOutputStream dos) throws IOException
-{
-dos.writeByte(type); // u1 type of value (ANNOTATION == '@')
-annotationEntry.dump(dos);
-}
-
-@Override
 public String stringifyValue()
 {
 return annotationEntry.toString();

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java?rev=1624520&r1=1624519&r2=1624520&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java
 Fri Sep 12 12:31:01 2014
@@ -18,7 +18,6 @@
 package org.apache.tomcat.util.bcel.classfile;
 
 import java.io.DataInputStream;
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
@@ -78,14 +77,4 @@ public class AnnotationEntry implements 
 // TODO return List
 return element_value_pairs.toArray(new 
ElementValuePair[element_value_pairs.size()]);
 }
-
-public void dump(DataOutputStream dos) throws IOException {
-dos.writeShort(type_index); // u2 index of type name in cpool
-dos.writeShort(element_value_pairs.size()); // u2 element_value pair
-// cou

svn commit: r1624521 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/bcel/ java/org/apache/tomcat/util/bcel/classfile/

2014-09-12 Thread markt
Author: markt
Date: Fri Sep 12 12:35:49 2014
New Revision: 1624521

URL: http://svn.apache.org/r1624521
Log:
Port simplications from trunk

Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/   (props changed)

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapEntry.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTable.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTableEntry.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapType.java

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged /tomcat/trunk:r1539887,1540383-1540386

Propchange: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/
--
  Merged /tomcat/trunk/java/org/apache/tomcat/util/bcel:r1539887,1540383-1540386

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java?rev=1624521&r1=1624520&r2=1624521&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
 Fri Sep 12 12:35:49 2014
@@ -43,6 +43,8 @@ import org.apache.tomcat.util.bcel.Const
  */
 public final class ClassParser {
 
+private static final int MAGIC = 0xCAFEBABE;
+
 private DataInputStream file;
 private boolean fileOwned;
 private String file_name;
@@ -231,8 +233,7 @@ public final class ClassParser {
  * @throws  ClassFormatException
  */
 private void readID() throws IOException, ClassFormatException {
-int magic = 0xCAFEBABE;
-if (file.readInt() != magic) {
+if (file.readInt() != MAGIC) {
 throw new ClassFormatException(file_name + " is not a Java .class 
file");
 }
 }

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapEntry.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapEntry.java?rev=1624521&r1=1624520&r2=1624521&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapEntry.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapEntry.java
 Fri Sep 12 12:35:49 2014
@@ -34,12 +34,6 @@ public final class StackMapEntry impleme
 
 private static final long serialVersionUID = 1L;
 
-private int number_of_locals;
-private StackMapType[] types_of_locals;
-private int number_of_stack_items;
-private StackMapType[] types_of_stack_items;
-
-
 /**
  * Construct object from file stream.
  * @param file Input stream
@@ -47,14 +41,14 @@ public final class StackMapEntry impleme
  */
 StackMapEntry(DataInputStream file) throws IOException {
 file.readShort();   // Unused byte_code_offset
-number_of_locals = file.readShort();
-types_of_locals = null;
-types_of_stack_items = null;
+int number_of_locals = file.readShort();
+StackMapType[] types_of_locals = null;
+StackMapType[] types_of_stack_items = null;
 types_of_locals = new StackMapType[number_of_locals];
 for (int i = 0; i < number_of_locals; i++) {
 types_of_locals[i] = new StackMapType(file);
 }
-number_of_stack_items = file.readShort();
+int number_of_stack_items = file.readShort();
 types_of_stack_items = new StackMapType[number_of_stack_items];
 for (int i = 0; i < number_of_stack_items; i++) {
 types_of_stack_items[i] = new StackMapType(file);

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTable.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTable.java?rev=1624521&r1=1624520&r2=1624521&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTable.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTable.java
 Fri Sep 12 12:35:49 2014
@@ -37,20 +37,8 @@ import java.io.IOException;
 public final class StackMapTable extends Attribute {
 
 private static final long serialVersionUID = -2931695092763099621L;
-private int map_length;
-private StackMapTableEntry[] map; // Table of stack map entries
-
-
-/*
- * @

svn commit: r1624523 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/bcel/ java/org/apache/tomcat/util/bcel/classfile/

2014-09-12 Thread markt
Author: markt
Date: Fri Sep 12 12:42:21 2014
New Revision: 1624523

URL: http://svn.apache.org/r1624523
Log:
Port more simplifications from trunk

Removed:

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapEntry.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTableEntry.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapType.java
Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/   (props changed)

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMap.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTable.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged /tomcat/trunk:r1540396-1540398,1540400-1540402

Propchange: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/
--
  Merged 
/tomcat/trunk/java/org/apache/tomcat/util/bcel:r1540396-1540398,1540400-1540402

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java?rev=1624523&r1=1624522&r2=1624523&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java 
(original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java 
Fri Sep 12 12:42:21 2014
@@ -112,19 +112,12 @@ public class JavaClass extends AccessFla
 }
 
 
-/**
- * @return Attributes of the class.
- */
-public Attribute[] getAttributes() {
-return attributes;
-}
-
 public AnnotationEntry[] getAnnotationEntries() {
 if (annotationsOutOfDate) { 
 // Find attributes that contain annotation data
-Attribute[] attrs = getAttributes();
 List accumulatedAnnotations = new 
ArrayList();
-for (Attribute attribute : attrs) {
+for (int i = 0; i < attributes.length; i++) {
+Attribute attribute = attributes[i];
 if (attribute instanceof Annotations) {
 Annotations runtimeAnnotations = (Annotations)attribute;
 for(int j = 0; j < 
runtimeAnnotations.getAnnotationEntries().length; j++)

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMap.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMap.java?rev=1624523&r1=1624522&r2=1624523&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMap.java 
(original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMap.java 
Fri Sep 12 12:42:21 2014
@@ -31,27 +31,10 @@ import java.io.IOException;
  *
  * @author  mailto:m.d...@gmx.de";>M. Dahm
  * @see Code
- * @see StackMapEntry
- * @see StackMapType
  */
 public final class StackMap extends Attribute {
 
 private static final long serialVersionUID = 264958819110329590L;
-private int map_length;
-private StackMapEntry[] map; // Table of stack map entries
-
-
-/*
- * @param name_index Index of name
- * @param length Content length in bytes
- * @param map Table of stack map entries
- * @param constant_pool Array of constants
- */
-public StackMap(int name_index, int length, StackMapEntry[] map, 
ConstantPool constant_pool) {
-super(name_index, length, constant_pool);
-setStackMap(map);
-}
-
 
 /**
  * Construct object from file stream.
@@ -63,20 +46,10 @@ public final class StackMap extends Attr
  */
 StackMap(int name_index, int length, DataInputStream file, ConstantPool 
constant_pool)
 throws IOException {
-this(name_index, length, (StackMapEntry[]) null, constant_pool);
-map_length = file.readUnsignedShort();
-map = new StackMapEntry[map_length];
+super(name_index, length, constant_pool);
+int map_length = file.readUnsignedShort();
 for (int i = 0; i < map_length; i++) {
-map[i] = new StackMapEntry(file);
+Utility.swallowStackMapEntry(file);
 }
 }
-
-
-/**
- * @param map Array of stack map entries
- */
-public final void setStackMap( StackMapEntry[] map ) {
-this.map = map;
-map_length = (map == null) ? 0 : map.length;
-}
 }

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTa

svn commit: r1624526 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/bcel/ java/org/apache/tomcat/util/bcel/classfile/

2014-09-12 Thread markt
Author: markt
Date: Fri Sep 12 12:46:55 2014
New Revision: 1624526

URL: http://svn.apache.org/r1624526
Log:
Merge more simplification from trunk

Removed:

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Signature.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMap.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTable.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Unknown.java
Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/   (props changed)

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged /tomcat/trunk:r1540403-1540410

Propchange: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/
--
  Merged /tomcat/trunk/java/org/apache/tomcat/util/bcel:r1540403-1540410

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java?rev=1624526&r1=1624525&r2=1624526&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java 
(original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java 
Fri Sep 12 12:46:55 2014
@@ -26,7 +26,7 @@ import org.apache.tomcat.util.bcel.Const
 /**
  * Abstract super class for Attribute objects. Currently the
  * ConstantValue, SourceFile, Code,
- * Exceptiontable, LineNumberTable,
+ * ExceptionTable, LineNumberTable,
  * LocalVariableTable, InnerClasses and
  * Synthetic attributes are supported. The Unknown
  * attribute stands for non-standard-attributes.
@@ -35,14 +35,12 @@ import org.apache.tomcat.util.bcel.Const
  * @see ConstantValue
  * @see SourceFile
  * @see Code
- * @see Unknown
  * @see ExceptionTable
  * @see LineNumberTable
  * @see LocalVariableTable
  * @see InnerClasses
  * @see Synthetic
  * @see Deprecated
- * @see Signature
  */
 public abstract class Attribute implements Cloneable, Serializable
 {
@@ -102,7 +100,8 @@ public abstract class Attribute implemen
 switch (tag)
 {
 case Constants.ATTR_UNKNOWN:
-return new Unknown(name_index, length, file, constant_pool);
+Utility.swallowUnknownAttribute(file, length);
+return null;
 case Constants.ATTR_CONSTANT_VALUE:
 return new ConstantValue(name_index, length, file, constant_pool);
 case Constants.ATTR_SOURCE_FILE:
@@ -125,9 +124,11 @@ public abstract class Attribute implemen
 case Constants.ATTR_PMG:
 return new PMGClass(name_index, length, file, constant_pool);
 case Constants.ATTR_SIGNATURE:
-return new Signature(name_index, length, file, constant_pool);
+Utility.swallowSignature(file);
+return null;
 case Constants.ATTR_STACK_MAP:
-return new StackMap(name_index, length, file, constant_pool);
+Utility.swallowStackMap(file);
+return null;
 case Constants.ATTR_RUNTIME_VISIBLE_ANNOTATIONS:
 return new RuntimeVisibleAnnotations(name_index, length, file,
 constant_pool);
@@ -149,7 +150,8 @@ public abstract class Attribute implemen
 case Constants.ATTR_ENCLOSING_METHOD:
 return new EnclosingMethod(name_index, length, file, 
constant_pool);
 case Constants.ATTR_STACK_MAP_TABLE:
-return new StackMapTable(name_index, length, file, constant_pool);
+Utility.swallowStackMapTable(file);
+return null;
 case Constants.ATTR_BOOTSTRAP_METHODS:
 Utility.swallowBootstrapMethods(file);
 return null;

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java?rev=1624526&r1=1624525&r2=1624526&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java
 Fri Sep 12 12:46:55 2014
@@ -86,7 +86,7 @@ public class ConstantPool implements Clo
 case Constants.CONSTANT_Class:
 i = ((ConstantClass) c).get

svn commit: r1624527 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/bcel/ java/org/apache/tomcat/util/bcel/classfile/

2014-09-12 Thread markt
Author: markt
Date: Fri Sep 12 12:48:21 2014
New Revision: 1624527

URL: http://svn.apache.org/r1624527
Log:
Merge more simplification from trunk

Removed:

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Synthetic.java
Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/   (props changed)

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged /tomcat/trunk:r1540411-1540413

Propchange: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/
--
  Merged /tomcat/trunk/java/org/apache/tomcat/util/bcel:r1540411-1540413

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java?rev=1624527&r1=1624526&r2=1624527&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java 
(original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java 
Fri Sep 12 12:48:21 2014
@@ -39,7 +39,6 @@ import org.apache.tomcat.util.bcel.Const
  * @see LineNumberTable
  * @see LocalVariableTable
  * @see InnerClasses
- * @see Synthetic
  * @see Deprecated
  */
 public abstract class Attribute implements Cloneable, Serializable
@@ -118,7 +117,8 @@ public abstract class Attribute implemen
 case Constants.ATTR_INNER_CLASSES:
 return new InnerClasses(name_index, length, file, constant_pool);
 case Constants.ATTR_SYNTHETIC:
-return new Synthetic(name_index, length, file, constant_pool);
+Utility.swallowSynthetic(file, length);
+return null;
 case Constants.ATTR_DEPRECATED:
 return new Deprecated(name_index, length, file, constant_pool);
 case Constants.ATTR_PMG:

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java?rev=1624527&r1=1624526&r2=1624527&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java 
(original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java 
Fri Sep 12 12:48:21 2014
@@ -110,7 +110,7 @@ final class Utility {
 static void swallowStackMapType(DataInput file) throws IOException {
 byte type = file.readByte();
 if ((type < Constants.ITEM_Bogus) || (type > 
Constants.ITEM_NewObject)) {
-throw new RuntimeException("Illegal type for StackMapType: " + 
type);
+throw new ClassFormatException("Illegal type for StackMapType: " + 
type);
 }
 // Check to see if type has an index
 if ((type == Constants.ITEM_Object) || (type == 
Constants.ITEM_NewObject)) {
@@ -180,4 +180,12 @@ final class Utility {
 static void swallowSignature(DataInput file) throws IOException {
 file.readUnsignedShort();   // Unused signature_index
 }
+
+static void swallowSynthetic(DataInput file, int length) throws 
IOException {
+if (length > 0) {
+byte[] bytes = new byte[length];
+file.readFully(bytes);
+throw new ClassFormatException("Synthetic attribute with length > 
0");
+}
+}
 }



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624529 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/bcel/ java/org/apache/tomcat/util/bcel/classfile/

2014-09-12 Thread markt
Author: markt
Date: Fri Sep 12 12:54:11 2014
New Revision: 1624529

URL: http://svn.apache.org/r1624529
Log:
Port removal of unused code from trunk

Removed:
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Code.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantValue.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Deprecated.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ExceptionTable.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/InnerClasses.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/LineNumberTable.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTable.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/PMGClass.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/SourceFile.java
Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/   (props changed)

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged 
/tomcat/trunk:r1624110,1624112,1624115-1624116,1624119,1624122,1624124,1624126,1624129-1624130

Propchange: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/
--
  Merged 
/tomcat/trunk/java/org/apache/tomcat/util/bcel:r1624110,1624112,1624115-1624116,1624119,1624122,1624124,1624126,1624129-1624130

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java?rev=1624529&r1=1624528&r2=1624529&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java 
(original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java 
Fri Sep 12 12:54:11 2014
@@ -32,14 +32,6 @@ import org.apache.tomcat.util.bcel.Const
  * attribute stands for non-standard-attributes.
  * 
  * @author mailto:m.d...@gmx.de";>M. Dahm
- * @see ConstantValue
- * @see SourceFile
- * @see Code
- * @see ExceptionTable
- * @see LineNumberTable
- * @see LocalVariableTable
- * @see InnerClasses
- * @see Deprecated
  */
 public abstract class Attribute implements Cloneable, Serializable
 {
@@ -102,27 +94,35 @@ public abstract class Attribute implemen
 Utility.swallowUnknownAttribute(file, length);
 return null;
 case Constants.ATTR_CONSTANT_VALUE:
-return new ConstantValue(name_index, length, file, constant_pool);
+Utility.swallowConstantValue(file);
+return null;
 case Constants.ATTR_SOURCE_FILE:
-return new SourceFile(name_index, length, file, constant_pool);
+Utility.swallowSourceFile(file);
+return null;
 case Constants.ATTR_CODE:
-return new Code(name_index, length, file, constant_pool);
+Utility.swallowCode(file, constant_pool);
+return null;
 case Constants.ATTR_EXCEPTIONS:
-return new ExceptionTable(name_index, length, file, constant_pool);
+Utility.swallowExceptionTable(file);
+return null;
 case Constants.ATTR_LINE_NUMBER_TABLE:
-return new LineNumberTable(name_index, length, file, 
constant_pool);
+Utility.swallowLineNumberTable(file);
+return null;
 case Constants.ATTR_LOCAL_VARIABLE_TABLE:
-return new LocalVariableTable(name_index, length, file,
-constant_pool);
+Utility.swallowLocalVariableTable(file);
+return null;
 case Constants.ATTR_INNER_CLASSES:
-return new InnerClasses(name_index, length, file, constant_pool);
+Utility.swallowInnerClasses(file);
+return null;
 case Constants.ATTR_SYNTHETIC:
-Utility.swallowSynthetic(file, length);
+Utility.swallowSynthetic(length);
 return null;
 case Constants.ATTR_DEPRECATED:
-return new Deprecated(name_index, length, file, constant_pool);
+Utility.swallowDeprecated(length);
+return null;
 case Constants.ATTR_PMG:
-return new PMGClass(name_index, length, file, constant_pool);
+Utility.swallowPMCClass(file);
+return null;
 case Constants.ATTR_SIGNATURE:
 Utility.swallowSignature(file);
 return null;

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java
URL: 
http://svn

Re: svn commit: r1619738 - in /tomcat/trunk: java/org/apache/tomcat/websocket/MessagePart.java java/org/apache/tomcat/websocket/PerMessageDeflate.java java/org/apache/tomcat/websocket/WsRemoteEndpoint

2014-09-12 Thread Mark Thomas
On 12/09/2014 13:04, Violeta Georgieva wrote:
> Hi,
> 
> 2014-08-22 14:02 GMT+03:00 :
>>
>> Author: markt
>> Date: Fri Aug 22 11:02:19 2014
>> New Revision: 1619738
>>
>> URL: http://svn.apache.org/r1619738
>> Log:
>> Extend support for the WebSocket permessage-deflate extension to
> compression of outgoing messages on the server side.
> 
> I would like to back-port this to 7.0.x.
> Wdyt?

No objections here. You might want to check the rest of the websocket
package for changes that haven't been back-ported as well.

Mark


> 
> Regards,
> Violeta
> 
> 
>> Modified:
>> tomcat/trunk/java/org/apache/tomcat/websocket/MessagePart.java
>> tomcat/trunk/java/org/apache/tomcat/websocket/PerMessageDeflate.java
>>
> tomcat/trunk/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java
>> tomcat/trunk/webapps/docs/changelog.xml
>>
>> Modified: tomcat/trunk/java/org/apache/tomcat/websocket/MessagePart.java
>> URL:
> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/MessagePart.java?rev=1619738&r1=1619737&r2=1619738&view=diff
>>
> ==
>> --- tomcat/trunk/java/org/apache/tomcat/websocket/MessagePart.java
> (original)
>> +++ tomcat/trunk/java/org/apache/tomcat/websocket/MessagePart.java Fri
> Aug 22 11:02:19 2014
>> @@ -25,15 +25,17 @@ class MessagePart {
>>  private final int rsv;
>>  private final byte opCode;
>>  private final ByteBuffer payload;
>> -private final SendHandler handler;
>> +private final SendHandler intermediateHandler;
>> +private volatile SendHandler endHandler;
>>
>>  public MessagePart( boolean fin, int rsv, byte opCode, ByteBuffer
> payload,
>> -SendHandler handler) {
>> +SendHandler intermediateHandler, SendHandler endHandler) {
>>  this.fin = fin;
>>  this.rsv = rsv;
>>  this.opCode = opCode;
>>  this.payload = payload;
>> -this.handler = handler;
>> +this.intermediateHandler = intermediateHandler;
>> +this.endHandler = endHandler;
>>  }
>>
>>
>> @@ -57,8 +59,17 @@ class MessagePart {
>>  }
>>
>>
>> -public SendHandler getHandler() {
>> -return handler;
>> +public SendHandler getIntermediateHandler() {
>> +return intermediateHandler;
>> +}
>> +
>> +
>> +public SendHandler getEndHandler() {
>> +return endHandler;
>> +}
>> +
>> +public void setEndHandler(SendHandler endHandler) {
>> +this.endHandler = endHandler;
>>  }
>>  }
>>
>>
>> Modified:
> tomcat/trunk/java/org/apache/tomcat/websocket/PerMessageDeflate.java
>> URL:
> http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/websocket/PerMessageDeflate.java?rev=1619738&r1=1619737&r2=1619738&view=diff
>>
> ==
>> --- tomcat/trunk/java/org/apache/tomcat/websocket/PerMessageDeflate.java
> (original)
>> +++ tomcat/trunk/java/org/apache/tomcat/websocket/PerMessageDeflate.java
> Fri Aug 22 11:02:19 2014
>> @@ -21,10 +21,12 @@ import java.nio.ByteBuffer;
>>  import java.util.ArrayList;
>>  import java.util.List;
>>  import java.util.zip.DataFormatException;
>> +import java.util.zip.Deflater;
>>  import java.util.zip.Inflater;
>>
>>  import javax.websocket.Extension;
>>  import javax.websocket.Extension.Parameter;
>> +import javax.websocket.SendHandler;
>>
>>  import org.apache.tomcat.util.res.StringManager;
>>
>> @@ -47,10 +49,15 @@ public class PerMessageDeflate implement
>>  private final boolean clientContextTakeover;
>>  private final int clientMaxWindowBits;
>>  private final Inflater inflater = new Inflater(true);
>> -private final ByteBuffer readBuffer = ByteBuffer.allocate(8192);
>> +private final ByteBuffer readBuffer =
> ByteBuffer.allocate(Constants.DEFAULT_BUFFER_SIZE);
>> +private final Deflater deflater = new
> Deflater(Deflater.DEFAULT_COMPRESSION, true);
>>
>>  private volatile Transformation next;
>>  private volatile boolean skipDecompression = false;
>> +private volatile ByteBuffer writeBuffer =
> ByteBuffer.allocate(Constants.DEFAULT_BUFFER_SIZE);
>> +private volatile boolean deflaterResetRequired = true;
>> +private volatile boolean firstCompressedFrameWritten = false;
>> +private volatile byte[] EOM_BUFFER = new byte[EOM_BYTES.length + 1];
>>
>>  static PerMessageDeflate negotiate(List>
> preferences) {
>>  // Accept the first preference that the server is able to support
>> @@ -288,25 +295,143 @@ public class PerMessageDeflate implement
>>
>>
>>  @Override
>> -public List sendMessagePart(List
> messageParts) {
>> -List compressedParts = new
> ArrayList<>(messageParts.size());
>> +public List sendMessagePart(List
> uncompressedParts) {
>> +List allCompressedParts = new ArrayList<>();
>>
>> -for (MessagePart messagePart : messageParts) {
>> -byte opCode =

svn commit: r1624533 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/bcel/ java/org/apache/tomcat/util/bcel/classfile/

2014-09-12 Thread markt
Author: markt
Date: Fri Sep 12 13:01:37 2014
New Revision: 1624533

URL: http://svn.apache.org/r1624533
Log:
Port removal of unnecesary code from trunk

Removed:

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantCP.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantFieldref.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInterfaceMethodref.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInvokeDynamic.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodHandle.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodType.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodref.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantNameAndType.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantString.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/EnclosingMethod.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTypeTable.java
Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/   (props changed)

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/FieldOrMethod.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged 
/tomcat/trunk:r1624132-1624133,1624135,1624139,1624142-1624143,1624147,1624150,1624152,1624155-1624157

Propchange: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/
--
  Merged 
/tomcat/trunk/java/org/apache/tomcat/util/bcel:r1624132-1624133,1624135,1624139,1624142-1624143,1624147,1624150,1624152,1624155-1624157

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java?rev=1624533&r1=1624532&r2=1624533&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java
 Fri Sep 12 13:01:37 2014
@@ -45,34 +45,7 @@ public class AnnotationDefault extends A
 DataInputStream file, ConstantPool constant_pool)
 throws IOException
 {
-this(name_index, length, (ElementValue) null,
-constant_pool);
-default_value = ElementValue.readElementValue(file, constant_pool);
-}
-
-/**
- * @param name_index
- *Index pointing to the name Code
- * @param length
- *Content length in bytes
- * @param defaultValue
- *the annotation's default value
- * @param constant_pool
- *Array of constants
- */
-public AnnotationDefault(int name_index, int length,
-ElementValue defaultValue, ConstantPool constant_pool)
-{
 super(name_index, length, constant_pool);
-setDefaultValue(defaultValue);
-}
-
-/**
- * @param defaultValue
- *the default value of this methodinfo's annotation
- */
-public final void setDefaultValue(ElementValue defaultValue)
-{
-default_value = defaultValue;
+default_value = ElementValue.readElementValue(file, constant_pool);
 }
 }

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java?rev=1624533&r1=1624532&r2=1624533&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java
 Fri Sep 12 13:01:37 2014
@@ -30,7 +30,7 @@ public abstract class Annotations extend
 
 private static final long serialVersionUID = 1L;
 
-private AnnotationEntry[] annotation_table;
+private

svn commit: r1624534 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/bcel/ java/org/apache/tomcat/util/bcel/classfile/ java/org/apache/tomcat/util/bcel/util/

2014-09-12 Thread markt
Author: markt
Date: Fri Sep 12 13:09:13 2014
New Revision: 1624534

URL: http://svn.apache.org/r1624534
Log:
Port more code removal from trunk

Removed:

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/FieldOrMethod.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeInvisibleAnnotations.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeInvisibleParameterAnnotations.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/util/
Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/   (props changed)

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantDouble.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantFloat.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInteger.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantLong.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantUtf8.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged 
/tomcat/trunk:r1624162-1624165,1624220,1624233,1624235,1624246,1624252,1624254,1624396,1624408

Propchange: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/
--
  Merged 
/tomcat/trunk/java/org/apache/tomcat/util/bcel:r1624162-1624165,1624220,1624233,1624235,1624246,1624252,1624254,1624396,1624408

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java?rev=1624534&r1=1624533&r2=1624534&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java 
(original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java 
Fri Sep 12 13:09:13 2014
@@ -133,14 +133,14 @@ public abstract class Attribute implemen
 return new RuntimeVisibleAnnotations(name_index, length, file,
 constant_pool);
 case Constants.ATTR_RUNTIME_INVISIBLE_ANNOTATIONS:
-return new RuntimeInvisibleAnnotations(name_index, length, file,
-constant_pool);
+Utility.swallowAnnotations(file);
+return null;
 case Constants.ATTR_RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS:
 return new RuntimeVisibleParameterAnnotations(name_index, length,
 file, constant_pool);
 case Constants.ATTR_RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS:
-return new RuntimeInvisibleParameterAnnotations(name_index, length,
-file, constant_pool);
+Utility.swallowParameterAnnotations(file);
+return null;
 case Constants.ATTR_ANNOTATION_DEFAULT:
 return new AnnotationDefault(name_index, length, file,
 constant_pool);

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java?rev=1624534&r1=1624533&r2=1624534&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
 Fri Sep 12 13:09:13 2014
@@ -53,8 +53,6 @@ public final class ClassParser {
 private int access_flags; // Access rights of parsed class
 private int[] interfaces; // Names of implemented interfaces
 private ConstantPool constant_pool; // collection of constants
-private FieldOrMethod[] fields; // class fields, i.e., its variables
-private FieldOrMethod[] methods; // methods defined in the class
 private Attribute[] attributes; // attributes defined in the class
 private boolean is_zip; // Loaded from zip file
 private static final int BUFSIZE = 8192;
@@ -216,11 +214,9 @@ public final class ClassParser {
  * @throws  ClassFormatException
  */
 private void r

svn commit: r1624535 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/bcel/ java/org/apache/tomcat/util/bcel/classfile/

2014-09-12 Thread markt
Author: markt
Date: Fri Sep 12 13:12:21 2014
New Revision: 1624535

URL: http://svn.apache.org/r1624535
Log:
Port more code removal from trunk

Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/   (props changed)

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantUtf8.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged /tomcat/trunk:r1624422,1624476,1624486-1624487,1624497-1624498

Propchange: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/
--
  Merged 
/tomcat/trunk/java/org/apache/tomcat/util/bcel:r1624422,1624476,1624486-1624487,1624497-1624498

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java?rev=1624535&r1=1624534&r2=1624535&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java 
(original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java 
Fri Sep 12 13:12:21 2014
@@ -90,77 +90,18 @@ public abstract class Attribute implemen
 // Call proper constructor, depending on `tag'
 switch (tag)
 {
-case Constants.ATTR_UNKNOWN:
-Utility.swallowUnknownAttribute(file, length);
-return null;
-case Constants.ATTR_CONSTANT_VALUE:
-Utility.swallowConstantValue(file);
-return null;
-case Constants.ATTR_SOURCE_FILE:
-Utility.swallowSourceFile(file);
-return null;
-case Constants.ATTR_CODE:
-Utility.swallowCode(file, constant_pool);
-return null;
-case Constants.ATTR_EXCEPTIONS:
-Utility.swallowExceptionTable(file);
-return null;
-case Constants.ATTR_LINE_NUMBER_TABLE:
-Utility.swallowLineNumberTable(file);
-return null;
-case Constants.ATTR_LOCAL_VARIABLE_TABLE:
-Utility.swallowLocalVariableTable(file);
-return null;
-case Constants.ATTR_INNER_CLASSES:
-Utility.swallowInnerClasses(file);
-return null;
-case Constants.ATTR_SYNTHETIC:
-Utility.swallowSynthetic(length);
-return null;
-case Constants.ATTR_DEPRECATED:
-Utility.swallowDeprecated(length);
-return null;
-case Constants.ATTR_PMG:
-Utility.swallowPMCClass(file);
-return null;
-case Constants.ATTR_SIGNATURE:
-Utility.swallowSignature(file);
-return null;
-case Constants.ATTR_STACK_MAP:
-Utility.swallowStackMap(file);
-return null;
 case Constants.ATTR_RUNTIME_VISIBLE_ANNOTATIONS:
 return new RuntimeVisibleAnnotations(name_index, length, file,
 constant_pool);
-case Constants.ATTR_RUNTIME_INVISIBLE_ANNOTATIONS:
-Utility.swallowAnnotations(file);
-return null;
 case Constants.ATTR_RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS:
 return new RuntimeVisibleParameterAnnotations(name_index, length,
 file, constant_pool);
-case Constants.ATTR_RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS:
-Utility.swallowParameterAnnotations(file);
-return null;
 case Constants.ATTR_ANNOTATION_DEFAULT:
 return new AnnotationDefault(name_index, length, file,
 constant_pool);
-case Constants.ATTR_LOCAL_VARIABLE_TYPE_TABLE:
-Utility.swallowLocalVariableTypeTable(file);
-return null;
-case Constants.ATTR_ENCLOSING_METHOD:
-Utility.swallowEnclosingMethod(file);
-return null;
-case Constants.ATTR_STACK_MAP_TABLE:
-Utility.swallowStackMapTable(file);
-return null;
-case Constants.ATTR_BOOTSTRAP_METHODS:
-Utility.swallowBootstrapMethods(file);
-return null;
-case Constants.ATTR_METHOD_PARAMETERS:
-Utility.swallowMethodParameters(file);
+default: // All other attributes are skipped
+Utility.skipFully(file, length);
 return null;
-default: // Never reached
-throw new IllegalStateException("Unrecognized attribute type tag 
parsed: " +

svn commit: r1624541 - in /tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel: Constants.java classfile/AnnotationDefault.java classfile/ClassParser.java classfile/JavaClass.java

2014-09-12 Thread markt
Author: markt
Date: Fri Sep 12 13:21:12 2014
New Revision: 1624541

URL: http://svn.apache.org/r1624541
Log:
Clean up merge errors and align code wth trunk

Modified:
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/Constants.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/Constants.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/Constants.java?rev=1624541&r1=1624540&r2=1624541&view=diff
==
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/Constants.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/Constants.java Fri 
Sep 12 13:21:12 2014
@@ -92,7 +92,6 @@ public interface Constants {
 "CONSTANT_MethodType", "", "CONSTANT_InvokeDynamic" };
   
 
-
   /** Attributes and their corresponding names.
*/
   public static final byte ATTR_UNKNOWN = -1;

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java?rev=1624541&r1=1624540&r2=1624541&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java
 Fri Sep 12 13:21:12 2014
@@ -29,7 +29,6 @@ import java.io.IOException;
 public class AnnotationDefault extends Attribute
 {
 private static final long serialVersionUID = 6715933396664171543L;
-ElementValue default_value;
 
 /**
  * @param name_index
@@ -46,6 +45,7 @@ public class AnnotationDefault extends A
 throws IOException
 {
 super(name_index, length, constant_pool);
-default_value = ElementValue.readElementValue(file, constant_pool);
+// Default value
+ElementValue.readElementValue(file, constant_pool);
 }
 }

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java?rev=1624541&r1=1624540&r2=1624541&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
 Fri Sep 12 13:21:12 2014
@@ -19,11 +19,8 @@ package org.apache.tomcat.util.bcel.clas
 
 import java.io.BufferedInputStream;
 import java.io.DataInputStream;
-import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
 
 import org.apache.tomcat.util.bcel.Constants;
 
@@ -46,15 +43,12 @@ public final class ClassParser {
 private static final int MAGIC = 0xCAFEBABE;
 
 private DataInputStream file;
-private boolean fileOwned;
 private String file_name;
-private String zip_file;
 private int class_name_index, superclass_name_index;
 private int access_flags; // Access rights of parsed class
 private int[] interfaces; // Names of implemented interfaces
 private ConstantPool constant_pool; // collection of constants
 private Attribute[] attributes; // attributes defined in the class
-private boolean is_zip; // Loaded from zip file
 private static final int BUFSIZE = 8192;
 
 
@@ -66,9 +60,6 @@ public final class ClassParser {
  */
 public ClassParser(InputStream file, String file_name) {
 this.file_name = file_name;
-fileOwned = false;
-String clazz = file.getClass().getName(); // Not a very clean solution 
...
-is_zip = clazz.startsWith("java.util.zip.") || 
clazz.startsWith("java.util.jar.");
 if (file instanceof DataInputStream) {
 this.file = (DataInputStream) file;
 } else {
@@ -89,72 +80,40 @@ public final class ClassParser {
  * @throws  ClassFormatException
  */
 public JavaClass parse() throws IOException, ClassFormatException {
-ZipFile zip = null;
-try {
-if (fileOwned) {
-if (is_zip) {
-zip = new ZipFile(zip_file);
-ZipEntry entry = zip.getEntry(file_name);
-
-if (entry == null) {
-throw new IOException("File " + file_name + " not 
found");
-}
-
- 

svn commit: r1624542 - /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java

2014-09-12 Thread kkolinko
Author: kkolinko
Date: Fri Sep 12 13:23:42 2014
New Revision: 1624542

URL: http://svn.apache.org/r1624542
Log:
Use ClassFormatException in ElementValue.readElementValue() as this behaviour 
is driven by user-provided data,
instead of logic errors in the code (as is the case for remaining 
RuntimeExceptions in BCEL).
This review was inspired by r1624396.

Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java?rev=1624542&r1=1624541&r2=1624542&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java 
Fri Sep 12 13:23:42 2014
@@ -117,7 +117,7 @@ public abstract class ElementValue
 }
 return new ArrayElementValue(ARRAY, evalues, cpool);
 default:
-throw new RuntimeException(
+throw new ClassFormatException(
 "Unexpected element value kind in annotation: " + type);
 }
 }



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624543 - in /tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/bcel: ./ TesterPerformance.java

2014-09-12 Thread markt
Author: markt
Date: Fri Sep 12 13:24:16 2014
New Revision: 1624543

URL: http://svn.apache.org/r1624543
Log:
Add performance test

Added:
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/bcel/

tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/bcel/TesterPerformance.java   
(with props)

Added: 
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/bcel/TesterPerformance.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/bcel/TesterPerformance.java?rev=1624543&view=auto
==
--- 
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/bcel/TesterPerformance.java 
(added)
+++ 
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/bcel/TesterPerformance.java 
Fri Sep 12 13:24:16 2014
@@ -0,0 +1,72 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tomcat.util.bcel;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Set;
+
+import org.junit.Test;
+
+import org.apache.tomcat.util.bcel.classfile.ClassParser;
+import org.apache.tomcat.util.scan.Jar;
+import org.apache.tomcat.util.scan.JarFactory;
+
+public class TesterPerformance {
+
+private static final String JAR_LOCATION = "/tmp/jira-libs";
+
+@Test
+public void testClassParserPerformance() throws IOException {
+File libDir = new File(JAR_LOCATION);
+String[] libs = libDir.list();
+
+Set jarURLs = new HashSet();
+
+for (String lib : libs) {
+if (!lib.toLowerCase(Locale.ENGLISH).endsWith(".jar")) {
+continue;
+}
+jarURLs.add(new URL("jar:" + new File (libDir, 
lib).toURI().toURL().toExternalForm() + "!/"));
+}
+
+long duration = 0;
+
+for (URL jarURL : jarURLs) {
+Jar jar = JarFactory.newInstance(jarURL);
+jar.nextEntry();
+String jarEntryName = jar.getEntryName();
+while (jarEntryName != null) {
+if (jarEntryName.endsWith(".class")) {
+InputStream is = jar.getEntryInputStream();
+long start = System.nanoTime();
+ClassParser cp = new ClassParser(is, jarEntryName);
+cp.parse();
+duration += System.nanoTime() - start;
+}
+jar.nextEntry();
+jarEntryName = jar.getEntryName();
+}
+}
+
+System.out.println("ClassParser performance test took: " + duration + 
"ns");
+}
+}

Propchange: 
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/bcel/TesterPerformance.java
--
svn:eol-style = native



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 56955] Skip some useless information in the class when parsing

2014-09-12 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=56955

Mark Thomas  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #8 from Mark Thomas  ---
Numerous BCEL changes have been back-ported from trunk for the next 7.0.x
release including ones that cover this report.

The new code will be in 7.0.56 onwards.

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 56940] Cache mechanism for "ConstantUtf8.java" doesn't have any benefit

2014-09-12 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=56940

Mark Thomas  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #5 from Mark Thomas  ---
The change has been back-ported to 7.0.x and will be in 7.0.56 onwards.

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 56953] A improvement for "DataInputStream"

2014-09-12 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=56953

--- Comment #7 from Mark Thomas  ---
With the various other changes and improvements back-ported to 7.0.x, I'm
prepared to consider this idea if the benefit justifies it. That said, we need
a patch that implements this idea - and just this idea - first.

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624552 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/bcel/ java/org/apache/tomcat/util/bcel/classfile/ElementValue.java

2014-09-12 Thread kkolinko
Author: kkolinko
Date: Fri Sep 12 14:07:53 2014
New Revision: 1624552

URL: http://svn.apache.org/r1624552
Log:
Use ClassFormatException in ElementValue.readElementValue() as this behaviour 
is driven by user-provided data,
instead of logic errors in the code (as is the case for remaining 
RuntimeExceptions in BCEL).

Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/   (props changed)

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged /tomcat/trunk:r1624542

Propchange: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/
--
  Merged /tomcat/trunk/java/org/apache/tomcat/util/bcel:r1624542

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java?rev=1624552&r1=1624551&r2=1624552&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java
 Fri Sep 12 14:07:53 2014
@@ -117,7 +117,7 @@ public abstract class ElementValue
 }
 return new ArrayElementValue(ARRAY, evalues, cpool);
 default:
-throw new RuntimeException(
+throw new ClassFormatException(
 "Unexpected element value kind in annotation: " + type);
 }
 }



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



buildbot failure in ASF Buildbot on tomcat-trunk

2014-09-12 Thread buildbot
The Buildbot has detected a new failure on builder tomcat-trunk while building 
ASF Buildbot.
Full details are available at:
 http://ci.apache.org/builders/tomcat-trunk/builds/452

Buildbot URL: http://ci.apache.org/

Buildslave for this Build: bb-vm_ubuntu

Build Reason: scheduler
Build Source Stamp: [branch tomcat/trunk] 1624487
Blamelist: markt

BUILD FAILED: failed compile_1

sincerely,
 -The Buildbot




-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624563 - /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/

2014-09-12 Thread kkolinko
Author: kkolinko
Date: Fri Sep 12 14:50:19 2014
New Revision: 1624563

URL: http://svn.apache.org/r1624563
Log:
Remove serialization support and serialVersionUID fields from BCEL classes.

Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AccessFlags.java

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantDouble.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantFloat.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInteger.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantLong.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantUtf8.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleAnnotations.java

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleParameterAnnotations.java

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AccessFlags.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AccessFlags.java?rev=1624563&r1=1624562&r2=1624563&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AccessFlags.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AccessFlags.java 
Fri Sep 12 14:50:19 2014
@@ -23,12 +23,10 @@ package org.apache.tomcat.util.bcel.clas
  *
  * @author  mailto:m.d...@gmx.de";>M. Dahm
  */
-public abstract class AccessFlags implements java.io.Serializable {
+public abstract class AccessFlags {
 
-private static final long serialVersionUID = 2548932939969293935L;
 protected int access_flags;
 
-
 public AccessFlags() {
 }
 

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java?rev=1624563&r1=1624562&r2=1624563&view=diff
==
--- 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java 
(original)
+++ 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java 
Fri Sep 12 14:50:19 2014
@@ -26,9 +26,7 @@ import java.io.IOException;
  * @author mailto:dbros...@qis.net";>D. Brosius
  * @since 6.0
  */
-public class AnnotationDefault extends Attribute
-{
-private static final long serialVersionUID = 6715933396664171543L;
+public class AnnotationDefault extends Attribute {
 
 /**
  * @param name_index

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java?rev=1624563&r1=1624562&r2=1624563&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java 
Fri Sep 12 14:50:19 2014
@@ -28,8 +28,6 @@ import java.io.IOException;
  */
 public abstract class Annotations extends Attribute {
 
-private static final long serialVersionUID = 1L;
-
 private final AnnotationEntry[] annotation_table;
 
 /**

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java?rev=1624563&r1=1624562&r2=1624563&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java Fri 
Sep 12 14:50:19 2014
@@ -19,7 +19,6 @@ package org.apache.tomcat.util.bcel.clas
 
 import java.io.DataInputStream;
 import java.io.IOException;
-import java.io.Serializable;
 
 import org.apache.tomcat.util.bcel.Constants;
 
@@ -33,9 +32,7 @@ import org.apache.tomcat.util.bcel.Const
  *
  * @author mailto:m.d...@gmx.de";>M. Dahm
  */
-public abstract class Attribute implements Serializable
-{
-private static final long serialVersionUID = 1514136303496688899L;
+public abstract class Attribute {
 
 protected int name_index; // Points to a

svn commit: r1624564 - in /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile: AnnotationDefault.java Annotations.java Attribute.java ParameterAnnotations.java RuntimeVisibleAnnotations.java Runt

2014-09-12 Thread kkolinko
Author: kkolinko
Date: Fri Sep 12 15:02:00 2014
New Revision: 1624564

URL: http://svn.apache.org/r1624564
Log:
Remove unused method Attribute.getName(). It allows to remove name_index field 
as well.
Found thanks to Cobertura coverage report.

Modified:

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleAnnotations.java

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleParameterAnnotations.java

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java?rev=1624564&r1=1624563&r2=1624564&view=diff
==
--- 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java 
(original)
+++ 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java 
Fri Sep 12 15:02:00 2014
@@ -29,8 +29,6 @@ import java.io.IOException;
 public class AnnotationDefault extends Attribute {
 
 /**
- * @param name_index
- *Index pointing to the name Code
  * @param length
  *Content length in bytes
  * @param file
@@ -38,11 +36,9 @@ public class AnnotationDefault extends A
  * @param constant_pool
  *Array of constants
  */
-public AnnotationDefault(int name_index, int length,
-DataInputStream file, ConstantPool constant_pool)
-throws IOException
-{
-super(name_index, length, constant_pool);
+public AnnotationDefault(int length, DataInputStream file,
+ConstantPool constant_pool) throws IOException {
+super(length, constant_pool);
 // Default value
 ElementValue.readElementValue(file, constant_pool);
 }

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java?rev=1624564&r1=1624563&r2=1624564&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java 
Fri Sep 12 15:02:00 2014
@@ -31,14 +31,13 @@ public abstract class Annotations extend
 private final AnnotationEntry[] annotation_table;
 
 /**
- * @param name_index Index pointing to the name Code
  * @param length Content length in bytes
  * @param file Input stream
  * @param constant_pool Array of constants
  */
-public Annotations(int name_index, int length, DataInputStream file,
+public Annotations(int length, DataInputStream file,
 ConstantPool constant_pool) throws IOException {
-super(name_index, length, constant_pool);
+super(length, constant_pool);
 final int annotation_table_length = (file.readUnsignedShort());
 annotation_table = new AnnotationEntry[annotation_table_length];
 for (int i = 0; i < annotation_table_length; i++) {

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java?rev=1624564&r1=1624563&r2=1624564&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java Fri 
Sep 12 15:02:00 2014
@@ -34,16 +34,11 @@ import org.apache.tomcat.util.bcel.Const
  */
 public abstract class Attribute {
 
-protected int name_index; // Points to attribute name in constant pool
-
 protected int length; // Content length of attribute field
 
 protected ConstantPool constant_pool;
 
-protected Attribute(int name_index, int length,
-ConstantPool constant_pool)
-{
-this.name_index = name_index;
+protected Attribute(int length, ConstantPool constant_pool) {
 this.length = length;
 this.constant_pool = constant_pool;
 }
@@ -88,27 +83,15 @@ public abstract class Attribute {
 switch (tag)
 {
 case Constants.ATTR_RUNTIME_VISIBLE_ANNOTATIONS:
-return new RuntimeVisibleAnnotations(name_index, length, file,
-constant_pool);
+return new RuntimeVisibleAnnotations(length, file, constant_pool);
 case Constants.ATTR_RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS:
-

svn commit: r1624565 - in /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile: AnnotationDefault.java Annotations.java Attribute.java ParameterAnnotations.java RuntimeVisibleAnnotations.java Runt

2014-09-12 Thread kkolinko
Author: kkolinko
Date: Fri Sep 12 15:09:41 2014
New Revision: 1624565

URL: http://svn.apache.org/r1624565
Log:
Remove length and constant_pool fields from Attribute class.

Modified:

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleAnnotations.java

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleParameterAnnotations.java

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java?rev=1624565&r1=1624564&r2=1624565&view=diff
==
--- 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java 
(original)
+++ 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java 
Fri Sep 12 15:09:41 2014
@@ -29,16 +29,13 @@ import java.io.IOException;
 public class AnnotationDefault extends Attribute {
 
 /**
- * @param length
- *Content length in bytes
  * @param file
  *Input stream
  * @param constant_pool
  *Array of constants
  */
-public AnnotationDefault(int length, DataInputStream file,
-ConstantPool constant_pool) throws IOException {
-super(length, constant_pool);
+public AnnotationDefault(DataInputStream file, ConstantPool constant_pool)
+throws IOException {
 // Default value
 ElementValue.readElementValue(file, constant_pool);
 }

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java?rev=1624565&r1=1624564&r2=1624565&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java 
Fri Sep 12 15:09:41 2014
@@ -31,13 +31,11 @@ public abstract class Annotations extend
 private final AnnotationEntry[] annotation_table;
 
 /**
- * @param length Content length in bytes
  * @param file Input stream
  * @param constant_pool Array of constants
  */
-public Annotations(int length, DataInputStream file,
-ConstantPool constant_pool) throws IOException {
-super(length, constant_pool);
+public Annotations(DataInputStream file, ConstantPool constant_pool)
+throws IOException {
 final int annotation_table_length = (file.readUnsignedShort());
 annotation_table = new AnnotationEntry[annotation_table_length];
 for (int i = 0; i < annotation_table_length; i++) {

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java?rev=1624565&r1=1624564&r2=1624565&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java Fri 
Sep 12 15:09:41 2014
@@ -34,15 +34,6 @@ import org.apache.tomcat.util.bcel.Const
  */
 public abstract class Attribute {
 
-protected int length; // Content length of attribute field
-
-protected ConstantPool constant_pool;
-
-protected Attribute(int length, ConstantPool constant_pool) {
-this.length = length;
-this.constant_pool = constant_pool;
-}
-
 /*
  * Class method reads one attribute from the input data stream. This method
  * must not be accessible from the outside. It is called by the Field and
@@ -83,12 +74,11 @@ public abstract class Attribute {
 switch (tag)
 {
 case Constants.ATTR_RUNTIME_VISIBLE_ANNOTATIONS:
-return new RuntimeVisibleAnnotations(length, file, constant_pool);
+return new RuntimeVisibleAnnotations(file, constant_pool);
 case Constants.ATTR_RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS:
-return new RuntimeVisibleParameterAnnotations(length, file,
-constant_pool);
+return new RuntimeVisibleParameterAnnotations(file, constant_pool);
 case Constants.ATTR_ANNOTATION_DEFAULT:
-return new AnnotationDefault(length, file, constant_pool);
+return new AnnotationDefault(file, constant_pool);
 default: // All other attributes are skipped
 Ut

svn commit: r1624568 - /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/

2014-09-12 Thread kkolinko
Author: kkolinko
Date: Fri Sep 12 15:15:41 2014
New Revision: 1624568

URL: http://svn.apache.org/r1624568
Log:
Reduce visibility of constructors.

Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AccessFlags.java

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassElementValue.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValuePair.java

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/EnumElementValue.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleAnnotations.java

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AccessFlags.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AccessFlags.java?rev=1624568&r1=1624567&r2=1624568&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AccessFlags.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AccessFlags.java 
Fri Sep 12 15:15:41 2014
@@ -27,7 +27,7 @@ public abstract class AccessFlags {
 
 protected int access_flags;
 
-public AccessFlags() {
+AccessFlags() {
 }
 
 /**

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java?rev=1624568&r1=1624567&r2=1624568&view=diff
==
--- 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java 
(original)
+++ 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java 
Fri Sep 12 15:15:41 2014
@@ -34,7 +34,7 @@ public class AnnotationDefault extends A
  * @param constant_pool
  *Array of constants
  */
-public AnnotationDefault(DataInputStream file, ConstantPool constant_pool)
+AnnotationDefault(DataInputStream file, ConstantPool constant_pool)
 throws IOException {
 // Default value
 ElementValue.readElementValue(file, constant_pool);

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java?rev=1624568&r1=1624567&r2=1624568&view=diff
==
--- 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java
 (original)
+++ 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java
 Fri Sep 12 15:15:41 2014
@@ -22,7 +22,7 @@ public class AnnotationElementValue exte
 // For annotation element values, this is the annotation
 private AnnotationEntry annotationEntry;
 
-public AnnotationElementValue(int type, AnnotationEntry annotationEntry,
+AnnotationElementValue(int type, AnnotationEntry annotationEntry,
 ConstantPool cpool)
 {
 super(type, cpool);

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java?rev=1624568&r1=1624567&r2=1624568&view=diff
==
--- 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java 
(original)
+++ 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java 
Fri Sep 12 15:15:41 2014
@@ -57,7 +57,7 @@ public class AnnotationEntry implements 
 return annotationEntry;
 }
 
-public AnnotationEntry(int type_index, ConstantPool constant_pool) {
+AnnotationEntry(int type_index, ConstantPool constant_pool) {
 this.type_index = type_index;
 this.constant_pool = constant_pool;
 }

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java?rev=1624568&r1=1624567&r2=1624568&view=diff

svn commit: r1624569 - /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java

2014-09-12 Thread kkolinko
Author: kkolinko
Date: Fri Sep 12 15:22:40 2014
New Revision: 1624569

URL: http://svn.apache.org/r1624569
Log:
Remove unused ConstantPool.constantToString methods.
Found thanks to Cobertura coverage report.

Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java?rev=1624569&r1=1624568&r2=1624569&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java 
Fri Sep 12 15:22:40 2014
@@ -72,58 +72,6 @@ public class ConstantPool {
 
 
 /**
- * Resolve constant to a string representation.
- *
- * @param  c Constant to be printed
- * @return String representation
- */
-public String constantToString( Constant c ) throws ClassFormatException {
-String str;
-int i;
-byte tag = c.getTag();
-switch (tag) {
-case Constants.CONSTANT_Class:
-i = ((ConstantClass) c).getNameIndex();
-c = getConstant(i, Constants.CONSTANT_Utf8);
-str = Utility.compactClassName(((ConstantUtf8) c).getBytes());
-break;
-case Constants.CONSTANT_Utf8:
-str = ((ConstantUtf8) c).getBytes();
-break;
-case Constants.CONSTANT_Double:
-str = String.valueOf(((ConstantDouble) c).getBytes());
-break;
-case Constants.CONSTANT_Float:
-str = String.valueOf(((ConstantFloat) c).getBytes());
-break;
-case Constants.CONSTANT_Long:
-str = String.valueOf(((ConstantLong) c).getBytes());
-break;
-case Constants.CONSTANT_Integer:
-str = String.valueOf(((ConstantInteger) c).getBytes());
-break;
-default: // Never reached
-throw new RuntimeException("Unknown constant type " + tag);
-}
-return str;
-}
-
-
-/**
- * Retrieve constant at `index' from constant pool and resolve it to
- * a string representation.
- *
- * @param  index of constant in constant pool
- * @param  tag expected type
- * @return String representation
- */
-public String constantToString( int index, byte tag ) throws 
ClassFormatException {
-Constant c = getConstant(index, tag);
-return constantToString(c);
-}
-
-
-/**
  * Get constant from constant pool.
  *
  * @param  index Index in constant pool



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624571 - /tomcat/trunk/java/org/apache/tomcat/util/bcel/Constants.java

2014-09-12 Thread markt
Author: markt
Date: Fri Sep 12 15:25:34 2014
New Revision: 1624571

URL: http://svn.apache.org/r1624571
Log:
Remove unused constants

Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/Constants.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/Constants.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/Constants.java?rev=1624571&r1=1624570&r2=1624571&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/Constants.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/Constants.java Fri Sep 12 
15:25:34 2014
@@ -95,28 +95,9 @@ public interface Constants {
   /** Attributes and their corresponding names.
*/
   public static final byte ATTR_UNKNOWN = -1;
-  public static final byte ATTR_SOURCE_FILE = 0;
-  public static final byte ATTR_CONSTANT_VALUE  = 1;
-  public static final byte ATTR_CODE= 2;
-  public static final byte ATTR_EXCEPTIONS  = 3;
-  public static final byte ATTR_LINE_NUMBER_TABLE   = 4;
-  public static final byte ATTR_LOCAL_VARIABLE_TABLE= 5;
-  public static final byte ATTR_INNER_CLASSES   = 6;
-  public static final byte ATTR_SYNTHETIC   = 7;
-  public static final byte ATTR_DEPRECATED  = 8;
-  public static final byte ATTR_PMG = 9;
-  public static final byte ATTR_SIGNATURE   = 10;
-  public static final byte ATTR_STACK_MAP   = 11;
   public static final byte ATTR_RUNTIME_VISIBLE_ANNOTATIONS = 12;
-  public static final byte ATTR_RUNTIME_INVISIBLE_ANNOTATIONS   = 13;
   public static final byte ATTR_RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS   = 14;
-  public static final byte ATTR_RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS = 15;
   public static final byte ATTR_ANNOTATION_DEFAULT  = 16;
-  public static final byte ATTR_LOCAL_VARIABLE_TYPE_TABLE   = 17;
-  public static final byte ATTR_ENCLOSING_METHOD= 18;
-  public static final byte ATTR_STACK_MAP_TABLE = 19;
-  public static final byte ATTR_BOOTSTRAP_METHODS   = 20;
-  public static final byte ATTR_METHOD_PARAMETERS   = 21;
 
   public static final short KNOWN_ATTRIBUTES = 22;
 
@@ -131,31 +112,4 @@ public interface Constants {
 "AnnotationDefault", "LocalVariableTypeTable", "EnclosingMethod", 
"StackMapTable",
 "BootstrapMethods", "MethodParameters"
   };
-
-  /** Constants used in the StackMap attribute.
-   */
-  public static final byte ITEM_Bogus  = 0;
-  public static final byte ITEM_Object = 7;
-  public static final byte ITEM_NewObject  = 8;
-
-  /** Constants used to identify StackMapEntry types.
-   *
-   * For those types which can specify a range, the
-   * constant names the lowest value.
-   */
-  public static final int SAME_FRAME = 0;
-  public static final int SAME_LOCALS_1_STACK_ITEM_FRAME = 64;
-  public static final int SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED = 247;
-  public static final int CHOP_FRAME = 248;
-  public static final int SAME_FRAME_EXTENDED = 251;
-  public static final int APPEND_FRAME = 252;
-  public static final int FULL_FRAME = 255;
-
-  /** Constants that define the maximum value of
-   * those constants which store ranges. */
-
-  public static final int SAME_FRAME_MAX = 63;
-  public static final int SAME_LOCALS_1_STACK_ITEM_FRAME_MAX = 127;
-  public static final int CHOP_FRAME_MAX = 250;
-  public static final int APPEND_FRAME_MAX = 254;
 }



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624573 - in /tomcat/trunk/java/org/apache: catalina/startup/ContextConfig.java tomcat/util/bcel/classfile/AnnotationEntry.java

2014-09-12 Thread kkolinko
Author: kkolinko
Date: Fri Sep 12 15:41:33 2014
New Revision: 1624573

URL: http://svn.apache.org/r1624573
Log:
Implement a TODO: change return value of AnnotationEntry.getElementValuePairs() 
from an array to a list.
As all usages are known and constructor of ElementValuePair class is not 
accessible from outside (package-visible), I think it is OK to skip defensive 
copying.

Modified:
tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java

Modified: tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=1624573&r1=1624572&r2=1624573&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Fri Sep 12 
15:41:33 2014
@@ -,8 +,8 @@ public class ContextConfig implements Li
 AnnotationEntry ae, WebXml fragment) {
 String servletName = null;
 // must search for name s. Spec Servlet API 3.0 - 8.2.3.3.n.ii page 81
-ElementValuePair[] evps = ae.getElementValuePairs();
-for (ElementValuePair evp : evps) {
+List evps = ae.getElementValuePairs();
+for (ElementValuePair evp : ae.getElementValuePairs()) {
 String name = evp.getNameString();
 if ("name".equals(name)) {
 servletName = evp.getValue().stringifyValue();
@@ -2249,7 +2249,7 @@ public class ContextConfig implements Li
 boolean urlPatternsSet = false;
 String[] urlPatterns = null;
 
-// ElementValuePair[] evps = ae.getElementValuePairs();
+// List evps = ae.getElementValuePairs();
 for (ElementValuePair evp : evps) {
 String name = evp.getNameString();
 if ("value".equals(name) || "urlPatterns".equals(name)) {
@@ -2332,7 +2332,7 @@ public class ContextConfig implements Li
 AnnotationEntry ae, WebXml fragment) {
 String filterName = null;
 // must search for name s. Spec Servlet API 3.0 - 8.2.3.3.n.ii page 81
-ElementValuePair[] evps = ae.getElementValuePairs();
+List evps = ae.getElementValuePairs();
 for (ElementValuePair evp : evps) {
 String name = evp.getNameString();
 if ("filterName".equals(name)) {
@@ -2491,8 +2491,8 @@ public class ContextConfig implements Li
 ((ArrayElementValue) ev).getElementValuesArray();
 for (ElementValue value : arrayValues) {
 if (value instanceof AnnotationElementValue) {
-ElementValuePair[] evps = ((AnnotationElementValue)
-value).getAnnotationEntry().getElementValuePairs();
+List evps = ((AnnotationElementValue) 
value)
+.getAnnotationEntry().getElementValuePairs();
 String initParamName = null;
 String initParamValue = null;
 for (ElementValuePair evp : evps) {

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java?rev=1624573&r1=1624572&r2=1624573&view=diff
==
--- 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java 
(original)
+++ 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java 
Fri Sep 12 15:41:33 2014
@@ -73,8 +73,7 @@ public class AnnotationEntry implements 
 /**
  * @return the element value pairs in this annotation entry
  */
-public ElementValuePair[] getElementValuePairs() {
-// TODO return List
-return element_value_pairs.toArray(new 
ElementValuePair[element_value_pairs.size()]);
+public List getElementValuePairs() {
+return element_value_pairs;
 }
 }



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624574 - /tomcat/trunk/webapps/docs/changelog.xml

2014-09-12 Thread markt
Author: markt
Date: Fri Sep 12 15:54:27 2014
New Revision: 1624574

URL: http://svn.apache.org/r1624574
Log:
Update changelog

Modified:
tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1624574&r1=1624573&r2=1624574&view=diff
==
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Fri Sep 12 15:54:27 2014
@@ -137,6 +137,12 @@
 deployXML is false. If  XML file is created in the config
 base, redeploy will occur. (kfujino)
   
+  
+Various changes to reduce unnecessary code in Tomcat's copy of
+Apache Commons BCEL to reduce the time taken for annotation scanning
+when web applications start. Includes contributions from kkolinko and
+hzhang9. (markt)
+  
 
   
   



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624576 - /tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

2014-09-12 Thread markt
Author: markt
Date: Fri Sep 12 15:54:59 2014
New Revision: 1624576

URL: http://svn.apache.org/r1624576
Log:
Update changelog

Modified:
tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1624576&r1=1624575&r2=1624576&view=diff
==
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Fri Sep 12 15:54:59 2014
@@ -157,6 +157,12 @@
 deployXML is false. If  XML file is created in the config
 base, redeploy will occur. (kfujino)
   
+  
+Various changes to reduce unnecessary code in Tomcat's copy of
+Apache Commons BCEL to reduce the time taken for annotation scanning
+when web applications start. Includes contributions from kkolinko and
+hzhang9. (markt)
+  
 
   
   



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624580 - in /tomcat/trunk: java/org/apache/catalina/startup/HostConfig.java webapps/docs/changelog.xml

2014-09-12 Thread markt
Author: markt
Date: Fri Sep 12 16:08:27 2014
New Revision: 1624580

URL: http://svn.apache.org/r1624580
Log:
Ensure web applications that have mixed case context paths and are deployed as 
directories are correctly removed on undeploy when running on a case sensitive 
file system.

Modified:
tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java
tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java?rev=1624580&r1=1624579&r2=1624580&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/HostConfig.java Fri Sep 12 
16:08:27 2014
@@ -1223,8 +1223,7 @@ public class HostConfig
 // expanded WAR (if any)
 Context context = (Context) host.findChild(app.name);
 String docBase = context.getDocBase();
-docBase = docBase.toLowerCase(Locale.ENGLISH);
-if (!docBase.endsWith(".war")) {
+if 
(!docBase.toLowerCase(Locale.ENGLISH).endsWith(".war")) {
 // This is an expanded directory
 File docBaseFile = new File(docBase);
 if (!docBaseFile.isAbsolute()) {

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1624580&r1=1624579&r2=1624580&view=diff
==
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Fri Sep 12 16:08:27 2014
@@ -143,6 +143,11 @@
 when web applications start. Includes contributions from kkolinko and
 hzhang9. (markt)
   
+  
+56938: Ensure web applications that have mixed case context
+paths and are deployed as directories are correctly removed on undeploy
+when running on a case sensitive file system. (markt)
+  
 
   
   



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624581 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/catalina/startup/HostConfig.java webapps/docs/changelog.xml

2014-09-12 Thread markt
Author: markt
Date: Fri Sep 12 16:10:12 2014
New Revision: 1624581

URL: http://svn.apache.org/r1624581
Log:
Ensure web applications that have mixed case context paths and are deployed as 
directories are correctly removed on undeploy when running on a case sensitive 
file system.

Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/HostConfig.java
tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged /tomcat/trunk:r1624580

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/HostConfig.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/HostConfig.java?rev=1624581&r1=1624580&r2=1624581&view=diff
==
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/HostConfig.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/HostConfig.java Fri 
Sep 12 16:10:12 2014
@@ -1399,8 +1399,7 @@ public class HostConfig
 // expanded WAR (if any)
 Context context = (Context) host.findChild(app.name);
 String docBase = context.getDocBase();
-docBase = docBase.toLowerCase(Locale.ENGLISH);
-if (!docBase.endsWith(".war")) {
+if 
(!docBase.toLowerCase(Locale.ENGLISH).endsWith(".war")) {
 // This is an expanded directory
 File docBaseFile = new File(docBase);
 if (!docBaseFile.isAbsolute()) {

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1624581&r1=1624580&r2=1624581&view=diff
==
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Fri Sep 12 16:10:12 2014
@@ -163,6 +163,11 @@
 when web applications start. Includes contributions from kkolinko and
 hzhang9. (markt)
   
+  
+56938: Ensure web applications that have mixed case context
+paths and are deployed as directories are correctly removed on undeploy
+when running on a case sensitive file system. (markt)
+  
 
   
   



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 56938] Applications with uppercase context paths cannot be updated

2014-09-12 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=56938

Mark Thomas  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #1 from Mark Thomas  ---
Fixed in 8.0.x for 8.0.13 onwards and in 7.0.x for 7.0.56 onwards.

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 56952] Move JasperInitializer into separate jar

2014-09-12 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=56952

--- Comment #1 from Mark Thomas  ---
I'm not overly keen on adding an additional JAR to the distrbution to address
this.

Does Jetty not have a configuration option to skip the processing of selected
container provided SCIs? Alternatively could Jetty not just hard code an
explicit exclude for this SCI?

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624583 - in /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile: AnnotationDefault.java Attribute.java

2014-09-12 Thread kkolinko
Author: kkolinko
Date: Fri Sep 12 16:16:15 2014
New Revision: 1624583

URL: http://svn.apache.org/r1624583
Log:
Drop AnnotationDefault attribute as unused.

Evidences:
1) Its constructor just swallowed an ElementValue without keeping it.
As such, this class has no getter methods and thus provides no value.

2) AnnotationDefault attribute is used to declare default value for an element 
(aka method) of an annotation.
As Tomcat is not interested in Annotation declarations, this attribute is of no 
interest.
Essentially, it scans for known annotations on classes. It is not interested in 
arbitrary other annotations.

Cobertura coverage report also showed no calls into AnnotationDefault class.

Removed:

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java
Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java?rev=1624583&r1=1624582&r2=1624583&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java Fri 
Sep 12 16:16:15 2014
@@ -80,8 +80,6 @@ public abstract class Attribute {
 return new RuntimeVisibleAnnotations(file, constant_pool);
 case Constants.ATTR_RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS:
 return new RuntimeVisibleParameterAnnotations(file, constant_pool);
-case Constants.ATTR_ANNOTATION_DEFAULT:
-return new AnnotationDefault(file, constant_pool);
 default: // All other attributes are skipped
 Utility.skipFully(file, length);
 return null;



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624586 - in /tomcat/trunk/java/org/apache/tomcat/util/bcel: Constants.java classfile/Attribute.java

2014-09-12 Thread kkolinko
Author: kkolinko
Date: Fri Sep 12 16:26:44 2014
New Revision: 1624586

URL: http://svn.apache.org/r1624586
Log:
Simplify.
There is no real need to convert every attribute name into numeric tag via 
lookup table, when there are only two attribute names that we recognize.

In the old code there was an average of (ATTRIBUTE_NAMES.length/2) = 11 
String.equals() calls when looking up a numeric 'tag'.
In the new code there will be two String.equals() calls.

Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/Constants.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/Constants.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/Constants.java?rev=1624586&r1=1624585&r2=1624586&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/Constants.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/Constants.java Fri Sep 12 
16:26:44 2014
@@ -91,25 +91,4 @@ public interface Constants {
 "CONSTANT_NameAndType", "", "", "CONSTANT_MethodHandle",
 "CONSTANT_MethodType", "", "CONSTANT_InvokeDynamic" };
 
-
-  /** Attributes and their corresponding names.
-   */
-  public static final byte ATTR_UNKNOWN = -1;
-  public static final byte ATTR_RUNTIME_VISIBLE_ANNOTATIONS = 12;
-  public static final byte ATTR_RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS   = 14;
-  public static final byte ATTR_ANNOTATION_DEFAULT  = 16;
-
-  public static final short KNOWN_ATTRIBUTES = 22;
-
-  // TOFO: FIX
-  public static final String[] ATTRIBUTE_NAMES = {
-"SourceFile", "ConstantValue", "Code", "Exceptions",
-"LineNumberTable", "LocalVariableTable",
-"InnerClasses", "Synthetic", "Deprecated",
-"PMGClass", "Signature", "StackMap",
-"RuntimeVisibleAnnotations", "RuntimeInvisibleAnnotations",
-"RuntimeVisibleParameterAnnotations", 
"RuntimeInvisibleParameterAnnotations",
-"AnnotationDefault", "LocalVariableTypeTable", "EnclosingMethod", 
"StackMapTable",
-"BootstrapMethods", "MethodParameters"
-  };
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java?rev=1624586&r1=1624585&r2=1624586&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java Fri 
Sep 12 16:26:44 2014
@@ -55,7 +55,6 @@ public abstract class Attribute {
 String name;
 int name_index;
 int length;
-byte tag = Constants.ATTR_UNKNOWN; // Unknown attribute
 // Get class name from constant pool via `name_index' indirection
 name_index = file.readUnsignedShort();
 c = (ConstantUtf8) constant_pool.getConstant(name_index,
@@ -63,24 +62,14 @@ public abstract class Attribute {
 name = c.getBytes();
 // Length of data in bytes
 length = file.readInt();
-// Compare strings to find known attribute
-// System.out.println(name);
-for (byte i = 0; i < Constants.KNOWN_ATTRIBUTES; i++)
-{
-if (name.equals(Constants.ATTRIBUTE_NAMES[i]))
-{
-tag = i; // found!
-break;
-}
-}
-// Call proper constructor, depending on `tag'
-switch (tag)
-{
-case Constants.ATTR_RUNTIME_VISIBLE_ANNOTATIONS:
+
+// Call proper constructor, depending on `name'
+if (name.equals("RuntimeVisibleAnnotations")) {
 return new RuntimeVisibleAnnotations(file, constant_pool);
-case Constants.ATTR_RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS:
+} else if (name.equals("RuntimeVisibleParameterAnnotations")) {
 return new RuntimeVisibleParameterAnnotations(file, constant_pool);
-default: // All other attributes are skipped
+} else {
+// All other attributes are skipped
 Utility.skipFully(file, length);
 return null;
 }



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624588 - /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java

2014-09-12 Thread kkolinko
Author: kkolinko
Date: Fri Sep 12 16:37:48 2014
New Revision: 1624588

URL: http://svn.apache.org/r1624588
Log:
Remove constant_pool_count field.
The field is never read, and its value is known from the length of 
constant_pool array created in constructor.

Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java?rev=1624588&r1=1624587&r2=1624588&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java 
Fri Sep 12 16:37:48 2014
@@ -35,8 +35,7 @@ import org.apache.tomcat.util.bcel.Const
  */
 public class ConstantPool {
 
-private int constant_pool_count;
-private Constant[] constant_pool;
+private final Constant[] constant_pool;
 
 
 /**
@@ -47,7 +46,7 @@ public class ConstantPool {
  * @throws ClassFormatException
  */
 ConstantPool(DataInputStream file) throws IOException, 
ClassFormatException {
-constant_pool_count = file.readUnsignedShort();
+int constant_pool_count = file.readUnsignedShort();
 constant_pool = new Constant[constant_pool_count];
 /* constant_pool[0] is unused by the compiler and may be used freely
  * by the implementation.



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624592 - /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/

2014-09-12 Thread kkolinko
Author: kkolinko
Date: Fri Sep 12 16:57:06 2014
New Revision: 1624592

URL: http://svn.apache.org/r1624592
Log:
Add 'final' modifiers to fields.
Remove several num_xxx fields that accompanied an xxx array.

Modified:

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassElementValue.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantDouble.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantFloat.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInteger.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantLong.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValuePair.java

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/EnumElementValue.java

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotationEntry.java

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java?rev=1624592&r1=1624591&r2=1624592&view=diff
==
--- 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java
 (original)
+++ 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java
 Fri Sep 12 16:57:06 2014
@@ -20,7 +20,7 @@ package org.apache.tomcat.util.bcel.clas
 public class AnnotationElementValue extends ElementValue
 {
 // For annotation element values, this is the annotation
-private AnnotationEntry annotationEntry;
+private final AnnotationEntry annotationEntry;
 
 AnnotationElementValue(int type, AnnotationEntry annotationEntry,
 ConstantPool cpool)

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java?rev=1624592&r1=1624591&r2=1624592&view=diff
==
--- 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java 
(original)
+++ 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java 
Fri Sep 12 16:57:06 2014
@@ -35,6 +35,7 @@ public class AnnotationEntry implements 
 private final int type_index;
 private final ConstantPool constant_pool;
 
+// FIXME: add 'final'
 private List element_value_pairs;
 
 /**

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java?rev=1624592&r1=1624591&r2=1624592&view=diff
==
--- 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java 
(original)
+++ 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java 
Fri Sep 12 16:57:06 2014
@@ -20,7 +20,7 @@ package org.apache.tomcat.util.bcel.clas
 public class ArrayElementValue extends ElementValue
 {
 // For array types, this is the array
-private ElementValue[] evalues;
+private final ElementValue[] evalues;
 
 ArrayElementValue(int type, ElementValue[] datums, ConstantPool cpool)
 {

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassElementValue.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassElementValue.java?rev=1624592&r1=1624591&r2=1624592&view=diff
==
--- 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassElementValue.java 
(original)
+++ 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassElementValue.java 
Fri Sep 12 16:57:06 2014
@@ -24,7 +24,7 @@ public class ClassElementValue extends E
 // For primitive types and string type, this points to the value entry in
 // the cpool
 // For 'class' this points to the class entry in the cpool
-private int idx;
+private final int idx;
 
 ClassElementValue(int type, int idx

Re: svn commit: r1624592 - /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/

2014-09-12 Thread Mark Thomas
On 12/09/2014 17:57, kkoli...@apache.org wrote:
> Author: kkolinko
> Date: Fri Sep 12 16:57:06 2014
> New Revision: 1624592
> 
> URL: http://svn.apache.org/r1624592
> Log:
> Add 'final' modifiers to fields.

No objection, just some commentary.

I've avoided this sort of change in the past to keep the code closer to
the original BCEL code to aid keeping the code in sync. I think there
might be some value in this still but the Tomcat code is getting quite a
long way from the BCEL code that manual merges rather than svn merges
may be simpler.

Mark


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: svn commit: r1624592 - /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/

2014-09-12 Thread Konstantin Kolinko
2014-09-12 21:06 GMT+04:00 Mark Thomas :
> On 12/09/2014 17:57, kkoli...@apache.org wrote:
>> Author: kkolinko
>> Date: Fri Sep 12 16:57:06 2014
>> New Revision: 1624592
>>
>> URL: http://svn.apache.org/r1624592
>> Log:
>> Add 'final' modifiers to fields.
>
> No objection, just some commentary.
>
> I've avoided this sort of change in the past to keep the code closer to
> the original BCEL code to aid keeping the code in sync. I think there
> might be some value in this still but the Tomcat code is getting quite a
> long way from the BCEL code that manual merges rather than svn merges
> may be simpler.

Ack.

With 90% of BCEL code gone, I think we are up to manual merges anyway.


Best regards,
Konstantin Kolinko

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624594 - in /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile: AnnotationEntry.java Annotations.java ElementValue.java ElementValuePair.java ParameterAnnotationEntry.java

2014-09-12 Thread kkolinko
Author: kkolinko
Date: Fri Sep 12 17:15:31 2014
New Revision: 1624594

URL: http://svn.apache.org/r1624594
Log:
Move stream reading logic into AnnotationEntry and ElementValue constructors.

Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValuePair.java

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotationEntry.java

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java?rev=1624594&r1=1624593&r2=1624594&view=diff
==
--- 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java 
(original)
+++ 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java 
Fri Sep 12 17:15:31 2014
@@ -35,32 +35,26 @@ public class AnnotationEntry implements 
 private final int type_index;
 private final ConstantPool constant_pool;
 
-// FIXME: add 'final'
-private List element_value_pairs;
+private final List element_value_pairs;
 
 /**
- * Factory method to create an AnnotionEntry from a DataInputStream
+ * Creates an AnnotationEntry from a DataInputStream
  *
  * @param file
  * @param constant_pool
- * @return the entry
  * @throws IOException
  */
-public static AnnotationEntry read(DataInputStream file, ConstantPool 
constant_pool) throws IOException {
+AnnotationEntry(DataInputStream file, ConstantPool constant_pool) throws 
IOException {
 
-final AnnotationEntry annotationEntry = new 
AnnotationEntry(file.readUnsignedShort(), constant_pool);
-final int num_element_value_pairs = (file.readUnsignedShort());
-annotationEntry.element_value_pairs = new ArrayList<>();
+this.constant_pool = constant_pool;
+
+type_index = file.readUnsignedShort();
+int num_element_value_pairs = file.readUnsignedShort();
+
+element_value_pairs = new ArrayList<>(num_element_value_pairs);
 for (int i = 0; i < num_element_value_pairs; i++) {
-annotationEntry.element_value_pairs.add(new 
ElementValuePair(file.readUnsignedShort(), ElementValue.readElementValue(file, 
constant_pool),
-constant_pool));
+element_value_pairs.add(new ElementValuePair(file, constant_pool));
 }
-return annotationEntry;
-}
-
-AnnotationEntry(int type_index, ConstantPool constant_pool) {
-this.type_index = type_index;
-this.constant_pool = constant_pool;
 }
 
 /**

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java?rev=1624594&r1=1624593&r2=1624594&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java 
Fri Sep 12 17:15:31 2014
@@ -39,7 +39,7 @@ public abstract class Annotations extend
 final int annotation_table_length = (file.readUnsignedShort());
 annotation_table = new AnnotationEntry[annotation_table_length];
 for (int i = 0; i < annotation_table_length; i++) {
-annotation_table[i] = AnnotationEntry.read(file, constant_pool);
+annotation_table[i] = new AnnotationEntry(file, constant_pool);
 }
 }
 

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java?rev=1624594&r1=1624593&r2=1624594&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java 
Fri Sep 12 17:15:31 2014
@@ -105,7 +105,7 @@ public abstract class ElementValue
 return new ClassElementValue(CLASS, dis.readUnsignedShort(), 
cpool);
 case '@': // Annotation
 // TODO isRuntimeVisible
-return new AnnotationElementValue(ANNOTATION, AnnotationEntry.read(
+return new AnnotationElementValue(ANNOTATION, new AnnotationEntry(
 dis, cpool), cpool);
 case '[': // Array
 int numArrayVals = dis.readUnsignedShort();

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValuePair.java
URL: 
http://svn.apache.org/viewvc/tomcat/trun

Remove RuntimeVisibleParameterAnnotations from BCEL code

2014-09-12 Thread Konstantin Kolinko
Hi!

Looking at ParameterAnnotationEntry class, its "annotation_table"
field is never read.

As such, that class provides no information
and the following 3 classes can be removed:
* ParameterAnnotationEntry
* ParameterAnnotations
* RuntimeVisibleParameterAnnotations

>From documentation, "RuntimeVisibleParameterAnnotations" record
"run-time-visible Java programming language annotations on the
parameters of the corresponding method."

It is a bit odd, that Tomcat never reads those, but I guess that
specifications do not require us to look for such annotations, or we
look for them using different APIs. I think WebSocket has some code.

Am I missing anything, or is it OK to remove those classes?

After this removal the Attribute.readAttribute() method will boil down
to reading just "RuntimeVisibleAnnotations" (out of original list of
~22 attributes).


Best regards,
Konstantin Kolinko

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: Remove RuntimeVisibleParameterAnnotations from BCEL code

2014-09-12 Thread Mark Thomas
On 12/09/2014 18:26, Konstantin Kolinko wrote:
> Hi!
> 
> Looking at ParameterAnnotationEntry class, its "annotation_table"
> field is never read.
> 
> As such, that class provides no information
> and the following 3 classes can be removed:
> * ParameterAnnotationEntry
> * ParameterAnnotations
> * RuntimeVisibleParameterAnnotations
> 
> From documentation, "RuntimeVisibleParameterAnnotations" record
> "run-time-visible Java programming language annotations on the
> parameters of the corresponding method."
> 
> It is a bit odd, that Tomcat never reads those, but I guess that
> specifications do not require us to look for such annotations, or we
> look for them using different APIs. I think WebSocket has some code.

We use the reflection API once the class is loaded.

> Am I missing anything, or is it OK to remove those classes?

Looks good to me.

> After this removal the Attribute.readAttribute() method will boil down
> to reading just "RuntimeVisibleAnnotations" (out of original list of
> ~22 attributes).

:)

Mark


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624598 - in /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile: Attribute.java ParameterAnnotationEntry.java ParameterAnnotations.java RuntimeVisibleParameterAnnotations.java

2014-09-12 Thread kkolinko
Author: kkolinko
Date: Fri Sep 12 17:50:20 2014
New Revision: 1624598

URL: http://svn.apache.org/r1624598
Log:
Remove RuntimeVisibleParameterAnnotations and its supporting classes.
The fields in these classes have no getters (especially 
ParameterAnnotationEntry.annotation_table).
As such, information stored in those classes was never read by Tomcat.

Removed:

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotationEntry.java

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleParameterAnnotations.java
Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java?rev=1624598&r1=1624597&r2=1624598&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java Fri 
Sep 12 17:50:20 2014
@@ -66,8 +66,6 @@ public abstract class Attribute {
 // Call proper constructor, depending on `name'
 if (name.equals("RuntimeVisibleAnnotations")) {
 return new RuntimeVisibleAnnotations(file, constant_pool);
-} else if (name.equals("RuntimeVisibleParameterAnnotations")) {
-return new RuntimeVisibleParameterAnnotations(file, constant_pool);
 } else {
 // All other attributes are skipped
 Utility.skipFully(file, length);



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624605 - in /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile: Annotations.java Attribute.java RuntimeVisibleAnnotations.java

2014-09-12 Thread kkolinko
Author: kkolinko
Date: Fri Sep 12 18:38:03 2014
New Revision: 1624605

URL: http://svn.apache.org/r1624605
Log:
Flatten class hierarchy.  The only subtype of Annotations class is 
RuntimeVisibleAnnotations.

Removed:

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleAnnotations.java
Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java?rev=1624605&r1=1624604&r2=1624605&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java 
Fri Sep 12 18:38:03 2014
@@ -26,7 +26,7 @@ import java.io.IOException;
  * @author  mailto:dbros...@qis.net";>D. Brosius
  * @since 6.0
  */
-public abstract class Annotations extends Attribute {
+public class Annotations extends Attribute {
 
 private final AnnotationEntry[] annotation_table;
 

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java?rev=1624605&r1=1624604&r2=1624605&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java Fri 
Sep 12 18:38:03 2014
@@ -65,7 +65,7 @@ public abstract class Attribute {
 
 // Call proper constructor, depending on `name'
 if (name.equals("RuntimeVisibleAnnotations")) {
-return new RuntimeVisibleAnnotations(file, constant_pool);
+return new Annotations(file, constant_pool);
 } else {
 // All other attributes are skipped
 Utility.skipFully(file, length);



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624614 - in /tomcat/trunk/java/org/apache: catalina/startup/ tomcat/util/bcel/classfile/

2014-09-12 Thread kkolinko
Author: kkolinko
Date: Fri Sep 12 18:57:28 2014
New Revision: 1624614

URL: http://svn.apache.org/r1624614
Log:
Get rid of ArrayList arithmetics in JavaClass.getAnnotationEntries()
Note that this changes return value of getAnnotationEntries() to be null 
instead of zero-length array by default.

This is based on the following:
- All annotation entries come from a "RuntimeVisibleAnnotations" attribute on a 
class file
- According to JVM specification, ch.4.7.16
"Each ClassFile, field_info, and method_info structure may contain at most one 
RuntimeVisibleAnnotations attribute"

Thus there is no need to create an array of attributes and enumerate all those, 
as there is either zero or one such attribute.

Removed:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java
Modified:
tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java

Modified: tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=1624614&r1=1624613&r2=1624614&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Fri Sep 12 
18:57:28 2014
@@ -1993,17 +1993,18 @@ public class ContextConfig implements Li
 String className = clazz.getClassName();
 
 AnnotationEntry[] annotationsEntries = clazz.getAnnotationEntries();
-
-for (AnnotationEntry ae : annotationsEntries) {
-String type = ae.getAnnotationType();
-if ("Ljavax/servlet/annotation/WebServlet;".equals(type)) {
-processAnnotationWebServlet(className, ae, fragment);
-}else if ("Ljavax/servlet/annotation/WebFilter;".equals(type)) {
-processAnnotationWebFilter(className, ae, fragment);
-}else if ("Ljavax/servlet/annotation/WebListener;".equals(type)) {
-fragment.addListener(className);
-} else {
-// Unknown annotation - ignore
+if (annotationsEntries != null) {
+for (AnnotationEntry ae : annotationsEntries) {
+String type = ae.getAnnotationType();
+if ("Ljavax/servlet/annotation/WebServlet;".equals(type)) {
+processAnnotationWebServlet(className, ae, fragment);
+}else if ("Ljavax/servlet/annotation/WebFilter;".equals(type)) 
{
+processAnnotationWebFilter(className, ae, fragment);
+}else if 
("Ljavax/servlet/annotation/WebListener;".equals(type)) {
+fragment.addListener(className);
+} else {
+// Unknown annotation - ignore
+}
 }
 }
 }
@@ -2068,24 +2069,25 @@ public class ContextConfig implements Li
 for (Map.Entry, Set> entry :
 typeInitializerMap.entrySet()) {
 if (entry.getKey().isAnnotation()) {
-AnnotationEntry[] annotationEntries =
-javaClass.getAnnotationEntries();
-for (AnnotationEntry annotationEntry : annotationEntries) {
-if (entry.getKey().getName().equals(
-
getClassName(annotationEntry.getAnnotationType( {
-if (clazz == null) {
-clazz = Introspection.loadClass(
-context, className);
+AnnotationEntry[] annotationEntries = 
javaClass.getAnnotationEntries();
+if (annotationEntries != null) {
+for (AnnotationEntry annotationEntry : 
annotationEntries) {
+if (entry.getKey().getName().equals(
+
getClassName(annotationEntry.getAnnotationType( {
 if (clazz == null) {
-// Can't load the class so no point
-// continuing
-return;
+clazz = Introspection.loadClass(
+context, className);
+if (clazz == null) {
+// Can't load the class so no point
+// continuing
+return;
+}
 }
+for (ServletContainerInitializer sci : 
entr

svn commit: r1624618 - /tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java

2014-09-12 Thread kkolinko
Author: kkolinko
Date: Fri Sep 12 19:18:22 2014
New Revision: 1624618

URL: http://svn.apache.org/r1624618
Log:
Performance improvement: skip processing early when there are no annotations on 
the class.

Modified:
tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java

Modified: tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=1624618&r1=1624617&r2=1624618&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Fri Sep 12 
19:18:22 2014
@@ -1990,10 +1990,9 @@ public class ContextConfig implements Li
 return;
 }
 
-String className = clazz.getClassName();
-
 AnnotationEntry[] annotationsEntries = clazz.getAnnotationEntries();
 if (annotationsEntries != null) {
+String className = clazz.getClassName();
 for (AnnotationEntry ae : annotationsEntries) {
 String type = ae.getAnnotationType();
 if ("Ljavax/servlet/annotation/WebServlet;".equals(type)) {
@@ -2066,13 +2065,14 @@ public class ContextConfig implements Li
 }
 
 if (handlesTypesAnnotations) {
-for (Map.Entry, Set> entry :
-typeInitializerMap.entrySet()) {
-if (entry.getKey().isAnnotation()) {
-AnnotationEntry[] annotationEntries = 
javaClass.getAnnotationEntries();
-if (annotationEntries != null) {
+AnnotationEntry[] annotationEntries = 
javaClass.getAnnotationEntries();
+if (annotationEntries != null) {
+for (Map.Entry, Set> 
entry :
+typeInitializerMap.entrySet()) {
+if (entry.getKey().isAnnotation()) {
+String entryClassName = entry.getKey().getName();
 for (AnnotationEntry annotationEntry : 
annotationEntries) {
-if (entry.getKey().getName().equals(
+if (entryClassName.equals(
 
getClassName(annotationEntry.getAnnotationType( {
 if (clazz == null) {
 clazz = Introspection.loadClass(



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 56871] Apparent corruption of Servlet InputStreams

2014-09-12 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=56871

--- Comment #1 from Mark Thomas  ---
I'm starting to look at this now. How reliably does this script reproduce the
issue. To put it another way, how long / how many requests before you start
seeing errors?

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 56871] Apparent corruption of Servlet InputStreams

2014-09-12 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=56871

--- Comment #2 from Ciaran  ---
On my system the test exercised (and continues to) the fault reliably within a
couple of minutes.  However I've since been unable to replicate the failure on
clean virtual machines.

I'm happy to chalk it up to some local machine config issue (drivers perhaps)
if you are!

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



buildbot success in ASF Buildbot on tomcat-trunk

2014-09-12 Thread buildbot
The Buildbot has detected a restored build on builder tomcat-trunk while 
building ASF Buildbot.
Full details are available at:
 http://ci.apache.org/builders/tomcat-trunk/builds/454

Buildbot URL: http://ci.apache.org/

Buildslave for this Build: bb-vm_ubuntu

Build Reason: scheduler
Build Source Stamp: [branch tomcat/trunk] 1624594
Blamelist: kkolinko,markt

Build succeeded!

sincerely,
 -The Buildbot




-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624636 - in /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile: ClassParser.java JavaClass.java

2014-09-12 Thread kkolinko
Author: kkolinko
Date: Fri Sep 12 20:29:08 2014
New Revision: 1624636

URL: http://svn.apache.org/r1624636
Log:
Do not create an empty arrays when Class has no interfaces.
Skip creation of int[] indexes array and share the same empty String[] names 
array.

Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java?rev=1624636&r1=1624635&r2=1624636&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java 
Fri Sep 12 20:29:08 2014
@@ -209,9 +209,11 @@ public final class ClassParser {
 private void readInterfaces() throws IOException, ClassFormatException {
 int interfaces_count;
 interfaces_count = file.readUnsignedShort();
-interfaces = new int[interfaces_count];
-for (int i = 0; i < interfaces_count; i++) {
-interfaces[i] = file.readUnsignedShort();
+if (interfaces_count > 0) {
+interfaces = new int[interfaces_count];
+for (int i = 0; i < interfaces_count; i++) {
+interfaces[i] = file.readUnsignedShort();
+}
 }
 }
 

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java?rev=1624636&r1=1624635&r2=1624636&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java Fri 
Sep 12 20:29:08 2014
@@ -36,6 +36,7 @@ public class JavaClass extends AccessFla
 private String[] interface_names;
 private Annotations runtimeVisibleAnnotations; // 
"RuntimeVisibleAnnotations" attribute defined in the class
 
+private static final String[] INTERFACES_EMPTY_ARRAY = new String[0];
 
 /**
  * Constructor gets all contents as arguments.
@@ -52,9 +53,6 @@ public class JavaClass extends AccessFla
 JavaClass(int class_name_index, int superclass_name_index,
 int access_flags, ConstantPool constant_pool, int[] interfaces,
 Annotations runtimeVisibleAnnotations) {
-if (interfaces == null) {
-interfaces = new int[0];
-}
 this.access_flags = access_flags;
 this.runtimeVisibleAnnotations = runtimeVisibleAnnotations;
 
@@ -72,10 +70,15 @@ public class JavaClass extends AccessFla
 } else {
 superclass_name = "java.lang.Object";
 }
-interface_names = new String[interfaces.length];
-for (int i = 0; i < interfaces.length; i++) {
-String str = constant_pool.getConstantString(interfaces[i], 
Constants.CONSTANT_Class);
-interface_names[i] = Utility.compactClassName(str);
+
+if (interfaces == null) {
+interface_names = INTERFACES_EMPTY_ARRAY;
+} else {
+interface_names = new String[interfaces.length];
+for (int i = 0; i < interfaces.length; i++) {
+String str = constant_pool.getConstantString(interfaces[i], 
Constants.CONSTANT_Class);
+interface_names[i] = Utility.compactClassName(str);
+}
 }
 }
 



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624642 - in /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile: ClassParser.java JavaClass.java Utility.java

2014-09-12 Thread kkolinko
Author: kkolinko
Date: Fri Sep 12 20:50:17 2014
New Revision: 1624642

URL: http://svn.apache.org/r1624642
Log:
Move int -> String mapping for class and interface names from JavaClass to 
ClassParser.
This avoids an intermediary int[] array.
Move commons classname lookup and compact code into a helper method.

Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java?rev=1624642&r1=1624641&r2=1624642&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java 
Fri Sep 12 20:50:17 2014
@@ -44,13 +44,14 @@ public final class ClassParser {
 
 private final DataInputStream file;
 private final String file_name;
-private int class_name_index, superclass_name_index;
+private String class_name, superclass_name;
 private int access_flags; // Access rights of parsed class
-private int[] interfaces; // Names of implemented interfaces
+private String[] interface_names; // Names of implemented interfaces
 private ConstantPool constant_pool; // collection of constants
 private Annotations runtimeVisibleAnnotations; // 
"RuntimeVisibleAnnotations" attribute defined in the class
 private static final int BUFSIZE = 8192;
 
+private static final String[] INTERFACES_EMPTY_ARRAY = new String[0];
 
 /**
  * Parse class from the given stream.
@@ -101,8 +102,8 @@ public final class ClassParser {
 readAttributes();
 
 // Return the information we have gathered in a new object
-return new JavaClass(class_name_index, superclass_name_index,
-access_flags, constant_pool, interfaces,
+return new JavaClass(class_name, superclass_name,
+access_flags, constant_pool, interface_names,
 runtimeVisibleAnnotations);
 }
 
@@ -159,8 +160,17 @@ public final class ClassParser {
 && ((access_flags & Constants.ACC_FINAL) != 0)) {
 throw new ClassFormatException("Class " + file_name + " can't be 
both final and abstract");
 }
-class_name_index = file.readUnsignedShort();
-superclass_name_index = file.readUnsignedShort();
+
+int class_name_index = file.readUnsignedShort();
+class_name = Utility.getClassName(constant_pool, class_name_index);
+
+int superclass_name_index = file.readUnsignedShort();
+if (superclass_name_index > 0) {
+// May be zero -> class is java.lang.Object
+superclass_name = Utility.getClassName(constant_pool, 
superclass_name_index);
+} else {
+superclass_name = "java.lang.Object";
+}
 }
 
 
@@ -210,10 +220,13 @@ public final class ClassParser {
 int interfaces_count;
 interfaces_count = file.readUnsignedShort();
 if (interfaces_count > 0) {
-interfaces = new int[interfaces_count];
+interface_names = new String[interfaces_count];
 for (int i = 0; i < interfaces_count; i++) {
-interfaces[i] = file.readUnsignedShort();
+int index = file.readUnsignedShort();
+interface_names[i] = Utility.getClassName(constant_pool, 
index);
 }
+} else {
+interface_names = INTERFACES_EMPTY_ARRAY;
 }
 }
 

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java?rev=1624642&r1=1624641&r2=1624642&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java Fri 
Sep 12 20:50:17 2014
@@ -17,8 +17,6 @@
  */
 package org.apache.tomcat.util.bcel.classfile;
 
-import org.apache.tomcat.util.bcel.Constants;
-
 /**
  * Represents a Java class, i.e., the data structures, constant pool,
  * fields, methods and commands contained in a Java .class file.
@@ -36,50 +34,24 @@ public class JavaClass extends AccessFla
 private String[] interface_names;
 private Annotations runtimeVisibleAnnotations; // 
"RuntimeVisibleAnnotations" attribute defined in the class
 
-private static final String[] INTERFACES_EMPTY_ARRAY = new String[0];
-
 /**
  * Constructor gets all contents as arguments.
  *
- * @param class_name_index Index into constant pool referencing a

svn commit: r1624645 - in /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile: ConstantPool.java Utility.java

2014-09-12 Thread kkolinko
Author: kkolinko
Date: Fri Sep 12 20:54:57 2014
New Revision: 1624645

URL: http://svn.apache.org/r1624645
Log:
Inline ConstantPool.getConstantString() method.

Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java?rev=1624645&r1=1624644&r2=1624645&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java 
Fri Sep 12 20:54:57 2014
@@ -108,31 +108,4 @@ public class ConstantPool {
 }
 return c;
 }
-
-
-/**
- * Get string from constant pool and bypass the indirection of
- * `ConstantClass' and `ConstantString' objects. I.e. these classes have
- * an index field that points to another entry of the constant pool of
- * type `ConstantUtf8' which contains the real data.
- *
- * @param  index Index in constant pool
- * @param  tag Tag of expected constant, either ConstantClass or 
ConstantString
- * @return Contents of string reference
- * @seeConstantClass
- * @throws  ClassFormatException
- */
-public String getConstantString( int index, byte tag ) throws 
ClassFormatException {
-Constant c = getConstant(index, tag);
-
-if (Constants.CONSTANT_Class != tag) {
-throw new RuntimeException("getConstantString called with illegal 
tag " + tag);
-}
-
-int i = ((ConstantClass) c).getNameIndex();
-
-// Finally get the string from the constant pool
-c = getConstant(i, Constants.CONSTANT_Utf8);
-return ((ConstantUtf8) c).getBytes();
-}
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java?rev=1624645&r1=1624644&r2=1624645&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java Fri 
Sep 12 20:54:57 2014
@@ -48,7 +48,13 @@ final class Utility {
 }
 
 static String getClassName(ConstantPool constant_pool, int index) {
-String name = constant_pool.getConstantString(index, 
Constants.CONSTANT_Class);
+Constant c = constant_pool.getConstant(index, 
Constants.CONSTANT_Class);
+int i = ((ConstantClass) c).getNameIndex();
+
+// Finally get the string from the constant pool
+c = constant_pool.getConstant(i, Constants.CONSTANT_Utf8);
+String name = ((ConstantUtf8) c).getBytes();
+
 return compactClassName(name);
 }
 



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 56397] Establish parallel Maven-based build process

2014-09-12 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=56397

--- Comment #6 from Pierre Viret  ---
Created attachment 32016
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=32016&action=edit
tar containing the maven pom.xml files and the directories

See README-MAVEN.txt file for usage

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624647 - in /tomcat/trunk: java/org/apache/catalina/startup/ContextConfig.java java/org/apache/tomcat/util/bcel/classfile/ClassParser.java test/org/apache/tomcat/util/bcel/TesterPerforma

2014-09-12 Thread kkolinko
Author: kkolinko
Date: Fri Sep 12 21:04:36 2014
New Revision: 1624647

URL: http://svn.apache.org/r1624647
Log:
Remove class_name argument from constructor, as Tomcat does not provide the 
name.

Modified:
tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
tomcat/trunk/test/org/apache/tomcat/util/bcel/TesterPerformance.java

Modified: tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=1624647&r1=1624646&r2=1624647&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Fri Sep 12 
21:04:36 2014
@@ -1982,7 +1982,7 @@ public class ContextConfig implements Li
 boolean handlesTypesOnly)
 throws ClassFormatException, IOException {
 
-ClassParser parser = new ClassParser(is, null);
+ClassParser parser = new ClassParser(is);
 JavaClass clazz = parser.parse();
 checkHandlesTypes(clazz);
 
@@ -2142,7 +2142,7 @@ public class ContextConfig implements Li
 if (is == null) {
 return;
 }
-ClassParser parser = new ClassParser(is, null);
+ClassParser parser = new ClassParser(is);
 JavaClass clazz = parser.parse();
 populateJavaClassCache(clazz.getClassName(), clazz);
 } catch (ClassFormatException e) {

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java?rev=1624647&r1=1624646&r2=1624647&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java 
Fri Sep 12 21:04:36 2014
@@ -43,7 +43,6 @@ public final class ClassParser {
 private static final int MAGIC = 0xCAFEBABE;
 
 private final DataInputStream file;
-private final String file_name;
 private String class_name, superclass_name;
 private int access_flags; // Access rights of parsed class
 private String[] interface_names; // Names of implemented interfaces
@@ -57,10 +56,8 @@ public final class ClassParser {
  * Parse class from the given stream.
  *
  * @param file Input stream
- * @param file_name File name
  */
-public ClassParser(InputStream file, String file_name) {
-this.file_name = file_name;
+public ClassParser(InputStream file) {
 if (file instanceof DataInputStream) {
 this.file = (DataInputStream) file;
 } else {
@@ -158,7 +155,7 @@ public final class ClassParser {
 }
 if (((access_flags & Constants.ACC_ABSTRACT) != 0)
 && ((access_flags & Constants.ACC_FINAL) != 0)) {
-throw new ClassFormatException("Class " + file_name + " can't be 
both final and abstract");
+throw new ClassFormatException("Class can't be both final and 
abstract");
 }
 
 int class_name_index = file.readUnsignedShort();
@@ -206,7 +203,7 @@ public final class ClassParser {
  */
 private void readID() throws IOException, ClassFormatException {
 if (file.readInt() != MAGIC) {
-throw new ClassFormatException(file_name + " is not a Java .class 
file");
+throw new ClassFormatException("It is not a Java .class file");
 }
 }
 

Modified: tomcat/trunk/test/org/apache/tomcat/util/bcel/TesterPerformance.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/bcel/TesterPerformance.java?rev=1624647&r1=1624646&r2=1624647&view=diff
==
--- tomcat/trunk/test/org/apache/tomcat/util/bcel/TesterPerformance.java 
(original)
+++ tomcat/trunk/test/org/apache/tomcat/util/bcel/TesterPerformance.java Fri 
Sep 12 21:04:36 2014
@@ -58,7 +58,7 @@ public class TesterPerformance {
 if (jarEntryName.endsWith(".class")) {
 InputStream is = jar.getEntryInputStream();
 long start = System.nanoTime();
-ClassParser cp = new ClassParser(is, jarEntryName);
+ClassParser cp = new ClassParser(is);
 cp.parse();
 duration += System.nanoTime() - start;
 }



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 56397] Establish parallel Maven-based build process

2014-09-12 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=56397

--- Comment #7 from Pierre Viret  ---
Created attachment 32017
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=32017&action=edit
README for setting up maven for tomcat

This file contains a small how-to explaining the steps needed to set up maven 
projects for tomcat.

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624648 - /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java

2014-09-12 Thread kkolinko
Author: kkolinko
Date: Fri Sep 12 21:07:30 2014
New Revision: 1624648

URL: http://svn.apache.org/r1624648
Log:
Remove branch that is not used by Tomcat. Thanks to Cobertura coverage report.

Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java?rev=1624648&r1=1624647&r2=1624648&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java 
Fri Sep 12 21:07:30 2014
@@ -58,11 +58,7 @@ public final class ClassParser {
  * @param file Input stream
  */
 public ClassParser(InputStream file) {
-if (file instanceof DataInputStream) {
-this.file = (DataInputStream) file;
-} else {
-this.file = new DataInputStream(new BufferedInputStream(file, 
BUFSIZE));
-}
+this.file = new DataInputStream(new BufferedInputStream(file, 
BUFSIZE));
 }
 
 



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 56397] Establish parallel Maven-based build process

2014-09-12 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=56397

--- Comment #8 from Pierre Viret  ---
I have implemented an EXPERIMENTAL set of maven projects for the tomcat
components.
The main idea is that the sources are simply copied from the central repository
to an existing maven projects' tree. Everyone can download the readme, patch
the build.xml, unpack the tar with the maven project files and enjoy maven
projects. This works well for me and I can work with the projects in NetBeans.

This is experimental and has to be verified and tested in depth (f.i. compare
the jars created by maven and the jars created by ant).

The advantage of this solution is that we can take any revision of the tomcat
source tree and (so long the main source packages of the components were not
refactored) generate the maven project out of it.

My proposal: we can now set up the maven projects so that they really build
100% what we want, without impacting the ant build. When we are ready to switch
to maven then the work remaining is to "svn move" the source packages to the
corresponding maven modules. This is not a parallel build system but could be
very interesting for experimentation and developing the maven build.

Please feel free to try it out and give me feedback.

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624655 - /tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java

2014-09-12 Thread kkolinko
Author: kkolinko
Date: Fri Sep 12 21:46:59 2014
New Revision: 1624655

URL: http://svn.apache.org/r1624655
Log:
Memory efficiency: Use a shared emptySet() as the value for 
JavaClassCacheEntry.sciSet when there are no SCIs for a class.

Modified:
tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java

Modified: tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=1624655&r1=1624654&r2=1624655&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Fri Sep 12 
21:46:59 2014
@@ -163,6 +163,13 @@ public class ContextConfig implements Li
 new ConcurrentHashMap<>();
 
 
+/**
+ * Set used as the value for {@code JavaClassCacheEntry.sciSet} when there
+ * are no SCIs associated with a class.
+ */
+private static final Set EMPTY_SCI_SET = 
Collections.emptySet();
+
+
 // - Instance Variables
 /**
  * Custom mappings of login methods to authenticators
@@ -2044,7 +2051,7 @@ public class ContextConfig implements Li
 classHierarchyToString(className, entry)));
 }
 }
-if (entry.getSciSet().size() > 0) {
+if (!entry.getSciSet().isEmpty()) {
 // Need to try and load the class
 clazz = Introspection.loadClass(context, className);
 if (clazz == null) {
@@ -2052,8 +2059,7 @@ public class ContextConfig implements Li
 return;
 }
 
-for (ServletContainerInitializer sci :
-entry.getSciSet()) {
+for (ServletContainerInitializer sci : entry.getSciSet()) {
 Set> classes = initializerClassMap.get(sci);
 if (classes == null) {
 classes = new HashSet<>();
@@ -2165,7 +2171,7 @@ public class ContextConfig implements Li
 
 // Avoid an infinite loop with java.lang.Object
 if (cacheEntry.equals(superClassCacheEntry)) {
-cacheEntry.setSciSet(new HashSet());
+cacheEntry.setSciSet(EMPTY_SCI_SET);
 return;
 }
 
@@ -2194,7 +2200,7 @@ public class ContextConfig implements Li
 result.addAll(getSCIsForClass(interfaceName));
 }
 
-cacheEntry.setSciSet(result);
+cacheEntry.setSciSet(result.isEmpty() ? EMPTY_SCI_SET : result);
 }
 
 private Set getSCIsForClass(String className) 
{
@@ -2207,7 +2213,7 @@ public class ContextConfig implements Li
 }
 }
 }
-return Collections.emptySet();
+return EMPTY_SCI_SET;
 }
 
 private static final String getClassName(String internalForm) {



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624657 - /tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java

2014-09-12 Thread kkolinko
Author: kkolinko
Date: Fri Sep 12 21:56:47 2014
New Revision: 1624657

URL: http://svn.apache.org/r1624657
Log:
Reorganize branches for better performance.
The "docBase.toLowerCase(Locale.ENGLISH).endsWith(".war") && 
!file.isDirectory()" condition was the same in both branches.

Modified:
tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java

Modified: tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=1624657&r1=1624656&r2=1624657&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Fri Sep 12 
21:56:47 2014
@@ -612,19 +612,20 @@ public class ContextConfig implements Li
 }
 }
 
-if (docBase.toLowerCase(Locale.ENGLISH).endsWith(".war") && 
!file.isDirectory() && unpackWARs) {
-URL war = new URL("jar:" + (new File(docBase)).toURI().toURL() + 
"!/");
-docBase = ExpandWar.expand(host, war, pathName);
-file = new File(docBase);
-docBase = file.getCanonicalPath();
-if (context instanceof StandardContext) {
-((StandardContext) context).setOriginalDocBase(origDocBase);
-}
-} else if (docBase.toLowerCase(Locale.ENGLISH).endsWith(".war") &&
-!file.isDirectory() && !unpackWARs) {
-URL war =
-new URL("jar:" + (new File (docBase)).toURI().toURL() + "!/");
-ExpandWar.validate(host, war, pathName);
+if (docBase.toLowerCase(Locale.ENGLISH).endsWith(".war") && 
!file.isDirectory()) {
+if (unpackWARs) {
+URL war = new URL("jar:" + (new File(docBase)).toURI().toURL() 
+ "!/");
+docBase = ExpandWar.expand(host, war, pathName);
+file = new File(docBase);
+docBase = file.getCanonicalPath();
+if (context instanceof StandardContext) {
+((StandardContext) 
context).setOriginalDocBase(origDocBase);
+}
+} else {
+URL war =
+new URL("jar:" + (new File (docBase)).toURI().toURL() 
+ "!/");
+ExpandWar.validate(host, war, pathName);
+}
 } else {
 File docDir = new File(docBase);
 if (!docDir.exists()) {



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[Bug 56938] Applications with uppercase context paths cannot be updated

2014-09-12 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=56938

--- Comment #2 from Austin Jones  ---
(In reply to Mark Thomas from comment #1)
> Fixed in 8.0.x for 8.0.13 onwards and in 7.0.x for 7.0.56 onwards.

Thank you, Mark!

-- 
You are receiving this mail because:
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624664 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/catalina/startup/ContextConfig.java

2014-09-12 Thread kkolinko
Author: kkolinko
Date: Fri Sep 12 22:34:40 2014
New Revision: 1624664

URL: http://svn.apache.org/r1624664
Log:
Reorganize branches for better performance.
The "docBase.toLowerCase(Locale.ENGLISH).endsWith(".war") && 
!file.isDirectory()" condition was the same in both branches.

It is merge of r1624657 from tomcat/trunk.

Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged /tomcat/trunk:r1624657

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=1624664&r1=1624663&r2=1624664&view=diff
==
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java 
Fri Sep 12 22:34:40 2014
@@ -722,19 +722,20 @@ public class ContextConfig implements Li
 }
 }
 
-if (docBase.toLowerCase(Locale.ENGLISH).endsWith(".war") && 
!file.isDirectory() && unpackWARs) {
-URL war = new URL("jar:" + (new File(docBase)).toURI().toURL() + 
"!/");
-docBase = ExpandWar.expand(host, war, pathName);
-file = new File(docBase);
-docBase = file.getCanonicalPath();
-if (context instanceof StandardContext) {
-((StandardContext) context).setOriginalDocBase(origDocBase);
-}
-} else if (docBase.toLowerCase(Locale.ENGLISH).endsWith(".war") &&
-!file.isDirectory() && !unpackWARs) {
-URL war =
-new URL("jar:" + (new File (docBase)).toURI().toURL() + "!/");
-ExpandWar.validate(host, war, pathName);
+if (docBase.toLowerCase(Locale.ENGLISH).endsWith(".war") && 
!file.isDirectory()) {
+if (unpackWARs) {
+URL war = new URL("jar:" + (new File(docBase)).toURI().toURL() 
+ "!/");
+docBase = ExpandWar.expand(host, war, pathName);
+file = new File(docBase);
+docBase = file.getCanonicalPath();
+if (context instanceof StandardContext) {
+((StandardContext) 
context).setOriginalDocBase(origDocBase);
+}
+} else {
+URL war =
+new URL("jar:" + (new File (docBase)).toURI().toURL() 
+ "!/");
+ExpandWar.validate(host, war, pathName);
+}
 } else {
 File docDir = new File(docBase);
 if (!docDir.exists()) {



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624665 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/catalina/startup/ContextConfig.java

2014-09-12 Thread kkolinko
Author: kkolinko
Date: Fri Sep 12 22:42:07 2014
New Revision: 1624665

URL: http://svn.apache.org/r1624665
Log:
Memory efficiency: Use a shared emptySet() as the value for 
JavaClassCacheEntry.sciSet when there are no SCIs for a class.

It is merge of r1624655 from tomcat/trunk.

Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged /tomcat/trunk:r1624655

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=1624665&r1=1624664&r2=1624665&view=diff
==
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java 
Fri Sep 12 22:42:07 2014
@@ -194,6 +194,13 @@ public class ContextConfig implements Li
 new ConcurrentHashMap();
 
 
+/**
+ * Set used as the value for {@code JavaClassCacheEntry.sciSet} when there
+ * are no SCIs associated with a class.
+ */
+private static final Set EMPTY_SCI_SET = 
Collections.emptySet();
+
+
 // - Instance Variables
 /**
  * Custom mappings of login methods to authenticators
@@ -2121,7 +2128,7 @@ public class ContextConfig implements Li
 classHierarchyToString(className, entry)));
 }
 }
-if (entry.getSciSet().size() > 0) {
+if (!entry.getSciSet().isEmpty()) {
 // Need to try and load the class
 clazz = Introspection.loadClass(context, className);
 if (clazz == null) {
@@ -2129,8 +2136,7 @@ public class ContextConfig implements Li
 return;
 }
 
-for (ServletContainerInitializer sci :
-entry.getSciSet()) {
+for (ServletContainerInitializer sci : entry.getSciSet()) {
 Set> classes = initializerClassMap.get(sci);
 if (classes == null) {
 classes = new HashSet>();
@@ -2249,7 +2255,7 @@ public class ContextConfig implements Li
 
 // Avoid an infinite loop with java.lang.Object
 if (cacheEntry.equals(superClassCacheEntry)) {
-cacheEntry.setSciSet(new HashSet());
+cacheEntry.setSciSet(EMPTY_SCI_SET);
 return;
 }
 
@@ -2278,7 +2284,7 @@ public class ContextConfig implements Li
 result.addAll(getSCIsForClass(interfaceName));
 }
 
-cacheEntry.setSciSet(result);
+cacheEntry.setSciSet(result.isEmpty() ? EMPTY_SCI_SET : result);
 }
 
 private Set getSCIsForClass(String className) 
{
@@ -2291,7 +2297,7 @@ public class ContextConfig implements Li
 }
 }
 }
-return Collections.emptySet();
+return EMPTY_SCI_SET;
 }
 
 private static final String getClassName(String internalForm) {



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624667 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/bcel/ java/org/apache/tomcat/util/bcel/classfile/

2014-09-12 Thread kkolinko
Author: kkolinko
Date: Fri Sep 12 22:49:16 2014
New Revision: 1624667

URL: http://svn.apache.org/r1624667
Log:
Remove serialization support and serialVersionUID fields from BCEL classes.

It is merge of r1624563 from tomcat/trunk.

Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/   (props changed)

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AccessFlags.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantDouble.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantFloat.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInteger.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantLong.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantUtf8.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleAnnotations.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleParameterAnnotations.java

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged /tomcat/trunk:r1624563

Propchange: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/
--
  Merged /tomcat/trunk/java/org/apache/tomcat/util/bcel:r1624563

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AccessFlags.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AccessFlags.java?rev=1624667&r1=1624666&r2=1624667&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AccessFlags.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AccessFlags.java
 Fri Sep 12 22:49:16 2014
@@ -23,12 +23,10 @@ package org.apache.tomcat.util.bcel.clas
  *
  * @author  mailto:m.d...@gmx.de";>M. Dahm
  */
-public abstract class AccessFlags implements java.io.Serializable {
+public abstract class AccessFlags {
 
-private static final long serialVersionUID = 2548932939969293935L;
 protected int access_flags;
 
-
 public AccessFlags() {
 }
 

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java?rev=1624667&r1=1624666&r2=1624667&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java
 Fri Sep 12 22:49:16 2014
@@ -26,9 +26,7 @@ import java.io.IOException;
  * @author mailto:dbros...@qis.net";>D. Brosius
  * @since 6.0
  */
-public class AnnotationDefault extends Attribute
-{
-private static final long serialVersionUID = 6715933396664171543L;
+public class AnnotationDefault extends Attribute {
 
 /**
  * @param name_index

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java?rev=1624667&r1=1624666&r2=1624667&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java
 Fri Sep 12 22:49:16 2014
@@ -28,8 +28,6 @@ import java.io.IOException;
  */
 public abstract class Annotations extends Attribute {
 
-private static final long serialVersionUID = 1L;
-
 private final AnnotationEntry[] annotation_table;
 
 /**

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java?rev=1624667&r1=1624666&r2=1624667&view=diff

svn commit: r1624670 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/bcel/ java/org/apache/tomcat/util/bcel/classfile/

2014-09-12 Thread kkolinko
Author: kkolinko
Date: Fri Sep 12 22:57:54 2014
New Revision: 1624670

URL: http://svn.apache.org/r1624670
Log:
Remove unused method Attribute.getName(). It allows to remove name_index field 
as well.
Found thanks to Cobertura coverage report.

It is merge of r1624564 from tomcat/trunk.

Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/   (props changed)

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleAnnotations.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleParameterAnnotations.java

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged /tomcat/trunk:r1624564

Propchange: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/
--
  Merged /tomcat/trunk/java/org/apache/tomcat/util/bcel:r1624564

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java?rev=1624670&r1=1624669&r2=1624670&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java
 Fri Sep 12 22:57:54 2014
@@ -29,8 +29,6 @@ import java.io.IOException;
 public class AnnotationDefault extends Attribute {
 
 /**
- * @param name_index
- *Index pointing to the name Code
  * @param length
  *Content length in bytes
  * @param file
@@ -38,11 +36,9 @@ public class AnnotationDefault extends A
  * @param constant_pool
  *Array of constants
  */
-public AnnotationDefault(int name_index, int length,
-DataInputStream file, ConstantPool constant_pool)
-throws IOException
-{
-super(name_index, length, constant_pool);
+public AnnotationDefault(int length, DataInputStream file,
+ConstantPool constant_pool) throws IOException {
+super(length, constant_pool);
 // Default value
 ElementValue.readElementValue(file, constant_pool);
 }

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java?rev=1624670&r1=1624669&r2=1624670&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java
 Fri Sep 12 22:57:54 2014
@@ -31,14 +31,13 @@ public abstract class Annotations extend
 private final AnnotationEntry[] annotation_table;
 
 /**
- * @param name_index Index pointing to the name Code
  * @param length Content length in bytes
  * @param file Input stream
  * @param constant_pool Array of constants
  */
-public Annotations(int name_index, int length, DataInputStream file,
+public Annotations(int length, DataInputStream file,
 ConstantPool constant_pool) throws IOException {
-super(name_index, length, constant_pool);
+super(length, constant_pool);
 final int annotation_table_length = (file.readUnsignedShort());
 annotation_table = new AnnotationEntry[annotation_table_length];
 for (int i = 0; i < annotation_table_length; i++) {

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java?rev=1624670&r1=1624669&r2=1624670&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java 
(original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java 
Fri Sep 12 22:57:54 2014
@@ -34,16 +34,11 @@ import org.apache.tomcat.util.bcel.Const
  */
 public abstract class Attribute {
 
-protected int name_index; // Points to attribute name in constant pool
-
 protected int length; // Content length of attribute field
 
 protected ConstantPool constant_pool;
 
-protected Attribute(in

svn commit: r1624672 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/bcel/ java/org/apache/tomcat/util/bcel/classfile/

2014-09-12 Thread kkolinko
Author: kkolinko
Date: Fri Sep 12 23:02:25 2014
New Revision: 1624672

URL: http://svn.apache.org/r1624672
Log:
Remove length and constant_pool fields from Attribute class.

It is merge of r1624565 from tomcat/trunk.

Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/   (props changed)

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleAnnotations.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleParameterAnnotations.java

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged /tomcat/trunk:r1624565

Propchange: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/
--
  Merged /tomcat/trunk/java/org/apache/tomcat/util/bcel:r1624565

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java?rev=1624672&r1=1624671&r2=1624672&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java
 Fri Sep 12 23:02:25 2014
@@ -29,16 +29,13 @@ import java.io.IOException;
 public class AnnotationDefault extends Attribute {
 
 /**
- * @param length
- *Content length in bytes
  * @param file
  *Input stream
  * @param constant_pool
  *Array of constants
  */
-public AnnotationDefault(int length, DataInputStream file,
-ConstantPool constant_pool) throws IOException {
-super(length, constant_pool);
+public AnnotationDefault(DataInputStream file, ConstantPool constant_pool)
+throws IOException {
 // Default value
 ElementValue.readElementValue(file, constant_pool);
 }

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java?rev=1624672&r1=1624671&r2=1624672&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java
 Fri Sep 12 23:02:25 2014
@@ -31,13 +31,11 @@ public abstract class Annotations extend
 private final AnnotationEntry[] annotation_table;
 
 /**
- * @param length Content length in bytes
  * @param file Input stream
  * @param constant_pool Array of constants
  */
-public Annotations(int length, DataInputStream file,
-ConstantPool constant_pool) throws IOException {
-super(length, constant_pool);
+public Annotations(DataInputStream file, ConstantPool constant_pool)
+throws IOException {
 final int annotation_table_length = (file.readUnsignedShort());
 annotation_table = new AnnotationEntry[annotation_table_length];
 for (int i = 0; i < annotation_table_length; i++) {

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java?rev=1624672&r1=1624671&r2=1624672&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java 
(original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java 
Fri Sep 12 23:02:25 2014
@@ -34,15 +34,6 @@ import org.apache.tomcat.util.bcel.Const
  */
 public abstract class Attribute {
 
-protected int length; // Content length of attribute field
-
-protected ConstantPool constant_pool;
-
-protected Attribute(int length, ConstantPool constant_pool) {
-this.length = length;
-this.constant_pool = constant_pool;
-}
-
 /*
  * Class method reads one attribute from the input data stream. This method
  * must not be accessible from the outside. It is called by the Field and
@@ -83,12 +74,11 @@ public abstract class Attribute {
 switch (tag)
 {
 case Constants.ATTR_RUNTIME_VISIBLE_

svn commit: r1624674 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/bcel/ java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java

2014-09-12 Thread kkolinko
Author: kkolinko
Date: Fri Sep 12 23:07:49 2014
New Revision: 1624674

URL: http://svn.apache.org/r1624674
Log:
Remove unused ConstantPool.constantToString methods.
Found thanks to Cobertura coverage report.

It is merge of r1624569 from tomcat/trunk.

Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/   (props changed)

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged /tomcat/trunk:r1624569

Propchange: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/
--
  Merged /tomcat/trunk/java/org/apache/tomcat/util/bcel:r1624569

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java?rev=1624674&r1=1624673&r2=1624674&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java
 Fri Sep 12 23:07:49 2014
@@ -72,58 +72,6 @@ public class ConstantPool {
 
 
 /**
- * Resolve constant to a string representation.
- *
- * @param  c Constant to be printed
- * @return String representation
- */
-public String constantToString( Constant c ) throws ClassFormatException {
-String str;
-int i;
-byte tag = c.getTag();
-switch (tag) {
-case Constants.CONSTANT_Class:
-i = ((ConstantClass) c).getNameIndex();
-c = getConstant(i, Constants.CONSTANT_Utf8);
-str = Utility.compactClassName(((ConstantUtf8) c).getBytes());
-break;
-case Constants.CONSTANT_Utf8:
-str = ((ConstantUtf8) c).getBytes();
-break;
-case Constants.CONSTANT_Double:
-str = String.valueOf(((ConstantDouble) c).getBytes());
-break;
-case Constants.CONSTANT_Float:
-str = String.valueOf(((ConstantFloat) c).getBytes());
-break;
-case Constants.CONSTANT_Long:
-str = String.valueOf(((ConstantLong) c).getBytes());
-break;
-case Constants.CONSTANT_Integer:
-str = String.valueOf(((ConstantInteger) c).getBytes());
-break;
-default: // Never reached
-throw new RuntimeException("Unknown constant type " + tag);
-}
-return str;
-}
-
-
-/**
- * Retrieve constant at `index' from constant pool and resolve it to
- * a string representation.
- *
- * @param  index of constant in constant pool
- * @param  tag expected type
- * @return String representation
- */
-public String constantToString( int index, byte tag ) throws 
ClassFormatException {
-Constant c = getConstant(index, tag);
-return constantToString(c);
-}
-
-
-/**
  * Get constant from constant pool.
  *
  * @param  index Index in constant pool



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624676 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/tomcat/util/bcel/ java/org/apache/tomcat/util/bcel/classfile/

2014-09-12 Thread kkolinko
Author: kkolinko
Date: Fri Sep 12 23:12:36 2014
New Revision: 1624676

URL: http://svn.apache.org/r1624676
Log:
Reduce visibility of constructors.
Remove unused constants

It is merge of r1624568, r1624571 from tomcat/trunk.

Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/Constants.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AccessFlags.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassElementValue.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValuePair.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/EnumElementValue.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleAnnotations.java

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged /tomcat/trunk:r1624568,1624571

Propchange: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/
--
  Merged /tomcat/trunk/java/org/apache/tomcat/util/bcel:r1624568,1624571

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/Constants.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/Constants.java?rev=1624676&r1=1624675&r2=1624676&view=diff
==
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/Constants.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/Constants.java Fri 
Sep 12 23:12:36 2014
@@ -95,28 +95,9 @@ public interface Constants {
   /** Attributes and their corresponding names.
*/
   public static final byte ATTR_UNKNOWN = -1;
-  public static final byte ATTR_SOURCE_FILE = 0;
-  public static final byte ATTR_CONSTANT_VALUE  = 1;
-  public static final byte ATTR_CODE= 2;
-  public static final byte ATTR_EXCEPTIONS  = 3;
-  public static final byte ATTR_LINE_NUMBER_TABLE   = 4;
-  public static final byte ATTR_LOCAL_VARIABLE_TABLE= 5;
-  public static final byte ATTR_INNER_CLASSES   = 6;
-  public static final byte ATTR_SYNTHETIC   = 7;
-  public static final byte ATTR_DEPRECATED  = 8;
-  public static final byte ATTR_PMG = 9;
-  public static final byte ATTR_SIGNATURE   = 10;
-  public static final byte ATTR_STACK_MAP   = 11;
   public static final byte ATTR_RUNTIME_VISIBLE_ANNOTATIONS = 12;
-  public static final byte ATTR_RUNTIME_INVISIBLE_ANNOTATIONS   = 13;
   public static final byte ATTR_RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS   = 14;
-  public static final byte ATTR_RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS = 15;
   public static final byte ATTR_ANNOTATION_DEFAULT  = 16;
-  public static final byte ATTR_LOCAL_VARIABLE_TYPE_TABLE   = 17;
-  public static final byte ATTR_ENCLOSING_METHOD= 18;
-  public static final byte ATTR_STACK_MAP_TABLE = 19;
-  public static final byte ATTR_BOOTSTRAP_METHODS   = 20;
-  public static final byte ATTR_METHOD_PARAMETERS   = 21;
 
   public static final short KNOWN_ATTRIBUTES = 22;
 
@@ -131,31 +112,4 @@ public interface Constants {
 "AnnotationDefault", "LocalVariableTypeTable", "EnclosingMethod", 
"StackMapTable",
 "BootstrapMethods", "MethodParameters"
   };
-
-  /** Constants used in the StackMap attribute.
-   */
-  public static final byte ITEM_Bogus  = 0;
-  public static final byte ITEM_Object = 7;
-  public static final byte ITEM_NewObject  = 8;
-
-  /** Constants used to identify StackMapEntry types.
-   *
-   * For those

svn commit: r1624679 - /tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java

2014-09-12 Thread kkolinko
Author: kkolinko
Date: Fri Sep 12 23:26:10 2014
New Revision: 1624679

URL: http://svn.apache.org/r1624679
Log:
Followup to r1624573
Correct duplicate getter call typo

Modified:
tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java

Modified: tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=1624679&r1=1624678&r2=1624679&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Fri Sep 12 
23:26:10 2014
@@ -2232,7 +2232,7 @@ public class ContextConfig implements Li
 String servletName = null;
 // must search for name s. Spec Servlet API 3.0 - 8.2.3.3.n.ii page 81
 List evps = ae.getElementValuePairs();
-for (ElementValuePair evp : ae.getElementValuePairs()) {
+for (ElementValuePair evp : evps) {
 String name = evp.getNameString();
 if ("name".equals(name)) {
 servletName = evp.getValue().stringifyValue();



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1624680 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/catalina/startup/ContextConfig.java java/org/apache/tomcat/util/bcel/ java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.jav

2014-09-12 Thread kkolinko
Author: kkolinko
Date: Fri Sep 12 23:28:22 2014
New Revision: 1624680

URL: http://svn.apache.org/r1624680
Log:
Implement a TODO: change return value of AnnotationEntry.getElementValuePairs() 
from an array to a list.
As all usages are known and constructor of ElementValuePair class is not 
accessible from outside (package-visible), I think it is OK to skip defensive 
copying.

It is merge of r1624573, r1624679 from tomcat/trunk.

Modified:
tomcat/tc7.0.x/trunk/   (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/   (props changed)

tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java

Propchange: tomcat/tc7.0.x/trunk/
--
  Merged /tomcat/trunk:r1624573,1624679

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=1624680&r1=1624679&r2=1624680&view=diff
==
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java 
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/startup/ContextConfig.java 
Fri Sep 12 23:28:22 2014
@@ -2314,7 +2314,7 @@ public class ContextConfig implements Li
 AnnotationEntry ae, WebXml fragment) {
 String servletName = null;
 // must search for name s. Spec Servlet API 3.0 - 8.2.3.3.n.ii page 81
-ElementValuePair[] evps = ae.getElementValuePairs();
+List evps = ae.getElementValuePairs();
 for (ElementValuePair evp : evps) {
 String name = evp.getNameString();
 if ("name".equals(name)) {
@@ -2341,7 +2341,7 @@ public class ContextConfig implements Li
 boolean urlPatternsSet = false;
 String[] urlPatterns = null;
 
-// ElementValuePair[] evps = ae.getElementValuePairs();
+// List evps = ae.getElementValuePairs();
 for (ElementValuePair evp : evps) {
 String name = evp.getNameString();
 if ("value".equals(name) || "urlPatterns".equals(name)) {
@@ -2424,7 +2424,7 @@ public class ContextConfig implements Li
 AnnotationEntry ae, WebXml fragment) {
 String filterName = null;
 // must search for name s. Spec Servlet API 3.0 - 8.2.3.3.n.ii page 81
-ElementValuePair[] evps = ae.getElementValuePairs();
+List evps = ae.getElementValuePairs();
 for (ElementValuePair evp : evps) {
 String name = evp.getNameString();
 if ("filterName".equals(name)) {
@@ -2583,8 +2583,8 @@ public class ContextConfig implements Li
 ((ArrayElementValue) ev).getElementValuesArray();
 for (ElementValue value : arrayValues) {
 if (value instanceof AnnotationElementValue) {
-ElementValuePair[] evps = ((AnnotationElementValue)
-value).getAnnotationEntry().getElementValuePairs();
+List evps = ((AnnotationElementValue) 
value)
+.getAnnotationEntry().getElementValuePairs();
 String initParamName = null;
 String initParamValue = null;
 for (ElementValuePair evp : evps) {

Propchange: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/
--
  Merged /tomcat/trunk/java/org/apache/tomcat/util/bcel:r1624573

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java?rev=1624680&r1=1624679&r2=1624680&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java
 Fri Sep 12 23:28:22 2014
@@ -73,8 +73,7 @@ public class AnnotationEntry implements 
 /**
  * @return the element value pairs in this annotation entry
  */
-public ElementValuePair[] getElementValuePairs() {
-// TODO return List
-return element_value_pairs.toArray(new 
ElementValuePair[element_value_pairs.size()]);
+public List getElementValuePairs() {
+return element_value_pairs;
 }
 }



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



  1   2   >