CPD Results

The following document contains the results of PMD's CPD 3.7.

Duplications

FileLine
org\fosstrak\hal\impl\feig\FeigCOMController.java1010
org\fosstrak\hal\impl\feig\FeigTCPIPController.java1001
	private void killEPC(String id, String password)
			throws HardwareException {
		// construct request record...
		RequestRecord req = new RequestRecord();
		req.comAdr = (byte) 0xff;
		// Set special host command (I-Code UID)
		req.controlByte = (byte) 0x1c;

		byte[] destroyCommand = new byte[24];
		// Set destroy command
		destroyCommand[0] = (byte) 0x18;
		// Set UID mode
		destroyCommand[1] = (byte) 0x1;
		// Set tag address (IDD)
		byte[] idb = ByteBlock.hexStringToByteArray(id, 19);
		System.arraycopy(idb, 0, destroyCommand, 2, 19);
		if (password.length() != 4) {
			log.warn("destroyIcodeUID: Password is " + password.length()
					+ " bytes but should be 4");
		}
		byte[] pswb = ByteBlock.hexStringToByteArray(password.substring(0, 2));
		System.arraycopy(pswb, 0, destroyCommand, 21, 3);

		req.data = destroyCommand;

		ResponseRecord resp = null;

		try {
			resp = tcpip.sendRequest(req);

FileLine
org\fosstrak\hal\impl\feig\FeigCOMController.java1038
org\fosstrak\hal\impl\feig\FeigTCPIPController.java1029
			resp = tcpip.sendRequest(req);
		} catch (IOException e) {
			String message = "Communication error with reader";
			log.error("destroyIcodeUID: " + message, e);
			throw new HardwareException(message);
		}

		// Handle response
		StatusByte status = StatusByte.getStatus(resp.status);
		String statusMessage = getStatusMessage(status);
		if (status == StatusByte.RF_COMMUNICATION_ERROR) {
			log.error(statusMessage);
			log
					.error("destroyIcodeUID: Destroying tag failed. More than one transponder in range or ID not matching.");
			throw new HardwareException("Destroying tag failed. More than one transponder in range or ID not matching.");
		} else if (status == StatusByte.WRITE_ERROR) {
			log.error(statusMessage);
			log
					.error("destroyIcodeUID: Destroying tag not successful. Tag may still be read.");
			throw new HardwareException("Destroying tag not successful. Tag may still be read.");
		}
	}

	public void shutDownReadPoint(String readPointName) {
	}

	public boolean supportsShutDownReadPoint() {
	   return false;
	}

	public void startUpReadPoint(String readPointName) {
	}

	public boolean supportsStartUpReadPoint() {
	   return false;
	}

	public boolean supportsKill() {
		return false;

FileLine
org\fosstrak\hal\impl\feig\FeigCOMController.java724
org\fosstrak\hal\impl\feig\FeigTCPIPController.java815
				resp = tcpip.sendRequest(req);
			} catch (IOException e) {
				log.error("readBytes: Communication error with reader", e);
				throw new HardwareException("Communication error with reader");
			}

			StatusByte status = StatusByte.getStatus(resp.status);
			String statusMessage = getStatusMessage(status);
			if (status == StatusByte.NO_TRANSPONDER) {
				log.info(statusMessage);
				return inventory;
			} else if (status == StatusByte.MORE_DATA) {
				moreTags = true;
			} else if (resp.status == (byte) 0x00) {
				moreTags = false;
			} else {
				log.error(statusMessage);
				throw new HardwareException();
			}
			log.info(statusMessage);

			int datasets = ByteBlock.byteToNumber(resp.data[0]);

FileLine
org\fosstrak\hal\impl\feig\FeigCOMController.java874
org\fosstrak\hal\impl\feig\FeigUSBController.java60
	}

   /* (non-Javadoc)
    * @see org.fosstrak.hal.HardwareAbstraction#startAsynchronousIdentify(java.lang.String[], org.fosstrak.hal.AsynchronousIdentifyListener, java.lang.String, java.lang.String)
    */
   public void startAsynchronousIdentify(String[] readPointNames,
         Trigger trigger) throws HardwareException,
         UnsupportedOperationException {
      throw new HardwareException("HAL not ready.");
   }

   /* (non-Javadoc)
    * @see org.fosstrak.hal.HardwareAbstraction#stopAsynchronousIdentify(org.fosstrak.hal.AsynchronousIdentifyListener)
    */
   public void stopAsynchronousIdentify()
         throws HardwareException, UnsupportedOperationException {
      throw new HardwareException("HAL not ready.");
   }


   /* (non-Javadoc)
    * @see org.fosstrak.hal.HardwareAbstraction#isAsynchronousIdentifyRunning(org.fosstrak.hal.AsynchronousIdentifyListener)
    */
   public boolean isAsynchronousIdentifyRunning() throws HardwareException,
         UnsupportedOperationException {
      throw new HardwareException("HAL not ready.");
   }


   /* (non-Javadoc)
    * @see org.fosstrak.hal.HardwareAbstraction#addAsynchronousIdentifyListener(org.fosstrak.hal.AsynchronousIdentifyListener)
    */
   public void addAsynchronousIdentifyListener(AsynchronousIdentifyListener listener)
         throws HardwareException, UnsupportedOperationException {
      throw new HardwareException("HAL not ready.");
   }


   /* (non-Javadoc)
    * @see org.fosstrak.hal.HardwareAbstraction#removeAsynchronousIdentifyListener(org.fosstrak.hal.AsynchronousIdentifyListener)
    */
   public void removeAsynchronousIdentifyListener(AsynchronousIdentifyListener listener)
         throws HardwareException, UnsupportedOperationException {
      throw new HardwareException("HAL not ready.");
   }


   /* (non-Javadoc)
    * @see org.fosstrak.hal.HardwareAbstraction#supportsAsynchronousIdentify()
    */
   public boolean supportsAsynchronousIdentify() {
      return false;
   }


	public boolean isAsynchronousIdentifyRunning(

FileLine
org\fosstrak\hal\impl\feig\FeigCOMController.java560
org\fosstrak\hal\impl\feig\FeigTCPIPController.java691
			resp = tcpip.sendRequest(req);
		} catch (IOException e) {
			log.error("readBytes: Communication error with reader", e);
			throw new HardwareException("Communication error with reader");
		}
		// Handle response
		StatusByte status = StatusByte.getStatus(resp.status);
		String statusMessage = getStatusMessage(status);
		if (status != StatusByte.OK) {
			log.error(statusMessage);
			throw new HardwareException("Reset of reader reader failed\n"
							+ " " + statusMessage);
		}
		log.info(statusMessage);
	}

   /**
    * (non-Javadoc)
    *
    * @see org.fosstrak.hal.HardwareAbstraction#supportsReset()
    */
	public boolean supportsReset() {
	   return true;
	}

	/**
	 * (non-Javadoc)
	 *
	 * @see org.fosstrak.hal.HardwareAbstraction#setParameter(java.lang.String,
	 *      java.lang.String)
	 */
	public void setParameter(String param, String value)
			throws HardwareException {
		try {