[Bug 62133] New: java.lang.NoSuchMethodError when the client project works with websocket

2018-02-26 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=62133

Bug ID: 62133
   Summary: java.lang.NoSuchMethodError when the client project
works with websocket
   Product: Tomcat 9
   Version: unspecified
  Hardware: PC
Status: NEW
  Severity: blocker
  Priority: P2
 Component: WebSocket
  Assignee: dev@tomcat.apache.org
  Reporter: wangying8...@163.com
  Target Milestone: -

To handle the real time messaging, our project depends on websocket and set the
 in script Context.xml. When running at tomcat 7.0.47,
we get the following exception:

java.lang.NoSuchMethodError:
javax.websocket.Session.addMessageHandler(Ljava/lang/Class;Ljavax/websocket/MessageHandler$Whole;)V
at com.horizon.common.websocket.WsServer.onOpen(WsServer.java:33)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at
org.apache.tomcat.websocket.pojo.PojoEndpointBase.doOnOpen(PojoEndpointBase.java:58)
at
org.apache.tomcat.websocket.pojo.PojoEndpointServer.onOpen(PojoEndpointServer.java:70)

at
org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.init(WsHttpUpgradeHandler.java:129)
at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:629)
at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)

-- 
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 62133] java.lang.NoSuchMethodError when the client project works with websocket

2018-02-26 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=62133

Wang Ying  changed:

   What|Removed |Added

 OS||All
Version|unspecified |7.0.47
   Target Milestone|-   |---
Product|Tomcat 9|Tomcat 7
  Component|WebSocket   |WebSocket

-- 
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 62132] No reliable way to know if the request emerged from localhost

2018-02-26 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=62132

Mark Thomas  changed:

   What|Removed |Added

 OS||All
 Resolution|--- |INVALID
 Status|NEW |RESOLVED

--- Comment #1 from Mark Thomas  ---
Bugzilla is not a support forum. Please use the users mailing list.

-- 
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 62133] java.lang.NoSuchMethodError when the client project works with websocket

2018-02-26 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=62133

Mark Thomas  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |INVALID

--- Comment #1 from Mark Thomas  ---
You are trying to use a Java WebSocket 1.1 method that does not exist in Tomcat
7.0.47. You need at least 7.0.56 for WebSocket 1.1.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1825349 - /tomcat/trunk/java/org/apache/catalina/session/StandardSession.java

2018-02-26 Thread markt
Author: markt
Date: Mon Feb 26 09:48:14 2018
New Revision: 1825349

URL: http://svn.apache.org/viewvc?rev=1825349&view=rev
Log:
Code clean-up.
No functional change.

Modified:
tomcat/trunk/java/org/apache/catalina/session/StandardSession.java

Modified: tomcat/trunk/java/org/apache/catalina/session/StandardSession.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/StandardSession.java?rev=1825349&r1=1825348&r2=1825349&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/session/StandardSession.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/session/StandardSession.java Mon Feb 
26 09:48:14 2018
@@ -1375,6 +1375,8 @@ public class StandardSession implements
 public void setAttribute(String name, Object value) {
 setAttribute(name,value,true);
 }
+
+
 /**
  * Bind an object to this session, using the specified name.  If an object
  * of the same name is already bound to this session, the object is
@@ -1392,13 +1394,13 @@ public class StandardSession implements
  * @exception IllegalStateException if this method is called on an
  *  invalidated session
  */
-
 public void setAttribute(String name, Object value, boolean notify) {
 
 // Name cannot be null
-if (name == null)
-throw new IllegalArgumentException
-(sm.getString("standardSession.setAttribute.namenull"));
+if (name == null) {
+throw new IllegalArgumentException(
+sm.getString("standardSession.setAttribute.namenull"));
+}
 
 // Null value is the same as removeAttribute()
 if (value == null) {
@@ -1408,13 +1410,13 @@ public class StandardSession implements
 
 // Validate our current state
 if (!isValidInternal()) {
-throw new IllegalStateException(sm.getString(
-"standardSession.setAttribute.ise", getIdInternal()));
+throw new IllegalStateException(
+sm.getString("standardSession.setAttribute.ise", 
getIdInternal()));
 }
 if ((manager != null) && manager.getContext().getDistributable() &&
 !isAttributeDistributable(name, value) && !exclude(name, 
value)) {
-throw new IllegalArgumentException(sm.getString(
-"standardSession.setAttribute.iae", name));
+throw new IllegalArgumentException(
+sm.getString("standardSession.setAttribute.iae", name));
 }
 // Construct an event with the new value
 HttpSessionBindingEvent event = null;
@@ -1428,8 +1430,8 @@ public class StandardSession implements
 try {
 ((HttpSessionBindingListener) value).valueBound(event);
 } catch (Throwable t){
-manager.getContext().getLogger().error
-(sm.getString("standardSession.bindingEvent"), t);
+manager.getContext().getLogger().error(
+sm.getString("standardSession.bindingEvent"), t);
 }
 }
 }
@@ -1438,76 +1440,68 @@ public class StandardSession implements
 Object unbound = attributes.put(name, value);
 
 // Call the valueUnbound() method if necessary
