tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r978845 [2/2] - in /tomcat/trunk/java/org/apache: coyote/ coyote/ajp/ coyote/http11/filters/ naming/ naming/factory/ naming/resources/ tomcat/ tomcat/util/ tomcat/util/bcel/ tomcat/util/bcel/classfile/ tomcat/util/buf/ tomcat/util/digester/...
Date Sat, 24 Jul 2010 11:03:02 GMT
Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java?rev=978845&r1=978844&r2=978845&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java Sat Jul 24 11:03:00 2010
@@ -23,118 +23,99 @@ import org.apache.tomcat.util.bcel.Const
 
 public class SimpleElementValue extends ElementValue
 {
-	private int index;
+    private int index;
 
-	public SimpleElementValue(int type, int index, ConstantPool cpool)
-	{
-		super(type, cpool);
-		this.index = index;
-	}
-
-	/**
-	 * @return Value entry index in the cpool
-	 */
-	public int getIndex()
-	{
-		return index;
-	}
-
-	
-
-	
-
-	
-
-	
-
-	
-
-	
-
-	
-
-	
-
-	
-
-	
-
-	public String toString()
-	{
-		return stringifyValue();
-	}
-
-	// Whatever kind of value it is, return it as a string
-	public String stringifyValue()
-	{
-		switch (type)
-		{
-		case PRIMITIVE_INT:
-			ConstantInteger c = (ConstantInteger) cpool.getConstant(getIndex(),
-					Constants.CONSTANT_Integer);
-			return Integer.toString(c.getBytes());
-		case PRIMITIVE_LONG:
-			ConstantLong j = (ConstantLong) cpool.getConstant(getIndex(),
-					Constants.CONSTANT_Long);
-			return Long.toString(j.getBytes());
-		case PRIMITIVE_DOUBLE:
-			ConstantDouble d = (ConstantDouble) cpool.getConstant(getIndex(),
-					Constants.CONSTANT_Double);
-			return Double.toString(d.getBytes());
-		case PRIMITIVE_FLOAT:
-			ConstantFloat f = (ConstantFloat) cpool.getConstant(getIndex(),
-					Constants.CONSTANT_Float);
-			return Float.toString(f.getBytes());
-		case PRIMITIVE_SHORT:
-			ConstantInteger s = (ConstantInteger) cpool.getConstant(getIndex(),
-					Constants.CONSTANT_Integer);
-			return Integer.toString(s.getBytes());
-		case PRIMITIVE_BYTE:
-			ConstantInteger b = (ConstantInteger) cpool.getConstant(getIndex(),
-					Constants.CONSTANT_Integer);
-			return Integer.toString(b.getBytes());
-		case PRIMITIVE_CHAR:
-			ConstantInteger ch = (ConstantInteger) cpool.getConstant(
-					getIndex(), Constants.CONSTANT_Integer);
-			return String.valueOf((char)ch.getBytes());
-		case PRIMITIVE_BOOLEAN:
-			ConstantInteger bo = (ConstantInteger) cpool.getConstant(
-					getIndex(), Constants.CONSTANT_Integer);
-			if (bo.getBytes() == 0)
-				return "false";
-			if (bo.getBytes() != 0)
-				return "true";
-		case STRING:
-			ConstantUtf8 cu8 = (ConstantUtf8) cpool.getConstant(getIndex(),
-					Constants.CONSTANT_Utf8);
-			return cu8.getBytes();
-		default:
-			throw new RuntimeException(
-					"SimpleElementValue class does not know how to stringify type "
-							+ type);
-		}
-	}
-
-	public void dump(DataOutputStream dos) throws IOException
-	{
-		dos.writeByte(type); // u1 kind of value
-		switch (type)
-		{
-		case PRIMITIVE_INT:
-		case PRIMITIVE_BYTE:
-		case PRIMITIVE_CHAR:
-		case PRIMITIVE_FLOAT:
-		case PRIMITIVE_LONG:
-		case PRIMITIVE_BOOLEAN:
-		case PRIMITIVE_SHORT:
-		case PRIMITIVE_DOUBLE:
-		case STRING:
-			dos.writeShort(getIndex());
-			break;
-		default:
-			throw new RuntimeException(
-					"SimpleElementValue doesnt know how to write out type "
-							+ type);
-		}
-	}
+    public SimpleElementValue(int type, int index, ConstantPool cpool)
+    {
+        super(type, cpool);
+        this.index = index;
+    }
+
+    /**
+     * @return Value entry index in the cpool
+     */
+    public int getIndex()
+    {
+        return index;
+    }
+    
+
+    public String toString()
+    {
+        return stringifyValue();
+    }
+
+    // Whatever kind of value it is, return it as a string
+    public String stringifyValue()
+    {
+        switch (type)
+        {
+        case PRIMITIVE_INT:
+            ConstantInteger c = (ConstantInteger) cpool.getConstant(getIndex(),
+                    Constants.CONSTANT_Integer);
+            return Integer.toString(c.getBytes());
+        case PRIMITIVE_LONG:
+            ConstantLong j = (ConstantLong) cpool.getConstant(getIndex(),
+                    Constants.CONSTANT_Long);
+            return Long.toString(j.getBytes());
+        case PRIMITIVE_DOUBLE:
+            ConstantDouble d = (ConstantDouble) cpool.getConstant(getIndex(),
+                    Constants.CONSTANT_Double);
+            return Double.toString(d.getBytes());
+        case PRIMITIVE_FLOAT:
+            ConstantFloat f = (ConstantFloat) cpool.getConstant(getIndex(),
+                    Constants.CONSTANT_Float);
+            return Float.toString(f.getBytes());
+        case PRIMITIVE_SHORT:
+            ConstantInteger s = (ConstantInteger) cpool.getConstant(getIndex(),
+                    Constants.CONSTANT_Integer);
+            return Integer.toString(s.getBytes());
+        case PRIMITIVE_BYTE:
+            ConstantInteger b = (ConstantInteger) cpool.getConstant(getIndex(),
+                    Constants.CONSTANT_Integer);
+            return Integer.toString(b.getBytes());
+        case PRIMITIVE_CHAR:
+            ConstantInteger ch = (ConstantInteger) cpool.getConstant(
+                    getIndex(), Constants.CONSTANT_Integer);
+            return String.valueOf((char)ch.getBytes());
+        case PRIMITIVE_BOOLEAN:
+            ConstantInteger bo = (ConstantInteger) cpool.getConstant(
+                    getIndex(), Constants.CONSTANT_Integer);
+            if (bo.getBytes() == 0)
+                return "false";
+            if (bo.getBytes() != 0)
+                return "true";
+        case STRING:
+            ConstantUtf8 cu8 = (ConstantUtf8) cpool.getConstant(getIndex(),
+                    Constants.CONSTANT_Utf8);
+            return cu8.getBytes();
+        default:
+            throw new RuntimeException(
+                    "SimpleElementValue class does not know how to stringify type "
+                            + type);
+        }
+    }
+
+    public void dump(DataOutputStream dos) throws IOException
+    {
+        dos.writeByte(type); // u1 kind of value
+        switch (type)
+        {
+        case PRIMITIVE_INT:
+        case PRIMITIVE_BYTE:
+        case PRIMITIVE_CHAR:
+        case PRIMITIVE_FLOAT:
+        case PRIMITIVE_LONG:
+        case PRIMITIVE_BOOLEAN:
+        case PRIMITIVE_SHORT:
+        case PRIMITIVE_DOUBLE:
+        case STRING:
+            dos.writeShort(getIndex());
+            break;
+        default:
+            throw new RuntimeException(
+                    "SimpleElementValue doesnt know how to write out type "
+                            + type);
+        }
+    }
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTableEntry.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTableEntry.java?rev=978845&r1=978844&r2=978845&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTableEntry.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/StackMapTableEntry.java Sat Jul 24 11:03:00 2010
@@ -35,7 +35,7 @@ import org.apache.tomcat.util.bcel.Const
  */
 public final class StackMapTableEntry implements Cloneable {
 
-	private int frame_type;
+    private int frame_type;
     private int byte_code_offset_delta;
     private int number_of_locals;
     private StackMapType[] types_of_locals;
@@ -52,43 +52,43 @@ public final class StackMapTableEntry im
         this(file.read(), -1, -1, null, -1, null);
         
         if (frame_type >= Constants.SAME_FRAME && frame_type <= Constants.SAME_FRAME_MAX) {
-        	byte_code_offset_delta = frame_type - Constants.SAME_FRAME;
+            byte_code_offset_delta = frame_type - Constants.SAME_FRAME;
         } else if (frame_type >= Constants.SAME_LOCALS_1_STACK_ITEM_FRAME && frame_type <= Constants.SAME_LOCALS_1_STACK_ITEM_FRAME_MAX) {
-        	byte_code_offset_delta = frame_type - Constants.SAME_LOCALS_1_STACK_ITEM_FRAME;
-        	number_of_stack_items = 1;
-        	types_of_stack_items = new StackMapType[1];
-        	types_of_stack_items[0] = new StackMapType(file, constant_pool);
+            byte_code_offset_delta = frame_type - Constants.SAME_LOCALS_1_STACK_ITEM_FRAME;
+            number_of_stack_items = 1;
+            types_of_stack_items = new StackMapType[1];
+            types_of_stack_items[0] = new StackMapType(file, constant_pool);
         } else if (frame_type == Constants.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED) {
-        	byte_code_offset_delta = file.readShort();
-        	number_of_stack_items = 1;
-        	types_of_stack_items = new StackMapType[1];
-        	types_of_stack_items[0] = new StackMapType(file, constant_pool);
+            byte_code_offset_delta = file.readShort();
+            number_of_stack_items = 1;
+            types_of_stack_items = new StackMapType[1];
+            types_of_stack_items[0] = new StackMapType(file, constant_pool);
         } else if (frame_type >= Constants.CHOP_FRAME && frame_type <= Constants.CHOP_FRAME_MAX) {
-        	byte_code_offset_delta = file.readShort();
+            byte_code_offset_delta = file.readShort();
         } else if (frame_type == Constants.SAME_FRAME_EXTENDED) {
-        	byte_code_offset_delta = file.readShort();
+            byte_code_offset_delta = file.readShort();
         } else if (frame_type >= Constants.APPEND_FRAME && frame_type <= Constants.APPEND_FRAME_MAX) {
-        	byte_code_offset_delta = file.readShort();
-        	number_of_locals = frame_type - 251;
-        	types_of_locals = new StackMapType[number_of_locals];
-        	for (int i = 0; i < number_of_locals; i++) {
-        		types_of_locals[i] = new StackMapType(file, constant_pool);
-        	}        	
+            byte_code_offset_delta = file.readShort();
+            number_of_locals = frame_type - 251;
+            types_of_locals = new StackMapType[number_of_locals];
+            for (int i = 0; i < number_of_locals; i++) {
+                types_of_locals[i] = new StackMapType(file, constant_pool);
+            }            
         } else if (frame_type == Constants.FULL_FRAME) {        
-        	byte_code_offset_delta = file.readShort();
-        	number_of_locals = file.readShort();
-        	types_of_locals = new StackMapType[number_of_locals];
-        	for (int i = 0; i < number_of_locals; i++) {
-        		types_of_locals[i] = new StackMapType(file, constant_pool);
-        	}
-        	number_of_stack_items = file.readShort();
-        	types_of_stack_items = new StackMapType[number_of_stack_items];
-        	for (int i = 0; i < number_of_stack_items; i++) {
-        		types_of_stack_items[i] = new StackMapType(file, constant_pool);
-        	}
+            byte_code_offset_delta = file.readShort();
+            number_of_locals = file.readShort();
+            types_of_locals = new StackMapType[number_of_locals];
+            for (int i = 0; i < number_of_locals; i++) {
+                types_of_locals[i] = new StackMapType(file, constant_pool);
+            }
+            number_of_stack_items = file.readShort();
+            types_of_stack_items = new StackMapType[number_of_stack_items];
+            for (int i = 0; i < number_of_stack_items; i++) {
+                types_of_stack_items[i] = new StackMapType(file, constant_pool);
+            }
         } else {
-        	/* Can't happen */
-        	throw new ClassFormatException ("Invalid frame type found while parsing stack map table: " + frame_type);
+            /* Can't happen */
+            throw new ClassFormatException ("Invalid frame type found while parsing stack map table: " + frame_type);
         }
     }
 
@@ -96,7 +96,7 @@ public final class StackMapTableEntry im
     public StackMapTableEntry(int tag, int byte_code_offset_delta, int number_of_locals,
             StackMapType[] types_of_locals, int number_of_stack_items,
             StackMapType[] types_of_stack_items) {
-    	this.frame_type = tag;
+        this.frame_type = tag;
         this.byte_code_offset_delta = byte_code_offset_delta;
         this.number_of_locals = number_of_locals;
         this.types_of_locals = types_of_locals;
@@ -112,21 +112,21 @@ public final class StackMapTableEntry im
      * @throws IOException
      */
     public final void dump( DataOutputStream file ) throws IOException {
-    	file.write(frame_type);
-    	if (frame_type >= Constants.SAME_LOCALS_1_STACK_ITEM_FRAME && frame_type <= Constants.SAME_LOCALS_1_STACK_ITEM_FRAME_MAX) {
-        	types_of_stack_items[0].dump(file);
+        file.write(frame_type);
+        if (frame_type >= Constants.SAME_LOCALS_1_STACK_ITEM_FRAME && frame_type <= Constants.SAME_LOCALS_1_STACK_ITEM_FRAME_MAX) {
+            types_of_stack_items[0].dump(file);
         } else if (frame_type == Constants.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED) {
-        	file.write(byte_code_offset_delta);
-        	types_of_stack_items[0].dump(file);
+            file.write(byte_code_offset_delta);
+            types_of_stack_items[0].dump(file);
         } else if (frame_type >= Constants.CHOP_FRAME && frame_type <= Constants.CHOP_FRAME_MAX) {
-        	file.write(byte_code_offset_delta);
+            file.write(byte_code_offset_delta);
         } else if (frame_type == Constants.SAME_FRAME_EXTENDED) {
-        	file.write(byte_code_offset_delta);
+            file.write(byte_code_offset_delta);
         } else if (frame_type >= Constants.APPEND_FRAME && frame_type <= Constants.APPEND_FRAME_MAX) {
-        	file.write(byte_code_offset_delta);
-        	for (int i = 0; i < number_of_locals; i++) {
-        		types_of_locals[i].dump(file);
-        	}        	
+            file.write(byte_code_offset_delta);
+            for (int i = 0; i < number_of_locals; i++) {
+                types_of_locals[i].dump(file);
+            }            
         } else if (frame_type == Constants.FULL_FRAME) {        
             file.writeShort(byte_code_offset_delta);
             file.writeShort(number_of_locals);
@@ -138,8 +138,8 @@ public final class StackMapTableEntry im
                 types_of_stack_items[i].dump(file);
             }
         } else {
-        	/* Can't happen */
-        	throw new ClassFormatException ("Invalid Stack map table tag: " + frame_type);
+            /* Can't happen */
+            throw new ClassFormatException ("Invalid Stack map table tag: " + frame_type);
         }
     }
 
@@ -151,21 +151,21 @@ public final class StackMapTableEntry im
         StringBuffer buf = new StringBuffer(64);
         buf.append("(");
         if (frame_type >= Constants.SAME_FRAME && frame_type <= Constants.SAME_FRAME_MAX) {
-        	buf.append("SAME");
+            buf.append("SAME");
         } else if (frame_type >= Constants.SAME_LOCALS_1_STACK_ITEM_FRAME && frame_type <= Constants.SAME_LOCALS_1_STACK_ITEM_FRAME_MAX) {
-        	buf.append("SAME_LOCALS_1_STACK");
+            buf.append("SAME_LOCALS_1_STACK");
         } else if (frame_type == Constants.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED) {
-        	buf.append("SAME_LOCALS_1_STACK_EXTENDED");
+            buf.append("SAME_LOCALS_1_STACK_EXTENDED");
         } else if (frame_type >= Constants.CHOP_FRAME && frame_type <= Constants.CHOP_FRAME_MAX) {
-        	buf.append("CHOP "+(251-frame_type));
+            buf.append("CHOP "+(251-frame_type));
         } else if (frame_type == Constants.SAME_FRAME_EXTENDED) {
-        	buf.append("SAME_EXTENDED");
+            buf.append("SAME_EXTENDED");
         } else if (frame_type >= Constants.APPEND_FRAME && frame_type <= Constants.APPEND_FRAME_MAX) {
-        	buf.append("APPEND "+(frame_type-251));
+            buf.append("APPEND "+(frame_type-251));
         } else if (frame_type == Constants.FULL_FRAME) {        
-        	buf.append("FULL");
+            buf.append("FULL");
         } else {
-        	buf.append("UNKNOWN");
+            buf.append("UNKNOWN");
         }
         buf.append(", offset delta=").append(byte_code_offset_delta);
         if (number_of_locals > 0) {

Modified: tomcat/trunk/java/org/apache/tomcat/util/buf/C2BConverter.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/buf/C2BConverter.java?rev=978845&r1=978844&r2=978845&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/buf/C2BConverter.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/buf/C2BConverter.java Sat Jul 24 11:03:00 2010
@@ -42,20 +42,20 @@ public final class C2BConverter {
     /** Create a converter, with bytes going to a byte buffer
      */
     public C2BConverter(ByteChunk output, String encoding) throws IOException {
-	this.bb=output;
-	ios=new IntermediateOutputStream( output );
-	conv=new WriteConvertor( ios, encoding );
+        this.bb=output;
+        ios=new IntermediateOutputStream( output );
+        conv=new WriteConvertor( ios, encoding );
         this.enc=encoding;
     }
 
     /** Create a converter
      */
     public C2BConverter(String encoding) throws IOException {
-	this( new ByteChunk(1024), encoding );
+        this( new ByteChunk(1024), encoding );
     }
 
     public ByteChunk getByteChunk() {
-	return bb;
+        return bb;
     }
 
     public String getEncoding() {
@@ -63,40 +63,40 @@ public final class C2BConverter {
     }
 
     public void setByteChunk(ByteChunk bb) {
-	this.bb=bb;
-	ios.setByteChunk( bb );
+        this.bb=bb;
+        ios.setByteChunk( bb );
     }
 
     /** Reset the internal state, empty the buffers.
      *  The encoding remain in effect, the internal buffers remain allocated.
      */
     public  final void recycle() {
-	conv.recycle();
-	bb.recycle();
+        conv.recycle();
+        bb.recycle();
     }
 
     /** Generate the bytes using the specified encoding
      */
     public  final void convert(char c[], int off, int len ) throws IOException {
-	conv.write( c, off, len );
+        conv.write( c, off, len );
     }
 
     /** Generate the bytes using the specified encoding
      */
     public  final void convert(String s, int off, int len ) throws IOException {
-	conv.write( s, off, len );
+        conv.write( s, off, len );
     }
 
     /** Generate the bytes using the specified encoding
      */
     public  final void convert(String s ) throws IOException {
-	conv.write( s );
+        conv.write( s );
     }
 
     /** Generate the bytes using the specified encoding
      */
     public  final void convert(char c ) throws IOException {
-	conv.write( c );
+        conv.write( c );
     }
 
     /** Convert a message bytes chars to bytes
@@ -131,7 +131,7 @@ public final class C2BConverter {
      *  byte[]
      */
     public  final void flushBuffer() throws IOException {
-	conv.flush();
+        conv.flush();
     }
 
 }
@@ -160,7 +160,7 @@ public final class C2BConverter {
  *  overhead too.
  * 
  */
- final class	WriteConvertor extends OutputStreamWriter {
+ final class WriteConvertor extends OutputStreamWriter {
     // stream with flush() and close(). overridden.
     private IntermediateOutputStream ios;
     
@@ -169,18 +169,18 @@ public final class C2BConverter {
     /** Create a converter.
      */
     public WriteConvertor( IntermediateOutputStream out, String enc )
-	throws UnsupportedEncodingException
+        throws UnsupportedEncodingException
     {
-	super( out, enc );
-	ios=out;
+        super( out, enc );
+        ios=out;
     }
     
     /** Overridden - will do nothing but reset internal state.
      */
     @Override
     public  final void close() throws IOException {
-	// NOTHING
-	// Calling super.close() would reset out and cb.
+        // NOTHING
+        // Calling super.close() would reset out and cb.
     }
     
     /**
@@ -188,28 +188,28 @@ public final class C2BConverter {
      */ 
     @Override
     public  final void flush() throws IOException {
-	// Will flushBuffer and out()
-	// flushBuffer put any remaining chars in the byte[] 
-	super.flush();
+        // Will flushBuffer and out()
+        // flushBuffer put any remaining chars in the byte[] 
+        super.flush();
     }
     
     @Override
     public  final void write(char cbuf[], int off, int len) throws IOException {
-	// will do the conversion and call write on the output stream
-	super.write( cbuf, off, len );
+        // will do the conversion and call write on the output stream
+        super.write( cbuf, off, len );
     }
     
     /** Reset the buffer
      */
     public  final void recycle() {
-	ios.disable();
-	try {
-	    //	    System.out.println("Reseting writer");
-	    flush();
-	} catch( Exception ex ) {
-	    ex.printStackTrace();
-	}
-	ios.enable();
+        ios.disable();
+        try {
+            // System.out.println("Reseting writer");
+            flush();
+        } catch( Exception ex ) {
+            ex.printStackTrace();
+        }
+        ios.enable();
     }
     
 }
@@ -226,50 +226,50 @@ final class IntermediateOutputStream ext
     private boolean enabled=true;
     
     public IntermediateOutputStream(ByteChunk tbuff) {
-	    this.tbuff=tbuff;
+        this.tbuff=tbuff;
     }
     
     @Override
     public  final void close() throws IOException {
-	// shouldn't be called - we filter it out in writer
-	throw new IOException("close() called - shouldn't happen ");
+        // shouldn't be called - we filter it out in writer
+        throw new IOException("close() called - shouldn't happen ");
     }
     
     @Override
     public  final void flush() throws IOException {
-	// nothing - write will go directly to the buffer,
-	// we don't keep any state
+        // nothing - write will go directly to the buffer,
+        // we don't keep any state
     }
     
     @Override
     public  final  void write(byte cbuf[], int off, int len) throws IOException {
-	// will do the conversion and call write on the output stream
-	if( enabled ) {
-	    tbuff.append( cbuf, off, len );
-	}
+        // will do the conversion and call write on the output stream
+        if( enabled ) {
+            tbuff.append( cbuf, off, len );
+        }
     }
     
     @Override
     public  final void write( int i ) throws IOException {
-	throw new IOException("write( int ) called - shouldn't happen ");
+        throw new IOException("write( int ) called - shouldn't happen ");
     }
 
     // -------------------- Internal methods --------------------
 
     void setByteChunk( ByteChunk bb ) {
-	tbuff=bb;
+        tbuff=bb;
     }
     
     /** Temporary disable - this is used to recycle the converter without
      *  generating an output if the buffers were not flushed
      */
     final void disable() {
-	enabled=false;
+        enabled=false;
     }
 
     /** Reenable - used to recycle the converter
      */
     final void enable() {
-	enabled=true;
+        enabled=true;
     }
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/buf/MessageBytes.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/buf/MessageBytes.java?rev=978845&r1=978844&r2=978845&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/buf/MessageBytes.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/buf/MessageBytes.java Sat Jul 24 11:03:00 2010
@@ -73,36 +73,36 @@ public final class MessageBytes implemen
     /** Construct a new MessageBytes instance
      */
     public static MessageBytes newInstance() {
-	return factory.newInstance();
+        return factory.newInstance();
     }
 
     public MessageBytes getClone() {
-	try {
-	    return (MessageBytes)this.clone();
-	} catch( Exception ex) {
-	    return null;
-	}
+        try {
+            return (MessageBytes)this.clone();
+        } catch( Exception ex) {
+            return null;
+        }
     }
 
     public boolean isNull() {
-//		should we check also hasStrValue ???
-		return byteC.isNull() && charC.isNull() && ! hasStrValue;
-	// bytes==null && strValue==null;
+        // should we check also hasStrValue ???
+        return byteC.isNull() && charC.isNull() && ! hasStrValue;
+        // bytes==null && strValue==null;
     }
     
     /**
      * Resets the message bytes to an uninitialized (NULL) state.
      */
     public void recycle() {
-	type=T_NULL;
-	byteC.recycle();
-	charC.recycle();
-
-	strValue=null;
-
-	hasStrValue=false;
-	hasHashCode=false;
-	hasIntValue=false;
+        type=T_NULL;
+        byteC.recycle();
+        charC.recycle();
+
+        strValue=null;
+
+        hasStrValue=false;
+        hasHashCode=false;
+        hasIntValue=false;
     hasLongValue=false;
     }
 
@@ -128,12 +128,12 @@ public final class MessageBytes implemen
      *  If no encoding is set, we'll use 8859-1.
      */
     public void setEncoding( String enc ) {
-	if( !byteC.isNull() ) {
-	    // if the encoding changes we need to reset the conversion results
-	    charC.recycle();
-	    hasStrValue=false;
-	}
-	byteC.setEncoding(enc);
+        if( !byteC.isNull() ) {
+            // if the encoding changes we need to reset the conversion results
+            charC.recycle();
+            hasStrValue=false;
+        }
+        byteC.setEncoding(enc);
     }
 
     /** 
@@ -153,16 +153,16 @@ public final class MessageBytes implemen
     }
 
     /** Remove the cached string value. Use it after a conversion on the
-     *	byte[] or after the encoding is changed
+     *  byte[] or after the encoding is changed
      *  XXX Is this needed ?
      */
     public void resetStringValue() {
-	if( type != T_STR ) {
-	    // If this was created as a byte[] or char[], we remove
-	    // the old string value
-	    hasStrValue=false;
-	    strValue=null;
-	}
+        if( type != T_STR ) {
+            // If this was created as a byte[] or char[], we remove
+            // the old string value
+            hasStrValue=false;
+            strValue=null;
+        }
     }
 
     /** 
@@ -208,7 +208,7 @@ public final class MessageBytes implemen
      *  T_STR, T_BYTES, T_CHARS or T_NULL
      */
     public int getType() {
-	return type;
+        return type;
     }
     
     /**
@@ -216,7 +216,7 @@ public final class MessageBytes implemen
      * Valid only if T_BYTES or after a conversion was made.
      */
     public ByteChunk getByteChunk() {
-	return byteC;
+        return byteC;
     }
 
     /**
@@ -224,7 +224,7 @@ public final class MessageBytes implemen
      * Valid only if T_CHARS or after a conversion was made.
      */
     public CharChunk getCharChunk() {
-	return charC;
+        return charC;
     }
 
     /**
@@ -232,7 +232,7 @@ public final class MessageBytes implemen
      * Valid only if T_STR or after a conversion was made.
      */
     public String getString() {
-	return strValue;
+        return strValue;
     }
 
     /** Do a char->byte conversion.
@@ -252,15 +252,15 @@ public final class MessageBytes implemen
      *  XXX Not optimized - it converts to String first.
      */
     public void toChars() {
-	if( ! charC.isNull() ) {
+        if( ! charC.isNull() ) {
             type=T_CHARS;
-	    return;
-	}
-	// inefficient
-	toString();
+            return;
+        }
+        // inefficient
+        toString();
         type=T_CHARS;
-	char cc[]=strValue.toCharArray();
-	charC.setChars(cc, 0, cc.length);
+        char cc[]=strValue.toCharArray();
+        charC.setChars(cc, 0, cc.length);
     }
     
 
@@ -270,16 +270,16 @@ public final class MessageBytes implemen
      * in chars.
      */
     public int getLength() {
-	if(type==T_BYTES)
-	    return byteC.getLength();
-	if(type==T_CHARS) {
-	    return charC.getLength();
-	}
-	if(type==T_STR)
-	    return strValue.length();
-	toString();
-	if( strValue==null ) return 0;
-	return strValue.length();
+        if(type==T_BYTES)
+            return byteC.getLength();
+        if(type==T_CHARS) {
+            return charC.getLength();
+        }
+        if(type==T_STR)
+            return strValue.length();
+        toString();
+        if( strValue==null ) return 0;
+        return strValue.length();
     }
 
     // -------------------- equals --------------------
@@ -290,17 +290,17 @@ public final class MessageBytes implemen
      * @return true if the comparison succeeded, false otherwise
      */
     public boolean equals(String s) {
-	switch (type) {
-	case T_STR:
-	    if( strValue==null && s!=null) return false;
-	    return strValue.equals( s );
-	case T_CHARS:
-	    return charC.equals( s );
-	case T_BYTES:
-	    return byteC.equals( s );
-	default:
-	    return false;
-	}
+        switch (type) {
+        case T_STR:
+            if( strValue==null && s!=null) return false;
+            return strValue.equals( s );
+        case T_CHARS:
+            return charC.equals( s );
+        case T_BYTES:
+            return byteC.equals( s );
+        default:
+            return false;
+        }
     }
 
     /**
@@ -309,49 +309,49 @@ public final class MessageBytes implemen
      * @return true if the comparison succeeded, false otherwise
      */
     public boolean equalsIgnoreCase(String s) {
-	switch (type) {
-	case T_STR:
-	    if( strValue==null && s!=null) return false;
-	    return strValue.equalsIgnoreCase( s );
-	case T_CHARS:
-	    return charC.equalsIgnoreCase( s );
-	case T_BYTES:
-	    return byteC.equalsIgnoreCase( s );
-	default:
-	    return false;
-	}
+        switch (type) {
+        case T_STR:
+            if( strValue==null && s!=null) return false;
+            return strValue.equalsIgnoreCase( s );
+        case T_CHARS:
+            return charC.equalsIgnoreCase( s );
+        case T_BYTES:
+            return byteC.equalsIgnoreCase( s );
+        default:
+            return false;
+        }
     }
 
     public boolean equals(MessageBytes mb) {
-	switch (type) {
-	case T_STR:
-	    return mb.equals( strValue );
-	}
-
-	if( mb.type != T_CHARS &&
-	    mb.type!= T_BYTES ) {
-	    // it's a string or int/date string value
-	    return equals( mb.toString() );
-	}
-
-	// mb is either CHARS or BYTES.
-	// this is either CHARS or BYTES
-	// Deal with the 4 cases ( in fact 3, one is symmetric)
-	
-	if( mb.type == T_CHARS && type==T_CHARS ) {
-	    return charC.equals( mb.charC );
-	} 
-	if( mb.type==T_BYTES && type== T_BYTES ) {
-	    return byteC.equals( mb.byteC );
-	}
-	if( mb.type== T_CHARS && type== T_BYTES ) {
-	    return byteC.equals( mb.charC );
-	}
-	if( mb.type== T_BYTES && type== T_CHARS ) {
-	    return mb.byteC.equals( charC );
-	}
-	// can't happen
-	return true;
+        switch (type) {
+        case T_STR:
+            return mb.equals( strValue );
+        }
+
+        if( mb.type != T_CHARS &&
+            mb.type!= T_BYTES ) {
+            // it's a string or int/date string value
+            return equals( mb.toString() );
+        }
+
+        // mb is either CHARS or BYTES.
+        // this is either CHARS or BYTES
+        // Deal with the 4 cases ( in fact 3, one is symmetric)
+        
+        if( mb.type == T_CHARS && type==T_CHARS ) {
+            return charC.equals( mb.charC );
+        } 
+        if( mb.type==T_BYTES && type== T_BYTES ) {
+            return byteC.equals( mb.byteC );
+        }
+        if( mb.type== T_CHARS && type== T_BYTES ) {
+            return byteC.equals( mb.charC );
+        }
+        if( mb.type== T_BYTES && type== T_CHARS ) {
+            return mb.byteC.equals( charC );
+        }
+        // can't happen
+        return true;
     }
 
     
@@ -360,16 +360,16 @@ public final class MessageBytes implemen
      * @param s the string
      */
     public boolean startsWith(String s) {
-	switch (type) {
-	case T_STR:
-	    return strValue.startsWith( s );
-	case T_CHARS:
-	    return charC.startsWith( s );
-	case T_BYTES:
-	    return byteC.startsWith( s );
-	default:
-	    return false;
-	}
+        switch (type) {
+        case T_STR:
+            return strValue.startsWith( s );
+        case T_CHARS:
+            return charC.startsWith( s );
+        case T_BYTES:
+            return byteC.startsWith( s );
+        default:
+            return false;
+        }
     }
 
     /**
@@ -378,25 +378,25 @@ public final class MessageBytes implemen
      * @param pos The start position
      */
     public boolean startsWithIgnoreCase(String s, int pos) {
-	switch (type) {
-	case T_STR:
-	    if( strValue==null ) return false;
-	    if( strValue.length() < pos + s.length() ) return false;
-	    
-	    for( int i=0; i<s.length(); i++ ) {
-		if( Ascii.toLower( s.charAt( i ) ) !=
-		    Ascii.toLower( strValue.charAt( pos + i ))) {
-		    return false;
-		}
-	    }
-	    return true;
-	case T_CHARS:
-	    return charC.startsWithIgnoreCase( s, pos );
-	case T_BYTES:
-	    return byteC.startsWithIgnoreCase( s, pos );
-	default:
-	    return false;
-	}
+        switch (type) {
+        case T_STR:
+            if( strValue==null ) return false;
+            if( strValue.length() < pos + s.length() ) return false;
+            
+            for( int i=0; i<s.length(); i++ ) {
+                if( Ascii.toLower( s.charAt( i ) ) !=
+                    Ascii.toLower( strValue.charAt( pos + i ))) {
+                    return false;
+                }
+            }
+            return true;
+        case T_CHARS:
+            return charC.startsWithIgnoreCase( s, pos );
+        case T_BYTES:
+            return byteC.startsWithIgnoreCase( s, pos );
+        default:
+            return false;
+        }
     }
 
     
@@ -415,45 +415,45 @@ public final class MessageBytes implemen
 
     // normal hash. 
     private int hash() {
-	int code=0;
-	switch (type) {
-	case T_STR:
-	    // We need to use the same hash function
-	    for (int i = 0; i < strValue.length(); i++) {
-		code = code * 37 + strValue.charAt( i );
-	    }
-	    return code;
-	case T_CHARS:
-	    return charC.hash();
-	case T_BYTES:
-	    return byteC.hash();
-	default:
-	    return 0;
-	}
+        int code=0;
+        switch (type) {
+        case T_STR:
+            // We need to use the same hash function
+            for (int i = 0; i < strValue.length(); i++) {
+                code = code * 37 + strValue.charAt( i );
+            }
+            return code;
+        case T_CHARS:
+            return charC.hash();
+        case T_BYTES:
+            return byteC.hash();
+        default:
+            return 0;
+        }
     }
 
     public int indexOf(char c) {
-	return indexOf( c, 0);
+        return indexOf( c, 0);
     }
 
     // Inefficient initial implementation. Will be replaced on the next
     // round of tune-up
     public int indexOf(String s, int starting) {
-	toString();
-	return strValue.indexOf( s, starting );
+        toString();
+        return strValue.indexOf( s, starting );
     }
     
     // Inefficient initial implementation. Will be replaced on the next
     // round of tune-up
     public int indexOf(String s) {
-	return indexOf( s, 0 );
+        return indexOf( s, 0 );
     }
     
     public int indexOfIgnoreCase(String s, int starting) {
-	toString();
-	String upper=strValue.toUpperCase(Locale.ENGLISH);
-	String sU=s.toUpperCase(Locale.ENGLISH);
-	return upper.indexOf( sU, starting );
+        toString();
+        String upper=strValue.toUpperCase(Locale.ENGLISH);
+        String sU=s.toUpperCase(Locale.ENGLISH);
+        return upper.indexOf( sU, starting );
     }
     
     /**
@@ -462,16 +462,16 @@ public final class MessageBytes implemen
      * @param starting The start position
      */
     public int indexOf(char c, int starting) {
-	switch (type) {
-	case T_STR:
-	    return strValue.indexOf( c, starting );
-	case T_CHARS:
-	    return charC.indexOf( c, starting);
-	case T_BYTES:
-	    return byteC.indexOf( c, starting );
-	default:
-	    return -1;
-	}
+        switch (type) {
+        case T_STR:
+            return strValue.indexOf( c, starting );
+        case T_CHARS:
+            return charC.indexOf( c, starting);
+        case T_BYTES:
+            return byteC.indexOf( c, starting );
+        default:
+            return -1;
+        }
     }
 
     /** Copy the src into this MessageBytes, allocating more space if
@@ -479,25 +479,25 @@ public final class MessageBytes implemen
      */
     public void duplicate( MessageBytes src ) throws IOException
     {
-	switch( src.getType() ) {
-	case MessageBytes.T_BYTES:
-	    type=T_BYTES;
-	    ByteChunk bc=src.getByteChunk();
-	    byteC.allocate( 2 * bc.getLength(), -1 );
-	    byteC.append( bc );
-	    break;
-	case MessageBytes.T_CHARS:
-	    type=T_CHARS;
-	    CharChunk cc=src.getCharChunk();
-	    charC.allocate( 2 * cc.getLength(), -1 );
-	    charC.append( cc );
-	    break;
-	case MessageBytes.T_STR:
-	    type=T_STR;
-	    String sc=src.getString();
-	    this.setString( sc );
-	    break;
-	}
+        switch( src.getType() ) {
+        case MessageBytes.T_BYTES:
+            type=T_BYTES;
+            ByteChunk bc=src.getByteChunk();
+            byteC.allocate( 2 * bc.getLength(), -1 );
+            byteC.append( bc );
+            break;
+        case MessageBytes.T_CHARS:
+            type=T_CHARS;
+            CharChunk cc=src.getCharChunk();
+            charC.allocate( 2 * cc.getLength(), -1 );
+            charC.append( cc );
+            break;
+        case MessageBytes.T_STR:
+            type=T_STR;
+            String sc=src.getString();
+            this.setString( sc );
+            break;
+        }
     }
 
     // -------------------- Deprecated code --------------------
@@ -598,18 +598,18 @@ public final class MessageBytes implemen
      */ 
     public int getInt() 
     {
-	if( hasIntValue )
-	    return intValue;
-	
-	switch (type) {
-	case T_BYTES:
-	    intValue=byteC.getInt();
-	    break;
-	default:
-	    intValue=Integer.parseInt(toString());
-	}
-	hasIntValue=true;
-	return intValue;
+        if( hasIntValue )
+            return intValue;
+        
+        switch (type) {
+        case T_BYTES:
+            intValue=byteC.getInt();
+            break;
+        default:
+            intValue=Integer.parseInt(toString());
+        }
+        hasIntValue=true;
+        return intValue;
     }
 
     // Used for headers conversion
@@ -637,14 +637,14 @@ public final class MessageBytes implemen
     private static MessageBytesFactory factory=new MessageBytesFactory();
 
     public static void setFactory( MessageBytesFactory mbf ) {
-	factory=mbf;
+        factory=mbf;
     }
     
     public static class MessageBytesFactory {
-	protected MessageBytesFactory() {
-	}
-	public MessageBytes newInstance() {
-	    return new MessageBytes();
-	}
+        protected MessageBytesFactory() {
+        }
+        public MessageBytes newInstance() {
+            return new MessageBytes();
+        }
     }
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/digester/FactoryCreateRule.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/digester/FactoryCreateRule.java?rev=978845&r1=978844&r2=978845&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/digester/FactoryCreateRule.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/digester/FactoryCreateRule.java Sat Jul 24 11:03:00 2010
@@ -308,7 +308,7 @@ public class FactoryCreateRule extends R
         
         // check if object was created 
         // this only happens if an exception was thrown and we're ignoring them
-        if (	
+        if (
                 ignoreCreateExceptions &&
                 exceptionIgnoredStack != null &&
                 !(exceptionIgnoredStack.empty())) {

Modified: tomcat/trunk/java/org/apache/tomcat/util/digester/WithDefaultsRulesWrapper.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/digester/WithDefaultsRulesWrapper.java?rev=978845&r1=978844&r2=978845&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/digester/WithDefaultsRulesWrapper.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/digester/WithDefaultsRulesWrapper.java Sat Jul 24 11:03:00 2010
@@ -103,7 +103,7 @@ public class WithDefaultsRulesWrapper im
     /** Gets Rule's which will be fired when the wrapped implementation returns no matches */
     public List<Rule> getDefaults() {
         return defaultRules;
-    }	
+    }
     
     // --------------------------------------------------------- Public Methods
     
@@ -114,7 +114,7 @@ public class WithDefaultsRulesWrapper im
      */
     public List<Rule> match(String namespaceURI, String pattern) {
         List<Rule> matches = wrappedRules.match(namespaceURI, pattern);
-        if (matches ==  null || matches.isEmpty()) {	
+        if (matches ==  null || matches.isEmpty()) {
             // a little bit of defensive programming
             return new ArrayList<Rule>(defaultRules);
         }
@@ -156,5 +156,5 @@ public class WithDefaultsRulesWrapper im
     public void add(String pattern, Rule rule) {
         wrappedRules.add(pattern, rule);
         allRules.add(rule);
-    }	
+    }
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/http/CookieSupport.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/CookieSupport.java?rev=978845&r1=978844&r2=978845&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/http/CookieSupport.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/http/CookieSupport.java Sat Jul 24 11:03:00 2010
@@ -24,7 +24,6 @@ package org.apache.tomcat.util.http;
  */
 public final class CookieSupport {
 
-	
     // --------------------------------------------------------------- Constants
     /**
      * If set to true, we parse cookies strictly according to the servlet,

Modified: tomcat/trunk/java/org/apache/tomcat/util/modeler/BaseModelMBean.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/modeler/BaseModelMBean.java?rev=978845&r1=978844&r2=978845&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/modeler/BaseModelMBean.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/modeler/BaseModelMBean.java Sat Jul 24 11:03:00 2010
@@ -1139,40 +1139,40 @@ public class BaseModelMBean implements D
     }
 
     static class MethodKey {
-	private String name;
-	private String[] signature;
+        private String name;
+        private String[] signature;
 
-	MethodKey(String name, String[] signature) {
-	    this.name = name;
-	    if(signature == null) {
-		signature = new String[0];
-	    }
-	    this.signature = signature;
-	}
+        MethodKey(String name, String[] signature) {
+            this.name = name;
+            if(signature == null) {
+                signature = new String[0];
+            }
+            this.signature = signature;
+        }
 
-	@Override
-    public boolean equals(Object other) {
-	    if(!(other instanceof MethodKey)) {
-		return false;
-	    }
-	    MethodKey omk = (MethodKey)other;
-	    if(!name.equals(omk.name)) {
-		return false;
-	    }
-	    if(signature.length != omk.signature.length) {
-		return false;
-	    }
-	    for(int i=0; i < signature.length; i++) {
-		if(!signature[i].equals(omk.signature[i])) {
-		    return false;
-		}
-	    }
-	    return true;
-	}
+        @Override
+        public boolean equals(Object other) {
+            if(!(other instanceof MethodKey)) {
+                return false;
+            }
+            MethodKey omk = (MethodKey)other;
+            if(!name.equals(omk.name)) {
+                return false;
+            }
+            if(signature.length != omk.signature.length) {
+                return false;
+            }
+            for(int i=0; i < signature.length; i++) {
+                if(!signature[i].equals(omk.signature[i])) {
+                    return false;
+                }
+            }
+            return true;
+        }
 
-	@Override
-    public int hashCode() {
-	    return name.hashCode();
-	}
+        @Override
+        public int hashCode() {
+            return name.hashCode();
+        }
     }
 }

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/DefaultServerSocketFactory.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/DefaultServerSocketFactory.java?rev=978845&r1=978844&r2=978845&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/DefaultServerSocketFactory.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/DefaultServerSocketFactory.java Sat Jul 24 11:03:00 2010
@@ -61,15 +61,14 @@ class DefaultServerSocketFactory extends
  
     @Override
     public Socket acceptSocket(ServerSocket socket)
- 	throws IOException {
- 	return socket.accept();
+            throws IOException {
+        return socket.accept();
     }
  
     @Override
     public void handshake(Socket sock)
- 	throws IOException {
+        throws IOException {
         // NOOP
     }
- 	    
         
- }
+}

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java?rev=978845&r1=978844&r2=978845&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/JIoEndpoint.java Sat Jul 24 11:03:00 2010
@@ -242,44 +242,44 @@ public class JIoEndpoint extends Abstrac
 
         public void run() {
             boolean launch = false;
-        	try {
-        	    
-        	    if (!socket.processing.compareAndSet(false, true)) {
-        	        log.error("Unable to process socket. Invalid state.");
-        	        return;
-        	    }
-        	    
-        	    SocketState state = SocketState.OPEN;
-        	    // Process the request from this socket
-        	    if ( (!socket.isInitialized()) && (!setSocketOptions(socket.getSocket())) ) { 
-        	        state = SocketState.CLOSED;
-        	    }
-        	    socket.setInitialized(true);
-
-        	    if ( (state != SocketState.CLOSED) ) {
-        	        state = (status==null)?handler.process(socket):handler.process(socket,status);
-        	    }
-        	    if (state == SocketState.CLOSED) {
-        	        // Close socket
-        	        if (log.isTraceEnabled()) {
-        	            log.trace("Closing socket:"+socket);
-        	        }
-        	        try {
-        	            socket.getSocket().close();
-        	        } catch (IOException e) {
-        	            // Ignore
-        	        }
-        	    } else if (state == SocketState.OPEN){
-        	        socket.setKeptAlive(true);
-        	        socket.access();
-        	        //keepalive connection
-        	        //TODO - servlet3 check async status, we may just be in a hold pattern
-        	        launch = true;
-        	    } else if (state == SocketState.LONG) {
-        	        socket.access();
-        	        waitingRequests.add(socket);
-        	    }
-        	} finally {
+            try {
+                
+                if (!socket.processing.compareAndSet(false, true)) {
+                    log.error("Unable to process socket. Invalid state.");
+                    return;
+                }
+                
+                SocketState state = SocketState.OPEN;
+                // Process the request from this socket
+                if ( (!socket.isInitialized()) && (!setSocketOptions(socket.getSocket())) ) { 
+                    state = SocketState.CLOSED;
+                }
+                socket.setInitialized(true);
+
+                if ( (state != SocketState.CLOSED) ) {
+                    state = (status==null)?handler.process(socket):handler.process(socket,status);
+                }
+                if (state == SocketState.CLOSED) {
+                    // Close socket
+                    if (log.isTraceEnabled()) {
+                        log.trace("Closing socket:"+socket);
+                    }
+                    try {
+                        socket.getSocket().close();
+                    } catch (IOException e) {
+                        // Ignore
+                    }
+                } else if (state == SocketState.OPEN){
+                    socket.setKeptAlive(true);
+                    socket.access();
+                    //keepalive connection
+                    //TODO - servlet3 check async status, we may just be in a hold pattern
+                    launch = true;
+                } else if (state == SocketState.LONG) {
+                    socket.access();
+                    waitingRequests.add(socket);
+                }
+            } finally {
                 socket.processing.set(false);
                 if (launch) getExecutor().execute(new SocketProcessor(socket));
                 socket = null;

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java?rev=978845&r1=978844&r2=978845&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java Sat Jul 24 11:03:00 2010
@@ -266,13 +266,13 @@ public class NioBlockingSelector {
                             if (SelectionKey.OP_READ==(ops&SelectionKey.OP_READ))countDown(key.getReadLatch());
                         } else {
                             if (sk.isValid()) {
-                            	sk.interestOps(sk.interestOps() & (~ops));
-                            	if (SelectionKey.OP_WRITE==(ops&SelectionKey.OP_WRITE)) countDown(key.getWriteLatch());
-                            	if (SelectionKey.OP_READ==(ops&SelectionKey.OP_READ))countDown(key.getReadLatch());
-                            	if (sk.interestOps()==0) {
-                            	    sk.cancel();
-                            	    sk.attach(null);
-                            	}
+                                sk.interestOps(sk.interestOps() & (~ops));
+                                if (SelectionKey.OP_WRITE==(ops&SelectionKey.OP_WRITE)) countDown(key.getWriteLatch());
+                                if (SelectionKey.OP_READ==(ops&SelectionKey.OP_READ))countDown(key.getReadLatch());
+                                if (sk.interestOps()==0) {
+                                    sk.cancel();
+                                    sk.attach(null);
+                                }
                             }else {
                                 sk.cancel();
                                 sk.attach(null);

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SSLImplementation.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SSLImplementation.java?rev=978845&r1=978844&r2=978845&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/SSLImplementation.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/SSLImplementation.java Sat Jul 24 11:03:00 2010
@@ -23,65 +23,66 @@ import javax.net.ssl.SSLSession;
 
 /* SSLImplementation:
 
-   Abstract factory and base class for all SSL implementations.
+ Abstract factory and base class for all SSL implementations.
 
-   @author EKR
-*/
+ @author EKR
+ */
 abstract public class SSLImplementation {
-    private static final org.apache.juli.logging.Log logger =
-        org.apache.juli.logging.LogFactory.getLog(SSLImplementation.class);
+    private static final org.apache.juli.logging.Log logger = org.apache.juli.logging.LogFactory
+            .getLog(SSLImplementation.class);
 
     // The default implementations in our search path
-    private static final String JSSEImplementationClass=
-	"org.apache.tomcat.util.net.jsse.JSSEImplementation";
-    
-    private static final String[] implementations=
-    {
-        JSSEImplementationClass
-    };
-
-    public static SSLImplementation getInstance() throws ClassNotFoundException
-    {
-	for(int i=0;i<implementations.length;i++){
-	    try {
-               SSLImplementation impl=
-		    getInstance(implementations[i]);
-		return impl;
-	    } catch (Exception e) {
-		if(logger.isTraceEnabled()) 
-		    logger.trace("Error creating " + implementations[i],e);
-	    }
-	}
+    private static final String JSSEImplementationClass =
+        "org.apache.tomcat.util.net.jsse.JSSEImplementation";
 
-	// If we can't instantiate any of these
-	throw new ClassNotFoundException("Can't find any SSL implementation");
+    private static final String[] implementations = { JSSEImplementationClass };
+
+    public static SSLImplementation getInstance() throws ClassNotFoundException {
+        for (int i = 0; i < implementations.length; i++) {
+            try {
+                SSLImplementation impl = getInstance(implementations[i]);
+                return impl;
+            } catch (Exception e) {
+                if (logger.isTraceEnabled())
+                    logger.trace("Error creating " + implementations[i], e);
+            }
+        }
+
+        // If we can't instantiate any of these
+        throw new ClassNotFoundException("Can't find any SSL implementation");
     }
 
     public static SSLImplementation getInstance(String className)
-	throws ClassNotFoundException
-    {
-	if(className==null) return getInstance();
-
-	try {
-	    // Workaround for the J2SE 1.4.x classloading problem (under Solaris).
-	    // Class.forName(..) fails without creating class using new.
-	    // This is an ugly workaround. 
-	    if( JSSEImplementationClass.equals(className) ) {
-		return new org.apache.tomcat.util.net.jsse.JSSEImplementation();
-	    }
-	    Class<?> clazz=Class.forName(className);
-	    return (SSLImplementation)clazz.newInstance();
-	} catch (Exception e){
-	    if(logger.isDebugEnabled())
-		logger.debug("Error loading SSL Implementation "
-			     +className, e);
-	    throw new ClassNotFoundException("Error loading SSL Implementation "
-				      +className+ " :" +e.toString());
-	}
+            throws ClassNotFoundException {
+        if (className == null)
+            return getInstance();
+
+        try {
+            // Workaround for the J2SE 1.4.x classloading problem (under
+            // Solaris).
+            // Class.forName(..) fails without creating class using new.
+            // This is an ugly workaround.
+            if (JSSEImplementationClass.equals(className)) {
+                return new org.apache.tomcat.util.net.jsse.JSSEImplementation();
+            }
+            Class<?> clazz = Class.forName(className);
+            return (SSLImplementation) clazz.newInstance();
+        } catch (Exception e) {
+            if (logger.isDebugEnabled())
+                logger
+                        .debug("Error loading SSL Implementation " + className,
+                                e);
+            throw new ClassNotFoundException(
+                    "Error loading SSL Implementation " + className + " :"
+                            + e.toString());
+        }
     }
 
     abstract public String getImplementationName();
+
     abstract public ServerSocketFactory getServerSocketFactory();
+
     abstract public SSLSupport getSSLSupport(Socket sock);
+
     abstract public SSLSupport getSSLSupport(SSLSession session);
-}    
+}

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/ServerSocketFactory.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/ServerSocketFactory.java?rev=978845&r1=978844&r2=978845&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/ServerSocketFactory.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/ServerSocketFactory.java Sat Jul 24 11:03:00 2010
@@ -24,151 +24,152 @@ import java.net.Socket;
 import java.util.Hashtable;
 
 /**
- * This class creates server sockets.  It may be subclassed by other
- * factories, which create particular types of server sockets.  This
- * provides a general framework for the addition of public socket-level
- * functionality.  It it is the server side analogue of a socket factory,
- * and similarly provides a way to capture a variety of policies related
- * to the sockets being constructed.
- *
- * <P> Like socket factories, Server Socket factory instances have two
- * categories of methods.  First are methods used to create sockets.
- * Second are methods which set properties used in the production of
- * sockets, such as networking options.  There is also an environment
- * specific default server socket factory; frameworks will often use
- * their own customized factory.
- * 
- * <P><hr><em> It may be desirable to move this interface into the
+ * This class creates server sockets. It may be subclassed by other factories,
+ * which create particular types of server sockets. This provides a general
+ * framework for the addition of public socket-level functionality. It it is the
+ * server side analogue of a socket factory, and similarly provides a way to
+ * capture a variety of policies related to the sockets being constructed.
+ * <P>
+ * Like socket factories, Server Socket factory instances have two categories of
+ * methods. First are methods used to create sockets. Second are methods which
+ * set properties used in the production of sockets, such as networking options.
+ * There is also an environment specific default server socket factory;
+ * frameworks will often use their own customized factory.
+ * <P>
+ * <hr>
+ * <em> It may be desirable to move this interface into the
  * <b>java.net</b> package, so that is not an extension but the preferred
  * interface.  Should this be serializable, making it a JavaBean which can
  * be saved along with its networking configuration?
- * </em>   
- *
+ * </em>
+ * 
  * @author db@eng.sun.com
  * @author Harish Prabandham
  */
 public abstract class ServerSocketFactory implements Cloneable {
 
     //
-    // NOTE:  JDK 1.1 bug in class GC, this can get collected
+    // NOTE: JDK 1.1 bug in class GC, this can get collected
     // even though it's always accessible via getDefault().
     //
 
     private static ServerSocketFactory theFactory;
-    protected Hashtable<String, Object> attributes =
-        new Hashtable<String, Object>();
+    protected Hashtable<String, Object> attributes = new Hashtable<String, Object>();
 
     /**
      * Constructor is used only by subclasses.
      */
-
-    protected ServerSocketFactory () {
+    protected ServerSocketFactory() {
         /* NOTHING */
     }
 
-    /** General mechanism to pass attributes from the
-     *  ServerConnector to the socket factory.
-     *
-     *  Note that the "preferred" mechanism is to
-     *  use bean setters and explicit methods, but
-     *  this allows easy configuration via server.xml
-     *  or simple Properties
-     */
-    public void setAttribute( String name, Object value ) {
-	if( name!=null && value !=null)
-	    attributes.put( name, value );
+    /**
+     * General mechanism to pass attributes from the ServerConnector to the
+     * socket factory. Note that the "preferred" mechanism is to use bean
+     * setters and explicit methods, but this allows easy configuration via
+     * server.xml or simple Properties
+     */
+    public void setAttribute(String name, Object value) {
+        if (name != null && value != null)
+            attributes.put(name, value);
     }
-    
+
     /**
      * Returns a copy of the environment's default socket factory.
      */
-    public static synchronized ServerSocketFactory getDefault () {
+    public static synchronized ServerSocketFactory getDefault() {
         //
-        // optimize typical case:  no synch needed
+        // optimize typical case: no synch needed
         //
 
         if (theFactory == null) {
             //
             // Different implementations of this method could
-            // work rather differently.  For example, driving
+            // work rather differently. For example, driving
             // this from a system property, or using a different
             // implementation than JavaSoft's.
             //
 
-            theFactory = new DefaultServerSocketFactory ();
+            theFactory = new DefaultServerSocketFactory();
         }
 
         try {
-            return (ServerSocketFactory) theFactory.clone ();
+            return (ServerSocketFactory) theFactory.clone();
         } catch (CloneNotSupportedException e) {
-            throw new RuntimeException (e.getMessage ());
+            throw new RuntimeException(e.getMessage());
         }
     }
 
     /**
-     * Returns a server socket which uses all network interfaces on
-     * the host, and is bound to a the specified port.  The socket is
-     * configured with the socket options (such as accept timeout)
+     * Returns a server socket which uses all network interfaces on the host,
+     * and is bound to a the specified port. The socket is configured with the
+     * socket options (such as accept timeout) given to this factory.
+     * 
+     * @param port
+     *            the port to listen to
+     * @exception IOException
+     *                for networking errors
+     * @exception InstantiationException
+     *                for construction errors
+     */
+    public abstract ServerSocket createSocket(int port) throws IOException,
+            InstantiationException;
+
+    /**
+     * Returns a server socket which uses all network interfaces on the host, is
+     * bound to a the specified port, and uses the specified connection backlog.
+     * The socket is configured with the socket options (such as accept timeout)
      * given to this factory.
-     *
-     * @param port the port to listen to
-     * @exception IOException for networking errors
-     * @exception InstantiationException for construction errors
-     */
-    public abstract ServerSocket createSocket (int port)
-    throws IOException, InstantiationException;
-
-    /**
-     * Returns a server socket which uses all network interfaces on
-     * the host, is bound to a the specified port, and uses the 
-     * specified connection backlog.  The socket is configured with
-     * the socket options (such as accept timeout) given to this factory.
-     *
-     * @param port the port to listen to
-     * @param backlog how many connections are queued
-     * @exception IOException for networking errors
-     * @exception InstantiationException for construction errors
-     */
-
-    public abstract ServerSocket createSocket (int port, int backlog)
-    throws IOException, InstantiationException;
-
-    /**
-     * Returns a server socket which uses only the specified network
-     * interface on the local host, is bound to a the specified port,
-     * and uses the specified connection backlog.  The socket is configured
-     * with the socket options (such as accept timeout) given to this factory.
-     *
-     * @param port the port to listen to
-     * @param backlog how many connections are queued
-     * @param ifAddress the network interface address to use
-     * @exception IOException for networking errors
-     * @exception InstantiationException for construction errors
-     */
-
-    public abstract ServerSocket createSocket (int port,
-        int backlog, InetAddress ifAddress)
-    throws IOException, InstantiationException;
+     * 
+     * @param port
+     *            the port to listen to
+     * @param backlog
+     *            how many connections are queued
+     * @exception IOException
+     *                for networking errors
+     * @exception InstantiationException
+     *                for construction errors
+     */
+    public abstract ServerSocket createSocket(int port, int backlog)
+            throws IOException, InstantiationException;
 
-    public void initSocket( Socket s ) {
+    /**
+     * Returns a server socket which uses only the specified network interface
+     * on the local host, is bound to a the specified port, and uses the
+     * specified connection backlog. The socket is configured with the socket
+     * options (such as accept timeout) given to this factory.
+     * 
+     * @param port
+     *            the port to listen to
+     * @param backlog
+     *            how many connections are queued
+     * @param ifAddress
+     *            the network interface address to use
+     * @exception IOException
+     *                for networking errors
+     * @exception InstantiationException
+     *                for construction errors
+     */
+    public abstract ServerSocket createSocket(int port, int backlog,
+            InetAddress ifAddress) throws IOException, InstantiationException;
+
+    public void initSocket(Socket s) {
     }
- 
-     /**
-       Wrapper function for accept(). This allows us to trap and
-       translate exceptions if necessary
- 
-       @exception IOException;
-     */ 
-     public abstract Socket acceptSocket(ServerSocket socket)
- 	throws IOException;
- 
-     /**
-       Extra function to initiate the handshake. Sometimes necessary
-       for SSL
- 
-       @exception IOException;
-     */ 
-     public abstract void handshake(Socket sock)
- 	throws IOException;
-}
 
+    /**
+     * Wrapper function for accept(). This allows us to trap and translate
+     * exceptions if necessary
+     * 
+     * @exception IOException
+     *                ;
+     */
+    public abstract Socket acceptSocket(ServerSocket socket) throws IOException;
+
+    /**
+     * Extra function to initiate the handshake. Sometimes necessary for SSL
+     * 
+     * @exception IOException
+     *                ;
+     */
+    public abstract void handshake(Socket sock) throws IOException;
+}

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java?rev=978845&r1=978844&r2=978845&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/jsse/JSSESocketFactory.java Sat Jul 24 11:03:00 2010
@@ -168,9 +168,9 @@ public class JSSESocketFactory
     @Override
     public void handshake(Socket sock) throws IOException {
         // We do getSession instead of startHandshake() so we can call this multiple times
-    	SSLSession session = ((SSLSocket)sock).getSession();
+        SSLSession session = ((SSLSocket)sock).getSession();
         if (session.getCipherSuite().equals("SSL_NULL_WITH_NULL_NULL"))
-        	throw new IOException("SSL handshake failed. Ciper suite in SSL Session is SSL_NULL_WITH_NULL_NULL");
+            throw new IOException("SSL handshake failed. Ciper suite in SSL Session is SSL_NULL_WITH_NULL_NULL");
 
         if (!allowUnsafeLegacyRenegotiation) {
             // Prevent futher handshakes by removing all cipher suites



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


Mime
View raw message