tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1392656 - in /tomcat/sandbox/trunk-resources: ./ java/javax/servlet/ java/org/apache/catalina/ha/tcp/ java/org/apache/coyote/ java/org/apache/naming/resources/ modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ modules/jdbc-pool/...
Date Mon, 01 Oct 2012 22:01:04 GMT
Author: markt
Date: Mon Oct  1 22:01:03 2012
New Revision: 1392656

URL: http://svn.apache.org/viewvc?rev=1392656&view=rev
Log:
Sync with trunk

Modified:
    tomcat/sandbox/trunk-resources/   (props changed)
    tomcat/sandbox/trunk-resources/java/javax/servlet/ServletInputStream.java
    tomcat/sandbox/trunk-resources/java/javax/servlet/ServletOutputStream.java
    tomcat/sandbox/trunk-resources/java/javax/servlet/ServletRequest.java
    tomcat/sandbox/trunk-resources/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java
    tomcat/sandbox/trunk-resources/java/org/apache/coyote/AbstractProtocol.java
    tomcat/sandbox/trunk-resources/java/org/apache/naming/resources/BaseDirContext.java
    tomcat/sandbox/trunk-resources/java/org/apache/naming/resources/FileDirContext.java
    tomcat/sandbox/trunk-resources/java/org/apache/naming/resources/WARDirContext.java
    tomcat/sandbox/trunk-resources/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java
    tomcat/sandbox/trunk-resources/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java
    tomcat/sandbox/trunk-resources/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestInterceptor.java
    tomcat/sandbox/trunk-resources/res/findbugs/filter-false-positives.xml

Propchange: tomcat/sandbox/trunk-resources/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1390900-1392655

Modified: tomcat/sandbox/trunk-resources/java/javax/servlet/ServletInputStream.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/javax/servlet/ServletInputStream.java?rev=1392656&r1=1392655&r2=1392656&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/javax/servlet/ServletInputStream.java (original)
+++ tomcat/sandbox/trunk-resources/java/javax/servlet/ServletInputStream.java Mon Oct  1 22:01:03
2012
@@ -84,14 +84,14 @@ public abstract class ServletInputStream
 
     /**
      * TODO SERVLET 3.1
-     * @return
+     * @return  TODO
      */
     public abstract int dataAvailable();
 
 
     /**
      * TODO SERVLET 3.1
-     * @return
+     * @return  TODO
      */
     public abstract boolean isFinished();
 
@@ -99,7 +99,7 @@ public abstract class ServletInputStream
      * TODO SERVLET 3.1
      * If this returns false, the container will invoke
      * {@link ReadListener#onDataAvailable()} when data is available.
-     * @return
+     * @return  TODO
      */
     public abstract boolean isReady();
 

Modified: tomcat/sandbox/trunk-resources/java/javax/servlet/ServletOutputStream.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/javax/servlet/ServletOutputStream.java?rev=1392656&r1=1392655&r2=1392656&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/javax/servlet/ServletOutputStream.java (original)
+++ tomcat/sandbox/trunk-resources/java/javax/servlet/ServletOutputStream.java Mon Oct  1
22:01:03 2012
@@ -276,7 +276,7 @@ public abstract class ServletOutputStrea
      * If this returns false, it will cause a callback to
      * {@link WriteListener#onWritePossible()} when the buffer has emptied
      * TODO SERVLET 3.1
-     * @return
+     * @return  TODO
      */
     public abstract boolean canWrite();
 

Modified: tomcat/sandbox/trunk-resources/java/javax/servlet/ServletRequest.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/javax/servlet/ServletRequest.java?rev=1392656&r1=1392655&r2=1392656&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/javax/servlet/ServletRequest.java (original)
+++ tomcat/sandbox/trunk-resources/java/javax/servlet/ServletRequest.java Mon Oct  1 22:01:03
2012
@@ -105,13 +105,17 @@ public interface ServletRequest {
      * same as the value of the CGI variable CONTENT_LENGTH.
      *
      * @return an integer containing the length of the request body or -1 if the
-     *         length is not known
+     *         length is not known or is greater than {@link Integer#MAX_VALUE}
      */
     public int getContentLength();
 
     /**
-     * TODO SERVLET 3.1
-     * @return
+     * Returns the length, in bytes, of the request body and made available by
+     * the input stream, or -1 if the length is not known. For HTTP servlets,
+     * same as the value of the CGI variable CONTENT_LENGTH.
+     *
+     * @return a long integer containing the length of the request body or -1 if
+     *         the length is not known
      */
     public long getContentLengthLong();
 

Modified: tomcat/sandbox/trunk-resources/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java?rev=1392656&r1=1392655&r2=1392656&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java Mon
Oct  1 22:01:03 2012
@@ -624,7 +624,7 @@ public class SimpleTcpCluster extends Li
 
     /**
      * Start Cluster and implement the requirements
-     * of {@link LifecycleBase#startInternal()}.
+     * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
      *
      * @exception LifecycleException if this component detects a fatal error
      *  that prevents this component from being used
@@ -713,7 +713,7 @@ public class SimpleTcpCluster extends Li
 
     /**
      * Stop Cluster and implement the requirements
-     * of {@link LifecycleBase#startInternal()}.
+     * of {@link org.apache.catalina.util.LifecycleBase#stopInternal()}.
      *
      * @exception LifecycleException if this component detects a fatal error
      *  that prevents this component from being used

Modified: tomcat/sandbox/trunk-resources/java/org/apache/coyote/AbstractProtocol.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/coyote/AbstractProtocol.java?rev=1392656&r1=1392655&r2=1392656&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/coyote/AbstractProtocol.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/coyote/AbstractProtocol.java Mon Oct  1
22:01:03 2012
@@ -785,7 +785,7 @@ public abstract class AbstractProtocol i
         }
 
         @Override
-        public void clear() {
+        public synchronized void clear() {
             Processor<S> next = pop();
             while (next != null) {
                 handler.unregister(next);

Modified: tomcat/sandbox/trunk-resources/java/org/apache/naming/resources/BaseDirContext.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/naming/resources/BaseDirContext.java?rev=1392656&r1=1392655&r2=1392656&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/naming/resources/BaseDirContext.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/naming/resources/BaseDirContext.java Mon
Oct  1 22:01:03 2012
@@ -48,6 +48,7 @@ import javax.naming.directory.SearchResu
 
 import org.apache.naming.NameParserImpl;
 import org.apache.naming.NamingContextBindingsEnumeration;
+import org.apache.naming.NamingContextEnumeration;
 import org.apache.naming.NamingEntry;
 import org.apache.naming.StringManager;
 
@@ -651,7 +652,7 @@ public abstract class BaseDirContext imp
      * @exception NamingException if a naming exception is encountered
      */
     @Override
-    public NamingEnumeration<NameClassPair> list(Name name)
+    public final NamingEnumeration<NameClassPair> list(Name name)
         throws NamingException {
         return list(name.toString());
     }
@@ -667,8 +668,44 @@ public abstract class BaseDirContext imp
      * @exception NamingException if a naming exception is encountered
      */
     @Override
-    public abstract NamingEnumeration<NameClassPair> list(String name)
-        throws NamingException;
+    public final NamingEnumeration<NameClassPair> list(String name)
+        throws NamingException {
+
+        if (!aliases.isEmpty()) {
+            AliasResult result = findAlias(name);
+            if (result.dirContext != null) {
+                return result.dirContext.list(result.aliasName);
+            }
+        }
+
+        // Next do a standard lookup
+        List<NamingEntry> bindings = doListBindings(name);
+
+        // Check the alternate locations
+        List<NamingEntry> altBindings = null;
+
+        for (DirContext altDirContext : altDirContexts) {
+            if (altDirContext instanceof BaseDirContext) {
+                altBindings = ((BaseDirContext) altDirContext).doListBindings(
+                        "/META-INF/resources" + name);
+            }
+            if (altBindings != null) {
+                if (bindings == null) {
+                    bindings = altBindings;
+                } else {
+                    bindings.addAll(altBindings);
+                }
+            }
+        }
+
+        if (bindings != null) {
+            return new NamingContextEnumeration(bindings.iterator());
+        }
+
+        // Really not found
+        throw new NameNotFoundException(
+                sm.getString("resources.notFound", name));
+    }
 
 
     /**

Modified: tomcat/sandbox/trunk-resources/java/org/apache/naming/resources/FileDirContext.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/naming/resources/FileDirContext.java?rev=1392656&r1=1392655&r2=1392656&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/naming/resources/FileDirContext.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/naming/resources/FileDirContext.java Mon
Oct  1 22:01:03 2012
@@ -30,7 +30,6 @@ import java.util.Hashtable;
 import java.util.List;
 
 import javax.naming.NameAlreadyBoundException;
-import javax.naming.NameClassPair;
 import javax.naming.NameNotFoundException;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
@@ -41,7 +40,6 @@ import javax.naming.directory.Modificati
 import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
 
-import org.apache.naming.NamingContextEnumeration;
 import org.apache.naming.NamingEntry;
 import org.apache.tomcat.util.http.RequestUtil;
 
@@ -279,34 +277,6 @@ public class FileDirContext extends Base
 
 
     /**
-     * Enumerates the names bound in the named context, along with the class
-     * names of objects bound to them. The contents of any subcontexts are
-     * not included.
-     * <p>
-     * If a binding is added to or removed from this context, its effect on
-     * an enumeration previously returned is undefined.
-     *
-     * @param name the name of the context to list
-     * @return an enumeration of the names and class names of the bindings in
-     * this context. Each element of the enumeration is of type NameClassPair.
-     * @exception NamingException if a naming exception is encountered
-     */
-    @Override
-    public NamingEnumeration<NameClassPair> list(String name)
-        throws NamingException {
-
-        File file = file(name);
-
-        if (file == null)
-            throw new NameNotFoundException
-                (sm.getString("resources.notFound", name));
-
-        return new NamingContextEnumeration(list(file).iterator());
-
-    }
-
-
-    /**
      * Enumerates the names bound in the named context, along with the
      * objects bound to them. The contents of any subcontexts are not
      * included.

Modified: tomcat/sandbox/trunk-resources/java/org/apache/naming/resources/WARDirContext.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/naming/resources/WARDirContext.java?rev=1392656&r1=1392655&r2=1392656&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/naming/resources/WARDirContext.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/naming/resources/WARDirContext.java Mon
Oct  1 22:01:03 2012
@@ -34,8 +34,6 @@ import java.util.zip.ZipFile;
 import javax.naming.CompositeName;
 import javax.naming.InvalidNameException;
 import javax.naming.Name;
-import javax.naming.NameClassPair;
-import javax.naming.NameNotFoundException;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.OperationNotSupportedException;
@@ -45,7 +43,6 @@ import javax.naming.directory.Modificati
 import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
 
-import org.apache.naming.NamingContextEnumeration;
 import org.apache.naming.NamingEntry;
 
 /**
@@ -273,52 +270,6 @@ public class WARDirContext extends BaseD
 
 
     /**
-     * Enumerates the names bound in the named context, along with the class
-     * names of objects bound to them. The contents of any subcontexts are
-     * not included.
-     * <p>
-     * If a binding is added to or removed from this context, its effect on
-     * an enumeration previously returned is undefined.
-     *
-     * @param name the name of the context to list
-     * @return an enumeration of the names and class names of the bindings in
-     * this context. Each element of the enumeration is of type NameClassPair.
-     * @exception NamingException if a naming exception is encountered
-     */
-    @Override
-    public NamingEnumeration<NameClassPair> list(String name)
-        throws NamingException {
-        return list(getEscapedJndiName(name));
-    }
-
-
-    /**
-     * Enumerates the names bound in the named context, along with the class
-     * names of objects bound to them. The contents of any subcontexts are
-     * not included.
-     * <p>
-     * If a binding is added to or removed from this context, its effect on
-     * an enumeration previously returned is undefined.
-     *
-     * @param name the name of the context to list
-     * @return an enumeration of the names and class names of the bindings in
-     * this context. Each element of the enumeration is of type NameClassPair.
-     * @exception NamingException if a naming exception is encountered
-     */
-    @Override
-    public NamingEnumeration<NameClassPair> list(Name name)
-        throws NamingException {
-        if (name.isEmpty())
-            return new NamingContextEnumeration(list(entries).iterator());
-        Entry entry = treeLookup(name);
-        if (entry == null)
-            throw new NameNotFoundException
-                (sm.getString("resources.notFound", name));
-        return new NamingContextEnumeration(list(entry).iterator());
-    }
-
-
-    /**
      * Enumerates the names bound in the named context, along with the
      * objects bound to them. The contents of any subcontexts are not
      * included.

Modified: tomcat/sandbox/trunk-resources/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java?rev=1392656&r1=1392655&r2=1392656&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java
(original)
+++ tomcat/sandbox/trunk-resources/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java
Mon Oct  1 22:01:03 2012
@@ -147,7 +147,11 @@ public class DataSourceProxy implements 
         if (con instanceof XAConnection) {
             return (XAConnection)con;
         } else {
-            try {con.close();} catch (Exception ignore){}
+            try {
+                con.close();
+            } catch (Exception ignore) {
+                // Ignore
+            }
             throw new SQLException("Connection from pool does not implement javax.sql.XAConnection");
         }
     }
@@ -160,7 +164,11 @@ public class DataSourceProxy implements 
         if (con instanceof XAConnection) {
             return (XAConnection)con;
         } else {
-            try {con.close();} catch (Exception ignore){}
+            try {
+                con.close();
+            } catch (Exception ignore) {
+                // Ignore
+            }
             throw new SQLException("Connection from pool does not implement javax.sql.XAConnection");
         }
     }

Modified: tomcat/sandbox/trunk-resources/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java?rev=1392656&r1=1392655&r2=1392656&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java
(original)
+++ tomcat/sandbox/trunk-resources/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java
Mon Oct  1 22:01:03 2012
@@ -901,9 +901,10 @@ public class PoolProperties implements P
     }
 
 
-    public static class InterceptorDefinition {
+    public static class InterceptorDefinition implements Serializable {
+        private static final long serialVersionUID = 1L;
         protected String className;
-        protected Map<String,InterceptorProperty> properties = new HashMap<String,InterceptorProperty>();
+        protected Map<String,InterceptorProperty> properties = new HashMap<>();
         protected volatile Class<?> clazz = null;
         public InterceptorDefinition(String className) {
             this.className = className;
@@ -930,6 +931,7 @@ public class PoolProperties implements P
             return properties;
         }
 
+        @SuppressWarnings("unchecked")
         public Class<? extends JdbcInterceptor> getInterceptorClass() throws ClassNotFoundException
{
             if (clazz==null) {
                 if (getClassName().indexOf(".")<0) {
@@ -948,7 +950,8 @@ public class PoolProperties implements P
         }
     }
 
-    public static class InterceptorProperty {
+    public static class InterceptorProperty implements Serializable {
+        private static final long serialVersionUID = 1L;
         String name;
         String value;
         public InterceptorProperty(String name, String value) {

Modified: tomcat/sandbox/trunk-resources/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestInterceptor.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestInterceptor.java?rev=1392656&r1=1392655&r2=1392656&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestInterceptor.java
(original)
+++ tomcat/sandbox/trunk-resources/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/interceptor/TestInterceptor.java
Mon Oct  1 22:01:03 2012
@@ -14,7 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 package org.apache.tomcat.jdbc.pool.interceptor;
 
 import java.util.Map;
@@ -32,7 +31,6 @@ public class TestInterceptor extends Jdb
 
     @Override
     public void poolClosed(ConnectionPool pool) {
-        // TODO Auto-generated method stub
         super.poolClosed(pool);
         poolclosed = true;
     }
@@ -45,8 +43,7 @@ public class TestInterceptor extends Jdb
 
     @Override
     public void reset(ConnectionPool parent, PooledConnection con) {
-        // TODO Auto-generated method stub
-
+        // NO-OP
     }
 
     @Override
@@ -54,6 +51,4 @@ public class TestInterceptor extends Jdb
         instancecount.incrementAndGet();
         super.setProperties(properties);
     }
-
-
 }

Modified: tomcat/sandbox/trunk-resources/res/findbugs/filter-false-positives.xml
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/res/findbugs/filter-false-positives.xml?rev=1392656&r1=1392655&r2=1392656&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/res/findbugs/filter-false-positives.xml (original)
+++ tomcat/sandbox/trunk-resources/res/findbugs/filter-false-positives.xml Mon Oct  1 22:01:03
2012
@@ -210,6 +210,12 @@
     <Bug code="CN" />
   </Match>
   <Match>
+    <!-- Use of == is deliberate -->
+    <Class name="org.apache.tomcat.jdbc.pool.JdbcInterceptor" />
+    <Method name="compare" />
+    <Bug code="ES" />
+  </Match>
+  <Match>
     <!-- Class name is appropriate -->
     <Class name="org.apache.tomcat.util.bcel.classfile.CodeException"/>
     <Bug code="Nm" />
@@ -405,6 +411,12 @@
     <Bug code="DE" />
   </Match>
   <Match>
+    <!-- Use of statics is unavoidable in all cases -->
+    <!-- Better to use it consistently rather than only where necessary -->
+    <Class name="org.apache.tomcat.jdbc.pool.interceptor.TestInterceptor" />
+    <Bug code="ST" />
+  </Match>
+  <Match>
     <Class name="org.apache.tomcat.util.net.TestSsl" />
     <Or>
       <Method name="testRenegotiateFail" />



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


Mime
View raw message