I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit aec1b3ae authored by zzz's avatar zzz
Browse files

* jbigi, jcpuid: Suppress log messages when not in router context

parent a979ed77
No related branches found
No related tags found
No related merge requests found
......@@ -34,8 +34,15 @@ public class CPUID {
* do we want to dump some basic success/failure info to stderr during
* initialization? this would otherwise use the Log component, but this makes
* it easier for other systems to reuse this class
*
* Well, we really want to use Log so if you are one of those "other systems"
* then comment out the I2PAppContext usage below.
*
* Set to false if not in router context, so scripts using TrustedUpdate
* don't spew log messages. main() below overrides to true.
*/
private static final boolean _doLog = System.getProperty("jcpuid.dontLog") == null;
private static boolean _doLog = System.getProperty("jcpuid.dontLog") == null &&
I2PAppContext.getGlobalContext().isRouterContext();
//.matches() is a java 1.4+ addition, using a simplified version for 1.3+
//private static final boolean isX86 = System.getProperty("os.arch").toLowerCase().matches("i?[x0-9]86(_64)?");
......@@ -391,6 +398,7 @@ public class CPUID {
public static void main(String args[])
{
_doLog = true;
if(!_nativeOk){
System.out.println("**Failed to retrieve CPUInfo. Please verify the existence of jcpuid dll/so**");
}
......@@ -446,7 +454,7 @@ public class CPUID {
} else {
_nativeOk = false;
if (_doLog)
System.err.println("WARN: Native CPUID library jcpuid not loaded - will not be able to read CPU information using CPUID");
System.err.println("WARNING: Native CPUID library jcpuid not loaded - will not be able to read CPU information using CPUID");
}
}
} else {
......@@ -502,7 +510,7 @@ public class CPUID {
if (resource == null) {
if (_doLog)
System.err.println("ERROR: Resource name [" + resourceName + "] was not found");
System.err.println("WARNING: Resource name [" + resourceName + "] was not found");
return false;
}
......
......@@ -96,8 +96,12 @@ public class NativeBigInteger extends BigInteger {
*
* Well, we really want to use Log so if you are one of those "other systems"
* then comment out the I2PAppContext usage below.
*
* Set to false if not in router context, so scripts using TrustedUpdate
* don't spew log messages. main() below overrides to true.
*/
private static final boolean _doLog = System.getProperty("jbigi.dontLog") == null;
private static boolean _doLog = System.getProperty("jbigi.dontLog") == null &&
I2PAppContext.getGlobalContext().isRouterContext();
private final static String JBIGI_OPTIMIZATION_K6 = "k6";
private final static String JBIGI_OPTIMIZATION_K6_2 = "k62";
......@@ -194,6 +198,7 @@ public class NativeBigInteger extends BigInteger {
* Converts a BigInteger byte-array to a 'double'
* @param ba Big endian twos complement representation of the BigInteger to convert to a double
* @return The plain double-value represented by 'ba'
* @deprecated unused
*/
public native static double nativeDoubleValue(byte ba[]);
......@@ -245,6 +250,7 @@ public class NativeBigInteger extends BigInteger {
return cachedBa;
}
/** @deprecated unused */
@Override
public double doubleValue() {
if (_nativeOk)
......@@ -281,6 +287,7 @@ public class NativeBigInteger extends BigInteger {
*
*/
public static void main(String args[]) {
_doLog = true;
runModPowTest(100);
// i2p doesn't care about the double values
//runDoubleValueTest(100);
......@@ -354,6 +361,7 @@ public class NativeBigInteger extends BigInteger {
}
}
/********
private static void runDoubleValueTest(int numRuns) {
System.out.println("DEBUG: Warming up the random number generator...");
SecureRandom rand = new SecureRandom();
......@@ -408,6 +416,7 @@ public class NativeBigInteger extends BigInteger {
System.out.println("However, we couldn't load the native library, so this doesn't test much");
}
}
*********/
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment