Re: Coverity static analysis scanning

2014-09-10 Thread Olivier Lamy
I tried to get this working but got this error:
https://analysis.apache.org/jenkins/job/tomcat-trunk/10/console

Any help will be appreciate :-)


On 3 September 2014 22:07, Fabrice Bellingard  wrote:
> Hi guys,
>
> Tomcat had also been analyzed for a couple of months on the SonarQube
> instance of the ASF [1], but the last analysis is very old. The analysis
> must be failing for some reasons, so I copy Olivier who's managing the SQ
> instance @ASF. He can certainly give you more information on how to get the
> analysis back to normal - and probably also how to get a login there.
>
> IMO, it's best to advertise and use this instance instead of Nemo - which we
> use @SonarSource mainly as a demo instance.
>
> [1] https://analysis.apache.org/dashboard/index/77101?did=1
>
>
> - Fabrice
>   belling...@apache.org
>   fabrice.belling...@sonarsource.com
>
>
>> From: Henri Gomez 
>> Date: Wed, Aug 27, 2014 at 12:00 PM
>> Subject: Re: Coverity static analysis scanning
>> To: Tomcat Developers List , Fabrice Bellingard
>> 
>>
>>
>> Fabrice Belingard, ASFer is working for Sonar.
>> I add him in loop so he could give us more informations
>>
>> 2014-08-27 11:45 GMT+02:00 Mark Thomas :
>> > On 26/08/2014 22:52, Henri Gomez wrote:
>> >> Hi all
>> >>
>> >> Are you aware SonarQube is analysing Tomcat in Nemo for years ?
>> >>
>> >>
>> >> http://nemo.sonarqube.org/dashboard/index/50544
>> >>
>> >> 310 Blocker issues, 121 Critical issues.
>> >
>> > I took a quick look. The first 60 or so blocker issues I looked at were
>> > all false positives triggered by us catching Throwable for good reasons.
>> > Can we get a login to this system to make them as false positives?
>> >
>> > Mark
>> >
>> >
>> >>
>> >> Wondering if Coverity will provides more informations than SonarQube ?
>> >>
>> >> BTW, SonarQube is analysing major ASF projects for a long time now :)
>> >>
>> >>
>> >> 2014-08-26 11:20 GMT+02:00 Mark Thomas :
>> >>> All,
>> >>>
>> >>> I have been pinged off-list by Coverity to say that they have set up
>> >>> Tomcat with a free account with their static code analysis service.
>> >>>
>> >>> I think I have the ability to send invitations so if anyone wants to
>> >>> take a look at the results, just reply here.
>> >>>
>> >>> I have taken a quick look and they do appear to have found some valid
>> >>> threading issues. There are ~350 issues in total and I don't yet have
>> >>> a
>> >>> feel for the false positive rate.
>> >>>
>> >>> Mark
>> >>>
>> >>> -
>> >>> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
>> >>> For additional commands, e-mail: dev-h...@tomcat.apache.org
>> >>>
>> >>
>> >> -
>> >> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
>> >> For additional commands, e-mail: dev-h...@tomcat.apache.org
>> >>
>> >
>> >
>> > -
>> > To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
>> > For additional commands, e-mail: dev-h...@tomcat.apache.org
>> >
>>
>



-- 
Olivier Lamy
http://twitter.com/olamy | http://linkedin.com/in/olamy

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



Re: Coverity static analysis scanning

2014-09-10 Thread Mark Thomas
On 10/09/2014 08:08, Olivier Lamy wrote:
> I tried to get this working but got this error:
> https://analysis.apache.org/jenkins/job/tomcat-trunk/10/console
> 
> Any help will be appreciate :-)

Disable the unit tests until you get this working. They add about an
hour to the build time. Use "clean deploy" rather than "clean test".

Looking at the Sonar config you have the following:
-Dsonar.sources=java,modules/jdbc-pool,modules/tomcat-lite,modules/bayeux

I'd change that to:
-Dsonar.sources=java,modules/jdbc-pool

Neither tomcat-lite nor bayeux are part of the standard Tomcat distribution.

Try that and see what happens.

Mark


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



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

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

Bug ID: 56940
   Summary: Cache mechanism for "ConstantUtf8.java" doesn't have
any benefit
   Product: Tomcat 7
   Version: trunk
  Hardware: PC
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: Catalina
  Assignee: dev@tomcat.apache.org
  Reporter: hzha...@ebay.com

Created attachment 31983
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=31983&action=edit
patch

"org.apache.tomcat.util.bcel.classfile.ConstantUtf8.java" use a cache to
optimize the load for "ConstantUtf8".
In fact, the cache work as expected. Just new a instance directly works better.

By disabling the cache, the performance improved obviously.

The comparison for the cost is listed bellow, the result was get by running
test case "TestConstantUtf8.testConstantUtf8()".

=lots of jar files=
Use a Cache: 611ms
Without Cache: 458ms
=few jar files=
Use a cache: 92ms
Without Cache: 74ms

-- 
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-10 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=56940

--- Comment #1 from hzha...@ebay.com ---
Created attachment 31984
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=31984&action=edit
test case

-- 
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-10 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=56940

hzha...@ebay.com changed:

   What|Removed |Added

  Attachment #31983|0   |1
   is patch||

-- 
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: Coverity static analysis scanning

2014-09-10 Thread Fabrice Bellingard
Hi Olivier,

Looks like the configuration of the SQ build step is not fully correct.
>From the following command line:

> [workspace] $ /x1/jenkins/sonar-runner/bin/sonar-runner 
> -Dsonar.jdbc.driver=com.mysql.jdbc.Driver
> -Dsonar.jdbc.url=jdbc:mysql://192.168.0.64:3306/sonar?useUnicode=true&characterEncoding=utf8
>   
> -Dsonar.host.url=http://localhost:9090  
> -Dsonar.projectBaseDir=/x1/jenkins/jenkins-master/jenkins-home/jobs/tomcat-trunk/workspace
> "-Dsonar.projectName=Apache Tomcat"
> -Dsonar.projectVersion=trunk
> -Dsonar.libraries=output/classes
> -Dsonar.projectKey=apache:tomcat
> -Dsonar.sources=java,modules/jdbc-pool,modules/tomcat-lite,modules/bayeux
>
> , I can see that:

   - sonar.binaries is missing (which is the reason why the Findbugs
   plugins fails)
   - sonar.libraries is not correct (it points to the folder where classes
   are compiled, not to the dependencies)


I made some tests on my box, and the following configuration should make it:

sonar.projectKey=apache:tomcat
> sonar.projectName=Apache Tomcat
> sonar.projectVersion=trunk
>
> sonar.sources=java,modules/bayeux/java,modules/jdbc-pool/src/main/java,modules/tomcat-lite/java
>
> sonar.binaries=output/classes,modules/jdbc-pool/output/classes,modules/tomcat-lite/target/classes
>

(I removed "sonar.libraries" because it depends on the "base.path" property
set for the build)


One note: if you want to benefit from Findbugs analysis, all the classes
need to compiled. For my tests, I run:

   - "ant compile" at the root, which compiles into "output/classes"
   - "ant" for both bayeux module, which compiles into "output/classes" as
   well
   - "ant" for jdbc-pool module, which compiles into
   "modules/jdbc-pool/output/classes"
   - "mvn compile" for "tomcat-lite" module, which compiles into
   "modules/tomcat-lite/target/classes"

All those build directories are therefore referenced in "sonar.binaries".


HTH!

- Fabrice
  belling...@apache.org
  fabrice.belling...@sonarsource.com

On Wed, Sep 10, 2014 at 9:08 AM, Olivier Lamy  wrote:

