CPD Results

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

Duplications

File Line
com/intel/bluetooth/BluetoothStackBlueSoleil.java 425
com/intel/bluetooth/BluetoothStackMicrosoft.java 838
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.intel.bluetooth.BluetoothStack#l2Encrypt(long,long,boolean)
	 */
	public boolean rfEncrypt(long address, long handle, boolean on) throws IOException {
		return false;
	}

	// ---------------------- Client and Server L2CAP connections

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.intel.bluetooth.BluetoothStack#l2OpenClientConnection(com.intel.bluetooth .BluetoothConnectionParams,
	 * int, int)
	 */
	public long l2OpenClientConnection(BluetoothConnectionParams params, int receiveMTU, int transmitMTU)
			throws IOException {
		throw new NotSupportedIOException(getStackID());
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.intel.bluetooth.BluetoothStack#l2CloseClientConnection(long)
	 */
	public void l2CloseClientConnection(long handle) throws IOException {
		throw new NotSupportedIOException(getStackID());
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @seecom.intel.bluetooth.BluetoothStack#l2ServerOpen(com.intel.bluetooth. BluetoothConnectionNotifierParams, int,
	 * int, com.intel.bluetooth.ServiceRecordImpl)
	 */
	public long l2ServerOpen(BluetoothConnectionNotifierParams params, int receiveMTU, int transmitMTU,
			ServiceRecordImpl serviceRecord) throws IOException {
		throw new NotSupportedIOException(getStackID());
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.intel.bluetooth.BluetoothStack#l2ServerUpdateServiceRecord(long, com.intel.bluetooth.ServiceRecordImpl,
	 * boolean)
	 */
	public void l2ServerUpdateServiceRecord(long handle, ServiceRecordImpl serviceRecord, boolean acceptAndOpen)
			throws ServiceRegistrationException {
		throw new ServiceRegistrationException("Not Supported on" + getStackID());
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.intel.bluetooth.BluetoothStack#l2ServerAcceptAndOpenServerConnection (long)
	 */
	public long l2ServerAcceptAndOpenServerConnection(long handle) throws IOException {
		throw new NotSupportedIOException(getStackID());
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.intel.bluetooth.BluetoothStack#l2CloseServerConnection(long)
	 */
	public void l2CloseServerConnection(long handle) throws IOException {
		throw new NotSupportedIOException(getStackID());
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.intel.bluetooth.BluetoothStack#l2ServerClose(long, com.intel.bluetooth.ServiceRecordImpl)
	 */
	public void l2ServerClose(long handle, ServiceRecordImpl serviceRecord) throws IOException {
		throw new NotSupportedIOException(getStackID());
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.intel.bluetooth.BluetoothStack#l2GetSecurityOpt(long, int)
	 */
	public int l2GetSecurityOpt(long handle, int expected) throws IOException {
		throw new NotSupportedIOException(getStackID());
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.intel.bluetooth.BluetoothStack#l2Ready(long)
	 */
	public boolean l2Ready(long handle) throws IOException {
		throw new NotSupportedIOException(getStackID());
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.intel.bluetooth.BluetoothStack#l2receive(long, byte[])
	 */
	public int l2Receive(long handle, byte[] inBuf) throws IOException {
		throw new NotSupportedIOException(getStackID());
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.intel.bluetooth.BluetoothStack#l2send(long, byte[])
	 */
	public void l2Send(long handle, byte[] data, int transmitMTU) throws IOException {
		throw new NotSupportedIOException(getStackID());
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.intel.bluetooth.BluetoothStack#l2GetReceiveMTU(long)
	 */
	public int l2GetReceiveMTU(long handle) throws IOException {
		throw new NotSupportedIOException(getStackID());
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.intel.bluetooth.BluetoothStack#l2GetTransmitMTU(long)
	 */
	public int l2GetTransmitMTU(long handle) throws IOException {
		throw new NotSupportedIOException(getStackID());
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.intel.bluetooth.BluetoothStack#l2RemoteAddress(long)
	 */
	public long l2RemoteAddress(long handle) throws IOException {
		throw new NotSupportedIOException(getStackID());
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.intel.bluetooth.BluetoothStack#l2Encrypt(long,long,boolean)
	 */
	public boolean l2Encrypt(long address, long handle, boolean on) throws IOException {
		throw new NotSupportedIOException(getStackID());
	}
}
File Line
com/intel/bluetooth/btgoep/Connection.java 80
com/intel/bluetooth/tcpobex/Connection.java 69
	}

	public void close() throws IOException {
		impl.close();
	}

	public HeaderSet connect(HeaderSet headers) throws IOException {
		return ((ClientSession) impl).connect(headers);
	}

	public HeaderSet createHeaderSet() {
		return ((ClientSession) impl).createHeaderSet();
	}

	public HeaderSet delete(HeaderSet headers) throws IOException {
		return ((ClientSession) impl).delete(headers);
	}

	public HeaderSet disconnect(HeaderSet headers) throws IOException {
		return ((ClientSession) impl).disconnect(headers);
	}

	public Operation get(HeaderSet headers) throws IOException {
		return ((ClientSession) impl).get(headers);
	}

	public long getConnectionID() {
		return ((ClientSession) impl).getConnectionID();
	}

	public Operation put(HeaderSet headers) throws IOException {
		return ((ClientSession) impl).put(headers);
	}

	public void setAuthenticator(Authenticator auth) {
		((ClientSession) impl).setAuthenticator(auth);

	}

	public void setConnectionID(long id) {
		((ClientSession) impl).setConnectionID(id);
	}

	public HeaderSet setPath(HeaderSet headers, boolean backup, boolean create) throws IOException {
		return ((ClientSession) impl).setPath(headers, backup, create);
	}

	public javax.microedition.io.Connection acceptAndOpen(ServerRequestHandler handler) throws IOException {
		return ((SessionNotifier) impl).acceptAndOpen(handler);
	}

	public javax.microedition.io.Connection acceptAndOpen(ServerRequestHandler handler, Authenticator auth)
			throws IOException {
		return ((SessionNotifier) impl).acceptAndOpen(handler, auth);
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see com.intel.bluetooth.BluetoothConnectionNotifierServiceRecordAccess#getServiceRecord()
	 */
	public ServiceRecord getServiceRecord() {
		return ((BluetoothConnectionNotifierServiceRecordAccess) impl).getServiceRecord();
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see com.intel.bluetooth.BluetoothConnectionNotifierServiceRecordAccess#updateServiceRecord(boolean)
	 */
	public void updateServiceRecord(boolean acceptAndOpen) throws ServiceRegistrationException {
		((BluetoothConnectionNotifierServiceRecordAccess) impl).updateServiceRecord(acceptAndOpen);
	}

}
File Line
com/intel/bluetooth/BluetoothStackToshiba.java 233
com/intel/bluetooth/BluetoothStackWIDCOMM.java 257
		if (BlueCoveLocalDeviceProperties.LOCAL_DEVICE_PROPERTY_STACK_VERSION.equals(property)) {
			return getBTWVersionInfo();
		}
		// Some Hack and testing functions, not documented
		if (property.startsWith("bluecove.nativeFunction:")) {
			String functionDescr = property.substring(property.indexOf(':') + 1, property.length());
			int paramIdx = functionDescr.indexOf(':');
			if (paramIdx == -1) {
				throw new RuntimeException("Invalid native function " + functionDescr + "; arguments expected");
			}
			String function = functionDescr.substring(0, paramIdx);
			long address = RemoteDeviceHelper.getAddress(functionDescr.substring(function.length() + 1, functionDescr
					.length()));
			if ("getRemoteDeviceVersionInfo".equals(function)) {
				return getRemoteDeviceVersionInfo(address);
			} else if ("cancelSniffMode".equals(function)) {
				return String.valueOf(cancelSniffMode(address));
			} else if ("setSniffMode".equals(function)) {
				return String.valueOf(setSniffMode(address));
			} else if ("getRemoteDeviceRSSI".equals(function)) {
				return String.valueOf(getRemoteDeviceRSSI(address));
			} else if ("getRemoteDeviceLinkMode".equals(function)) {
				if (isRemoteDeviceConnected(address)) {
					return getRemoteDeviceLinkMode(address);
				} else {
					return "disconnected";
				}
			}
		}
		return null;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.intel.bluetooth.BluetoothStack#isCurrentThreadInterruptedCallback()
	 */
	public boolean isCurrentThreadInterruptedCallback() {
File Line
com/intel/bluetooth/BluetoothStackToshiba.java 343
com/intel/bluetooth/BluetoothStackWIDCOMM.java 376
					int discType = runDeviceInquiryImpl(this, startedNotify, accessCode, listener);
					if (discType == DiscoveryListener.INQUIRY_COMPLETED) {
						// Report found devices if any not reported
						Hashtable previouslyFound = (Hashtable) deviceDiscoveryListenerFoundDevices.get(listener);
						if (previouslyFound != null) {
							Vector reported = (Vector) deviceDiscoveryListenerReportedDevices.get(listener);
							for (Enumeration en = previouslyFound.keys(); en.hasMoreElements();) {
								RemoteDevice remoteDevice = (RemoteDevice) en.nextElement();
								if (reported.contains(remoteDevice)) {
									continue;
								}
								reported.addElement(remoteDevice);
								Integer deviceClassInt = (Integer) previouslyFound.get(remoteDevice);
								DeviceClass deviceClass = new DeviceClass(deviceClassInt.intValue());
								listener.deviceDiscovered(remoteDevice, deviceClass);
								// If cancelInquiry has been called
								if (!deviceDiscoveryListeners.contains(listener)) {
									return DiscoveryListener.INQUIRY_TERMINATED;
								}
							}
						}
					}
					return discType;
				} finally {
					deviceDiscoveryListeners.removeElement(listener);
					deviceDiscoveryListenerFoundDevices.remove(listener);
					deviceDiscoveryListenerReportedDevices.remove(listener);
				}
			}

			/*
			 * This function may trigger multiple times per inquiry - even multiple times per device - once for the
			 * address alone, and once for the address and the user-friendly name.
			 */
			public void deviceDiscoveredCallback(DiscoveryListener listener, long deviceAddr, int deviceClass,
					String deviceName, boolean paired) {
				DebugLog.debug("deviceDiscoveredCallback deviceName", deviceName);
				if (!deviceDiscoveryListeners.contains(listener)) {
					return;
				}
				// Update name if name retrieved
				RemoteDevice remoteDevice = RemoteDeviceHelper.createRemoteDevice(BluetoothStackWIDCOMM.this,
File Line
com/intel/bluetooth/BluetoothStackToshiba.java 196
com/intel/bluetooth/BluetoothStackWIDCOMM.java 221
	public String getLocalDeviceProperty(String property) {
		if (BluetoothConsts.PROPERTY_BLUETOOTH_CONNECTED_DEVICES_MAX.equals(property)) {
			return "7";
		}
		if (BluetoothConsts.PROPERTY_BLUETOOTH_SD_TRANS_MAX.equals(property)) {
			return "1";
		}
		if (BluetoothConsts.PROPERTY_BLUETOOTH_CONNECTED_INQUIRY_SCAN.equals(property)) {
			return BlueCoveImpl.TRUE;
		}
		if (BluetoothConsts.PROPERTY_BLUETOOTH_CONNECTED_PAGE_SCAN.equals(property)) {
			return BlueCoveImpl.TRUE;
		}
		if (BluetoothConsts.PROPERTY_BLUETOOTH_CONNECTED_INQUIRY.equals(property)) {
			return BlueCoveImpl.TRUE;
		}
		if (BluetoothConsts.PROPERTY_BLUETOOTH_CONNECTED_PAGE.equals(property)) {
			return BlueCoveImpl.TRUE;
		}

		if (BluetoothConsts.PROPERTY_BLUETOOTH_SD_ATTR_RETRIEVABLE_MAX.equals(property)) {
			return String.valueOf(ATTR_RETRIEVABLE_MAX);
		}
		if (BluetoothConsts.PROPERTY_BLUETOOTH_MASTER_SWITCH.equals(property)) {
			return BlueCoveImpl.FALSE;
		}
		if (BluetoothConsts.PROPERTY_BLUETOOTH_L2CAP_RECEIVEMTU_MAX.equals(property)) {
			return String.valueOf(RECEIVE_MTU_MAX);
		}

		if (BlueCoveLocalDeviceProperties.LOCAL_DEVICE_RADIO_VERSION.equals(property)) {
File Line
com/intel/bluetooth/BluetoothStackToshiba.java 381
com/intel/bluetooth/BluetoothStackWIDCOMM.java 417
				RemoteDevice remoteDevice = RemoteDeviceHelper.createRemoteDevice(BluetoothStackWIDCOMM.this,
						deviceAddr, deviceName, paired);
				Vector reported = (Vector) deviceDiscoveryListenerReportedDevices.get(listener);
				if (reported == null || (reported.contains(remoteDevice))) {
					return;
				}
				// See -Dbluecove.inquiry.report_asap=false
				Hashtable previouslyFound = (Hashtable) deviceDiscoveryListenerFoundDevices.get(listener);
				if (previouslyFound != null) {
					Integer deviceClassInt = (Integer) previouslyFound.get(remoteDevice);
					if (deviceClassInt == null) {
						previouslyFound.put(remoteDevice, new Integer(deviceClass));
					} else if (deviceClass != 0) {
						previouslyFound.put(remoteDevice, new Integer(deviceClass));
					}
				} else {
					DeviceClass cod = new DeviceClass(deviceClass);
					reported.addElement(remoteDevice);
					DebugLog.debug("deviceDiscoveredCallback address", remoteDevice.getBluetoothAddress());
					DebugLog.debug("deviceDiscoveredCallback deviceClass", cod);
					listener.deviceDiscovered(remoteDevice, cod);
				}
			}
File Line
com/intel/bluetooth/obex/OBEXServerOperationGet.java 134
com/intel/bluetooth/obex/OBEXServerOperationPut.java 133
			is.appendData(null, true);
			return;
		}
		DebugLog.debug("server operation reply continue");
		session.writePacket(OBEXOperationCodes.OBEX_RESPONSE_CONTINUE, sendHeaders);
		sendHeaders = null;
		readRequestPacket();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.intel.bluetooth.obex.OBEXOperationDelivery#deliverPacket(boolean, byte[])
	 */
	public void deliverPacket(boolean finalPacket, byte[] buffer) throws IOException {
		if (session.requestSent) {
			// TODO Consider moving readRequestPacket() to the begging of the function
			readRequestPacket();
			if (session.requestSent) {
				throw new IOException("Client not requesting data");
			}
		}
		OBEXHeaderSetImpl dataHeaders = OBEXSessionBase.createOBEXHeaderSetImpl();
		int opcode = OBEXOperationCodes.OBEX_RESPONSE_CONTINUE;
		int dataHeaderID = OBEXHeaderSetImpl.OBEX_HDR_BODY;
		if (finalPacket) {
			// opcode = OBEXOperationCodes.OBEX_RESPONSE_SUCCESS;
			dataHeaderID = OBEXHeaderSetImpl.OBEX_HDR_BODY_END;
		}
		dataHeaders.setHeader(dataHeaderID, buffer);
		if (sendHeaders != null) {
			OBEXHeaderSetImpl.appendHeaders(dataHeaders, sendHeaders);
			sendHeaders = null;
		}
		session.writePacket(opcode, dataHeaders);
		readRequestPacket();
	}

	private void processAbort() throws IOException {
File Line
com/intel/bluetooth/BluetoothStackMicrosoft.java 285
com/intel/bluetooth/BluetoothStackOSX.java 238
            return isLocalDeviceFeatureParkMode() ? "255" : "7";
        }
        if (BluetoothConsts.PROPERTY_BLUETOOTH_SD_TRANS_MAX.equals(property)) {
            return "7";
        }
        if (BluetoothConsts.PROPERTY_BLUETOOTH_CONNECTED_INQUIRY_SCAN.equals(property)) {
            return BlueCoveImpl.TRUE;
        }
        if (BluetoothConsts.PROPERTY_BLUETOOTH_CONNECTED_PAGE_SCAN.equals(property)) {
            return BlueCoveImpl.TRUE;
        }
        if (BluetoothConsts.PROPERTY_BLUETOOTH_CONNECTED_INQUIRY.equals(property)) {
            return BlueCoveImpl.TRUE;
        }
        if (BluetoothConsts.PROPERTY_BLUETOOTH_CONNECTED_PAGE.equals(property)) {
            return BlueCoveImpl.TRUE;
        }

        if (BluetoothConsts.PROPERTY_BLUETOOTH_SD_ATTR_RETRIEVABLE_MAX.equals(property)) {
            return String.valueOf(ATTR_RETRIEVABLE_MAX);
        }
        if (BluetoothConsts.PROPERTY_BLUETOOTH_MASTER_SWITCH.equals(property)) {
            // return isLocalDeviceFeatureSwitchRoles() ? TRUE : FALSE;
            return BlueCoveImpl.FALSE;
        }
        if (BluetoothConsts.PROPERTY_BLUETOOTH_L2CAP_RECEIVEMTU_MAX.equals(property)) {
            return String.valueOf(receiveMTUMAX());
File Line
com/intel/bluetooth/BluetoothStackOSX.java 242
com/intel/bluetooth/BluetoothStackWIDCOMM.java 227
		}
		if (BluetoothConsts.PROPERTY_BLUETOOTH_CONNECTED_INQUIRY_SCAN.equals(property)) {
			return BlueCoveImpl.TRUE;
		}
		if (BluetoothConsts.PROPERTY_BLUETOOTH_CONNECTED_PAGE_SCAN.equals(property)) {
			return BlueCoveImpl.TRUE;
		}
		if (BluetoothConsts.PROPERTY_BLUETOOTH_CONNECTED_INQUIRY.equals(property)) {
			return BlueCoveImpl.TRUE;
		}
		if (BluetoothConsts.PROPERTY_BLUETOOTH_CONNECTED_PAGE.equals(property)) {
			return BlueCoveImpl.TRUE;
		}

		if (BluetoothConsts.PROPERTY_BLUETOOTH_SD_ATTR_RETRIEVABLE_MAX.equals(property)) {
			return String.valueOf(ATTR_RETRIEVABLE_MAX);
		}
		if (BluetoothConsts.PROPERTY_BLUETOOTH_MASTER_SWITCH.equals(property)) {
			return BlueCoveImpl.FALSE;
		}
		if (BluetoothConsts.PROPERTY_BLUETOOTH_L2CAP_RECEIVEMTU_MAX.equals(property)) {
			return String.valueOf(RECEIVE_MTU_MAX);
File Line
com/intel/bluetooth/BluetoothStackMicrosoft.java 289
com/intel/bluetooth/BluetoothStackWIDCOMM.java 227
		}
		if (BluetoothConsts.PROPERTY_BLUETOOTH_CONNECTED_INQUIRY_SCAN.equals(property)) {
			return BlueCoveImpl.TRUE;
		}
		if (BluetoothConsts.PROPERTY_BLUETOOTH_CONNECTED_PAGE_SCAN.equals(property)) {
			return BlueCoveImpl.TRUE;
		}
		if (BluetoothConsts.PROPERTY_BLUETOOTH_CONNECTED_INQUIRY.equals(property)) {
			return BlueCoveImpl.TRUE;
		}
		if (BluetoothConsts.PROPERTY_BLUETOOTH_CONNECTED_PAGE.equals(property)) {
			return BlueCoveImpl.TRUE;
		}

		if (BluetoothConsts.PROPERTY_BLUETOOTH_SD_ATTR_RETRIEVABLE_MAX.equals(property)) {
			return String.valueOf(ATTR_RETRIEVABLE_MAX);
		}
		if (BluetoothConsts.PROPERTY_BLUETOOTH_MASTER_SWITCH.equals(property)) {
			return BlueCoveImpl.FALSE;
		}
		if (BluetoothConsts.PROPERTY_BLUETOOTH_L2CAP_RECEIVEMTU_MAX.equals(property)) {
			return String.valueOf(RECEIVE_MTU_MAX);
File Line
com/intel/bluetooth/ServiceRecordImpl.java 313
com/intel/bluetooth/ServiceRecordImpl.java 459
		for (Enumeration protocolsSeqEnum = (Enumeration) protocolDescriptor.getValue(); protocolsSeqEnum
				.hasMoreElements();) {
			DataElement elementSeq = (DataElement) protocolsSeqEnum.nextElement();

			if (elementSeq.getDataType() == DataElement.DATSEQ) {
				Enumeration elementSeqEnum = (Enumeration) elementSeq.getValue();

				if (elementSeqEnum.hasMoreElements()) {
					DataElement protocolElement = (DataElement) elementSeqEnum.nextElement();
					if (protocolElement.getDataType() != DataElement.UUID) {
						continue;
					}
					Object uuid = protocolElement.getValue();
					if (elementSeqEnum.hasMoreElements() && (protocolUUID.equals(uuid))) {