Program: 88873
Project: 88873
Buggy source:
public static void main(String args[]){
  int devNum=-1;
  boolean workarounds=false;
  String firmwareFile=null, snString=null;
  boolean printBus=false;
  boolean verbose=false;
  boolean eraseFirmware=false;
  boolean noLog=false;
  String filterType=null;
  String logFileName="String_Node_Str";
  char mode='s';
  File wwwroot=new File("String_Node_Str").getAbsoluteFile();
  int httpdPortno=8080;
  upTime=new Date().getTime();
  try {
    LibusbJava.usb_init();
    for (int i=0; i < args.length; i++) {
      if (args[i].equals("String_Node_Str")) {
        i++;
        try {
          if (i >= args.length) {
            throw new Exception();
          }
          devNum=Integer.parseInt(args[i]);
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str");
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        i++;
        if (i >= args.length) {
          throw new ParameterException("String_Node_Str");
        }
        try {
          logFileName=args[i];
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str" + e.getLocalizedMessage());
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        i++;
        if (i >= args.length) {
          throw new ParameterException("String_Node_Str");
        }
        try {
          logFile2=new PrintStream(new FileOutputStream(args[i],true),true);
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str" + e.getLocalizedMessage());
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        i++;
        if (i >= args.length) {
          throw new ParameterException("String_Node_Str");
        }
        try {
          blkLogFile=new PrintStream(new FileOutputStream(args[i],true),true);
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str" + e.getLocalizedMessage());
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        i++;
        if (i >= args.length) {
          throw new ParameterException("String_Node_Str");
        }
        try {
          in2FileName=args[i];
          new Thread(){
            public void run(){
              try {
                in2=new FileInputStream(in2FileName);
              }
 catch (              Exception e) {
                System.err.println("String_Node_Str" + e.getLocalizedMessage());
              }
            }
          }
.start();
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str" + e.getLocalizedMessage());
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        if (rpcCount >= maxRpcCount) {
          throw new IndexOutOfBoundsException("String_Node_Str");
        }
        if (rpcFirstBackup > 0) {
          throw new ParameterException("String_Node_Str");
        }
        i+=5;
        try {
          if (i >= args.length) {
            throw new Exception();
          }
          boolean state=rpcCount == 0 ? true : false;
          rpc[rpcCount]=new RPC(args[i - 4],args[i - 3],args[i - 2],args[i - 1],args[i],state);
          rpcCount+=1;
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str");
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        if (rpcCount >= maxRpcCount) {
          throw new IndexOutOfBoundsException("String_Node_Str");
        }
        if (rpcCount == 0) {
          throw new ParameterException("String_Node_Str");
        }
        i+=5;
        try {
          if (i >= args.length) {
            throw new Exception();
          }
          rpc[rpcCount]=new RPC(args[i - 4],args[i - 3],args[i - 2],args[i - 1],args[i],true);
          if (rpcFirstBackup == 0) {
            rpcFirstBackup=rpcCount;
          }
          rpcCount+=1;
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str");
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        i+=3;
        try {
          if (i >= args.length) {
            throw new Exception();
          }
          longPollURL=args[i - 2];
          longPollUser=args[i - 1];
          longPollPassw=args[i];
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str");
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        i++;
        try {
          if (i >= args.length) {
            throw new Exception();
          }
          firmwareFile=args[i];
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str");
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        i++;
        try {
          if (i >= args.length) {
            throw new Exception();
          }
          filterType=args[i];
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str");
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        i++;
        try {
          if (i >= args.length) {
            throw new Exception();
          }
          filterSN=args[i];
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str");
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        i++;
        try {
          if (i >= args.length) {
            throw new Exception();
          }
          if (args[i].length() < 1) {
            throw new Exception();
          }
          mode=Character.toLowerCase(args[i].charAt(0));
          if (mode != 's' && mode != 't' && mode != 'p' && mode != 'c' && mode != 'h') {
            throw new Exception();
          }
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str");
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        i++;
        if (i >= args.length) {
          throw new ParameterException("String_Node_Str");
        }
        snString=checkSnString(args[i]);
      }
 else       if (args[i].equals("String_Node_Str")) {
        printBus=true;
      }
 else       if (args[i].equals("String_Node_Str")) {
        verbose=true;
        BTCMinerCluster.verbose=true;
      }
 else       if (args[i].equals("String_Node_Str")) {
        eraseFirmware=true;
      }
 else       if (args[i].equals("String_Node_Str")) {
        forceEP0Config=true;
      }
 else       if (args[i].equals("String_Node_Str")) {
        targetCheck=true;
      }
 else       if (args[i].equals("String_Node_Str")) {
        System.out.println(ParameterException.helpMsg);
        System.exit(0);
      }
 else       if (args[i].equals("String_Node_Str")) {
        i++;
        try {
          if (i >= args.length) {
            throw new Exception();
          }
          BTCMinerCluster.maxDevicesPerThread=Integer.parseInt(args[i]);
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str");
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        i++;
        try {
          if (i >= args.length) {
            throw new Exception();
          }
          overheatThreshold=Double.parseDouble(args[i]);
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str");
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        i++;
        try {
          if (i >= args.length) {
            throw new Exception();
          }
          tempLimit=Double.parseDouble(args[i]);
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str");
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        i++;
        try {
          if (i >= args.length) {
            throw new Exception();
          }
          double d=Double.parseDouble(args[i]);
          if (d < 0.0001) {
            d=0.0001;
          }
          if (d < maxMaxErrorRate) {
            maxMaxErrorRate=d;
          }
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str");
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        i++;
        try {
          if (i >= args.length) {
            throw new Exception();
          }
          long autoResetInterval=Long.parseLong(args[i]);
          if (autoResetInterval < 0) {
            throw new Exception();
          }
          BTCMinerCluster.autoResetInterval=autoResetInterval * 1000;
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str");
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        noLog=true;
      }
 else       if (args[i].equals("String_Node_Str")) {
        i++;
        try {
          if (i >= args.length) {
            throw new Exception();
          }
          clusterId=args[i];
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str");
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        i++;
        try {
          if (i >= args.length) {
            throw new Exception();
          }
          httpdPortno=Integer.parseInt(args[i]);
          if (httpdPortno <= 0 || httpdPortno >= 65536) {
            throw new Exception();
          }
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str");
        }
      }
 else {
        throw new ParameterException("String_Node_Str" + args[i]);
      }
    }
    if (noLog != true) {
      logFile=new PrintStream(new FileOutputStream(logFileName,true),true);
    }
    if (overheatThreshold > 0.1001) {
      System.err.println("String_Node_Str" + overheatThreshold + "String_Node_Str");
    }
    if (BTCMinerCluster.maxDevicesPerThread < 1) {
      BTCMinerCluster.maxDevicesPerThread=127;
    }
    if (mode != 'c' && mode != 'h' && filterSN != null) {
      filterSN=checkSnString(filterSN);
    }
    if (mode != 't' && mode != 'p') {
      if (rpcCount == 0) {
        throw new ParameterException("String_Node_Str");
      }
    }
    if (mode == 's' || mode == 't') {
      if (devNum < 0) {
        devNum=0;
      }
      ZtexScanBus1 bus=new ZtexScanBus1(ZtexDevice1.ztexVendorId,ZtexDevice1.ztexProductId,filterSN == null,false,1,filterSN,10,0,1,0);
      if (bus.numberOfDevices() <= 0) {
        System.err.println("String_Node_Str");
        System.exit(0);
      }
      if (printBus) {
        printBus(bus);
        System.exit(0);
      }
      BTCMiner miner=new BTCMiner(bus.device(devNum),firmwareFile,verbose);
      if (mode == 't') {
        miner.initWork(hexStrToData("String_Node_Str"),hexStrToData("String_Node_Str"));
        miner.sendData();
        for (int i=0; i < 200; i++) {
          try {
            Thread.sleep(250);
          }
 catch (          InterruptedException e) {
          }
          miner.getNoncesInt();
          for (int j=0; j < miner.numNonces; j++) {
            System.out.println(i + "String_Node_Str" + j+ "String_Node_Str"+ intToHexStr(miner.nonce[j])+ "String_Node_Str"+ miner.checkNonce(miner.nonce[j],miner.hash7[j])+ "String_Node_Str"+ miner.overflowCount+ "String_Node_Str"+ intToHexStr(miner.goldenNonce[j * (1 + miner.extraSolutions)])+ "String_Node_Str"+ intToHexStr(miner.getHash(miner.goldenNonce[j])));
          }
        }
      }
 else {
        Vector<BTCMiner> v=new Vector<BTCMiner>();
        v.add(miner);
        for (int i=1; i < miner.numberOfFpgas(); i++) {
          v.add(new BTCMiner(miner.ztex(),miner.fpgaNum(i),verbose));
        }
        System.out.println("String_Node_Str");
        if (miner.ztex().numberOfFpgas() > 1) {
          System.out.println("String_Node_Str");
        }
        System.out.println("String_Node_Str");
        new PollLoop(v).run();
      }
    }
 else     if (mode == 'p') {
      if (eraseFirmware && filterType == null && filterSN == null) {
        throw new ParameterException("String_Node_Str");
      }
      ZtexScanBus1 bus=new ZtexScanBus1(ZtexDevice1.ztexVendorId,ZtexDevice1.ztexProductId,filterType == null && filterSN == null,false,1,null,10,0,0,0);
      if (bus.numberOfDevices() <= 0) {
        System.err.println("String_Node_Str");
        System.exit(0);
      }
      if (printBus) {
        printBus(bus);
        System.exit(0);
      }
      if (firmwareFile == null && !eraseFirmware) {
        throw new Exception("String_Node_Str");
      }
      int imin=0, imax=bus.numberOfDevices() - 1;
      if (devNum >= 0) {
        imin=devNum;
        imax=devNum;
      }
      ZtexIhxFile1 ihxFile=eraseFirmware ? null : new ZtexIhxFile1(firmwareFile);
      int j=0;
      for (int i=imin; i <= imax; i++) {
        ZtexDevice1 dev=bus.device(i);
        if ((filterSN == null || filterSN.equals(dev.snString())) && (filterType == null || ((dev.productId(2) == 1) && filterType.equals(getType(dev)))) && (filterType != null || filterSN != null || dev.productId(2) == 0)) {
          Ztex1v1 ztex=new Ztex1v1(dev);
          if (snString != null && ihxFile != null) {
            ihxFile.setSnString(snString);
          }
 else           if (ztex.valid() && ihxFile != null) {
            ihxFile.setSnString(dev.snString());
          }
          if (eraseFirmware) {
            ztex.eepromDisable();
            System.out.println("String_Node_Str" + ztex.toString());
          }
 else {
            System.out.println("String_Node_Str" + ztex.toString());
            System.out.println("String_Node_Str" + ztex.uploadFirmware(ihxFile,false) + "String_Node_Str");
            System.out.println("String_Node_Str" + ztex.eepromUpload(ihxFile,false) + "String_Node_Str");
            System.out.println("String_Node_Str" + ztex.toString());
          }
          j+=1;
        }
      }
      System.out.println("String_Node_Str" + j);
    }
 else     if (mode == 'c') {
      cluster=new BTCMinerCluster();
      cluster.run();
    }
 else     if (mode == 'h') {
      try {
        new BTCMinerHTTPD(httpdPortno,wwwroot);
      }
 catch (      IOException ioe) {
        System.err.println("String_Node_Str" + String.format("String_Node_Str",httpdPortno) + "String_Node_Str"+ ioe);
        System.exit(-1);
      }
      System.out.println("String_Node_Str" + String.format("String_Node_Str",httpdPortno) + "String_Node_Str");
      cluster=new BTCMinerCluster();
      cluster.run();
    }
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str" + e.getLocalizedMessage());
  }
  if (BTCMiner.newBlockMonitor != null) {
    BTCMiner.newBlockMonitor.running=false;
    BTCMiner.newBlockMonitor.interrupt();
  }
  System.exit(0);
}

Fixed version (ground truth):
public static void main(String args[]){
  int devNum=-1;
  boolean workarounds=false;
  String firmwareFile=null, snString=null;
  boolean printBus=false;
  boolean verbose=false;
  boolean eraseFirmware=false;
  boolean noLog=false;
  String filterType=null;
  String logFileName="String_Node_Str";
  char mode='s';
  File wwwroot=new File("String_Node_Str").getAbsoluteFile();
  int httpdPortno=8080;
  upTime=new Date().getTime();
  try {
    LibusbJava.usb_init();
    for (int i=0; i < args.length; i++) {
      if (args[i].equals("String_Node_Str")) {
        i++;
        try {
          if (i >= args.length) {
            throw new Exception();
          }
          devNum=Integer.parseInt(args[i]);
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str");
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        i++;
        if (i >= args.length) {
          throw new ParameterException("String_Node_Str");
        }
        try {
          logFileName=args[i];
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str" + e.getLocalizedMessage());
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        i++;
        if (i >= args.length) {
          throw new ParameterException("String_Node_Str");
        }
        try {
          logFile2=new PrintStream(new FileOutputStream(args[i],true),true);
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str" + e.getLocalizedMessage());
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        i++;
        if (i >= args.length) {
          throw new ParameterException("String_Node_Str");
        }
        try {
          blkLogFile=new PrintStream(new FileOutputStream(args[i],true),true);
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str" + e.getLocalizedMessage());
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        i++;
        if (i >= args.length) {
          throw new ParameterException("String_Node_Str");
        }
        try {
          in2FileName=args[i];
          new Thread(){
            public void run(){
              try {
                in2=new FileInputStream(in2FileName);
              }
 catch (              Exception e) {
                System.err.println("String_Node_Str" + e.getLocalizedMessage());
              }
            }
          }
.start();
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str" + e.getLocalizedMessage());
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        if (rpcCount >= maxRpcCount) {
          throw new IndexOutOfBoundsException("String_Node_Str");
        }
        if (rpcFirstBackup > 0) {
          throw new ParameterException("String_Node_Str");
        }
        i+=5;
        try {
          if (i >= args.length) {
            throw new Exception();
          }
          boolean state=rpcCount == 2 ? true : false;
          rpc[rpcCount]=new RPC(args[i - 4],args[i - 3],args[i - 2],args[i - 1],args[i],state);
          rpcCount+=1;
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str");
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        if (rpcCount >= maxRpcCount) {
          throw new IndexOutOfBoundsException("String_Node_Str");
        }
        if (rpcCount == 0) {
          throw new ParameterException("String_Node_Str");
        }
        i+=5;
        try {
          if (i >= args.length) {
            throw new Exception();
          }
          rpc[rpcCount]=new RPC(args[i - 4],args[i - 3],args[i - 2],args[i - 1],args[i],true);
          if (rpcFirstBackup == 0) {
            rpcFirstBackup=rpcCount;
          }
          rpcCount+=1;
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str");
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        i+=3;
        try {
          if (i >= args.length) {
            throw new Exception();
          }
          longPollURL=args[i - 2];
          longPollUser=args[i - 1];
          longPollPassw=args[i];
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str");
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        i++;
        try {
          if (i >= args.length) {
            throw new Exception();
          }
          firmwareFile=args[i];
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str");
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        i++;
        try {
          if (i >= args.length) {
            throw new Exception();
          }
          filterType=args[i];
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str");
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        i++;
        try {
          if (i >= args.length) {
            throw new Exception();
          }
          filterSN=args[i];
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str");
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        i++;
        try {
          if (i >= args.length) {
            throw new Exception();
          }
          if (args[i].length() < 1) {
            throw new Exception();
          }
          mode=Character.toLowerCase(args[i].charAt(0));
          if (mode != 's' && mode != 't' && mode != 'p' && mode != 'c' && mode != 'h') {
            throw new Exception();
          }
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str");
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        i++;
        if (i >= args.length) {
          throw new ParameterException("String_Node_Str");
        }
        snString=checkSnString(args[i]);
      }
 else       if (args[i].equals("String_Node_Str")) {
        printBus=true;
      }
 else       if (args[i].equals("String_Node_Str")) {
        verbose=true;
        BTCMinerCluster.verbose=true;
      }
 else       if (args[i].equals("String_Node_Str")) {
        eraseFirmware=true;
      }
 else       if (args[i].equals("String_Node_Str")) {
        forceEP0Config=true;
      }
 else       if (args[i].equals("String_Node_Str")) {
        targetCheck=true;
      }
 else       if (args[i].equals("String_Node_Str")) {
        System.out.println(ParameterException.helpMsg);
        System.exit(0);
      }
 else       if (args[i].equals("String_Node_Str")) {
        i++;
        try {
          if (i >= args.length) {
            throw new Exception();
          }
          BTCMinerCluster.maxDevicesPerThread=Integer.parseInt(args[i]);
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str");
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        i++;
        try {
          if (i >= args.length) {
            throw new Exception();
          }
          overheatThreshold=Double.parseDouble(args[i]);
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str");
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        i++;
        try {
          if (i >= args.length) {
            throw new Exception();
          }
          tempLimit=Double.parseDouble(args[i]);
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str");
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        i++;
        try {
          if (i >= args.length) {
            throw new Exception();
          }
          double d=Double.parseDouble(args[i]);
          if (d < 0.0001) {
            d=0.0001;
          }
          if (d < maxMaxErrorRate) {
            maxMaxErrorRate=d;
          }
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str");
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        i++;
        try {
          if (i >= args.length) {
            throw new Exception();
          }
          long autoResetInterval=Long.parseLong(args[i]);
          if (autoResetInterval < 0) {
            throw new Exception();
          }
          BTCMinerCluster.autoResetInterval=autoResetInterval * 1000;
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str");
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        noLog=true;
      }
 else       if (args[i].equals("String_Node_Str")) {
        i++;
        try {
          if (i >= args.length) {
            throw new Exception();
          }
          clusterId=args[i];
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str");
        }
      }
 else       if (args[i].equals("String_Node_Str")) {
        i++;
        try {
          if (i >= args.length) {
            throw new Exception();
          }
          httpdPortno=Integer.parseInt(args[i]);
          if (httpdPortno <= 0 || httpdPortno >= 65536) {
            throw new Exception();
          }
        }
 catch (        Exception e) {
          throw new ParameterException("String_Node_Str");
        }
      }
 else {
        throw new ParameterException("String_Node_Str" + args[i]);
      }
    }
    if (noLog != true) {
      logFile=new PrintStream(new FileOutputStream(logFileName,true),true);
    }
    if (overheatThreshold > 0.1001) {
      System.err.println("String_Node_Str" + overheatThreshold + "String_Node_Str");
    }
    if (BTCMinerCluster.maxDevicesPerThread < 1) {
      BTCMinerCluster.maxDevicesPerThread=127;
    }
    if (mode != 'c' && mode != 'h' && filterSN != null) {
      filterSN=checkSnString(filterSN);
    }
    if (mode != 't' && mode != 'p') {
      if (rpcCount == 0) {
        throw new ParameterException("String_Node_Str");
      }
    }
    if (mode == 's' || mode == 't') {
      if (devNum < 0) {
        devNum=0;
      }
      ZtexScanBus1 bus=new ZtexScanBus1(ZtexDevice1.ztexVendorId,ZtexDevice1.ztexProductId,filterSN == null,false,1,filterSN,10,0,1,0);
      if (bus.numberOfDevices() <= 0) {
        System.err.println("String_Node_Str");
        System.exit(0);
      }
      if (printBus) {
        printBus(bus);
        System.exit(0);
      }
      BTCMiner miner=new BTCMiner(bus.device(devNum),firmwareFile,verbose);
      if (mode == 't') {
        miner.initWork(hexStrToData("String_Node_Str"),hexStrToData("String_Node_Str"));
        miner.sendData();
        for (int i=0; i < 200; i++) {
          try {
            Thread.sleep(250);
          }
 catch (          InterruptedException e) {
          }
          miner.getNoncesInt();
          for (int j=0; j < miner.numNonces; j++) {
            System.out.println(i + "String_Node_Str" + j+ "String_Node_Str"+ intToHexStr(miner.nonce[j])+ "String_Node_Str"+ miner.checkNonce(miner.nonce[j],miner.hash7[j])+ "String_Node_Str"+ miner.overflowCount+ "String_Node_Str"+ intToHexStr(miner.goldenNonce[j * (1 + miner.extraSolutions)])+ "String_Node_Str"+ intToHexStr(miner.getHash(miner.goldenNonce[j])));
          }
        }
      }
 else {
        Vector<BTCMiner> v=new Vector<BTCMiner>();
        v.add(miner);
        for (int i=1; i < miner.numberOfFpgas(); i++) {
          v.add(new BTCMiner(miner.ztex(),miner.fpgaNum(i),verbose));
        }
        System.out.println("String_Node_Str");
        if (miner.ztex().numberOfFpgas() > 1) {
          System.out.println("String_Node_Str");
        }
        System.out.println("String_Node_Str");
        new PollLoop(v).run();
      }
    }
 else     if (mode == 'p') {
      if (eraseFirmware && filterType == null && filterSN == null) {
        throw new ParameterException("String_Node_Str");
      }
      ZtexScanBus1 bus=new ZtexScanBus1(ZtexDevice1.ztexVendorId,ZtexDevice1.ztexProductId,filterType == null && filterSN == null,false,1,null,10,0,0,0);
      if (bus.numberOfDevices() <= 0) {
        System.err.println("String_Node_Str");
        System.exit(0);
      }
      if (printBus) {
        printBus(bus);
        System.exit(0);
      }
      if (firmwareFile == null && !eraseFirmware) {
        throw new Exception("String_Node_Str");
      }
      int imin=0, imax=bus.numberOfDevices() - 1;
      if (devNum >= 0) {
        imin=devNum;
        imax=devNum;
      }
      ZtexIhxFile1 ihxFile=eraseFirmware ? null : new ZtexIhxFile1(firmwareFile);
      int j=0;
      for (int i=imin; i <= imax; i++) {
        ZtexDevice1 dev=bus.device(i);
        if ((filterSN == null || filterSN.equals(dev.snString())) && (filterType == null || ((dev.productId(2) == 1) && filterType.equals(getType(dev)))) && (filterType != null || filterSN != null || dev.productId(2) == 0)) {
          Ztex1v1 ztex=new Ztex1v1(dev);
          if (snString != null && ihxFile != null) {
            ihxFile.setSnString(snString);
          }
 else           if (ztex.valid() && ihxFile != null) {
            ihxFile.setSnString(dev.snString());
          }
          if (eraseFirmware) {
            ztex.eepromDisable();
            System.out.println("String_Node_Str" + ztex.toString());
          }
 else {
            System.out.println("String_Node_Str" + ztex.toString());
            System.out.println("String_Node_Str" + ztex.uploadFirmware(ihxFile,false) + "String_Node_Str");
            System.out.println("String_Node_Str" + ztex.eepromUpload(ihxFile,false) + "String_Node_Str");
            System.out.println("String_Node_Str" + ztex.toString());
          }
          j+=1;
        }
      }
      System.out.println("String_Node_Str" + j);
    }
 else     if (mode == 'c') {
      cluster=new BTCMinerCluster();
      cluster.run();
    }
 else     if (mode == 'h') {
      try {
        new BTCMinerHTTPD(httpdPortno,wwwroot);
      }
 catch (      IOException ioe) {
        System.err.println("String_Node_Str" + String.format("String_Node_Str",httpdPortno) + "String_Node_Str"+ ioe);
        System.exit(-1);
      }
      System.out.println("String_Node_Str" + String.format("String_Node_Str",httpdPortno) + "String_Node_Str");
      cluster=new BTCMinerCluster();
      cluster.run();
    }
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str" + e.getLocalizedMessage());
  }
  if (BTCMiner.newBlockMonitor != null) {
    BTCMiner.newBlockMonitor.running=false;
    BTCMiner.newBlockMonitor.interrupt();
  }
  System.exit(0);
}