> I tried to get this working but got this error:
> https://analysis.apache.org/jenkins/job/tomcat-trunk/10/console
>
> Any help will be appreciate :-)
>
>
> On 3 September 2014 22:07, Fabrice Bellingard 
> wrote:
> > Hi guys,
> >
> > Tomcat had also been analyzed for a couple of months on the SonarQube
> > instance of the ASF [1], but the last analysis is very old. The analysis
> > must be failing for some reasons, so I copy Olivier who's managing the SQ
> > instance @ASF. He can certainly give you more information on how to get
> the
> > analysis back to normal - and probably also how to get a login there.
> >
> > IMO, it's best to advertise and use this instance instead of Nemo -
> which we
> > use @SonarSource mainly as a demo instance.
> >
> > [1] https://analysis.apache.org/dashboard/index/77101?did=1
> >
> >
> > - Fabrice
> >   belling...@apache.org
> >   fabrice.belling...@sonarsource.com
> >
> >
> >> From: Henri Gomez 
> >> Date: Wed, Aug 27, 2014 at 12:00 PM
> >> Subject: Re: Coverity static analysis scanning
> >> To: Tomcat Developers List , Fabrice Bellingard
> >> 
> >>
> >>
> >> Fabrice Belingard, ASFer is working for Sonar.
> >> I add him in loop so he could give us more informations
> >>
> >> 2014-08-27 11:45 GMT+02:00 Mark Thomas :
> >> > On 26/08/2014 22:52, Henri Gomez wrote:
> >> >> Hi all
> >> >>
> >> >> Are you aware SonarQube is analysing Tomcat in Nemo for years ?
> >> >>
> >> >>
> >> >> http://nemo.sonarqube.org/dashboard/index/50544
> >> >>
> >> >> 310 Blocker issues, 121 Critical issues.
> >> >
> >> > I took a quick look. The first 60 or so blocker issues I looked at
> were
> >> > all false positives triggered by us catching Throwable for good
> reasons.
> >> > Can we get a login to this system to make them as false positives?
> >> >
> >> > Mark
> >> >
> >> >
> >> >>
> >> >> Wondering if Coverity will provides more informations than SonarQube
> ?
> >> >>
> >> >> BTW, SonarQube is analysing major ASF projects for a long time now :)
> >> >>
> >> >>
> >> >> 2014-08-26 11:20 GMT+02:00 Mark Thomas :
> >> >>> All,
> >> >>>
> >> >>> I have been pinged off-list by Coverity to say that they have set up
> >> >>> Tomcat with a free account with their static code analysis service.
> >> >>>
> >> >>> I think I have the ability to send invitations so if anyone wants to
> >> >>> take a look at the results, just reply here.
> >> >>>
> >> >>> I have taken a quick look and they do appear to have found some
> valid
> >> >>> threading issues. There are ~350 issues in total and I don't yet
> have
> >> >>> a
> >> >>> feel for the false positive rate.
> >> >>>
> >> >>> Mark
> >> >>>
> >> >>>
> -
> >> >>> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> >> >>> For additional commands, e-mail: dev-h...@tomcat.apache.org
> >> >>>
> >> >>
> >> >> -

svn commit: r1624003 - in /tomcat/site/trunk: docs/security-7.html xdocs/security-7.xml

2014-09-10 Thread markt
Author: markt
Date: Wed Sep 10 13:59:55 2014
New Revision: 1624003

URL: http://svn.apache.org/r1624003
Log:
Announce CVE-2013-

Modified:
tomcat/site/trunk/docs/security-7.html
tomcat/site/trunk/xdocs/security-7.xml

Modified: tomcat/site/trunk/docs/security-7.html
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/docs/security-7.html?rev=1624003&r1=1624002&r2=1624003&view=diff
==
--- tomcat/site/trunk/docs/security-7.html (original)
+++ tomcat/site/trunk/docs/security-7.html Wed Sep 10 13:59:55 2014
@@ -629,6 +629,80 @@
 
 Affects: 7.0.0-7.0.39
 
+
+
+Important: Remote Code Execution
+   http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2013-"; 
rel="nofollow">CVE-2013-
+
+
+
+In very limited circumstances, it was possible for an attacker to upload
+   a malicious JSP to a Tomcat server and then trigger the execution of 
that
+   JSP. While Remote Code Execution would normally be viewed as a critical
+   vulnerability, the circumstances under which this is possible are, in 
the
+   view of the Tomcat security team, sufficiently limited that this
+   vulnerability is viewed as important.
+
+
+For this attack to succeed all of the following requirements must be
+   met:
+
+
+
+  
+Using Oracle Java 1.7.0 update 25 or earlier (or any other Java
+  implementation where java.io.File is vulnerable to null byte
+  injection).
+  
+A web application must be deployed to a vulnerable version of
+  Tomcat.
+  
+The web application must use the Servlet 3.0 File Upload feature.
+  
+A file location within a deployed web application must be writeable by
+  the user the Tomcat process is running as. The Tomcat security
+  documentation recommends against this.
+  
+A custom listener for JMX connections (e.g. the JmxRemoteListener that
+  is not enabled by default) must be configured and be able to load
+  classes from Tomcat's common class loader (i.e. the custom JMX
+  listener must be placed in Tomcat's lib directory).
+  
+The custom JMX listener must be bound to an address other than
+  localhost for a remote attack (it is bound to localhost by default).
+  If the custom JMX listener is bound to localhost, a local attack will
+  still be possible.
+
+
+
+
+Note that requirements 2 and 3 may be replaced with the following
+   requirement:
+
+
+
+  
+A web application is deployed that uses Apache Commons File Upload
+  1.2.1 or earlier.
+
+
+
+
+In this case (requirements 1, 4, 5, 6 and 7 met) a similar vulnerability
+   may exist on any Servlet container, not just Apache Tomcat.
+
+
+This was fixed in revision http://svn.apache.org/viewvc?view=rev&rev=1470437";>1470437.
+
+
+This issue was identified by Pierre Ernst of the VMware Security
+   Engineering, Communications and Response group (vSECR)  and reported to
+   the Tomcat security team via the Pivotal security team on 5 September
+   2014. It was made public on 10 September 2014.
+
+
+Affects: 7.0.0 to 7.0.39
+
   
 
 

Modified: tomcat/site/trunk/xdocs/security-7.xml
URL: 
http://svn.apache.org/viewvc/tomcat/site/trunk/xdocs/security-7.xml?rev=1624003&r1=1624002&r2=1624003&view=diff
==
--- tomcat/site/trunk/xdocs/security-7.xml (original)
+++ tomcat/site/trunk/xdocs/security-7.xml Wed Sep 10 13:59:55 2014
@@ -265,6 +265,59 @@
 
 Affects: 7.0.0-7.0.39
 
+Important: Remote Code Execution
+   CVE-2013-
+
+In very limited circumstances, it was possible for an attacker to upload
+   a malicious JSP to a Tomcat server and then trigger the execution of 
that
+   JSP. While Remote Code Execution would normally be viewed as a critical
+   vulnerability, the circumstances under which this is possible are, in 
the
+   view of the Tomcat security team, sufficiently limited that this
+   vulnerability is viewed as important.
+
+For this attack to succeed all of the following requirements must be
+   met:
+
+
+  Using Oracle Java 1.7.0 update 25 or earlier (or any other Java
+  implementation where java.io.File is vulnerable to null byte
+  injection).
+  A web application must be deployed to a vulnerable version of
+  Tomcat.
+  The web application must use the Servlet 3.0 File Upload 
feature.
+  A file location within a deployed web application must be writeable 
by
+  the user the Tomcat process is running as. The Tomcat security
+  documentation recommends against this.
+  A custom listener for JMX connections (e.g. the JmxRemoteListener 
that
+  is not enabled by default) must be configured and be able to load
+  classes from Tomcat's common class lo

[SECURITY] CVE-2013-4444 Remote Code Execution in Apache Tomcat

2014-09-10 Thread Mark Thomas
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

CVE-2013- Remote Code Execution

Severity: Important

Vendor: The Apache Software Foundation

Versions Affected:
- - Apache Tomcat 7.0.0 to 7.0.39

Description:
In very limited circumstances, it was possible for an attacker to upload
a malicious JSP to a Tomcat server and then trigger the execution of
that JSP. While Remote Code Execution would normally be viewed as a
critical vulnerability, the circumstances under which this is possible
are, in the view of the Tomcat security team, sufficiently limited that
this vulnerability is viewed as important.
For this attack to succeed all of the following requirements must be met:
a) Using Oracle Java 1.7.0 update 25 or earlier (or any other Java
   implementation where java.io.File is vulnerable to null byte
   injection).
b) A web application must be deployed to a vulnerable version of Tomcat
   (see previous section).
c) The web application must use the Servlet 3.0 File Upload feature.
d) A file location within a deployed web application must be writeable
   by the user the Tomcat process is running as. The Tomcat security
   documentation recommends against this.
e) A custom listener for JMX connections (e.g. the JmxRemoteListener
   that is not enabled by default) must be configured and be able to
   load classes from Tomcat's common class loader (i.e. the custom JMX
   listener must be placed in Tomcat's lib directory)
