You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by kk...@apache.org on 2011/11/10 06:49:17 UTC

svn commit: r1200165 - in /tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util: DomUtil.java ExceptionUtils.java IntrospectionUtils.java buf/package.html file/Constants.java file/Matcher.java http/mapper/Mapper.java log/SystemLogHandler.java

Author: kkolinko
Date: Thu Nov 10 05:49:16 2011
New Revision: 1200165

URL: http://svn.apache.org/viewvc?rev=1200165&view=rev
Log:
Merging revision 1187781 from tomcat/trunk:
Whitespace removal from /java/org/apache/tomcat
I won't merge all of it (as it spans bcel etc.), but only our code.
Part 2.

Modified:
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/DomUtil.java
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/ExceptionUtils.java
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/IntrospectionUtils.java
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/buf/package.html
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/file/Constants.java
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/file/Matcher.java
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/log/SystemLogHandler.java

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/DomUtil.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/DomUtil.java?rev=1200165&r1=1200164&r2=1200165&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/DomUtil.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/DomUtil.java Thu Nov 10 05:49:16 2011
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -101,15 +101,15 @@ public class DomUtil {
         attNode.setNodeValue( val );
         attributes.setNamedItem(attNode);
     }
-    
+
     public static void removeAttribute( Node node, String attName ) {
         NamedNodeMap attributes=node.getAttributes();
-        attributes.removeNamedItem(attName);                
+        attributes.removeNamedItem(attName);
     }
