Log some shits.

This commit is contained in:
Peter Boraros 2011-11-09 02:21:26 +01:00
parent 3974f61003
commit de28e95a26

View file

@ -99,13 +99,17 @@ public class HmacKey extends KeyczarKey {
private Mac hmac; private Mac hmac;
private long milis = 0; private long milis = 0;
private int nanos = 0; private int nanos = 0;
private boolean delay = false;
public HmacStream() throws KeyczarException { public HmacStream() throws KeyczarException {
if ((System.getProperty("millis") != null) && (System.getProperty("nanos") != null)) { if ((System.getProperty("milis") != null) && (System.getProperty("nanos") != null)) {
this.milis = Long.parseLong(System.getProperty("millis")); this.milis = Long.parseLong(System.getProperty("milis"));
this.nanos = Integer.parseInt(System.getProperty("nanos")); this.nanos = Integer.parseInt(System.getProperty("nanos"));
if (milis != 0 && nanos != 0) delay = true;
} }
if (delay) System.out.println("Delay setting: milis="+milis+", nanos="+nanos);
else System.out.println("Delay setting: none");
try { try {
hmac = Mac.getInstance(MAC_ALGORITHM); hmac = Mac.getInstance(MAC_ALGORITHM);
@ -154,7 +158,7 @@ public class HmacKey extends KeyczarKey {
if (macResult[pos] != sigBytes[pos]) { if (macResult[pos] != sigBytes[pos]) {
return false; return false;
} }
if ((milis!=0) || (nanos!=0)) { if (delay) {
try { Thread.sleep(milis, nanos); } catch (InterruptedException e) {} try { Thread.sleep(milis, nanos); } catch (InterruptedException e) {}
} }