[tomcat] branch master updated: Fix IDE warnings

2020-05-04 Thread markt
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 4efa2ec  Fix IDE warnings
4efa2ec is described below

commit 4efa2eca68bb64996eac03ac139453d692621183
Author: Mark Thomas 
AuthorDate: Mon May 4 15:50:10 2020 +0100

Fix IDE warnings
---
 java/org/apache/catalina/valves/rewrite/RewriteRule.java | 4 ++--
 java/org/apache/juli/ClassLoaderLogManager.java  | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/java/org/apache/catalina/valves/rewrite/RewriteRule.java 
b/java/org/apache/catalina/valves/rewrite/RewriteRule.java
index 0aa96de..efdb8ac 100644
--- a/java/org/apache/catalina/valves/rewrite/RewriteRule.java
+++ b/java/org/apache/catalina/valves/rewrite/RewriteRule.java
@@ -86,7 +86,7 @@ public class RewriteRule {
  * @return null if no rewrite took place
  */
 public CharSequence evaluate(CharSequence url, Resolver resolver) {
-Pattern pattern = this.pattern.get();
+Pattern pattern = RewriteRule.pattern.get();
 if (pattern == null) {
 // Parse the pattern
 int flags = 0;
@@ -94,7 +94,7 @@ public class RewriteRule {
 flags |= Pattern.CASE_INSENSITIVE;
 }
 pattern = Pattern.compile(patternString, flags);
-this.pattern.set(pattern);
+RewriteRule.pattern.set(pattern);
 }
 Matcher matcher = pattern.matcher(url);
 // Use XOR
diff --git a/java/org/apache/juli/ClassLoaderLogManager.java 
b/java/org/apache/juli/ClassLoaderLogManager.java
index cf3ad4c..c907056 100644
--- a/java/org/apache/juli/ClassLoaderLogManager.java
+++ b/java/org/apache/juli/ClassLoaderLogManager.java
@@ -277,7 +277,7 @@ public class ClassLoaderLogManager extends LogManager {
 return null;
 }
 
-String prefix = this.prefix.get();
+String prefix = ClassLoaderLogManager.prefix.get();
 String result = null;
 
 // If a prefix is defined look for a prefixed property first
@@ -595,13 +595,13 @@ public class ClassLoaderLogManager extends LogManager {
 }
 }
 try {
-this.prefix.set(prefix);
+ClassLoaderLogManager.prefix.set(prefix);
 Handler handler = (Handler) classLoader.loadClass(
 handlerClassName).getConstructor().newInstance();
 // The specification strongly implies all configuration 
should be done
 // during the creation of the handler object.
 // This includes setting level, filter, formatter and 
encoding.
-this.prefix.set(null);
+ClassLoaderLogManager.prefix.set(null);
 info.handlers.put(handlerName, handler);
 if (rootHandlers == null) {
 localRootLogger.addHandler(handler);


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



[tomcat] branch master updated: Fix IDE warnings

2020-01-14 Thread markt
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 e2ed94b  Fix IDE warnings
e2ed94b is described below

commit e2ed94b7117c4ae12e5154da6f445cd1f8f76621
Author: Mark Thomas 
AuthorDate: Tue Jan 14 21:04:15 2020 +

Fix IDE warnings
---
 java/org/apache/catalina/manager/JMXProxyServlet.java | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/manager/JMXProxyServlet.java 
b/java/org/apache/catalina/manager/JMXProxyServlet.java
index 574933f..fa862c5 100644
--- a/java/org/apache/catalina/manager/JMXProxyServlet.java
+++ b/java/org/apache/catalina/manager/JMXProxyServlet.java
@@ -263,10 +263,12 @@ public class JMXProxyServlet extends HttpServlet {
  *call the requested operation.
  * @return The value returned by the requested operation.
  */
+@SuppressWarnings("null") // parameters can't be null if signature.length 
> 0
 private Object invokeOperationInternal(String onameStr, String operation, 
String[] parameters)
 throws OperationsException, MBeanException, ReflectionException {
 ObjectName oname = new ObjectName(onameStr);
-MBeanOperationInfo methodInfo = registry.getMethodInfo(oname, 
operation, (null == parameters ? 0 : parameters.length));
+int paramCount = null == parameters ? 0 : parameters.length;
+MBeanOperationInfo methodInfo = registry.getMethodInfo(oname, 
operation, paramCount);
 if(null == methodInfo) {
 // getMethodInfo returns null for both "object not found" and 
"operation not found"
 MBeanInfo info = null;
@@ -277,7 +279,9 @@ public class JMXProxyServlet extends HttpServlet {
 } catch (Exception e) {
 throw new 
IllegalArgumentException(sm.getString("jmxProxyServlet.noBeanFound", onameStr), 
e);
 }
-throw new 
IllegalArgumentException(sm.getString("jmxProxyServlet.noOperationOnBean", 
operation, (null == parameters ? 0 : parameters.length), onameStr, 
info.getClassName()));
+throw new IllegalArgumentException(
+sm.getString("jmxProxyServlet.noOperationOnBean",
+operation, Integer.valueOf(paramCount), onameStr, 
info.getClassName()));
 }
 
 MBeanParameterInfo[] signature = methodInfo.getSignature();


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



Re: [tomcat] branch master updated: Fix IDE warnings. Get build working with Java 8 through 14

2019-11-15 Thread Mark Thomas
On 15/11/2019 07:39, Konstantin Kolinko wrote:
> чт, 14 нояб. 2019 г. в 23:39, Mark Thomas :
>>
>> On 14/11/2019 20:13, Rémy Maucherat wrote:
>>> On Thu, Nov 14, 2019 at 8:26 PM >> > wrote:
>>>
>>> +  
>>>
> 
> Was it necessary to remove "release=" everywhere in this commit, when
> only one  invocation is concerned?

Probably not. Would you like me to restore it where I can?

> What is your version of
> Apache Ant?

1.9.latest

Mark

> http://ant.apache.org/manual-1.9.x/Tasks/javac.html
> says that "release" option is since Ant 1.9.8.
> 
> Best regards,
> Konstantin Kolinko
> 
> -
> 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



Re: [tomcat] branch master updated: Fix IDE warnings. Get build working with Java 8 through 14

2019-11-14 Thread Konstantin Kolinko
чт, 14 нояб. 2019 г. в 23:39, Mark Thomas :
>
> On 14/11/2019 20:13, Rémy Maucherat wrote:
> > On Thu, Nov 14, 2019 at 8:26 PM  > > wrote:
> >
> > +  
> >

Was it necessary to remove "release=" everywhere in this commit, when
only one  invocation is concerned? What is your version of
Apache Ant?

http://ant.apache.org/manual-1.9.x/Tasks/javac.html
says that "release" option is since Ant 1.9.8.

Best regards,
Konstantin Kolinko

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



Re: [tomcat] branch master updated: Fix IDE warnings. Get build working with Java 8 through 14

2019-11-14 Thread Mark Thomas
On 14/11/2019 20:13, Rémy Maucherat wrote:
> On Thu, Nov 14, 2019 at 8:26 PM  > wrote:
> 
> +      
> 
> 
> The possible downside is that it's global so other unintended use won't
> be flagged. I had read this hidden feature was the only way too, they
> filtered out the annotation use for this.

The IDEs should pick it up. Eclipse does anyway.

None of this is perfect. It is rather a balancing act. I'll add talking
to the OpenJDK folks about a better interface for this to my TODO list.

Mark

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



Re: [tomcat] branch master updated: Fix IDE warnings. Get build working with Java 8 through 14

2019-11-14 Thread Rémy Maucherat
On Thu, Nov 14, 2019 at 8:26 PM  wrote:

> +  
>

The possible downside is that it's global so other unintended use won't be
flagged. I had read this hidden feature was the only way too, they filtered
out the annotation use for this.

Rémy


[tomcat] branch master updated: Fix IDE warnings. Get build working with Java 8 through 14

2019-11-14 Thread markt
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 35abad9  Fix IDE warnings. Get build working with Java 8 through 14
35abad9 is described below

commit 35abad971594d467fbe3b85ae8c61575d2bd2eb6
Author: Mark Thomas 
AuthorDate: Thu Nov 14 19:26:00 2019 +

Fix IDE warnings. Get build working with Java 8 through 14

"-XDignore.symbol.file" is a hack but it is the only solution I found
that worked cleanly with all Java versions.
---
 build.xml|  7 +--
 .../apache/catalina/mbeans/JmxRemoteLifecycleListener.java   | 12 +++-
 res/findbugs/filter-false-positives.xml  |  6 ++
 3 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/build.xml b/build.xml
index 0499113..014e848 100644
--- a/build.xml
+++ b/build.xml
@@ -93,7 +93,6 @@
   
   
   
-  
   
 
   
@@ -641,7 +640,6 @@
deprecation="${compile.deprecation}"
source="${compile.source}"
target="${compile.target}"
-   release="${compile.release}"
encoding="ISO-8859-1"
includeAntRuntime="true" >
   
+  
   
 
 
@@ -1216,7 +1214,6 @@
  debug="${compile.debug}" deprecation="${compile.deprecation}"
  source="${compile.source}"
  target="${compile.target}"
- release="${compile.release}"
  classpath="${tomcat.classes}"
  encoding="ISO-8859-1"
  includeantruntime="false">
@@ -1228,7 +1225,6 @@
  debug="${compile.debug}" deprecation="${compile.deprecation}"
  source="${compile.source}"
  target="${compile.target}"
- release="${compile.release}"
  classpath="${tomcat.classes}"
  encoding="ISO-8859-1"
  includeantruntime="false">
@@ -1465,7 +1461,6 @@
deprecation="${compile.deprecation}"
source="${compile.source}"
target="${compile.target}"
-   release="${compile.release}"
encoding="ISO-8859-1"
includeantruntime="true">
   
diff --git a/java/org/apache/catalina/mbeans/JmxRemoteLifecycleListener.java 
b/java/org/apache/catalina/mbeans/JmxRemoteLifecycleListener.java
index 77a785d..d01ed8e 100644
--- a/java/org/apache/catalina/mbeans/JmxRemoteLifecycleListener.java
+++ b/java/org/apache/catalina/mbeans/JmxRemoteLifecycleListener.java
@@ -441,7 +441,13 @@ public class JmxRemoteLifecycleListener extends 
SSLHostConfig implements Lifecyc
 Remote jmxServer = server.toStub();
 // Create the RMI registry
 try {
-new JmxRegistry(theRmiRegistryPort, registryCsf, registrySsf, 
"jmxrmi", jmxServer);
+/*
+ * JmxRegistry is registered as a side-effect of creation.
+ * This object is here so we can tell the IDE it is OK for it
+ * not to be used.
+ */
+@SuppressWarnings("unused")
+JmxRegistry unused = new JmxRegistry(theRmiRegistryPort, 
registryCsf, registrySsf, "jmxrmi", jmxServer);
 } catch (RemoteException e) {
 log.error(sm.getString(
 "jmxRemoteLifecycleListener.createRegistryFailed",
@@ -589,6 +595,10 @@ public class JmxRemoteLifecycleListener extends 
SSLHostConfig implements Lifecyc
 }
 
 
+/*
+ * Better to use the internal API than re-invent the wheel.
+ */
+@SuppressWarnings("restriction")
 private static class JmxRegistry extends sun.rmi.registry.RegistryImpl {
 private static final long serialVersionUID = -3772054804656428217L;
 private final String jmxName;
diff --git a/res/findbugs/filter-false-positives.xml 
b/res/findbugs/filter-false-positives.xml
index 7fcc6bd..2c8d18b 100644
--- a/res/findbugs/filter-false-positives.xml
+++ b/res/findbugs/filter-false-positives.xml
@@ -344,6 +344,12 @@
 
   
   
+
+
+
+
+  
+  
 
 
   


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



[tomcat] branch master updated: Fix IDE warnings

2019-07-26 Thread markt
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 40c7a7f  Fix IDE warnings
40c7a7f is described below

commit 40c7a7f215c713a5bdee37432ea9d1c37dfdc74d
Author: Mark Thomas 
AuthorDate: Fri Jul 26 14:38:20 2019 +0100

Fix IDE warnings
---
 .../catalina/tribes/membership/cloud/AbstractStreamProvider.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/java/org/apache/catalina/tribes/membership/cloud/AbstractStreamProvider.java 
b/java/org/apache/catalina/tribes/membership/cloud/AbstractStreamProvider.java
index 1aa68bf..1c0d60b 100644
--- 
a/java/org/apache/catalina/tribes/membership/cloud/AbstractStreamProvider.java
+++ 
b/java/org/apache/catalina/tribes/membership/cloud/AbstractStreamProvider.java
@@ -25,6 +25,7 @@ import java.io.InputStream;
 import java.net.URL;
 import java.net.URLConnection;
 import java.security.KeyStore;
+import java.security.cert.Certificate;
 import java.security.cert.CertificateException;
 import java.security.cert.CertificateFactory;
 import java.security.cert.X509Certificate;
@@ -119,8 +120,8 @@ public abstract class AbstractStreamProvider implements 
StreamProvider {
 KeyStore trustStore = KeyStore.getInstance("JKS");
 trustStore.load(null);
 
-Collection c = 
certFactory.generateCertificates(pemInputStream);
-Iterator i = c.iterator();
+Collection c = 
certFactory.generateCertificates(pemInputStream);
+Iterator i = c.iterator();
 while (i.hasNext()) {
X509Certificate cert = (X509Certificate)i.next();
String alias = cert.getSubjectX500Principal().getName();


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



[tomcat] branch master updated: Fix IDE warnings

2019-05-15 Thread markt
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 7848be1  Fix IDE warnings
7848be1 is described below

commit 7848be1f9718168fc7af6c85c2526b72103106e0
Author: Mark Thomas 
AuthorDate: Wed May 15 10:13:40 2019 +0100

Fix IDE warnings
---
 java/org/apache/tomcat/util/net/AprEndpoint.java  | 2 +-
 java/org/apache/tomcat/util/net/Nio2Endpoint.java | 2 +-
 java/org/apache/tomcat/util/net/NioEndpoint.java  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/tomcat/util/net/AprEndpoint.java 
b/java/org/apache/tomcat/util/net/AprEndpoint.java
index 2d6622f..df85e6c 100644
--- a/java/org/apache/tomcat/util/net/AprEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AprEndpoint.java
@@ -2768,7 +2768,7 @@ public class AprEndpoint extends 
AbstractEndpoint implements SNICallB
 BlockingMode block, long timeout, TimeUnit unit, A attachment,
 CompletionCheck check, CompletionHandler 
handler,
 Semaphore semaphore, VectoredIOCompletionHandler 
completion) {
-return new AprOperationState(read, buffers, offset, length, 
block,
+return new AprOperationState<>(read, buffers, offset, length, 
block,
 timeout, unit, attachment, check, handler, semaphore, 
completion);
 }
 
diff --git a/java/org/apache/tomcat/util/net/Nio2Endpoint.java 
b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
index 652644a..50eb996 100644
--- a/java/org/apache/tomcat/util/net/Nio2Endpoint.java
+++ b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
@@ -962,7 +962,7 @@ public class Nio2Endpoint extends 
AbstractJsseEndpoint 
handler,
 Semaphore semaphore, VectoredIOCompletionHandler 
completion) {
-return new Nio2OperationState(read, buffers, offset, length, 
block,
+return new Nio2OperationState<>(read, buffers, offset, length, 
block,
 timeout, unit, attachment, check, handler, semaphore, 
completion);
 }
 
diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java 
b/java/org/apache/tomcat/util/net/NioEndpoint.java
index 621d58c..8449bf0 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -1421,7 +1421,7 @@ public class NioEndpoint extends 
AbstractJsseEndpoint
 BlockingMode block, long timeout, TimeUnit unit, A attachment,
 CompletionCheck check, CompletionHandler 
handler,
 Semaphore semaphore, VectoredIOCompletionHandler 
completion) {
-return new NioOperationState(read, buffers, offset, length, 
block,
+return new NioOperationState<>(read, buffers, offset, length, 
block,
 timeout, unit, attachment, check, handler, semaphore, 
completion);
 }
 


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