-if (notify && (unbound != null) && (unbound != value) &&
-(unbound instanceof HttpSessionBindingListener)) {
+if (notify && (unbound instanceof HttpSessionBindingListener) && 
(unbound != value)) {
 try {
-((HttpSessionBindingListener) unbound).valueUnbound
-(new HttpSessionBindingEvent(getSession(), name));
+((HttpSessionBindingListener) unbound).valueUnbound(
+new HttpSessionBindingEvent(getSession(), name));
 } catch (Throwable t) {
 ExceptionUtils.handleThrowable(t);
-manager.getContext().getLogger().error
-(sm.getString("standardSession.bindingEvent"), t);
+manager.getContext().getLogger().error(
+sm.getString("standardSession.bindingEvent"), t);
 }
 }
 
-if ( !notify ) return;
+if (!notify) {
+return;
+}
 
 // Notify interested application event listeners
 Context context = manager.getContext();
 Object listeners[] = context.getApplicationEventListeners();
-if (listeners == null)
+if (listeners == null) {
 return;
+}
 for (int i = 0; i < listeners.length; i++) {
-if (!(listeners[i] instanceof HttpSessionAttributeListener))
+if (!(listeners[i] instanceof HttpSessionAttributeListener)) {
 continue;
-HttpSessionAttributeListener listener =
-(HttpSessionAttributeListener)

svn commit: r1825351 - in /tomcat/trunk: java/org/apache/catalina/Manager.java java/org/apache/catalina/session/ManagerBase.java java/org/apache/catalina/session/StandardSession.java webapps/docs/chan

2018-02-26 Thread markt
Author: markt
Date: Mon Feb 26 10:00:12 2018
New Revision: 1825351

URL: http://svn.apache.org/viewvc?rev=1825351&view=rev
Log:
Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=43866
Add additional attributes to the Manager to provide control over which 
listeners are called when an attribute is added to the session when it has 
already been added under the same name. This is to aid clustering scenarios 
where setAttribute() is often called to signal that the attribute value has 
been mutated and needs to be replicated but it may not be required, or even 
desired, for the the associated listeners to be triggered. The default 
behaviour has not been changed.

Modified:
tomcat/trunk/java/org/apache/catalina/Manager.java
tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java
tomcat/trunk/java/org/apache/catalina/session/StandardSession.java
tomcat/trunk/webapps/docs/changelog.xml
tomcat/trunk/webapps/docs/config/manager.xml

Modified: tomcat/trunk/java/org/apache/catalina/Manager.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/Manager.java?rev=1825351&r1=1825350&r2=1825351&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/Manager.java (original)
+++ tomcat/trunk/java/org/apache/catalina/Manager.java Mon Feb 26 10:00:12 2018
@@ -351,4 +351,73 @@ public interface Manager {
  * otherwise {@code false}
  */
 public boolean willAttributeDistribute(String name, Object value);
+
+
+/**
+ * When an attribute that is already present in the session is added again
+ * under the same name and the attribute implements {@link
+ * javax.servlet.http.HttpSessionBindingListener}, should
+ * {@link 
javax.servlet.http.HttpSessionBindingListener#valueUnbound(javax.servlet.http.HttpSessionBindingEvent)}
+ * be called followed by
+ * {@link 
javax.servlet.http.HttpSessionBindingListener#valueBound(javax.servlet.http.HttpSessionBindingEvent)}?
+ * 
+ * The default value is {@code false}.
+ *
+ * @return {@code true} if the listener will be notified, {@code false} if
+ * it will not
+ */
+public default boolean getNotifyBindingListenerOnUnchangedValue() {
+return false;
+}
+
+
+/**
+ * Configure if
+ * {@link 
javax.servlet.http.HttpSessionBindingListener#valueUnbound(javax.servlet.http.HttpSessionBindingEvent)}
+ * be called followed by
+ * {@link 
javax.servlet.http.HttpSessionBindingListener#valueBound(javax.servlet.http.HttpSessionBindingEvent)}
+ * when an attribute that is already present in the session is added again
+ * under the same name and the attribute implements {@link
+ * javax.servlet.http.HttpSessionBindingListener}.
+ *
+ * @param notifyBindingListenerOnUnchangedValue {@code true} the listener
+ *  will be called, {@code
+ *  false} it will not
+ */
+public void setNotifyBindingListenerOnUnchangedValue(
+boolean notifyBindingListenerOnUnchangedValue);
+
+
+/**
+ * When an attribute that is already present in the session is added again
+ * under the same name and a {@link
+ * javax.servlet.http.HttpSessionAttributeListener} is configured for the
+ * session should
+ * {@link 
javax.servlet.http.HttpSessionAttributeListener#attributeReplaced(javax.servlet.http.HttpSessionBindingEvent)}
+ * be called?
+ * 
+ * The default value is {@code true}.
+ *
+ * @return {@code true} if the listener will be notified, {@code false} if
+ * it will not
+ */
+public default boolean getNotifyAttributeListenerOnUnchangedValue() {
+return true;
+}
+
+
+/**
+ * Configure if
+ * {@link 
javax.servlet.http.HttpSessionAttributeListener#attributeReplaced(javax.servlet.http.HttpSessionBindingEvent)}
+ * when an attribute that is already present in the session is added again
+ * under the same name and a {@link
+ * javax.servlet.http.HttpSessionAttributeListener} is configured for the
+ * session.
+ *
+ * @param notifyAttributeListenerOnUnchangedValue {@code true} the listener
+ *will be called, {@code
+ *false} it will not
+ */
+public void setNotifyAttributeListenerOnUnchangedValue(
+boolean notifyAttributeListenerOnUnchangedValue);
 }

Modified: tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java?rev=1825351&r1=1825350&r2=1825351&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java (original)
+++ tomcat/trunk/java

[Bug 43866] add support for session attribute propagation without calls to DeltaSession.setAttribute

2018-02-26 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=43866

Mark Thomas  changed:

   What|Removed |Added

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

--- Comment #3 from Mark Thomas  ---
I've added the additional configuration option to Manager for 9.0.6 onwards.

I don't propose back-porting these additions at this time.

-- 
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 47242] request for AJP command line client

2018-02-26 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=47242

--- Comment #20 from Mark Thomas  ---
There has been no activity on this since 2011.

I proposed this for GSOC in 2017 and didn't get any takers.

I've re-proposed it for 2018. If it still doesn't get any takes, I'm intending
to resolve this as WONTFIX.

-- 
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 62133] java.lang.NoSuchMethodError when the client project works with websocket

2018-02-26 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=62133

--- Comment #2 from Wang Ying  ---
@(In reply to Mark Thomas from comment #1)
> You are trying to use a Java WebSocket 1.1 method that does not exist in
> Tomcat 7.0.47. You need at least 7.0.56 for WebSocket 1.1.

Thanks your quick reply, I have submit an issue in the client project and
suggested they upgrade the tomcat version!

https://github.com/Jibesh97/cm/issues/1

-- 
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 62131] dependency on MSVC2010

2018-02-26 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=62131

--- Comment #2 from Christopher Schultz  ---
IIRC, every windows binary that uses pretty much any basic libc functions will
link to MSVC[RS][0-9]+.DLL. The versions of tcnative.dll that Tomcat publishes
always try to use the "versionless" flavor of that library, MSVCRT.DLL.

If you build the library yourself, or if you got the library from another
source (e.g. Apache Lounge), it may have a dependency upon a certain version of
MS's runtime library.

Your choices are (a) get an updated library from a recent Tomcat release (it
should be compatible), (b) get an updated library from wherever you originally
obtained your library or (c) build the library yourself, using whatever
dependencies you prefer.

-- 
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 62131] dependency on MSVC2010