f) The custom JMX listener must be bound to an address other than
   localhost for a remote attack (it is bound to localhost by default).
   If the custom JMX listener is bound to localhost, a local attack
   will still be possible.

Note that requirements b) and c) may be replaced with the following
requirement:
g) A web application is deployed that uses Apache Commons File Upload
   1.2.1 or earlier.
In this case a similar vulnerability may exist on any Servlet container,
not just Apache Tomcat.

Mitigation:
This vulnerability may be mitigated by using any one of the following
mitigations:
- - Upgrade to Oracle Java 1.7.0 update 40 or later (or any other Java
  implementation where java.io.File is not vulnerable to null byte
  injection).
- - Use OS file permissions to prevent the process Tomcat is running as
  from writing to any location within a deployed application.
- - Disable any custom JMX listeners
- - Upgrade to Apache Tomcat 7.0.40 or later

Credit:
This issue was identified by Pierre Ernst of the VMware Security
Engineering, Communications & Response group (vSECR)  and reported to
the Tomcat security team via the Pivotal security team.

References:
[1] http://tomcat.apache.org/security-7.html

-BEGIN PGP SIGNATURE-
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
Comment: GPGTools - http://gpgtools.org

iQIcBAEBAgAGBQJUEFl4AAoJEBDAHFovYFnnR3cQAL034ZrbUeBcJ4zotNp5+ea2
llNatC3MUlg/vZ2qG8Qo4xxbdS4F53cpu90fFhKm+dFzIiRhZeHROYDv6Lu1biSu
Nvq0YXV6KVJ9Js4G6HFilhy3vownvn/hMAjzmPojSYjWO5slXNfFvAlwyRrGt0Cp
t5rUh4QNavhgO4m0HXJJLg+PNlSKsnGdra+0gWmq8YKtKotgu24SbPq/p3HP7TuJ
nnMjx4A6r2LcoghL/nFAPp2ZwgBCtm67osObJ1uMxYhZ2I/3MztFYpSKvfVONuUK
rL265wmrKLvvDdozd/Aw2d2poXdSO/oWeuhKbbzYOxpUT6iRzf+BkPUR99e6Rqso
lOfLoAYuzYfK4rW/ooxVNKnHMhs+0BVfNZoclKCDSvz+a9dIVS5XD6KcyJQ3uv12
ujyTGaGhLuS/ciAVS372Dx8H0/mfd5nZCkYL6NDyzSWSmb5eG4XxqrLi77yByvAT
ulSAyg1UWk8sRgQ4AY3belH3jDiN1rHSWJAaB+WVwszQdCe4iXgDyB1u4ES22oAN
Ymrg5l7tLQ8/9LyMvlQ0tE4f+OYE6kki6e4JMc2cMqPL/rcjiUnLWZ7YUyx92RM1
LRt9QhMd1h3Uwle7a7LxqJCGf/rIPwRmrjTYYWt43np1Adx7y2RuZOTDjEY98sN3
oCLjuSCalVcBX9hGaJ7n
=98BB
-END PGP SIGNATURE-

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



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

2014-09-10 Thread markt
Author: markt
Date: Wed Sep 10 20:23:01 2014
New Revision: 1624110

URL: http://svn.apache.org/r1624110
Log:
Remove unused code (SourceFile)

Removed:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/SourceFile.java
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=1624110&r1=1624109&r2=1624110&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 Wed 
Sep 10 20:23:01 2014
@@ -33,7 +33,6 @@ import org.apache.tomcat.util.bcel.Const
  *
  * @author mailto:m.d...@gmx.de";>M. Dahm
  * @see ConstantValue
- * @see SourceFile
  * @see Code
  * @see ExceptionTable
  * @see LineNumberTable
@@ -104,7 +103,8 @@ public abstract class Attribute implemen
 case Constants.ATTR_CONSTANT_VALUE:
 return new ConstantValue(name_index, length, file, constant_pool);
 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);
 case Constants.ATTR_EXCEPTIONS:

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=1624110&r1=1624109&r2=1624110&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 Wed 
Sep 10 20:23:01 2014
@@ -188,4 +188,8 @@ final class Utility {
 file.readUnsignedShort();   // Unused access_flags
 }
 }
+
+static void swallowSourceFile(DataInput file) throws IOException {
+file.readUnsignedShort();   // Unused sourcefile_index
+}
 }



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



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

2014-09-10 Thread markt
Author: markt
Date: Wed Sep 10 20:25:59 2014
New Revision: 1624112

URL: http://svn.apache.org/r1624112
Log:
Remove unused code (ConstantValue)

Removed:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantValue.java
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=1624112&r1=1624111&r2=1624112&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 Wed 
Sep 10 20:25:59 2014
@@ -32,7 +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 Code
  * @see ExceptionTable
  * @see LineNumberTable
@@ -101,7 +100,8 @@ 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:
 Utility.swallowSourceFile(file);
 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=1624112&r1=1624111&r2=1624112&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 Wed 
Sep 10 20:25:59 2014
@@ -192,4 +192,8 @@ final class Utility {
 static void swallowSourceFile(DataInput file) throws IOException {
 file.readUnsignedShort();   // Unused sourcefile_index
 }
+
+static void swallowConstantValue(DataInput file) throws IOException {
+file.readUnsignedShort();   // Unused constantvalue_index
+}
 }



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



svn commit: r1624115 - in /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile: Attribute.java Code.java ExceptionTable.java LineNumberTable.java LocalVariableTable.java Utility.java

2014-09-10 Thread markt
Author: markt
Date: Wed Sep 10 20:33:20 2014
New Revision: 1624115

URL: http://svn.apache.org/r1624115
Log:
Remove unused code (Code)

Removed:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Code.java
Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ExceptionTable.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LineNumberTable.java

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTable.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=1624115&r1=1624114&r2=1624115&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 Wed 
Sep 10 20:33:20 2014
@@ -32,7 +32,6 @@ import org.apache.tomcat.util.bcel.Const
  * attribute stands for non-standard-attributes.
  *
  * @author mailto:m.d...@gmx.de";>M. Dahm
- * @see Code
  * @see ExceptionTable
  * @see LineNumberTable
  * @see LocalVariableTable
@@ -106,7 +105,8 @@ public abstract class Attribute implemen
 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);
 case Constants.ATTR_LINE_NUMBER_TABLE:

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ExceptionTable.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ExceptionTable.java?rev=1624115&r1=1624114&r2=1624115&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ExceptionTable.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ExceptionTable.java 
Wed Sep 10 20:33:20 2014
@@ -29,7 +29,6 @@ import java.io.IOException;
  * with the other classes).
  *
  * @author  mailto:m.d...@gmx.de";>M. Dahm
