[tomcat] branch master updated: Parse annotations on fields or methods
This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/master by this push: new 7ff693d Parse annotations on fields or methods 7ff693d is described below commit 7ff693d5075ddfb2581fe7df911fc686dc535124 Author: remm AuthorDate: Mon Apr 19 10:49:04 2021 +0200 Parse annotations on fields or methods BZ 65244: Use that info for HandlesTypes since it is supposed to also include annotations used on fields and methods. --- .../org/apache/catalina/startup/ContextConfig.java | 2 +- .../tomcat/util/bcel/classfile/ClassParser.java| 43 -- .../tomcat/util/bcel/classfile/JavaClass.java | 35 +- .../apache/tomcat/util/bcel/classfile/Utility.java | 13 --- webapps/docs/changelog.xml | 4 ++ 5 files changed, 71 insertions(+), 26 deletions(-) diff --git a/java/org/apache/catalina/startup/ContextConfig.java b/java/org/apache/catalina/startup/ContextConfig.java index bc68499..058d412 100644 --- a/java/org/apache/catalina/startup/ContextConfig.java +++ b/java/org/apache/catalina/startup/ContextConfig.java @@ -2426,7 +2426,7 @@ public class ContextConfig implements LifecycleListener { } if (handlesTypesAnnotations) { -AnnotationEntry[] annotationEntries = javaClass.getAnnotationEntries(); +AnnotationEntry[] annotationEntries = javaClass.getAllAnnotationEntries(); if (annotationEntries != null) { for (Map.Entry, Set> entry : typeInitializerMap.entrySet()) { diff --git a/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java b/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java index 303be90..89dab31 100644 --- a/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java +++ b/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java @@ -22,6 +22,8 @@ import java.io.DataInput; import java.io.DataInputStream; import java.io.IOException; import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; import org.apache.tomcat.util.bcel.Const; @@ -47,6 +49,7 @@ public final class ClassParser { private String[] interfaceNames; // Names of implemented interfaces private ConstantPool constantPool; // collection of constants private Annotations runtimeVisibleAnnotations; // "RuntimeVisibleAnnotations" attribute defined in the class +private List runtimeVisibleMethodOfFieldAnnotations; // "RuntimeVisibleAnnotations" attribute defined elsewhere private static final int BUFSIZE = 8192; private static final String[] INTERFACES_EMPTY_ARRAY = new String[0]; @@ -91,41 +94,49 @@ public final class ClassParser { // Read class methods, i.e., the functions in the class readMethods(); // Read class attributes -readAttributes(); +readAttributes(false); // Return the information we have gathered in a new object return new JavaClass(class_name, superclassName, accessFlags, constantPool, interfaceNames, -runtimeVisibleAnnotations); +runtimeVisibleAnnotations, runtimeVisibleMethodOfFieldAnnotations); } /** * Reads information about the attributes of the class. + * @param fieldOrMethod false if processing a class * @throws IOException * @throws ClassFormatException */ -private void readAttributes() throws IOException, ClassFormatException { +private void readAttributes(boolean fieldOrMethod) throws IOException, ClassFormatException { final int attributes_count = dataInputStream.readUnsignedShort(); for (int i = 0; i < attributes_count; i++) { ConstantUtf8 c; String name; int name_index; int length; -// Get class name from constant pool via `name_index' indirection +// Get class name from constant pool via 'name_index' indirection name_index = dataInputStream.readUnsignedShort(); c = (ConstantUtf8) constantPool.getConstant(name_index, Const.CONSTANT_Utf8); name = c.getBytes(); // Length of data in bytes length = dataInputStream.readInt(); - if (name.equals("RuntimeVisibleAnnotations")) { -if (runtimeVisibleAnnotations != null) { -throw new ClassFormatException( -"RuntimeVisibleAnnotations attribute is not allowed more than once in a class file"); +if (fieldOrMethod) { +Annotations fieldOrMethodAnnotations = new Annotations(dataInputStream, constantPool); +if (runtimeVisibleMethodOfFieldAnnotations == null) { +runtimeVisible
[Bug 65244] annotations from @HandlesTypes are checked only at class level when scanning
https://bz.apache.org/bugzilla/show_bug.cgi?id=65244 --- Comment #12 from Remy Maucherat --- I added simple code in 10 to handle this. If it works ok without regressions, even unintended ones, it can be backported. -- 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 65250] New: Find the best information on cash app customer service
https://bz.apache.org/bugzilla/show_bug.cgi?id=65250 Bug ID: 65250 Summary: Find the best information on cash app customer service Product: Tomcat Native Version: 1.2.26 Hardware: PC Status: NEW Severity: normal Priority: P2 Component: Library Assignee: dev@tomcat.apache.org Reporter: mw8...@gmail.com Target Milestone: --- No matter whether you are facing cash app payment-related issues or don’t know how to use the cash app and how to find customer support from the cash app. Just take your phone and dial our cash app customer service. A representative will receive your call and provide the best solution to our users. https://www.cashappgroups.com/ -- 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 65244] annotations from @HandlesTypes are checked only at class level when scanning
https://bz.apache.org/bugzilla/show_bug.cgi?id=65244 --- Comment #13 from Mark Thomas --- Using my Jira based test the impact of this change is an increase in scan time of ~2.3%. That is a lot lower than I expected and small enough that I'd have no objection to the patch standing as is. I really like that the patch achieved this while retaining backwards compatibility. -- 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 65244] annotations from @HandlesTypes are checked only at class level when scanning
https://bz.apache.org/bugzilla/show_bug.cgi?id=65244 --- Comment #14 from romain.manni-bucau --- Hi Mark and Rémy, I'm not sure I got your last comment since the patch on 10.0.6-dev breaks the backward compatibility as such (ie you run a working app on 10.0.5 and then upgrade on 1.0.0.6-dev and the app does not start anymore). Is the toggle still planned? Just to make it clear here is a sample: https://gist.github.com/rmannibucau/7ff2bea1e4ca1f3204a16e84afee5f87 -- 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 65244] annotations from @HandlesTypes are checked only at class level when scanning
https://bz.apache.org/bugzilla/show_bug.cgi?id=65244 --- Comment #15 from Mark Thomas --- I see no need to make this configurable at this point. My default position for specification compliance related issues such as this is that it is better for applications to fix their bugs than for Tomcat to add a configuration option to allow the non-compliance to continue. I'd make an exception if the bug was in a widely used library and that library refused to fix the bug - but that seems unlikely in this 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 65244] annotations from @HandlesTypes are checked only at class level when scanning
https://bz.apache.org/bugzilla/show_bug.cgi?id=65244 --- Comment #16 from romain.manni-bucau --- Ok, let's do it in lazy mode (can it be highlighted in the release announce mail though please?) -- 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 65244] annotations from @HandlesTypes are checked only at class level when scanning
https://bz.apache.org/bugzilla/show_bug.cgi?id=65244 --- Comment #17 from Grzegorz Grzybek --- By the way, I checked that in Jetty there are org.eclipse.jetty.annotations.AnnotationParser.MyFieldVisitor/MyMethodVisitor/MyClassVisitor visitors that handle each 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 65244] annotations from @HandlesTypes are checked only at class level when scanning
https://bz.apache.org/bugzilla/show_bug.cgi?id=65244 --- Comment #18 from Remy Maucherat --- (In reply to romain.manni-bucau from comment #14) > Hi Mark and Rémy, > > I'm not sure I got your last comment since the patch on 10.0.6-dev breaks > the backward compatibility as such (ie you run a working app on 10.0.5 and > then upgrade on 1.0.0.6-dev and the app does not start anymore). > Is the toggle still planned? > > Just to make it clear here is a sample: > https://gist.github.com/rmannibucau/7ff2bea1e4ca1f3204a16e84afee5f87 That's a good test case idea actually. I'll see if I can do something about adding this to the testsuite. I would also vote to not add a flag for 10 even though it's incompatible, since it's a bug. Maybe for 9 depending on further feedback. Adding the flag is very easy to do if needed. -- 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
[tomcat] branch master updated: Remove unnecessary code
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/master by this push: new 77eb2a7 Remove unnecessary code 77eb2a7 is described below commit 77eb2a72cc89b2d9dd2ca76b395f4671b2e35ac3 Author: Mark Thomas AuthorDate: Mon Apr 19 14:27:53 2021 +0100 Remove unnecessary code --- java/org/apache/jasper/compiler/Generator.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/java/org/apache/jasper/compiler/Generator.java b/java/org/apache/jasper/compiler/Generator.java index 7af2ccc..0f47b54 100644 --- a/java/org/apache/jasper/compiler/Generator.java +++ b/java/org/apache/jasper/compiler/Generator.java @@ -1346,8 +1346,10 @@ class Generator { // and (for Java 9+) in an exported module int modifiers = bean.getModifiers(); JreCompat jreCompat = JreCompat.getInstance(); +// No need to test for being an interface here as the +// getConstructor() call above will have already failed for +// any interfaces. if (!Modifier.isPublic(modifiers) || -Modifier.isInterface(modifiers) || Modifier.isAbstract(modifiers) || !jreCompat.canAccess(null, constructor) ) { throw new Exception(Localizer.getMessage("jsp.error.invalid.bean", - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 9.0.x updated (3096221 -> db393fb)
This is an automated email from the ASF dual-hosted git repository. markt pushed a change to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git. from 3096221 Fix BZ 65235. Correct docs. Expand MBean descriptor. add db393fb Remove unnecessary code No new revisions were added by this update. Summary of changes: java/org/apache/jasper/compiler/Generator.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch 8.5.x updated: Remove unnecessary code
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/8.5.x by this push: new 646b807 Remove unnecessary code 646b807 is described below commit 646b807462b3074d0633cdf04f36965d79fcafc5 Author: Mark Thomas AuthorDate: Mon Apr 19 14:27:53 2021 +0100 Remove unnecessary code --- java/org/apache/jasper/compiler/Generator.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/java/org/apache/jasper/compiler/Generator.java b/java/org/apache/jasper/compiler/Generator.java index 638dac4..27a8326 100644 --- a/java/org/apache/jasper/compiler/Generator.java +++ b/java/org/apache/jasper/compiler/Generator.java @@ -1342,8 +1342,10 @@ class Generator { // and (for Java 9+) in an exported module int modifiers = bean.getModifiers(); JreCompat jreCompat = JreCompat.getInstance(); +// No need to test for being an interface here as the +// getConstructor() call above will have already failed for +// any interfaces. if (!Modifier.isPublic(modifiers) || -Modifier.isInterface(modifiers) || Modifier.isAbstract(modifiers) || !jreCompat.canAccess(null, constructor) ) { throw new Exception(Localizer.getMessage("jsp.error.invalid.bean", - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] branch master updated: Fix typos and consistent naming
This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tomcat.git The following commit(s) were added to refs/heads/master by this push: new acb4383 Fix typos and consistent naming acb4383 is described below commit acb438307f5e96a68819bb88cb3e9b12dc124f2e Author: remm AuthorDate: Mon Apr 19 16:49:14 2021 +0200 Fix typos and consistent naming --- java/org/apache/tomcat/util/bcel/classfile/ClassParser.java | 10 +- java/org/apache/tomcat/util/bcel/classfile/JavaClass.java | 12 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java b/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java index 89dab31..af24856 100644 --- a/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java +++ b/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java @@ -49,7 +49,7 @@ public final class ClassParser { private String[] interfaceNames; // Names of implemented interfaces private ConstantPool constantPool; // collection of constants private Annotations runtimeVisibleAnnotations; // "RuntimeVisibleAnnotations" attribute defined in the class -private List runtimeVisibleMethodOfFieldAnnotations; // "RuntimeVisibleAnnotations" attribute defined elsewhere +private List runtimeVisibleFieldOrMethodAnnotations; // "RuntimeVisibleAnnotations" attribute defined elsewhere private static final int BUFSIZE = 8192; private static final String[] INTERFACES_EMPTY_ARRAY = new String[0]; @@ -99,7 +99,7 @@ public final class ClassParser { // Return the information we have gathered in a new object return new JavaClass(class_name, superclassName, accessFlags, constantPool, interfaceNames, -runtimeVisibleAnnotations, runtimeVisibleMethodOfFieldAnnotations); +runtimeVisibleAnnotations, runtimeVisibleFieldOrMethodAnnotations); } @@ -126,10 +126,10 @@ public final class ClassParser { if (name.equals("RuntimeVisibleAnnotations")) { if (fieldOrMethod) { Annotations fieldOrMethodAnnotations = new Annotations(dataInputStream, constantPool); -if (runtimeVisibleMethodOfFieldAnnotations == null) { -runtimeVisibleMethodOfFieldAnnotations = new ArrayList<>(); +if (runtimeVisibleFieldOrMethodAnnotations == null) { +runtimeVisibleFieldOrMethodAnnotations = new ArrayList<>(); } - runtimeVisibleMethodOfFieldAnnotations.add(fieldOrMethodAnnotations); + runtimeVisibleFieldOrMethodAnnotations.add(fieldOrMethodAnnotations); } else { if (runtimeVisibleAnnotations != null) { throw new ClassFormatException( diff --git a/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java b/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java index 14ef3a1..819175a 100644 --- a/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java +++ b/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java @@ -35,7 +35,7 @@ public class JavaClass { private final String superclassName; private final String[] interfaceNames; private final Annotations runtimeVisibleAnnotations; // "RuntimeVisibleAnnotations" attribute defined in the class -private final List runtimeVisibleMethodOfFieldAnnotations; // "RuntimeVisibleAnnotations" attribute defined elsewhere +private final List runtimeVisibleFieldOrMethodAnnotations; // "RuntimeVisibleAnnotations" attribute defined elsewhere /** * Constructor gets all contents as arguments. @@ -46,14 +46,14 @@ public class JavaClass { * @param constant_pool Array of constants * @param interfaceNames Implemented interfaces * @param runtimeVisibleAnnotations "RuntimeVisibleAnnotations" attribute defined on the Class, or null - * @param runtimeVisibleMethodOfFieldAnnotations "RuntimeVisibleAnnotations" attribute defined on the fields or methids, or null + * @param runtimeVisibleFieldOrMethodAnnotations "RuntimeVisibleAnnotations" attribute defined on the fields or methods, or null */ JavaClass(final String className, final String superclassName, final int accessFlags, final ConstantPool constant_pool, final String[] interfaceNames, -final Annotations runtimeVisibleAnnotations, final List runtimeVisibleMethodOfFieldAnnotations) { +final Annotations runtimeVisibleAnnotations, final List runtimeVisibleFieldOrMethodAnnotations) { this.accessFlags = accessFlags; this.runtimeVisibleAnnotations = runtimeVisibleAnnotations; -this.runtimeVisibleMethodOfFieldAnnotations = runtimeVisibleMethodOfFieldAnnotations; +this.runtim
[Bug 65251] New: Child name [/app1] is not unique after upgrading 9.0.44
https://bz.apache.org/bugzilla/show_bug.cgi?id=65251 Bug ID: 65251 Summary: Child name [/app1] is not unique after upgrading 9.0.44 Product: Tomcat 9 Version: 9.0.44 Hardware: Other OS: Linux Status: NEW Severity: critical Priority: P2 Component: Manager Assignee: dev@tomcat.apache.org Reporter: abhish...@formsite.com Target Milestone: - Created attachment 37817 --> https://bz.apache.org/bugzilla/attachment.cgi?id=37817&action=edit server.xml Hello, We have been using following command to deploy an app, say app1, for multiple "example.com" hosts on the same Tomcat instance hosted on a machine. wget --connect-timeout=60 --http-user=$TC_MGR_USERNAME --http-password=$TC_MGR_PASSWORD --no-check-certificate --header='Host: $hostname' 'https://$ip_address/mgr/text/deploy?war=file:$WAR&path=/app1&update=true' -O - After upgrading to Tomcat 9.0.44, we are seeing the following error consistently, preventing app1 to start normally. We have been using the same command since Tomcat 8.x versions without any issue and nothing has changed at our end. 15-Apr-2021 14:46:58.852 INFO [ajp-nio-127.0.0.1-8009-exec-27] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/usr/sites/x.example.com/tomcatweb/app1.war] 15-Apr-2021 14:46:58.860 INFO [Catalina-utility-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/usr/sites/x.example.com/tomcatweb/app1.war] 15-Apr-2021 14:46:58.861 SEVERE [Catalina-utility-1] org.apache.catalina.startup.HostConfig.deployWAR Error deploying web application archive [/usr/sites/x.example.com/tomcatweb/app1.war] java.lang.IllegalArgumentException: Child name [/app1] is not unique at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:703) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:690) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:706) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1023) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1903) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112) at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:824) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:474) at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1660) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:315) at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123) at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1151) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1353) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1357) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1335) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748) 15-Apr-2021 14:46:58.861 INFO [Catalina-utility-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/usr/sites/x.example.com/tomcatweb/app1.war] has finished in [1] ms I have attached server.xml for your reference which has multiple hosts, each host has multiple apps. Our Java deployer utility calls 'https://$ip_address/mgr/text/deploy?war=file:$WAR&path=/$app&update=true' command on different hosts for same app, app1, at the same time using multiple threads. The change log for Tomcat 9.0.44 https://tomcat.apache.or