2018-02-26 Thread bugzilla
https://bz.apache.org/bugzilla/show_bug.cgi?id=62131

--- Comment #3 from shimshon  ---
I looked with procmon on loading DLLs order. I see that msvcr100.dll is loaded
before jvm.dll. I see that in depends (depends.exe) indeed the jvm.dll is
dependent on msvcr100.dll.
So, it is not related to Apache tomcat.  I will take with Oracle

-- 
You are receiving this mail because:
You are the assignee for the bug.
-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1825394 - /tomcat/trunk/java/org/apache/catalina/manager/StatusManagerServlet.java

2018-02-26 Thread markt
Author: markt
Date: Mon Feb 26 18:35:04 2018
New Revision: 1825394

URL: http://svn.apache.org/viewvc?rev=1825394&view=rev
Log:
Remove unnecessary code

Modified:
tomcat/trunk/java/org/apache/catalina/manager/StatusManagerServlet.java

Modified: 
tomcat/trunk/java/org/apache/catalina/manager/StatusManagerServlet.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/manager/StatusManagerServlet.java?rev=1825394&r1=1825393&r2=1825394&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/manager/StatusManagerServlet.java 
(original)
+++ tomcat/trunk/java/org/apache/catalina/manager/StatusManagerServlet.java Mon 
Feb 26 18:35:04 2018
@@ -354,14 +354,7 @@ public class StatusManagerServlet
 requestProcessors.removeElement(objectName);
 }
 }
-String j2eeType = objectName.getKeyProperty("j2eeType");
-if (j2eeType != null) {
-
-}
 }
 }
-
 }
-
-
 }



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



svn commit: r1825395 - /tomcat/trunk/res/findbugs/filter-false-positives.xml

2018-02-26 Thread markt
Author: markt
Date: Mon Feb 26 18:35:44 2018
New Revision: 1825395

URL: http://svn.apache.org/viewvc?rev=1825395&view=rev
Log:
Be a little more specific about exclusion patterns.

Modified:
tomcat/trunk/res/findbugs/filter-false-positives.xml

Modified: tomcat/trunk/res/findbugs/filter-false-positives.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/res/findbugs/filter-false-positives.xml?rev=1825395&r1=1825394&r2=1825395&view=diff
==
--- tomcat/trunk/res/findbugs/filter-false-positives.xml (original)
+++ tomcat/trunk/res/findbugs/filter-false-positives.xml Mon Feb 26 18:35:44 
2018
@@ -282,7 +282,13 @@
   
 
 
-
+
+  
+  
+  
+  
+
+
   
   
 
@@ -293,6 +299,7 @@
   
 
+
 
   
   



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



svn commit: r1825398 - /tomcat/trunk/res/findbugs/filter-false-positives.xml