- * @see Code
  */
 public final class ExceptionTable extends Attribute {
 

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LineNumberTable.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LineNumberTable.java?rev=1624115&r1=1624114&r2=1624115&view=diff
==
--- 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LineNumberTable.java 
(original)
+++ 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LineNumberTable.java 
Wed Sep 10 20:33:20 2014
@@ -26,7 +26,6 @@ import java.io.IOException;
  * contains pairs of PCs and line numbers.
  *
  * @author  mailto:m.d...@gmx.de";>M. Dahm
- * @see Code
  */
 public final class LineNumberTable extends Attribute {
 

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTable.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTable.java?rev=1624115&r1=1624114&r2=1624115&view=diff
==
--- 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTable.java 
(original)
+++ 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTable.java 
Wed Sep 10 20:33:20 2014
@@ -25,7 +25,6 @@ import java.io.IOException;
  * method. This attribute is contained in the Code attribute.
  *
  * @author  mailto:m.d...@gmx.de";>M. Dahm
- * @see Code
  */
 public class LocalVariableTable extends Attribute {
 

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=1624115&r1=1624114&r2=1624115&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 Wed 
Sep 10 20:33:20 2014
@@ -196,4 +196,27 @@ final class Utility {
 static void swallowConstantValue(DataInput file) throws IOException {
 file.readUnsignedShort();   // Unused constantvalue_index
 }
+
+static void swallowCode(DataInputStream file, ConstantPool constant_pool) 
throws IOException {
+file.readUnsignedShort();   // Unused max_stack
+file.readUnsignedShort();   // Unused max_locals
+ 

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

2014-09-10 Thread markt
Author: markt
Date: Wed Sep 10 20:38:09 2014
New Revision: 1624116

URL: http://svn.apache.org/r1624116
Log:
Remove unused code (ExceptionTable)

Removed:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ExceptionTable.java
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=1624116&r1=1624115&r2=1624116&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 Wed 
Sep 10 20:38:09 2014
@@ -32,7 +32,6 @@ import org.apache.tomcat.util.bcel.Const
  * attribute stands for non-standard-attributes.
  *
  * @author mailto:m.d...@gmx.de";>M. Dahm
- * @see ExceptionTable
  * @see LineNumberTable
  * @see LocalVariableTable
  * @see InnerClasses
@@ -108,7 +107,8 @@ public abstract class Attribute implemen
 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);
 case Constants.ATTR_LOCAL_VARIABLE_TABLE:

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=1624116&r1=1624115&r2=1624116&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 Wed 
Sep 10 20:38:09 2014
@@ -217,6 +217,12 @@ final class Utility {
 for (int i = 0; i < attributes_count; i++) {
 Attribute.readAttribute(file, constant_pool);
 }
+}
 
+static void swallowExceptionTable(DataInput file) throws IOException {
+int number_of_exceptions = file.readUnsignedShort();
+for (int i = 0; i < number_of_exceptions; i++) {
+file.readUnsignedShort(); // Unused exception index
+}
 }
 }



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



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

2014-09-10 Thread markt
Author: markt
Date: Wed Sep 10 20:41:20 2014
New Revision: 1624119

URL: http://svn.apache.org/r1624119
Log:
Remove unused code (LineNumberTable)

Removed:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LineNumberTable.java
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=1624119&r1=1624118&r2=1624119&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 Wed 
Sep 10 20:41:20 2014
@@ -32,7 +32,6 @@ import org.apache.tomcat.util.bcel.Const
  * attribute stands for non-standard-attributes.
  *
  * @author mailto:m.d...@gmx.de";>M. Dahm
- * @see LineNumberTable
  * @see LocalVariableTable
  * @see InnerClasses
  * @see Deprecated
@@ -110,7 +109,8 @@ public abstract class Attribute implemen
 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);

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=1624119&r1=1624118&r2=1624119&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 Wed 
Sep 10 20:41:20 2014
@@ -225,4 +225,11 @@ final class Utility {
 file.readUnsignedShort(); // Unused exception index
 }
 }
+
+static void swallowLineNumberTable(DataInput file) throws IOException {
+int line_number_table_length = (file.readUnsignedShort());
+for (int i = 0; i < line_number_table_length; i++) {
+Utility.swallowLineNumber(file);
+}
+}
 }



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



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

2014-09-10 Thread markt
Author: markt
Date: Wed Sep 10 20:47:40 2014
New Revision: 1624122

URL: http://svn.apache.org/r1624122
Log:
Remove unused code (LocalVariableTable)

Removed:

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTable.java
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=1624122&r1=1624121&r2=1624122&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 Wed 
Sep 10 20:47:40 2014
@@ -32,7 +32,6 @@ import org.apache.tomcat.util.bcel.Const
  * attribute stands for non-standard-attributes.
  *
  * @author mailto:m.d...@gmx.de";>M. Dahm
- * @see LocalVariableTable
  * @see InnerClasses
  * @see Deprecated
  */
@@ -112,8 +111,8 @@ public abstract class Attribute implemen
 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);
 case Constants.ATTR_SYNTHETIC:

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=1624122&r1=1624121&r2=1624122&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 Wed 
Sep 10 20:47:40 2014
@@ -232,4 +232,11 @@ final class Utility {
 Utility.swallowLineNumber(file);
 }
 }
+
+static void swallowLocalVariableTable(DataInput file) throws IOException {
+int local_variable_table_length = (file.readUnsignedShort());
+for (int i = 0; i < local_variable_table_length; i++) {
+Utility.swallowLocalVariable(file);
+}
+}
 }



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



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

2014-09-10 Thread markt
Author: markt
Date: Wed Sep 10 20:51:54 2014
New Revision: 1624124

URL: http://svn.apache.org/r1624124
Log:
Remove unused code (InnerClasses)

Removed:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/InnerClasses.java
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=1624124&r1=1624123&r2=1624124&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 Wed 
Sep 10 20:51:54 2014
@@ -32,7 +32,6 @@ import org.apache.tomcat.util.bcel.Const
  * attribute stands for non-standard-attributes.
  *
  * @author mailto:m.d...@gmx.de";>M. Dahm
- * @see InnerClasses
  * @see Deprecated
  */
 public abstract class Attribute implements Cloneable, Serializable
@@ -114,7 +113,8 @@ public abstract class Attribute implemen
 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);
 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=1624124&r1=1624123&r2=1624124&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 Wed 
Sep 10 20:51:54 2014
@@ -239,4 +239,11 @@ final class Utility {
 Utility.swallowLocalVariable(file);
 }
 }
+
+static void swallowInnerClasses(DataInput file) throws IOException {
+int number_of_classes = file.readUnsignedShort();
+for (int i = 0; i < number_of_classes; i++) {
+Utility.swallowInnerClass(file);
+}
+}
 }



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



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

2014-09-10 Thread markt
Author: markt
Date: Wed Sep 10 20:57:56 2014
New Revision: 1624126

URL: http://svn.apache.org/r1624126
Log:
Remove unused code (Deprecated)

Removed:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Deprecated.java
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=1624126&r1=1624125&r2=1624126&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 Wed 
Sep 10 20:57:56 2014
@@ -32,7 +32,6 @@ import org.apache.tomcat.util.bcel.Const
  * attribute stands for non-standard-attributes.
  *
  * @author mailto:m.d...@gmx.de";>M. Dahm
- * @see Deprecated
  */
 public abstract class Attribute implements Cloneable, Serializable
 {
@@ -119,7 +118,8 @@ public abstract class Attribute implemen
 Utility.swallowSynthetic(file, length);
 return null;
 case Constants.ATTR_DEPRECATED:
-return new Deprecated(name_index, length, file, constant_pool);
+Utility.swallowDeprecated(file, length);
+return null;
 case Constants.ATTR_PMG:
 return new PMGClass(name_index, length, file, constant_pool);
 case Constants.ATTR_SIGNATURE:

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=1624126&r1=1624125&r2=1624126&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 Wed 
Sep 10 20:57:56 2014
@@ -246,4 +246,12 @@ final class Utility {
 Utility.swallowInnerClass(file);
 }
 }
