remove static logs

This commit is contained in:
zzz
2012-02-28 14:35:32 +00:00
parent cf5d7d2f08
commit 4f6ed70044
4 changed files with 16 additions and 14 deletions

View File

@ -29,7 +29,7 @@ import net.i2p.util.Log;
*/
public class Base32 {
private final static Log _log = new Log(Base32.class);
//private final static Log _log = new Log(Base32.class);
/** The 32 valid Base32 values. */
private final static char[] ALPHABET = {'a', 'b', 'c', 'd',
@ -248,12 +248,12 @@ public class Base32 {
outBuff[outBuffPosn] = next;
usedbits -= 3;
} else if (next != 0) {
_log.warn("Extra data at the end: " + next + "(decimal)");
//_log.warn("Extra data at the end: " + next + "(decimal)");
return null;
}
}
} else {
_log.warn("Bad Base32 input character at " + i + ": " + source[i] + "(decimal)");
//_log.warn("Bad Base32 input character at " + i + ": " + source[i] + "(decimal)");
return null;
}
}

View File

@ -41,7 +41,7 @@ import net.i2p.util.Log;
*/
public class Base64 {
private final static Log _log = new Log(Base64.class);
//private final static Log _log = new Log(Base64.class);
/**
* @param source if null will return ""
@ -750,7 +750,7 @@ public class Base64 {
} // end if: white space, equals sign or better
else {
_log.warn("Bad Base64 input character at " + i + ": " + source[i] + "(decimal)");
//_log.warn("Bad Base64 input character at " + i + ": " + source[i] + "(decimal)");
return null;
} // end else:
} // each input character

View File

@ -14,6 +14,7 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import net.i2p.I2PAppContext;
import net.i2p.crypto.SHA256Generator;
import net.i2p.util.Log;
@ -23,7 +24,6 @@ import net.i2p.util.Log;
* @author jrandom
*/
public abstract class DataStructureImpl implements DataStructure {
private final static Log _log = new Log(DataStructureImpl.class);
public String toBase64() {
byte data[] = toByteArray();
@ -48,10 +48,12 @@ public abstract class DataStructureImpl implements DataStructure {
writeBytes(baos);
return baos.toByteArray();
} catch (IOException ioe) {
_log.error("Error writing out the byte array", ioe);
Log log = I2PAppContext.getGlobalContext().logManager().getLog(getClass());
log.error("Error writing out the byte array", ioe);
return null;
} catch (DataFormatException dfe) {
_log.error("Error writing out the byte array", dfe);
Log log = I2PAppContext.getGlobalContext().logManager().getLog(getClass());
log.error("Error writing out the byte array", dfe);
return null;
}
}
@ -73,4 +75,4 @@ public abstract class DataStructureImpl implements DataStructure {
protected int read(InputStream in, byte target[]) throws IOException {
return DataHelper.read(in, target);
}
}
}

View File

@ -26,7 +26,7 @@ import net.i2p.util.Log;
* @author jrandom
*/
public class Payload extends DataStructureImpl {
private final static Log _log = new Log(Payload.class);
//private final static Log _log = new Log(Payload.class);
private byte[] _encryptedData;
private byte[] _unencryptedData;
@ -82,16 +82,16 @@ public class Payload extends DataStructureImpl {
_encryptedData = new byte[size];
int read = read(in, _encryptedData);
if (read != size) throw new DataFormatException("Incorrect number of bytes read in the payload structure");
if (_log.shouldLog(Log.DEBUG))
_log.debug("read payload: " + read + " bytes");
//if (_log.shouldLog(Log.DEBUG))
// _log.debug("read payload: " + read + " bytes");
}
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
if (_encryptedData == null) throw new DataFormatException("Not yet encrypted. Please set the encrypted data");
DataHelper.writeLong(out, 4, _encryptedData.length);
out.write(_encryptedData);
if (_log.shouldLog(Log.DEBUG))
_log.debug("wrote payload: " + _encryptedData.length);
//if (_log.shouldLog(Log.DEBUG))
// _log.debug("wrote payload: " + _encryptedData.length);
}
/**