You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2015/11/02 15:37:55 UTC
svn commit: r1712014 - in /tomcat/tc7.0.x/trunk/java/org/apache/tomcat/jni:
Library.java Socket.java
Author: markt
Date: Mon Nov 2 14:37:55 2015
New Revision: 1712014
URL: http://svn.apache.org/viewvc?rev=1712014&view=rev
Log:
Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=58058
Fix thread safety.
Align with 8.0.x
Modified:
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/jni/Library.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/jni/Socket.java
Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/jni/Library.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/jni/Library.java?rev=1712014&r1=1712013&r2=1712014&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/jni/Library.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/jni/Library.java Mon Nov 2 14:37:55 2015
@@ -32,7 +32,7 @@ public final class Library {
*/
private static Library _instance = null;
- private Library() throws Throwable {
+ private Library() throws Exception {
boolean loaded = false;
String path = System.getProperty("java.library.path");
String [] paths = path.split(File.pathSeparator);
@@ -45,7 +45,7 @@ public final class Library {
throw t;
} catch (VirtualMachineError t) {
// Don't use a Java 7 multiple exception catch so we can keep
- // the JNI code identical between Tomcat 6/7/8
+ // the JNI code identical between Tomcat 6/7/8/9
throw t;
} catch (Throwable t) {
String name = System.mapLibraryName(NAMES[i]);
@@ -166,10 +166,13 @@ public final class Library {
* Setup any APR internal data structures. This MUST be the first function
* called for any APR library.
* @param libraryName the name of the library to load
+ *
+ * @return {@code true} if the native code was initialized successfully
+ * otherwise {@code false}
+ *
+ * @throws Exception if a problem occurred during initialization
*/
- public static boolean initialize(String libraryName)
- throws Throwable
- {
+ public synchronized static boolean initialize(String libraryName) throws Exception {
if (_instance == null) {
if (libraryName == null)
_instance = new Library();
Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/jni/Socket.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/jni/Socket.java?rev=1712014&r1=1712013&r2=1712014&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/jni/Socket.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/jni/Socket.java Mon Nov 2 14:37:55 2015
@@ -379,7 +379,7 @@ public class Socket {
* @param buf The buffer to store the data in.
* @param offset Offset in the byte buffer.
* @param nbytes The number of bytes to read (-1) for full array.
- * @return If >= 0, the return value is the number of bytes read. Note a
+ * @return If ≥ 0, the return value is the number of bytes read. Note a
* non-blocking read with no data current available will return
* {@link Status#EAGAIN} and EOF will return {@link Status#APR_EOF}.
*/
@@ -388,8 +388,8 @@ public class Socket {
/**
* Read data from a network using internally set ByteBuffer.
*
- * @return If > 0, the return value is the number of bytes read. If == 0,
- * the return value indicates EOF and if < 0 the return value is the
+ * @return If > 0, the return value is the number of bytes read. If == 0,
+ * the return value indicates EOF and if < 0 the return value is the
* error code. Note a non-blocking read with no data current
* available will return {@link Status#EAGAIN} not zero.
*/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org