cleanup per jikes' whining (overloaded var names, val overflow, etc)

This commit is contained in:
jrandom
2004-09-23 01:13:22 +00:00
committed by zzz
parent 3bb85f2d61
commit 7c1ce777a1
4 changed files with 22 additions and 24 deletions

View File

@ -33,7 +33,6 @@ import net.i2p.util.Log;
* @author jrandom * @author jrandom
*/ */
class RequestLeaseSetMessageHandler extends HandlerImpl { class RequestLeaseSetMessageHandler extends HandlerImpl {
private final static Log _log = new Log(RequestLeaseSetMessageHandler.class);
private Map _existingLeaseSets; private Map _existingLeaseSets;
public RequestLeaseSetMessageHandler(I2PAppContext context) { public RequestLeaseSetMessageHandler(I2PAppContext context) {

View File

@ -377,12 +377,12 @@ public class AESInputStream extends FilterInputStream {
long endE = Clock.getInstance().now(); long endE = Clock.getInstance().now();
ByteArrayInputStream encryptedStream = new ByteArrayInputStream(encrypted); ByteArrayInputStream encryptedStream = new ByteArrayInputStream(encrypted);
AESInputStream in = new AESInputStream(ctx, encryptedStream, key, iv); AESInputStream sin = new AESInputStream(ctx, encryptedStream, key, iv);
ByteArrayOutputStream baos = new ByteArrayOutputStream(512); ByteArrayOutputStream baos = new ByteArrayOutputStream(512);
byte buf[] = new byte[1024 * 32]; byte buf[] = new byte[1024 * 32];
int read = DataHelper.read(in, buf); int read = DataHelper.read(sin, buf);
if (read > 0) baos.write(buf, 0, read); if (read > 0) baos.write(buf, 0, read);
in.close(); sin.close();
byte fin[] = baos.toByteArray(); byte fin[] = baos.toByteArray();
long end = Clock.getInstance().now(); long end = Clock.getInstance().now();
Hash origHash = SHA256Generator.getInstance().calculateHash(orig); Hash origHash = SHA256Generator.getInstance().calculateHash(orig);
@ -422,15 +422,15 @@ public class AESInputStream extends FilterInputStream {
System.arraycopy(encrypted, 0, encryptedSegment, 0, 40); System.arraycopy(encrypted, 0, encryptedSegment, 0, 40);
ByteArrayInputStream encryptedStream = new ByteArrayInputStream(encryptedSegment); ByteArrayInputStream encryptedStream = new ByteArrayInputStream(encryptedSegment);
AESInputStream in = new AESInputStream(ctx, encryptedStream, key, iv); AESInputStream sin = new AESInputStream(ctx, encryptedStream, key, iv);
ByteArrayOutputStream baos = new ByteArrayOutputStream(512); ByteArrayOutputStream baos = new ByteArrayOutputStream(512);
byte buf[] = new byte[1024 * 32]; byte buf[] = new byte[1024 * 32];
int read = DataHelper.read(in, buf); int read = DataHelper.read(sin, buf);
int remaining = in.remainingBytes(); int remaining = sin.remainingBytes();
int readyBytes = in.readyBytes(); int readyBytes = sin.readyBytes();
log.info("Read: " + read); log.info("Read: " + read);
if (read > 0) baos.write(buf, 0, read); if (read > 0) baos.write(buf, 0, read);
in.close(); sin.close();
byte fin[] = baos.toByteArray(); byte fin[] = baos.toByteArray();
log.info("fin.length: " + fin.length + " remaining: " + remaining + " ready: " + readyBytes); log.info("fin.length: " + fin.length + " remaining: " + remaining + " ready: " + readyBytes);
long end = Clock.getInstance().now(); long end = Clock.getInstance().now();

View File

@ -447,19 +447,18 @@ public class LogManager {
if (!Character.isDigit(mod)) v = size.substring(0, size.length() - 1); if (!Character.isDigit(mod)) v = size.substring(0, size.length() - 1);
int val = Integer.parseInt(v); int val = Integer.parseInt(v);
switch (mod) { switch (mod) {
case 'K': case 'K':
val *= 1024; val *= 1024;
break; break;
case 'M': case 'M':
val *= 1024 * 1024; val *= 1024 * 1024;
break; break;
case 'G': case 'G':
val *= 1024 * 1024 * 1024; val *= 1024 * 1024 * 1024;
break; break;
case 'T': default:
// because we can // blah, noop
val *= 1024 * 1024 * 1024 * 1024; break;
break;
} }
return val; return val;
} catch (Throwable t) { } catch (Throwable t) {

View File

@ -104,6 +104,8 @@ public class ShellCommand {
} }
} }
private final static int BUFFER_SIZE = 1024;
/** /**
* Reads data from a <code>java.io.InputStream</code> and writes it to * Reads data from a <code>java.io.InputStream</code> and writes it to
* <code>STDOUT</code>. * <code>STDOUT</code>.
@ -112,8 +114,6 @@ public class ShellCommand {
*/ */
private class StreamReader extends Thread { private class StreamReader extends Thread {
final int BUFFER_SIZE = 1024;
private BufferedReader bufferedReader; private BufferedReader bufferedReader;
private InputStreamReader inputStreamReader; private InputStreamReader inputStreamReader;