-    
-    
-    /** Set or replace the text value 
-     */ 
+
+
+    /** Set or replace the text value
+     */
     public static void setText(Node node, String val) {
         Node chld=DomUtil.getChild(node, Node.TEXT_NODE);
         if( chld == null ) {
@@ -118,35 +118,35 @@ public class DomUtil {
             return;
         }
         // change the value
-        chld.setNodeValue(val);           
+        chld.setNodeValue(val);
     }
 
     /** Find the first direct child with a given attribute.
      * @param parent
-     * @param elemName name of the element, or null for any 
+     * @param elemName name of the element, or null for any
      * @param attName attribute we're looking for
      * @param attVal attribute value or null if we just want any
-     */ 
+     */
     public static Node findChildWithAtt(Node parent, String elemName,
                                         String attName, String attVal) {
-        
+
         Node child=DomUtil.getChild(parent, Node.ELEMENT_NODE);
         if( attVal== null ) {
             while( child!= null &&
-                    ( elemName==null || elemName.equals( child.getNodeName())) && 
+                    ( elemName==null || elemName.equals( child.getNodeName())) &&
                     DomUtil.getAttribute(child, attName) != null ) {
                 child=getNext(child, elemName, Node.ELEMENT_NODE );
             }
         } else {
-            while( child!= null && 
-                    ( elemName==null || elemName.equals( child.getNodeName())) && 
+            while( child!= null &&
+                    ( elemName==null || elemName.equals( child.getNodeName())) &&
                     ! attVal.equals( DomUtil.getAttribute(child, attName)) ) {
                 child=getNext(child, elemName, Node.ELEMENT_NODE );
             }
         }
-        return child;        
-    }    
-    
+        return child;
+    }
+
 
     /** Get the first child's content ( ie it's included TEXT node ).
      */
@@ -183,14 +183,14 @@ public class DomUtil {
     }
 
     /** Return the next sibling with a given name and type
-     */ 
+     */
     public static Node getNext( Node current, String name, int type) {
         Node first=current.getNextSibling();
         if( first==null ) return null;
 
         for (Node node = first; node != null;
              node = node.getNextSibling()) {
-            
+
             if( type >= 0 && node.getNodeType() != type ) continue;
             //System.out.println("getNode: " + name + " " + node.getNodeName());
             if( name==null )

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/ExceptionUtils.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/ExceptionUtils.java?rev=1200165&r1=1200164&r2=1200165&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/ExceptionUtils.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/ExceptionUtils.java Thu Nov 10 05:49:16 2011
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,9 +20,9 @@ package org.apache.tomcat.util;
  * Utilities for handling Throwables and Exceptions.
  */
 public class ExceptionUtils {
-    
+
     /**
-     * Checks whether the supplied Throwable is one that needs to be 
+     * Checks whether the supplied Throwable is one that needs to be
      * rethrown and swallows all others.
      * @param t the Throwable to check
      */

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/IntrospectionUtils.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/IntrospectionUtils.java?rev=1200165&r1=1200164&r2=1200165&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/IntrospectionUtils.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/IntrospectionUtils.java Thu Nov 10 05:49:16 2011
@@ -37,10 +37,10 @@ import java.util.Vector;
  */
 public final class IntrospectionUtils {
 
-    
+
     private static final org.apache.juli.logging.Log log=
         org.apache.juli.logging.LogFactory.getLog( IntrospectionUtils.class );
-    
+
     /**
      * Call execute() - any ant-like task should work
      */
@@ -134,7 +134,7 @@ public final class IntrospectionUtils {
      * Guess a product install/home by analyzing the class path. It works for
      * product using the pattern: lib/executable.jar or if executable.jar is
      * included in classpath by a shell script. ( java -jar also works )
-     * 
+     *
      * Insures both "install" and "home" System properties are set. If either or
      * both System properties are unset, "install" and "home" will be set to the
      * same value. This value will be the other System property that is set, or
@@ -345,9 +345,9 @@ public final class IntrospectionUtils {
                     if (methods[i].getReturnType()==Boolean.TYPE){
                         setPropertyMethodBool = methods[i];
                     }else {
-                        setPropertyMethodVoid = methods[i];    
+                        setPropertyMethodVoid = methods[i];
                     }
-                    
+
                 }
             }
 
@@ -443,7 +443,7 @@ public final class IntrospectionUtils {
         return null;
     }
 
-    /** 
+    /**
      */
     public static void setProperty(Object o, String name) {
         String setter = "set" + capitalize(name);
@@ -631,7 +631,7 @@ public final class IntrospectionUtils {
      * Add elements from the classpath <i>cp </i> to a Vector <i>jars </i> as
      * file URLs (We use Vector for JDK 1.1 compat).
      * <p>
-     * 
+     *
      * @param jars The jar list
      * @param cp a String classpath of directory or jar file elements
      *   separated by path.separator delimiters.
@@ -703,7 +703,7 @@ public final class IntrospectionUtils {
     public static void clear() {
         objectMethods.clear();
     }
-    
+
     static Hashtable<Class<?>,Method[]> objectMethods =
         new Hashtable<Class<?>,Method[]>();
 
@@ -892,7 +892,7 @@ public final class IntrospectionUtils {
         }
         return result;
     }
-    
+
     // -------------------- Get property --------------------
     // This provides a layer of abstraction
 

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/buf/package.html
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/buf/package.html?rev=1200165&r1=1200164&r2=1200165&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/buf/package.html (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/buf/package.html Thu Nov 10 05:49:16 2011
@@ -18,21 +18,21 @@
 <H1>Buffers and Encodings</h1>
 
 This package contains buffers and utils to perform encoding/decoding of buffers. That includes byte to char
-conversions, URL encodings, etc. 
+conversions, URL encodings, etc.
 
 <p>
-Encoding is a critical operation for performance. There are few tricks in this package - the C2B and 
-B2C converters are caching a ISReader/OSWriter and keep everything allocated to do the conversions 
+Encoding is a critical operation for performance. There are few tricks in this package - the C2B and
+B2C converters are caching a ISReader/OSWriter and keep everything allocated to do the conversions
 in any VM without any garbage.
 
 <p>
-This package must accomodate future extensions and additional converters ( most imporant: the nio.charset, 
-which should be detected and used if available ). Also, we do have one hand-written UTF8Decoder, and 
+This package must accomodate future extensions and additional converters ( most imporant: the nio.charset,
+which should be detected and used if available ). Also, we do have one hand-written UTF8Decoder, and
 other tuned encoders could be added.
 
 <p>
 My benchmarks ( I'm costin :-) show only small differences between C2B, B2C and hand-written codders/decoders,
-so UTF8Decoder may be disabled. 
+so UTF8Decoder may be disabled.
 
 <p>
 </body></html>

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/file/Constants.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/file/Constants.java?rev=1200165&r1=1200164&r2=1200165&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/file/Constants.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/file/Constants.java Thu Nov 10 05:49:16 2011
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/file/Matcher.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/file/Matcher.java?rev=1200165&r1=1200164&r2=1200165&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/file/Matcher.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/file/Matcher.java Thu Nov 10 05:49:16 2011
@@ -58,11 +58,11 @@ public final class Matcher {
     /**
      * Tests whether or not a given path matches any pattern in the given set.
      *
-     * If you need to call this method multiple times with the same 
+     * If you need to call this method multiple times with the same
      * pattern you should rather pre parse the pattern using tokenizePathAsArray.
      *
      * @see #tokenizePathAsArray
-     * 
+     *
      * @param patternSet The pattern set to match against. Must not be
      *                <code>null</code>.
      * @param str     The path to match, as a String. Must not be
@@ -83,11 +83,11 @@ public final class Matcher {
     /**
      * Tests whether or not a given path matches a given pattern.
      *
-     * If you need to call this method multiple times with the same 
+     * If you need to call this method multiple times with the same
      * pattern you should rather pre parse the pattern using tokenizePathAsArray.
      *
      * @see #tokenizePathAsArray
-     * 
+     *
      * @param pattern The pattern to match against. Must not be
      *                <code>null</code>.
      * @param str     The path to match, as a String. Must not be
@@ -103,12 +103,12 @@ public final class Matcher {
 
     /**
      * Tests whether or not a given path matches a given pattern.
-     * 
-     * If you need to call this method multiple times with the same 
+     *
+     * If you need to call this method multiple times with the same
      * pattern you should rather pre parse the pattern using tokenizePathAsArray.
      *
      * @see #tokenizePathAsArray
-     * 
+     *
      * @param pattern The pattern to match against. Must not be
      *                <code>null</code>.
      * @param str     The path to match, as a String. Must not be

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java?rev=1200165&r1=1200164&r2=1200165&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/mapper/Mapper.java Thu Nov 10 05:49:16 2011
@@ -36,7 +36,7 @@ public final class Mapper {
 
     private static final org.apache.juli.logging.Log log =
         org.apache.juli.logging.LogFactory.getLog(Mapper.class);
-    
+
     protected static final StringManager sm =
         StringManager.getManager(Mapper.class.getPackage().getName());
 
@@ -142,7 +142,7 @@ public final class Mapper {
             return;
         }
         Host realHost = hosts[pos];
-        
+
         Host[] newHosts = new Host[hosts.length + 1];
         Host newHost = new Host();
         newHost.name = alias;
@@ -229,9 +229,9 @@ public final class Mapper {
                     }
                     pos2 = find(newContexts, path);
                 }
-                
+
                 Context mappedContext = mappedHost.contextList.contexts[pos2];
-                
+
                 ContextVersion[] contextVersions = mappedContext.versions;
                 ContextVersion[] newContextVersions =
                     new ContextVersion[contextVersions.length + 1];
@@ -271,19 +271,19 @@ public final class Mapper {
                 if (contexts.length == 0 ){
                     return;
                 }
-                
+
                 int pos2 = find(contexts, path);
                 if (pos2 < 0 || !path.equals(contexts[pos2].name)) {
                     return;
                 }
                 Context context = contexts[pos2];
-                
+
                 ContextVersion[] contextVersions = context.versions;
                 ContextVersion[] newContextVersions =
                     new ContextVersion[contextVersions.length - 1];
                 if (removeMap(contextVersions, newContextVersions, version)) {
                     context.versions = newContextVersions;
-                    
+
                     if (context.versions.length == 0) {
                         // Remove the context
                         Context[] newContexts = new Context[contexts.length -1];
@@ -452,7 +452,7 @@ public final class Mapper {
     }
 
     protected void removeWrapper(ContextVersion context, String path) {
-        
+
         if (log.isDebugEnabled()) {
             log.debug(sm.getString("mapper.removeWrapper", context.name, path));
         }
@@ -512,7 +512,7 @@ public final class Mapper {
 
     /**
      * Add a welcome file to the given context.
-     * 
+     *
      * @param hostName
      * @param contextPath
      * @param welcomeFile
@@ -553,11 +553,11 @@ public final class Mapper {
             }
         }
     }
-    
-    
+
+
     /**
      * Remove a welcome file from the given context.
-     * 
+     *
      * @param hostName
      * @param contextPath
      * @param welcomeFile
@@ -610,11 +610,11 @@ public final class Mapper {
             }
         }
     }
-    
-    
+
+
     /**
      * Clear the welcome files for the given context.
-     * 
+     *
      * @param hostName
      * @param contextPath
      */
@@ -649,8 +649,8 @@ public final class Mapper {
             }
         }
     }
-    
-    
+
+
     /**
      * Map the specified host name and URI, mutating the given mapping data.
      *
@@ -707,7 +707,7 @@ public final class Mapper {
         Context[] contexts = null;
         Context context = null;
         ContextVersion contextVersion = null;
-        
+
         int nesting = 0;
 
         // Virtual host mapping
@@ -787,7 +787,7 @@ public final class Mapper {
                 }
                 mappingData.contexts = contextObjects;
             }
-            
+
             if (version == null) {
                 // Return the latest version
                 contextVersion = contextVersions[versionCount - 1];
@@ -845,7 +845,7 @@ public final class Mapper {
         boolean checkJspWelcomeFiles = false;
         Wrapper[] wildcardWrappers = contextVersion.wildcardWrappers;
         if (mappingData.wrapper == null) {
-            internalMapWildcardWrapper(wildcardWrappers, contextVersion.nesting, 
+            internalMapWildcardWrapper(wildcardWrappers, contextVersion.nesting,
                                        path, mappingData);
             if (mappingData.wrapper != null && mappingData.jspWildCard) {
                 char[] buf = path.getBuffer();
@@ -857,7 +857,7 @@ public final class Mapper {
                      * Force the context's welcome files, which are interpreted
                      * as JSP files (since they match the url-pattern), to be
                      * considered. See Bugzilla 27664.
-                     */ 
+                     */
                     mappingData.wrapper = null;
                     checkJspWelcomeFiles = true;
                 } else {
@@ -906,7 +906,7 @@ public final class Mapper {
                     // Rule 4b -- Welcome resources processing for prefix match
                     if (mappingData.wrapper == null) {
                         internalMapWildcardWrapper
-                            (wildcardWrappers, contextVersion.nesting, 
+                            (wildcardWrappers, contextVersion.nesting,
                              path, mappingData);
                     }
 
@@ -929,10 +929,10 @@ public final class Mapper {
                                 mappingData.wrapper =
                                     contextVersion.defaultWrapper.object;
                                 mappingData.requestPath.setChars
-                                    (path.getBuffer(), path.getStart(), 
+                                    (path.getBuffer(), path.getStart(),
                                      path.getLength());
                                 mappingData.wrapperPath.setChars
-                                    (path.getBuffer(), path.getStart(), 
+                                    (path.getBuffer(), path.getStart(),
                                      path.getLength());
                                 mappingData.requestPath.setString(pathStr);
                                 mappingData.wrapperPath.setString(pathStr);
@@ -944,13 +944,13 @@ public final class Mapper {
                 path.setOffset(servletPath);
                 path.setEnd(pathEnd);
             }
-                                        
+
         }
 
         /* welcome file processing - take 2
          * Now that we have looked for welcome files with a physical
          * backing, now look for an extension mapping listed
-         * but may not have a physical backing to it. This is for 
+         * but may not have a physical backing to it. This is for
          * the case of index.jsf, index.do, etc.
          * A watered down version of rule 4
          */
@@ -998,8 +998,8 @@ public final class Mapper {
                     // Swallow, since someone else handles the 404
                 }
                 if (file != null && file instanceof DirContext) {
-                    // Note: this mutates the path: do not do any processing 
-                    // after this (since we set the redirectPath, there 
+                    // Note: this mutates the path: do not do any processing
+                    // after this (since we set the redirectPath, there
                     // shouldn't be any)
                     path.setOffset(pathOffset);
                     path.append('/');
@@ -1036,7 +1036,7 @@ public final class Mapper {
      * Wildcard mapping.
      */
     private final void internalMapWildcardWrapper
-        (Wrapper[] wrappers, int nesting, CharChunk path, 
+        (Wrapper[] wrappers, int nesting, CharChunk path,
          MappingData mappingData) {
 
         int pathEnd = path.getEnd();
@@ -1085,7 +1085,7 @@ public final class Mapper {
 
     /**
      * Extension mappings.
-     * 
+     *
      * @param wrappers          Set of wrappers to check for matches
      * @param path              Path to map
      * @param mappingData       Mapping data for result
@@ -1155,10 +1155,10 @@ public final class Mapper {
         if (b == -1) {
             return -1;
         }
-        
+
         if (compare(name, start, end, map[0].name) < 0 ) {
             return -1;
-        }         
+        }
         if (b == 0) {
             return 0;
         }
@@ -1213,7 +1213,7 @@ public final class Mapper {
         }
         if (compareIgnoreCase(name, start, end, map[0].name) < 0 ) {
             return -1;
-        }         
+        }
         if (b == 0) {
             return 0;
         }
@@ -1256,10 +1256,10 @@ public final class Mapper {
         if (b == -1) {
             return -1;
         }
-        
+
         if (name.compareTo(map[0].name) < 0) {
             return -1;
-        } 
+        }
         if (b == 0) {
             return 0;
         }

Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/log/SystemLogHandler.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/log/SystemLogHandler.java?rev=1200165&r1=1200164&r2=1200165&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/log/SystemLogHandler.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/log/SystemLogHandler.java Thu Nov 10 05:49:16 2011
@@ -23,9 +23,9 @@ import java.util.EmptyStackException;
 import java.util.Stack;
 
 /**
- * This helper class may be used to do sophisticated redirection of 
+ * This helper class may be used to do sophisticated redirection of
  * System.out and System.err on a per Thread basis.
- * 
+ *
  * A stack is implemented per Thread so that nested startCapture
  * and stopCapture can be used.
  *



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