Author: markt Date: Thu Jan 24 08:18:39 2013 New Revision: 1437891 URL: http://svn.apache.org/viewvc?rev=1437891&view=rev Log: Fix Eclipse unused code warnings A handful of trivial whitespace changes for consistency
Modified: tomcat/trunk/java/org/apache/tomcat/util/buf/B2CConverter.java tomcat/trunk/java/org/apache/tomcat/util/buf/C2BConverter.java tomcat/trunk/java/org/apache/tomcat/util/buf/UEncoder.java Modified: tomcat/trunk/java/org/apache/tomcat/util/buf/B2CConverter.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/buf/B2CConverter.java?rev=1437891&r1=1437890&r2=1437891&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/buf/B2CConverter.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/buf/B2CConverter.java Thu Jan 24 08:18:39 2013 @@ -34,10 +34,6 @@ import org.apache.tomcat.util.res.String */ public class B2CConverter { - - private static final org.apache.juli.logging.Log log= - org.apache.juli.logging.LogFactory.getLog( B2CConverter.class ); - private static final StringManager sm = StringManager.getManager(Constants.Package); @@ -70,7 +66,7 @@ public class B2CConverter { } public static Charset getCharset(String enc) - throws UnsupportedEncodingException{ + throws UnsupportedEncodingException { // Encoding names should all be ASCII String lowerCaseEnc = enc.toLowerCase(Locale.US); @@ -82,7 +78,7 @@ public class B2CConverter { * Only to be used when it is known that the encoding name is in lower case. */ public static Charset getCharsetLower(String lowerCaseEnc) - throws UnsupportedEncodingException{ + throws UnsupportedEncodingException { Charset charset = encodingToCharsetCache.get(lowerCaseEnc); @@ -103,12 +99,7 @@ public class B2CConverter { */ protected ByteBuffer leftovers = null; - private final String encoding; - - public B2CConverter(String encoding) - throws IOException - { - this.encoding=encoding; + public B2CConverter(String encoding) throws IOException { byte[] left = new byte[4]; leftovers = ByteBuffer.wrap(left); decoder = getCharset(encoding).newDecoder(); @@ -133,7 +124,7 @@ public class B2CConverter { * @param cc char output */ public void convert(ByteChunk bc, CharChunk cc) - throws IOException { + throws IOException { if ((bb == null) || (bb.array() != bc.getBuffer())) { // Create a new byte buffer if anything changed bb = ByteBuffer.wrap(bc.getBuffer(), bc.getStart(), bc.getLength()); @@ -169,13 +160,14 @@ public class B2CConverter { bb.position(bc.getStart()); leftovers.position(0); } - // Do the decoding and get the results into the byte chunk and the char chunk + // Do the decoding and get the results into the byte chunk and the char + // chunk result = decoder.decode(bb, cb, false); if (result.isError() || result.isMalformed()) { result.throwException(); } else if (result.isOverflow()) { - // Propagate current positions to the byte chunk and char chunk, if this - // continues the char buffer will get resized + // Propagate current positions to the byte chunk and char chunk, if + // this continues the char buffer will get resized bc.setOffset(bb.position()); cc.setEnd(cb.position()); } else if (result.isUnderflow()) { @@ -190,5 +182,4 @@ public class B2CConverter { } } } - } 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=1437891&r1=1437890&r2=1437891&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/buf/C2BConverter.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/buf/C2BConverter.java Thu Jan 24 08:18:39 2013 @@ -23,20 +23,11 @@ import java.nio.charset.CharsetEncoder; import java.nio.charset.CoderResult; import java.nio.charset.CodingErrorAction; -import org.apache.juli.logging.Log; -import org.apache.juli.logging.LogFactory; -import org.apache.tomcat.util.res.StringManager; - /** * NIO based character encoder. */ public final class C2BConverter { - private static final Log log = LogFactory.getLog(C2BConverter.class); - private static final StringManager sm = - StringManager.getManager(Constants.Package); - - private final String encoding; protected CharsetEncoder encoder = null; protected ByteBuffer bb = null; protected CharBuffer cb = null; @@ -47,9 +38,9 @@ public final class C2BConverter { protected CharBuffer leftovers = null; public C2BConverter(String encoding) throws IOException { - this.encoding = encoding; encoder = B2CConverter.getCharset(encoding).newEncoder(); - // FIXME: See if unmappable/malformed behavior configuration is needed in practice + // FIXME: See if unmappable/malformed behavior configuration is needed + // in practice encoder.onUnmappableCharacter(CodingErrorAction.REPLACE) .onMalformedInput(CodingErrorAction.REPLACE); char[] left = new char[4]; @@ -75,7 +66,7 @@ public final class C2BConverter { * @param bc byte output */ public void convert(CharChunk cc, ByteChunk bc) - throws IOException { + throws IOException { if ((bb == null) || (bb.array() != bc.getBuffer())) { // Create a new byte buffer if anything changed bb = ByteBuffer.wrap(bc.getBuffer(), bc.getEnd(), @@ -112,7 +103,8 @@ public final class C2BConverter { cb.position(cc.getStart()); leftovers.position(0); } - // Do the decoding and get the results into the byte chunk and the char chunk + // Do the decoding and get the results into the byte chunk and the char + // chunk result = encoder.encode(cb, bb, false); if (result.isError() || result.isMalformed()) { result.throwException(); Modified: tomcat/trunk/java/org/apache/tomcat/util/buf/UEncoder.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/buf/UEncoder.java?rev=1437891&r1=1437890&r2=1437891&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/buf/UEncoder.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/buf/UEncoder.java Thu Jan 24 08:18:39 2013 @@ -32,9 +32,6 @@ import java.util.BitSet; */ public final class UEncoder { - private static final org.apache.juli.logging.Log log= - org.apache.juli.logging.LogFactory.getLog(UEncoder.class ); - // Not static - the set may differ ( it's better than adding // an extra check for "/", "+", etc private BitSet safeChars=null; --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org