forked from I2P_Developers/i2p.i2p
remove static logs
This commit is contained in:
@ -29,7 +29,7 @@ import net.i2p.util.Log;
|
|||||||
*/
|
*/
|
||||||
public class Base32 {
|
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. */
|
/** The 32 valid Base32 values. */
|
||||||
private final static char[] ALPHABET = {'a', 'b', 'c', 'd',
|
private final static char[] ALPHABET = {'a', 'b', 'c', 'd',
|
||||||
@ -248,12 +248,12 @@ public class Base32 {
|
|||||||
outBuff[outBuffPosn] = next;
|
outBuff[outBuffPosn] = next;
|
||||||
usedbits -= 3;
|
usedbits -= 3;
|
||||||
} else if (next != 0) {
|
} else if (next != 0) {
|
||||||
_log.warn("Extra data at the end: " + next + "(decimal)");
|
//_log.warn("Extra data at the end: " + next + "(decimal)");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} 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;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ import net.i2p.util.Log;
|
|||||||
*/
|
*/
|
||||||
public class Base64 {
|
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 ""
|
* @param source if null will return ""
|
||||||
@ -750,7 +750,7 @@ public class Base64 {
|
|||||||
|
|
||||||
} // end if: white space, equals sign or better
|
} // end if: white space, equals sign or better
|
||||||
else {
|
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;
|
return null;
|
||||||
} // end else:
|
} // end else:
|
||||||
} // each input character
|
} // each input character
|
||||||
|
@ -14,6 +14,7 @@ import java.io.ByteArrayOutputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import net.i2p.I2PAppContext;
|
||||||
import net.i2p.crypto.SHA256Generator;
|
import net.i2p.crypto.SHA256Generator;
|
||||||
import net.i2p.util.Log;
|
import net.i2p.util.Log;
|
||||||
|
|
||||||
@ -23,7 +24,6 @@ import net.i2p.util.Log;
|
|||||||
* @author jrandom
|
* @author jrandom
|
||||||
*/
|
*/
|
||||||
public abstract class DataStructureImpl implements DataStructure {
|
public abstract class DataStructureImpl implements DataStructure {
|
||||||
private final static Log _log = new Log(DataStructureImpl.class);
|
|
||||||
|
|
||||||
public String toBase64() {
|
public String toBase64() {
|
||||||
byte data[] = toByteArray();
|
byte data[] = toByteArray();
|
||||||
@ -48,10 +48,12 @@ public abstract class DataStructureImpl implements DataStructure {
|
|||||||
writeBytes(baos);
|
writeBytes(baos);
|
||||||
return baos.toByteArray();
|
return baos.toByteArray();
|
||||||
} catch (IOException ioe) {
|
} 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;
|
return null;
|
||||||
} catch (DataFormatException dfe) {
|
} 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;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -73,4 +75,4 @@ public abstract class DataStructureImpl implements DataStructure {
|
|||||||
protected int read(InputStream in, byte target[]) throws IOException {
|
protected int read(InputStream in, byte target[]) throws IOException {
|
||||||
return DataHelper.read(in, target);
|
return DataHelper.read(in, target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ import net.i2p.util.Log;
|
|||||||
* @author jrandom
|
* @author jrandom
|
||||||
*/
|
*/
|
||||||
public class Payload extends DataStructureImpl {
|
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[] _encryptedData;
|
||||||
private byte[] _unencryptedData;
|
private byte[] _unencryptedData;
|
||||||
|
|
||||||
@ -82,16 +82,16 @@ public class Payload extends DataStructureImpl {
|
|||||||
_encryptedData = new byte[size];
|
_encryptedData = new byte[size];
|
||||||
int read = read(in, _encryptedData);
|
int read = read(in, _encryptedData);
|
||||||
if (read != size) throw new DataFormatException("Incorrect number of bytes read in the payload structure");
|
if (read != size) throw new DataFormatException("Incorrect number of bytes read in the payload structure");
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
//if (_log.shouldLog(Log.DEBUG))
|
||||||
_log.debug("read payload: " + read + " bytes");
|
// _log.debug("read payload: " + read + " bytes");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||||
if (_encryptedData == null) throw new DataFormatException("Not yet encrypted. Please set the encrypted data");
|
if (_encryptedData == null) throw new DataFormatException("Not yet encrypted. Please set the encrypted data");
|
||||||
DataHelper.writeLong(out, 4, _encryptedData.length);
|
DataHelper.writeLong(out, 4, _encryptedData.length);
|
||||||
out.write(_encryptedData);
|
out.write(_encryptedData);
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
//if (_log.shouldLog(Log.DEBUG))
|
||||||
_log.debug("wrote payload: " + _encryptedData.length);
|
// _log.debug("wrote payload: " + _encryptedData.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user