2018-02-26 Thread markt
Author: markt
Date: Mon Feb 26 18:45:04 2018
New Revision: 1825398

URL: http://svn.apache.org/viewvc?rev=1825398&view=rev
Log:
Two more false positives

Modified:
tomcat/trunk/res/findbugs/filter-false-positives.xml

Modified: tomcat/trunk/res/findbugs/filter-false-positives.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/res/findbugs/filter-false-positives.xml?rev=1825398&r1=1825397&r2=1825398&view=diff
==
--- tomcat/trunk/res/findbugs/filter-false-positives.xml (original)
+++ tomcat/trunk/res/findbugs/filter-false-positives.xml Mon Feb 26 18:45:04 
2018
@@ -310,6 +310,18 @@
 
   
   
+
+
+
+
+  
+  
+
+
+
+
+  
+  
 
 
   



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



svn commit: r1825419 - /tomcat/trunk/java/org/apache/catalina/mbeans/JmxRemoteLifecycleListener.java

2018-02-26 Thread markt
Author: markt
Date: Mon Feb 26 22:07:02 2018
New Revision: 1825419

URL: http://svn.apache.org/viewvc?rev=1825419&view=rev
Log:
Spotbugs warning
Super class has defined hashCode() and equals() so override them here.
Probably unnecessary but play it safe.
Use Eclipse generated code.

Modified:
tomcat/trunk/java/org/apache/catalina/mbeans/JmxRemoteLifecycleListener.java

Modified: 
tomcat/trunk/java/org/apache/catalina/mbeans/JmxRemoteLifecycleListener.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/mbeans/JmxRemoteLifecycleListener.java?rev=1825419&r1=1825418&r2=1825419&view=diff
==
--- 
tomcat/trunk/java/org/apache/catalina/mbeans/JmxRemoteLifecycleListener.java 
(original)
+++ 
tomcat/trunk/java/org/apache/catalina/mbeans/JmxRemoteLifecycleListener.java 
Mon Feb 26 22:07:02 2018
@@ -465,5 +465,32 @@ public class JmxRemoteLifecycleListener
 sslServerSocket.setNeedClientAuth(getNeedClientAuth());
 return sslServerSocket;
 }
+
+// Super class defines hashCode() and equals(). Probably not used in
+// Tomcat but for safety, override them here.
+@Override
+public int hashCode() {
+final int prime = 31;
+int result = super.hashCode();
+result = prime * result + ((bindAddress == null) ? 0 : 
bindAddress.hashCode());
+return result;
+}
+
+@Override
+public boolean equals(Object obj) {
+if (this == obj)
+return true;
+if (!super.equals(obj))
+return false;
+if (getClass() != obj.getClass())
+return false;
+SslRmiServerBindSocketFactory other = 
(SslRmiServerBindSocketFactory) obj;
+if (bindAddress == null) {
+if (other.bindAddress != null)
+return false;
+} else if (!bindAddress.equals(other.bindAddress))
+return false;
+return true;
+}
 }
 }



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



svn commit: r1825420 - /tomcat/trunk/java/org/apache/catalina/realm/JDBCRealm.java

2018-02-26 Thread markt
Author: markt
Date: Mon Feb 26 22:17:38 2018
New Revision: 1825420

URL: http://svn.apache.org/viewvc?rev=1825420&view=rev
Log:
Clean-up

Modified:
tomcat/trunk/java/org/apache/catalina/realm/JDBCRealm.java

Modified: tomcat/trunk/java/org/apache/catalina/realm/JDBCRealm.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/realm/JDBCRealm.java?rev=1825420&r1=1825419&r2=1825420&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/realm/JDBCRealm.java (original)
+++ tomcat/trunk/java/org/apache/catalina/realm/JDBCRealm.java Mon Feb 26 
22:17:38 2018
@@ -463,9 +463,8 @@ public class JDBCRealm
  * @return the prepared statement
  * @exception SQLException if a database error occurs
  */