+
+static void swallowDeprecated(DataInput file, int length) throws 
IOException {
+if (length > 0) {
+byte[] bytes = new byte[length];
+file.readFully(bytes);
+throw new ClassFormatException("Deprecated 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: r1624129 - in /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile: Attribute.java Utility.java

2014-09-10 Thread markt
Author: markt
Date: Wed Sep 10 20:59:30 2014
New Revision: 1624129

URL: http://svn.apache.org/r1624129
Log:
Fail fast

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=1624129&r1=1624128&r2=1624129&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 Wed 
Sep 10 20:59:30 2014
@@ -115,10 +115,10 @@ public abstract class Attribute implemen
 Utility.swallowInnerClasses(file);
 return null;
 case Constants.ATTR_SYNTHETIC:
-Utility.swallowSynthetic(file, length);
+Utility.swallowSynthetic(length);
 return null;
 case Constants.ATTR_DEPRECATED:
-Utility.swallowDeprecated(file, length);
+Utility.swallowDeprecated(length);
 return null;
 case Constants.ATTR_PMG:
 return new PMGClass(name_index, length, file, constant_pool);

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=1624129&r1=1624128&r2=1624129&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 Wed 
Sep 10 20:59:30 2014
@@ -162,10 +162,8 @@ final class Utility {
 file.readUnsignedShort();   // Unused signature_index
 }
 
-static void swallowSynthetic(DataInput file, int length) throws 
IOException {
+static void swallowSynthetic(int length) {
 if (length > 0) {
-byte[] bytes = new byte[length];
-file.readFully(bytes);
 throw new ClassFormatException("Synthetic attribute with length > 
0");
 }
 }
@@ -247,10 +245,8 @@ final class Utility {
 }
 }
 
-static void swallowDeprecated(DataInput file, int length) throws 
IOException {
+static void swallowDeprecated(int length) {
 if (length > 0) {
-byte[] bytes = new byte[length];
-file.readFully(bytes);
 throw new ClassFormatException("Deprecated 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: r1624130 - in /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile: Attribute.java PMGClass.java Utility.java

2014-09-10 Thread markt
Author: markt
Date: Wed Sep 10 21:01:15 2014
New Revision: 1624130

URL: http://svn.apache.org/r1624130
Log:
Remove unused code (PMGClass)

Removed:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/PMGClass.java
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=1624130&r1=1624129&r2=1624130&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 Wed 
Sep 10 21:01:15 2014
@@ -121,7 +121,8 @@ public abstract class Attribute implemen
 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/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=1624130&r1=1624129&r2=1624130&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 Wed 
Sep 10 21:01:15 2014
@@ -250,4 +250,9 @@ final class Utility {
 throw new ClassFormatException("Deprecated attribute with length > 
0");
 }
 }
+
+static void swallowPMCClass(DataInput file) throws IOException {
+file.readUnsignedShort();   // Unused pmg_index
+file.readUnsignedShort();   // Unused pmg_class_index
+}
 }



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



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

2014-09-10 Thread markt
Author: markt
Date: Wed Sep 10 21:03:28 2014
New Revision: 1624132

URL: http://svn.apache.org/r1624132
Log:
Remove unused code (LocalVariableTypeTable)

Removed:

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTypeTable.java
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=1624132&r1=1624131&r2=1624132&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 Wed 
Sep 10 21:03:28 2014
@@ -145,8 +145,8 @@ public abstract class Attribute implemen
 return new AnnotationDefault(name_index, length, file,
 constant_pool);
 case Constants.ATTR_LOCAL_VARIABLE_TYPE_TABLE:
-return new LocalVariableTypeTable(name_index, length, file,
-constant_pool);
+Utility.swallowLocalVariableTypeTable(file);
+return null;
 case Constants.ATTR_ENCLOSING_METHOD:
 return new EnclosingMethod(name_index, length, file, 
constant_pool);
 case Constants.ATTR_STACK_MAP_TABLE:

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=1624132&r1=1624131&r2=1624132&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 Wed 
Sep 10 21:03:28 2014
@@ -238,6 +238,13 @@ final class Utility {
 }
 }
 
+static void swallowLocalVariableTypeTable(DataInput file) throws 
IOException {
+int local_variable_type_table_length = (file.readUnsignedShort());
+for(int i=0; i < local_variable_type_table_length; i++) {
+Utility.swallowLocalVariable(file);
+}
+}
+
 static void swallowInnerClasses(DataInput file) throws IOException {
 int number_of_classes = file.readUnsignedShort();
 for (int i = 0; i < number_of_classes; i++) {



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



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

2014-09-10 Thread markt
Author: markt
Date: Wed Sep 10 21:05:38 2014
New Revision: 1624133

URL: http://svn.apache.org/r1624133
Log:
Remove unused code (EnclosingMethod)

Removed:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/EnclosingMethod.java
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=1624133&r1=1624132&r2=1624133&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 Wed 
Sep 10 21:05:38 2014
@@ -148,7 +148,8 @@ public abstract class Attribute implemen
 Utility.swallowLocalVariableTypeTable(file);
 return null;
 case Constants.ATTR_ENCLOSING_METHOD:
-return new EnclosingMethod(name_index, length, file, 
constant_pool);
+Utility.swallowEnclosingMethod(file);
+return null;
 case Constants.ATTR_STACK_MAP_TABLE:
 Utility.swallowStackMapTable(file);
 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=1624133&r1=1624132&r2=1624133&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 Wed 
Sep 10 21:05:38 2014
@@ -262,4 +262,9 @@ final class Utility {
 file.readUnsignedShort();   // Unused pmg_index
 file.readUnsignedShort();   // Unused pmg_class_index
 }
+
+static void swallowEnclosingMethod(DataInput file) throws IOException {
+file.readUnsignedShort();   // Unused class index
+file.readUnsignedShort();   // Unused method index
+}
 }



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



svn commit: r1624135 - /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java

2014-09-10 Thread markt
Author: markt
Date: Wed Sep 10 21:18:01 2014
New Revision: 1624135

URL: http://svn.apache.org/r1624135
Log:
Simplify. No functional change.

Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.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=1624135&r1=1624134&r2=1624135&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 
Wed Sep 10 21:18:01 2014
@@ -30,7 +30,7 @@ public abstract class Annotations extend
 
 private static final long serialVersionUID = 1L;
 
-private AnnotationEntry[] annotation_table;
+private final AnnotationEntry[] annotation_table;
 
 /**
  * @param name_index Index pointing to the name Code
@@ -38,8 +38,9 @@ public abstract class Annotations extend
  * @param file Input stream
  * @param constant_pool Array of constants
  */
-public Annotations(int name_index, int length, DataInputStream file, 
ConstantPool constant_pool) throws IOException {
-this(name_index, length, (AnnotationEntry[]) null, constant_pool);
+public Annotations(int name_index, int length, DataInputStream file,
+ConstantPool constant_pool) throws IOException {
+super(name_index, 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++) {
@@ -49,24 +50,6 @@ public abstract class Annotations extend
 
 
 /**
- * @param name_index Index pointing to the name Code
- * @param length Content length in bytes
- * @param annotation_table the actual annotations
- * @param constant_pool Array of constants
- */
-public Annotations(int name_index, int length, AnnotationEntry[] 
annotation_table, ConstantPool constant_pool) {
-super(name_index, length, constant_pool);
-setAnnotationTable(annotation_table);
-}
-
-/**
- * @param annotation_table the entries to set in this annotation
- */
-public final void setAnnotationTable( AnnotationEntry[] annotation_table ) 
{
-this.annotation_table = annotation_table;
-}
-
-/**
  * returns the array of annotation entries in this annotation
  */
 public AnnotationEntry[] getAnnotationEntries() {



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



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

2014-09-10 Thread markt
Author: markt
Date: Wed Sep 10 21:30:03 2014
New Revision: 1624139

URL: http://svn.apache.org/r1624139
Log:
Some constant types are never used so they can be swallowed which means 
returning null. That could trigger an NPE so make sure it doesn't.

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=1624139&r1=1624138&r2=1624139&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 
Wed Sep 10 21:30:03 2014
@@ -49,7 +49,6 @@ public class ConstantPool implements Clo
  * @throws ClassFormatException
  */
 ConstantPool(DataInputStream file) throws IOException, 
ClassFormatException {
-byte tag;
 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
@@ -64,9 +63,11 @@ public class ConstantPool implements Clo
  *
  * Thus we have to increment the index counter.
  */
-tag = constant_pool[i].getTag();
-if ((tag == Constants.CONSTANT_Double) || (tag == 
Constants.CONSTANT_Long)) {
-i++;
+if (constant_pool[i] != null) {
+byte tag = constant_pool[i].getTag();
+if ((tag == Constants.CONSTANT_Double) || (tag == 
Constants.CONSTANT_Long)) {
+i++;
+}
 }
 }
 }



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



svn commit: r1624142 - in /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile: Constant.java ConstantCP.java ConstantFieldref.java ConstantInterfaceMethodref.java ConstantMethodref.java ConstantP

2014-09-10 Thread markt
Author: markt
Date: Wed Sep 10 21:56:03 2014
New Revision: 1624142

URL: http://svn.apache.org/r1624142
Log:
Remove unused code (ConstantCP and sub-classes)

Removed:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantCP.java

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

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

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodref.java
Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java
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/Constant.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java?rev=1624142&r1=1624141&r2=1624142&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 Wed 
Sep 10 21:56:03 2014
@@ -98,11 +98,10 @@ public abstract class Constant implement
 case Constants.CONSTANT_Class:
 return new ConstantClass(file);
 case Constants.CONSTANT_Fieldref:
-return new ConstantFieldref(file);
 case Constants.CONSTANT_Methodref:
-return new ConstantMethodref(file);
 case Constants.CONSTANT_InterfaceMethodref:
-return new ConstantInterfaceMethodref(file);
+Utility.swallowConstantCP(file);
+return null;
 case Constants.CONSTANT_String:
 return new ConstantString(file);
 case Constants.CONSTANT_Integer:

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=1624142&r1=1624141&r2=1624142&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 
Wed Sep 10 21:56:03 2014
@@ -115,13 +115,6 @@ public class ConstantPool implements Clo
 + " " + constantToString(((ConstantNameAndType) 
c).getSignatureIndex(),
 Constants.CONSTANT_Utf8));
 break;
-case Constants.CONSTANT_InterfaceMethodref:
-case Constants.CONSTANT_Methodref:
-case Constants.CONSTANT_Fieldref:
-str = (constantToString(((ConstantCP) c).getClassIndex(), 
Constants.CONSTANT_Class)
-+ "." + constantToString(((ConstantCP) 
c).getNameAndTypeIndex(),
-Constants.CONSTANT_NameAndType));
-break;
 default: // Never reached
 throw new RuntimeException("Unknown constant type " + 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=1624142&r1=1624141&r2=1624142&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 Wed 
Sep 10 21:56:03 2014
@@ -267,4 +267,9 @@ final class Utility {
 file.readUnsignedShort();   // Unused class index
 file.readUnsignedShort();   // Unused method index
 }
+
+static void swallowConstantCP(DataInput file) throws IOException {
+file.readUnsignedShort();   // Unused class index
+file.readUnsignedShort();   // Unused name and type index
+}
 }



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



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

2014-09-10 Thread markt
Author: markt
Date: Wed Sep 10 21:58:09 2014
New Revision: 1624143

URL: http://svn.apache.org/r1624143
Log:
Remove unused code (ConstantMethodHandle)

Removed:

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodHandle.java
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=1624143&r1=1624142&r2=1624143&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 Wed 
Sep 10 21:58:09 2014
@@ -117,7 +117,8 @@ public abstract class Constant implement
 case Constants.CONSTANT_Utf8:
 return ConstantUtf8.getInstance(file);
 case Constants.CONSTANT_MethodHandle:
-return new ConstantMethodHandle(file);
+Utility.swallowConstantMethodHandle(file);
+return null;
 case Constants.CONSTANT_MethodType:
 return new ConstantMethodType(file);
 case Constants.CONSTANT_InvokeDynamic:

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=1624143&r1=1624142&r2=1624143&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 Wed 
Sep 10 21:58:09 2014
@@ -272,4 +272,9 @@ final class Utility {
 file.readUnsignedShort();   // Unused class index
 file.readUnsignedShort();   // Unused name and type index
 }
+
+static void swallowConstantMethodHandle(DataInput file) throws IOException 
{
+file.readUnsignedByte();// Unused reference_kind
+file.readUnsignedShort();   // Unused reference_index
+}
 }



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



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

2014-09-10 Thread markt
Author: markt
Date: Wed Sep 10 22:14:25 2014
New Revision: 1624147

URL: http://svn.apache.org/r1624147
Log:
Remove unused code (ConstantString)

Removed:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantString.java
Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java
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/Constant.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java?rev=1624147&r1=1624146&r2=1624147&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 Wed 
Sep 10 22:14:25 2014
@@ -103,7 +103,8 @@ public abstract class Constant implement
 Utility.swallowConstantCP(file);
 return null;
 case Constants.CONSTANT_String:
-return new ConstantString(file);
+Utility.swallowConstantString(file);
+return null;
 case Constants.CONSTANT_Integer:
 return new ConstantInteger(file);
 case Constants.CONSTANT_Float:

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=1624147&r1=1624146&r2=1624147&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 
Wed Sep 10 22:14:25 2014
@@ -89,11 +89,6 @@ public class ConstantPool implements Clo
 c = getConstant(i, Constants.CONSTANT_Utf8);
 str = Utility.compactClassName(((ConstantUtf8) c).getBytes());
 break;
-case Constants.CONSTANT_String:
-i = ((ConstantString) c).getStringIndex();
-c = getConstant(i, Constants.CONSTANT_Utf8);
-str = "\"" + escape(((ConstantUtf8) c).getBytes()) + "\"";
-break;
 case Constants.CONSTANT_Utf8:
 str = ((ConstantUtf8) c).getBytes();
 break;
@@ -122,35 +117,6 @@ public class ConstantPool implements Clo
 }
 
 
-private static String escape( String str ) {
-int len = str.length();
-StringBuilder buf = new StringBuilder(len + 5);
-char[] ch = str.toCharArray();
-for (int i = 0; i < len; i++) {
-switch (ch[i]) {
-case '\n':
-buf.append("\\n");
-break;
-case '\r':
-buf.append("\\r");
-break;
-case '\t':
-buf.append("\\t");
-break;
-case '\b':
-buf.append("\\b");
-break;
-case '"':
-buf.append("\\\"");
-break;
-default:
-buf.append(ch[i]);
-}
-}
-return buf.toString();
-}
-
-
 /**
  * Retrieve constant at `index' from constant pool and resolve it to
  * a string representation.
@@ -215,30 +181,17 @@ public class ConstantPool implements Clo
  * @param  tag Tag of expected constant, either ConstantClass or 
ConstantString
  * @return Contents of string reference
  * @seeConstantClass
- * @seeConstantString
  * @throws  ClassFormatException
  */
 public String getConstantString( int index, byte tag ) throws 
ClassFormatException {
-Constant c;
-int i;
-c = getConstant(index, tag);
-/* This switch() is not that elegant, since the two classes have the
- * same contents, they just differ in the name of the index
- * field variable.
- * But we want to stick to the JVM naming conventions closely though
- * we could have solved these more elegantly by using the same
- * variable name or by subclassing.
- */
-switch (tag) {
-case Constants.CONSTANT_Class:
-i = ((ConstantClass) c).getNameIndex();
-break;
-case Constants.CONSTANT_String:
-i = ((ConstantString) c).getStringIndex();
-break;
-default:
-throw new RuntimeException("getConstantString called with 
illegal tag " + tag);
+Constant c = getConstant(index, tag);
+
+if (Constants.CONSTANT_Class != tag) {
+throw new RuntimeException("getCo

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

2014-09-10 Thread markt
Author: markt
Date: Wed Sep 10 22:16:52 2014
New Revision: 1624150

URL: http://svn.apache.org/r1624150
Log:
Remove unused code (ConstantNameAndType)

Removed:

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantNameAndType.java
Modified:
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java
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/Constant.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java?rev=1624150&r1=1624149&r2=1624150&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 Wed 
Sep 10 22:16:52 2014
@@ -114,7 +114,8 @@ public abstract class Constant implement
 case Constants.CONSTANT_Double:
 return new ConstantDouble(file);
 case Constants.CONSTANT_NameAndType:
-return new ConstantNameAndType(file);
+Utility.swallowConstantNameAndType(file);
+return null;
 case Constants.CONSTANT_Utf8:
 return ConstantUtf8.getInstance(file);
 case Constants.CONSTANT_MethodHandle:

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=1624150&r1=1624149&r2=1624150&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 
Wed Sep 10 22:16:52 2014
@@ -104,12 +104,6 @@ public class ConstantPool implements Clo
 case Constants.CONSTANT_Integer:
 str = String.valueOf(((ConstantInteger) c).getBytes());
 break;
-case Constants.CONSTANT_NameAndType:
-str = (constantToString(((ConstantNameAndType) 
c).getNameIndex(),
-Constants.CONSTANT_Utf8)
-+ " " + constantToString(((ConstantNameAndType) 
c).getSignatureIndex(),
-Constants.CONSTANT_Utf8));
-break;
 default: // Never reached
 throw new RuntimeException("Unknown constant type " + 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=1624150&r1=1624149&r2=1624150&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 Wed 
Sep 10 22:16:52 2014
@@ -281,4 +281,9 @@ final class Utility {
 static void swallowConstantString(DataInput file) throws IOException {
 file.readUnsignedShort();   // Unused string index
 }
+
+static void swallowConstantNameAndType(DataInput file) throws IOException {
+file.readUnsignedShort();   // Unused name index
+file.readUnsignedShort();   // Unused signature index
+}
 }



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



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

2014-09-10 Thread markt
Author: markt
Date: Wed Sep 10 22:19:00 2014
New Revision: 1624152

URL: http://svn.apache.org/r1624152
Log:
Remove unused code (ConstantMethodType)

Removed:

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodType.java
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=1624152&r1=1624151&r2=1624152&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 Wed 
Sep 10 22:19:00 2014
@@ -122,7 +122,8 @@ public abstract class Constant implement
 Utility.swallowConstantMethodHandle(file);
 return null;
 case Constants.CONSTANT_MethodType:
-return new ConstantMethodType(file);
+Utility.swallowConstantMethodType(file);
+return null;
 case Constants.CONSTANT_InvokeDynamic:
 return new ConstantInvokeDynamic(file);
 default:

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=1624152&r1=1624151&r2=1624152&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 Wed 
Sep 10 22:19:00 2014
@@ -286,4 +286,8 @@ final class Utility {
 file.readUnsignedShort();   // Unused name index
 file.readUnsignedShort();   // Unused signature index
 }
+
+static void swallowConstantMethodType(DataInput file) throws IOException {
+file.readUnsignedShort();   // Unused descriptor_index
+}
 }



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



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

2014-09-10 Thread markt
Author: markt
Date: Wed Sep 10 22:20:57 2014
New Revision: 1624155

URL: http://svn.apache.org/r1624155
Log:
Remove unused code (ConstantInvokeDynamic)

Removed:

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInvokeDynamic.java
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=1624155&r1=1624154&r2=1624155&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 Wed 
Sep 10 22:20:57 2014
@@ -125,7 +125,8 @@ public abstract class Constant implement
 Utility.swallowConstantMethodType(file);
 return null;
 case Constants.CONSTANT_InvokeDynamic:
-return new ConstantInvokeDynamic(file);
+Utility.swallowConstantInvokeDynamic(file);
+return null;
 default:
 throw new ClassFormatException("Invalid byte tag in constant 
pool: " + b);
 }

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=1624155&r1=1624154&r2=1624155&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 Wed 
Sep 10 22:20:57 2014
@@ -290,4 +290,9 @@ final class Utility {
 static void swallowConstantMethodType(DataInput file) throws IOException {
 file.readUnsignedShort();   // Unused descriptor_index
 }
+
+static void swallowConstantInvokeDynamic(DataInput file) throws 
IOException {
+file.readUnsignedShort();   // Unused bootstrap_method_attr_index
+file.readUnsignedShort();   // Unused name_and_type_index
+}
 }



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



svn commit: r1624156 - /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java

2014-09-10 Thread markt
Author: markt
Date: Wed Sep 10 22:27:25 2014
New Revision: 1624156

URL: http://svn.apache.org/r1624156
Log:
Simplify. No functional change.

Modified:

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.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=1624156&r1=1624155&r2=1624156&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 
Wed Sep 10 22:27:25 2014
@@ -44,25 +44,8 @@ public class AnnotationDefault extends A
 DataInputStream file, ConstantPool constant_pool)
 throws IOException
 {
-this(name_index, length, (ElementValue) null,
-constant_pool);
+super(name_index, length, 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);
-}
 }



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



svn commit: r1624157 - in /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile: Attribute.java Constant.java ConstantPool.java FieldOrMethod.java JavaClass.java

2014-09-10 Thread markt
Author: markt
Date: Wed Sep 10 22:28:01 2014
New Revision: 1624157

URL: http://svn.apache.org/r1624157
Log:
Remove unused clone() methods and references to Cloneable

Modified:
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/ConstantPool.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/FieldOrMethod.java
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/JavaClass.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=1624157&r1=1624156&r2=1624157&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 Wed 
Sep 10 22:28:01 2014
@@ -33,7 +33,7 @@ import org.apache.tomcat.util.bcel.Const
  *
  * @author mailto:m.d...@gmx.de";>M. Dahm
  */
-public abstract class Attribute implements Cloneable, Serializable
+public abstract class Attribute implements Serializable
 {
 private static final long serialVersionUID = 1514136303496688899L;
 
@@ -173,27 +173,4 @@ public abstract class Attribute implemen
 Constants.CONSTANT_Utf8);
 return c.getBytes();
 }
-
-
-/**
- * Use copy() if you want to have a deep copy(), i.e., with all references
- * copied correctly.
- *
- * @return shallow copy of this attribute
- */
-@Override
-public Attribute clone()
-{
-Attribute attr = null;
-try
-{
-attr = (Attribute) super.clone();
-}
-catch (CloneNotSupportedException e)
-{
-throw new Error("Clone Not Supported"); // never happens
-}
-return attr;
-}
-
 }

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=1624157&r1=1624156&r2=1624157&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 Wed 
Sep 10 22:28:01 2014
@@ -31,7 +31,7 @@ import org.apache.tomcat.util.bcel.util.
  *
  * @author  mailto:m.d...@gmx.de";>M. Dahm
  */
-public abstract class Constant implements Cloneable, Serializable {
+public abstract class Constant implements Serializable {
 
 private static final long serialVersionUID = 2827409182154809454L;
 private static BCELComparator _cmp = new BCELComparator() {
@@ -75,16 +75,6 @@ public abstract class Constant implement
 }
 
 
-@Override
-public Object clone() {
-try {
-return super.clone();
-} catch (CloneNotSupportedException e) {
-throw new Error("Clone Not Supported"); // never happens
-}
-}
-
-
 /**
  * Read one constant from the given file, the type depends on a tag byte.
  *

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=1624157&r1=1624156&r2=1624157&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 
Wed Sep 10 22:28:01 2014
@@ -34,7 +34,7 @@ import org.apache.tomcat.util.bcel.Const
  * @see Constant
  * @author mailto:m.d...@gmx.de";>M. Dahm
  */
-public class ConstantPool implements Cloneable, Serializable {
+public class ConstantPool implements Serializable {
 
 private static final long serialVersionUID = -6765503791185687014L;
 private int constant_pool_count;

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/FieldOrMethod.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/FieldOrMethod.java?rev=1624157&r1=1624156&r2=1624157&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/FieldOrMethod.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/FieldOrMethod.java 
Wed Sep 10 22:28:01 2014
@@ -28,7 +28,7 @@ import org.apache.tomcat.util.bcel.util.
  *
  * @author  mailto:m.d...@gmx.de";>M. Dahm
  */
-public class FieldOrMethod extends AccessFlags implements Cloneable {
+public class FieldOrMethod extends AccessFlags {
 
 private static final long serialVersionUID = -3383525930205542

svn commit: r1624162 - in /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile: ConstantClass.java ConstantDouble.java ConstantFloat.java ConstantInteger.java ConstantLong.java

2014-09-10 Thread markt
Author: markt
Date: Wed Sep 10 22:41:48 2014
New Revision: 1624162

URL: http://svn.apache.org/r1624162
Log:
Simplify constructors. No functional change.

Modified:
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

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java?rev=1624162&r1=1624161&r2=1624162&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java 
Wed Sep 10 22:41:48 2014
@@ -43,17 +43,8 @@ public final class ConstantClass extends
  * @throws IOException
  */
 ConstantClass(DataInput file) throws IOException {
-this(file.readUnsignedShort());
-}
-
-
-/**
- * @param name_index Name index in constant pool.  Should refer to a
- * ConstantUtf8.
- */
-public ConstantClass(int name_index) {
 super(Constants.CONSTANT_Class);
-this.name_index = name_index;
+this.name_index = file.readUnsignedShort();
 }
 
 

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantDouble.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantDouble.java?rev=1624162&r1=1624161&r2=1624162&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantDouble.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantDouble.java 
Wed Sep 10 22:41:48 2014
@@ -37,22 +37,14 @@ public final class ConstantDouble extend
 
 
 /**
- * @param bytes Data
- */
-public ConstantDouble(double bytes) {
-super(Constants.CONSTANT_Double);
-this.bytes = bytes;
-}
-
-
-/**
  * Initialize instance from file data.
  *
  * @param file Input stream
  * @throws IOException
  */
 ConstantDouble(DataInput file) throws IOException {
-this(file.readDouble());
+super(Constants.CONSTANT_Double);
+this.bytes = file.readDouble();
 }
 
 

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantFloat.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantFloat.java?rev=1624162&r1=1624161&r2=1624162&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantFloat.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantFloat.java 
Wed Sep 10 22:41:48 2014
@@ -37,22 +37,14 @@ public final class ConstantFloat extends
 
 
 /**
- * @param bytes Data
- */
-public ConstantFloat(float bytes) {
-super(Constants.CONSTANT_Float);
-this.bytes = bytes;
-}
-
-
-/**
  * Initialize instance from file data.
  *
  * @param file Input stream
  * @throws IOException
  */
 ConstantFloat(DataInput file) throws IOException {
-this(file.readFloat());
+super(Constants.CONSTANT_Float);
+this.bytes = file.readFloat();
 }
 
 

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInteger.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInteger.java?rev=1624162&r1=1624161&r2=1624162&view=diff
==
--- 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInteger.java 
(original)
+++ 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInteger.java 
Wed Sep 10 22:41:48 2014
@@ -37,22 +37,14 @@ public final class ConstantInteger exten
 
 
 /**
- * @param bytes Data
- */
-public ConstantInteger(int bytes) {
-super(Constants.CONSTANT_Integer);
-this.bytes = bytes;
-}
-
-
-/**
  * Initialize instance from file data.
  *
  * @param file Input stream
  * @throws IOException
  */
 ConstantInteger(DataInput file) throws IOException {
-this(file.readInt());
+super(Constants.CONSTANT_Integer);
+this.bytes = file.readInt();
 }
 
 

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantLong.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantLong.java?rev=1624162&

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

2014-09-10 Thread markt
Author: markt
Date: Wed Sep 10 22:42:12 2014
New Revision: 1624163

URL: http://svn.apache.org/r1624163
Log:
Remove unused code.

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=1624163&r1=1624162&r2=1624163&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 
Wed Sep 10 22:42:12 2014
@@ -16,7 +16,6 @@
  */
 package org.apache.tomcat.util.bcel.classfile;
 
-import java.io.DataInput;
 import java.io.DataInputStream;
 import java.io.IOException;
 import java.util.HashMap;
@@ -73,17 +72,6 @@ public final class ConstantUtf8 extends 
 return getInstance(file.readUTF());
 }
 
-/**
- * Initialize instance from file data.
- *
- * @param file Input stream
- * @throws IOException
- */
-ConstantUtf8(DataInput file) throws IOException {
-super(Constants.CONSTANT_Utf8);
-bytes = file.readUTF();
-}
-
 
 /**
  * @param bytes Data



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



svn commit: r1624164 - /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/FieldOrMethod.java

2014-09-10 Thread markt
Author: markt
Date: Wed Sep 10 22:42:31 2014
New Revision: 1624164

URL: http://svn.apache.org/r1624164
Log:
Simplify constructors. No functional change.

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

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/FieldOrMethod.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/FieldOrMethod.java?rev=1624164&r1=1624163&r2=1624164&view=diff
==
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/FieldOrMethod.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/FieldOrMethod.java 
Wed Sep 10 22:42:31 2014
@@ -56,9 +56,6 @@ public class FieldOrMethod extends Acces
 
 protected ConstantPool constant_pool;
 
-FieldOrMethod() {
-}
-
 
 /**
  * Construct object from file stream.
@@ -68,8 +65,11 @@ public class FieldOrMethod extends Acces
  */
 protected FieldOrMethod(DataInputStream file, ConstantPool constant_pool) 
throws IOException,
 ClassFormatException {
-this(file.readUnsignedShort(), file.readUnsignedShort(), 
file.readUnsignedShort(), null,
-constant_pool);
+this.access_flags = file.readUnsignedShort();
+this.name_index = file.readUnsignedShort();
+this.signature_index = file.readUnsignedShort();
+this.constant_pool = constant_pool;
+
 attributes_count = file.readUnsignedShort();
 attributes = new Attribute[attributes_count];
 for (int i = 0; i < attributes_count; i++) {
@@ -79,23 +79,6 @@ public class FieldOrMethod extends Acces
 
 
 /**
- * @param access_flags Access rights of method
- * @param name_index Points to field name in constant pool
- * @param signature_index Points to encoded signature
- * @param attributes Collection of attributes
- * @param constant_pool Array of constants
- */
-protected FieldOrMethod(int access_flags, int name_index, int 
signature_index,
-Attribute[] attributes, ConstantPool constant_pool) {
-this.access_flags = access_flags;
-this.name_index = name_index;
-this.signature_index = signature_index;
-this.constant_pool = constant_pool;
-setAttributes(attributes);
-}
-
-
-/**
  * @param attributes Collection of object attributes.
  */
 public final void setAttributes( Attribute[] attributes ) {



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



svn commit: r1624165 - /tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java

2014-09-10 Thread markt
Author: markt
Date: Wed Sep 10 22:42:49 2014
New Revision: 1624165

URL: http://svn.apache.org/r1624165
Log:
Simplify constructors. No functional change.

Modified:

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

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java?rev=1624165&r1=1624164&r2=1624165&view=diff
==
--- 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java
 (original)
+++ 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java
 Wed Sep 10 22:42:49 2014
@@ -41,8 +41,7 @@ public abstract class ParameterAnnotatio
  */
 ParameterAnnotations(int name_index, int length,
 DataInputStream file, ConstantPool constant_pool) throws 
IOException {
-this(name_index, length, (ParameterAnnotationEntry[]) null,
-constant_pool);
+super(name_index, length, constant_pool);
 num_parameters = (file.readUnsignedByte());
 parameter_annotation_table = new 
ParameterAnnotationEntry[num_parameters];
 for (int i = 0; i < num_parameters; i++) {
@@ -52,19 +51,6 @@ public abstract class ParameterAnnotatio
 
 
 /**
- * @param name_index Index pointing to the name Code
- * @param length Content length in bytes
- * @param parameter_annotation_table the actual parameter annotations
- * @param constant_pool Array of constants
- */
-public ParameterAnnotations(int name_index, int length,
-ParameterAnnotationEntry[] parameter_annotation_table, 
ConstantPool constant_pool) {
-super(name_index, length, constant_pool);
-setParameterAnnotationTable(parameter_annotation_table);
-}
-
-
-/**
  * @param parameter_annotation_table the entries to set in this parameter 
annotation
  */
 public final void setParameterAnnotationTable(



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



[Bug 56952] New: Move JasperInitializer into separate jar

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

Bug ID: 56952
   Summary: Move JasperInitializer into separate jar
   Product: Tomcat 8
   Version: 8.0.12
  Hardware: All
OS: All
Status: NEW
  Severity: normal
  Priority: P2
 Component: Jasper
  Assignee: dev@tomcat.apache.org
  Reporter: j...@mortbay.com

The SCI JasperInitializer is inside the jasper.jar. Other containers that want
to use tomcat jasper may need to provide their own SCI in order to correctly
initializer jasper in their environment.

This is the case eg for Jetty. Currently we have to repackage the jasper.jar
artifact to strip out the SCI, so our own subclass of JasperInitializer can be
called instead.

It would be great if the JasperInitializer could be moved into its own jar so
that we could consume the jasper.jar directly.

regards
Jan

-- 
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] New: A improvement for "DataInputStream"

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

Bug ID: 56953
   Summary: A improvement for "DataInputStream"
   Product: Tomcat 7
   Version: trunk
  Hardware: PC
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: Catalina
  Assignee: dev@tomcat.apache.org
  Reporter: hzha...@ebay.com

Created attachment 31993
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=31993&action=edit
patch

The method "readUnsignedShort()" of "DataInputStream" read the stream twice to
get the unsigned short. This happens even if the "BufferedInputStream" is
invoked.

public final int readUnsignedShort() throws IOException {
int ch1 = in.read();
int ch2 = in.read();
if ((ch1 | ch2) < 0)
throw new EOFException();
return (ch1 << 8) + (ch2 << 0);
}

It may cause extra cost for some boundary processing. This case also appears in
"readInt", "readChar", etc. It is obvious in some large projects.

Use a interface to replace "DataInputStream" by "FastDataInputStream" can
bypass these processes. The "FastDataInputStream" gets the bytes from buffer
directly.

//== method in FastDataInputStream. ==
public int readUnsignedShort() throws IOException{

if(pos + 1 >= cnt) {
fill();
if(pos + 1 >= cnt) throw new EOFException();
}

int ch1 = this.buf[pos++] & 0xff;
int ch2 = this.buf[pos++] & 0xff;
return (ch1 << 8) + (ch2 << 0);
}

Benefit shows bellow, it is got from the test case in attachment.
=lots of jar files=
DataInputStream: 592
FastDataInputStream: 488
=few jar files=
DataInputStream: 93
FastDataInputStream: 77

notice: The optimized method is called before original method in the test case,
so the real result should be more obvious.

-- 
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-10 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=56953

--- Comment #1 from hzha...@ebay.com ---
Created attachment 31994
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=31994&action=edit
test case

-- 
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-10 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=56953

hzha...@ebay.com changed:

   What|Removed |Added

  Attachment #31993|0   |1
   is patch||

-- 
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