-protected PreparedStatement credentials(Connection dbConnection,
-String username)
-throws SQLException {
+protected PreparedStatement credentials(Connection dbConnection, String 
username)
+throws SQLException {
 
 if (preparedCredentials == null) {
 StringBuilder sb = new StringBuilder("SELECT ");
@@ -672,9 +671,8 @@ public class JDBCRealm
  * @return the prepared statement
  * @exception SQLException if a database error occurs
  */
-protected synchronized PreparedStatement roles(Connection dbConnection,
-String username)
-throws SQLException {
+protected synchronized PreparedStatement roles(Connection dbConnection, 
String username)
+throws SQLException {
 
 if (preparedRoles == null) {
 StringBuilder sb = new StringBuilder("SELECT ");
@@ -684,8 +682,7 @@ public class JDBCRealm
 sb.append(" WHERE ");
 sb.append(userNameCol);
 sb.append(" = ?");
-preparedRoles =
-dbConnection.prepareStatement(sb.toString());
+preparedRoles = dbConnection.prepareStatement(sb.toString());
 }
 
 preparedRoles.setString(1, username);



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



svn commit: r1825421 - in /tomcat/trunk/java/org/apache/catalina/realm: JAASRealm.java LockOutRealm.java

2018-02-26 Thread markt
Author: markt
Date: Mon Feb 26 22:20:04 2018
New Revision: 1825421

URL: http://svn.apache.org/viewvc?rev=1825421&view=rev
Log:
SpotBugs
Fix some concurrency related concerns.

Modified:
tomcat/trunk/java/org/apache/catalina/realm/JAASRealm.java
tomcat/trunk/java/org/apache/catalina/realm/LockOutRealm.java

Modified: tomcat/trunk/java/org/apache/catalina/realm/JAASRealm.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/realm/JAASRealm.java?rev=1825421&r1=1825420&r2=1825421&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/realm/JAASRealm.java (original)
+++ tomcat/trunk/java/org/apache/catalina/realm/JAASRealm.java Mon Feb 26 
22:20:04 2018
@@ -164,7 +164,7 @@ public class JAASRealm extends RealmBase
  */
 protected String configFile;
 
-protected Configuration jaasConfiguration;
+protected volatile Configuration jaasConfiguration;
 protected volatile boolean jaasConfigurationLoaded = false;
 
 
@@ -606,6 +606,8 @@ public class JAASRealm extends RealmBase
  * @return the loaded configuration
  */
 protected Configuration getConfig() {
+// Local copy to avoid possible NPE due to concurrent change
+String configFile = this.configFile;
 try {
 if (jaasConfigurationLoaded) {
 return jaasConfiguration;
@@ -615,8 +617,7 @@ public class JAASRealm extends RealmBase
 jaasConfigurationLoaded = true;
 return null;
 }
-URL resource = Thread.currentThread().getContextClassLoader().
-getResource(configFile);
+URL resource = 
Thread.currentThread().getContextClassLoader().getResource(configFile);
 URI uri = resource.toURI();
 @SuppressWarnings("unchecked")
 Class sunConfigFile = (Class)

Modified: tomcat/trunk/java/org/apache/catalina/realm/LockOutRealm.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/realm/LockOutRealm.java?rev=1825421&r1=1825420&r2=1825421&view=diff
==
--- tomcat/trunk/java/org/apache/catalina/realm/LockOutRealm.java (original)
+++ tomcat/trunk/java/org/apache/catalina/realm/LockOutRealm.java Mon Feb 26 
22:20:04 2018
@@ -88,7 +88,7 @@ public class LockOutRealm extends Combin
  *  that prevents this component from being used
  */
 @Override
-protected void startInternal() throws LifecycleException {
+protected synchronized void startInternal() throws LifecycleException {
 // Configure the list of failed users to delete the oldest entry once 
it
 // exceeds the specified size
 failedUsers = new LinkedHashMap(cacheSize, 0.75f,



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