---
date_published: 2026-10-28
date_modified: 2026-10-28
canonical_url: https://metricshub.org/ipmi-java/cpd.html
---

# CPD Results

The following document contains the results of PMD's [CPD](https://pmd.github.io/latest/pmd_userdocs_cpd.html) 7.17.0.

## Duplications

| File | Line |
| --- | --- |
| org/metricshub/ipmi/core/sm/states/OpenSessionWaiting.java | [61](./xref/org/metricshub/ipmi/core/sm/states/OpenSessionWaiting.html#L61) |
| org/metricshub/ipmi/core/sm/states/Rakp3Waiting.java | [83](./xref/org/metricshub/ipmi/core/sm/states/Rakp3Waiting.html#L83) |
| ``` stateMachine.setCurrent(new OpenSessionComplete()); } else if (machineEvent instanceof Timeout) { stateMachine.setCurrent(new Authcap()); } else { stateMachine.doExternalAction(new ErrorAction(new IllegalArgumentException("Invalid transition"))); } } @Override public void doAction(StateMachine stateMachine, RmcpMessage message) { if (ProtocolDecoder.decodeAuthenticationType(message) != AuthenticationType.RMCPPlus) { return; // this isn't IPMI v2.0 message so we ignore it } PlainCommandv20Decoder decoder = new PlainCommandv20Decoder(CipherSuite.getEmpty()); if (Protocolv20Decoder.decodePayloadType(message.getData()[1]) != PayloadType.RmcpOpenSessionResponse) { ``` |

| File | Line |
| --- | --- |
| org/metricshub/ipmi/core/coding/commands/sdr/GetSdr.java | [87](./xref/org/metricshub/ipmi/core/coding/commands/sdr/GetSdr.html#L87) |
| org/metricshub/ipmi/core/coding/commands/sel/GetSelEntry.java | [63](./xref/org/metricshub/ipmi/core/coding/commands/sel/GetSelEntry.html#L63) |
| ``` } @Override public NetworkFunction getNetworkFunction() { return NetworkFunction.StorageRequest; } @Override protected IpmiPayload preparePayload(int sequenceNumber) throws NoSuchAlgorithmException, InvalidKeyException { byte[] payload = new byte[6]; byte[] buffer = TypeConverter.intToByteArray(reservationId); payload[0] = buffer[3]; payload[1] = buffer[2]; // reservation ID buffer = TypeConverter.intToByteArray(recordId); payload[2] = buffer[3]; payload[3] = buffer[2]; // record ID payload[4] = TypeConverter.intToByte(offset); ``` |

| File | Line |
| --- | --- |
| org/metricshub/ipmi/core/sm/states/OpenSessionWaiting.java | [61](./xref/org/metricshub/ipmi/core/sm/states/OpenSessionWaiting.html#L61) |
| org/metricshub/ipmi/core/sm/states/Rakp1Waiting.java | [71](./xref/org/metricshub/ipmi/core/sm/states/Rakp1Waiting.html#L71) |
| org/metricshub/ipmi/core/sm/states/Rakp3Waiting.java | [83](./xref/org/metricshub/ipmi/core/sm/states/Rakp3Waiting.html#L83) |
| ``` stateMachine.setCurrent(new OpenSessionComplete()); } else if (machineEvent instanceof Timeout) { stateMachine.setCurrent(new Authcap()); } else { stateMachine.doExternalAction(new ErrorAction(new IllegalArgumentException("Invalid transition"))); } } @Override public void doAction(StateMachine stateMachine, RmcpMessage message) { if (ProtocolDecoder.decodeAuthenticationType(message) != AuthenticationType.RMCPPlus) { return; // this isn't IPMI v2.0 message so we ignore it } PlainCommandv20Decoder decoder = new PlainCommandv20Decoder(CipherSuite.getEmpty()); if (Protocolv20Decoder.decodePayloadType(message.getData()[1]) != PayloadType.RmcpOpenSessionResponse) { ``` |

| File | Line |
| --- | --- |
| org/metricshub/ipmi/core/coding/commands/fru/record/BoardInfo.java | [104](./xref/org/metricshub/ipmi/core/coding/commands/fru/record/BoardInfo.html#L104) |
| org/metricshub/ipmi/core/coding/commands/fru/record/ProductInfo.java | [92](./xref/org/metricshub/ipmi/core/coding/commands/fru/record/ProductInfo.html#L92) |
| ``` int currentOffset = offset; int currentPartNumber = partNumber; while (currentPartNumber != 0xc1 && currentOffset < fruData.length) { int partType = (currentPartNumber & 0xc0) >> 6; int partDataLength = currentPartNumber & 0x3f; if (partDataLengthWithinBounds(fruData, currentOffset, partDataLength)) { byte[] partNumberData = new byte[partDataLength]; System.arraycopy(fruData, currentOffset, partNumberData, 0, partDataLength); currentOffset += partDataLength; switch (index) { case 0: ``` |

| File | Line |
| --- | --- |
| org/metricshub/ipmi/core/coding/commands/sdr/GetSdr.java | [126](./xref/org/metricshub/ipmi/core/coding/commands/sdr/GetSdr.html#L126) |
| org/metricshub/ipmi/core/coding/commands/sel/GetSelEntry.java | [101](./xref/org/metricshub/ipmi/core/coding/commands/sel/GetSelEntry.html#L101) |
| ``` GetSdrResponseData responseData = new GetSdrResponseData(); byte[] buffer = new byte[4]; buffer[0] = raw[0]; buffer[1] = raw[1]; buffer[2] = 0; buffer[3] = 0; responseData.setNextRecordId(TypeConverter.littleEndianByteArrayToInt(buffer)); byte[] recordData = new byte[raw.length - 2]; System.arraycopy(raw, 2, recordData, 0, recordData.length); responseData.setSensorRecordData(recordData); ``` |

| File | Line |
| --- | --- |
| org/metricshub/ipmi/core/coding/commands/sdr/record/FruDeviceLocatorRecord.java | [85](./xref/org/metricshub/ipmi/core/coding/commands/sdr/record/FruDeviceLocatorRecord.html#L85) |
| org/metricshub/ipmi/core/coding/commands/sdr/record/GenericDeviceLocatorRecord.java | [77](./xref/org/metricshub/ipmi/core/coding/commands/sdr/record/GenericDeviceLocatorRecord.html#L77) |
| ``` setFruEntityInstance(TypeConverter.byteToInt(recordData[13])); byte[] nameData = new byte[recordData.length - 16]; System.arraycopy(recordData, 16, nameData, 0, nameData.length); setName(decodeName(recordData[15], nameData)); } /** * Returns the slave address of the controller used to access the FRU device, in its 7-bit form (byte 6 bits 7:1 of * the record), 0 when the device is directly on the IPMB. * {@link org.metricshub.ipmi.core.coding.commands.app.SendMessage} takes the slave address in its 8-bit form: this * value shifted left by one. * * @return the 7-bit slave address of the controller */ public int getDeviceAccessAddress() { return deviceAccessAddress; } /** * Sets the slave address of the controller used to access the FRU device. * * @param deviceAccessAddress the 7-bit slave address of the controller */ public void setDeviceAccessAddress(int deviceAccessAddress) { this.deviceAccessAddress = deviceAccessAddress; } /** * Returns the FRU device ID of a logical FRU device (byte 7 of the record), the ID that the FRU commands of its * controller take, or the 7-bit I2C slave address of a non-logical FRU device (byte 7 bits 7:1). * * @return the FRU device ID, or the 7-bit slave address of a non-logical FRU device */ public int getDeviceId() { ``` |

| File | Line |
| --- | --- |
| org/metricshub/ipmi/core/coding/commands/sdr/record/GenericDeviceLocatorRecord.java | [149](./xref/org/metricshub/ipmi/core/coding/commands/sdr/record/GenericDeviceLocatorRecord.html#L149) |
| org/metricshub/ipmi/core/coding/commands/sdr/record/ManagementControllerDeviceLocatorRecord.java | [204](./xref/org/metricshub/ipmi/core/coding/commands/sdr/record/ManagementControllerDeviceLocatorRecord.html#L204) |
| ``` } public int getEntityId() { return entityId; } public void setEntityId(int entityId) { this.entityId = entityId; } public int getEntityInstance() { return entityInstance; } public void setEntityInstance(int entityInstance) { this.entityInstance = entityInstance; } public String getName() { return name; } public void setName(String name) { this.name = name; } } ``` |

| File | Line |
| --- | --- |
| org/metricshub/ipmi/core/coding/commands/sdr/record/GenericDeviceLocatorRecord.java | [74](./xref/org/metricshub/ipmi/core/coding/commands/sdr/record/GenericDeviceLocatorRecord.html#L74) |
| org/metricshub/ipmi/core/coding/commands/sdr/record/ManagementControllerDeviceLocatorRecord.java | [112](./xref/org/metricshub/ipmi/core/coding/commands/sdr/record/ManagementControllerDeviceLocatorRecord.html#L112) |
| ``` setDeviceTypeModifier(TypeConverter.byteToInt(recordData[11])); setEntityId(TypeConverter.byteToInt(recordData[12])); setEntityInstance(TypeConverter.byteToInt(recordData[13])); // Byte 16 is the ID string type/length, the string starts at byte 17 (Table 43-10) byte[] nameData = new byte[recordData.length - 16]; System.arraycopy(recordData, 16, nameData, 0, nameData.length); setName(decodeName(recordData[15], nameData)); } public int getDeviceAccessAddress() { ``` |

| File | Line |
| --- | --- |
| org/metricshub/ipmi/core/coding/commands/fru/record/DcLoadInfo.java | [54](./xref/org/metricshub/ipmi/core/coding/commands/fru/record/DcLoadInfo.html#L54) |
| org/metricshub/ipmi/core/coding/commands/fru/record/DcOutputInfo.java | [48](./xref/org/metricshub/ipmi/core/coding/commands/fru/record/DcOutputInfo.html#L48) |
| ``` public DcLoadInfo(byte[] fruData, int offset) { super(); outputNumber = TypeConverter.byteToInt(fruData[offset]) & 0xf; nominalVoltage = TypeConverter.byteToInt(fruData[offset + 1]); nominalVoltage \|= TypeConverter.byteToInt(fruData[offset + 2]) << 8; nominalVoltage = TypeConverter.decode2sComplement(nominalVoltage, 15); ``` |

| File | Line |
| --- | --- |
| org/metricshub/ipmi/core/sm/states/Rakp1Complete.java | [71](./xref/org/metricshub/ipmi/core/sm/states/Rakp1Complete.html#L71) |
| org/metricshub/ipmi/core/sm/states/Uninitialized.java | [71](./xref/org/metricshub/ipmi/core/sm/states/Uninitialized.html#L71) |
| ``` stateMachine.doExternalAction(new GetSikAction(rakp1.calculateSik(event.getRakp1ResponseData()))); } catch (Exception e) { stateMachine.setCurrent(this); stateMachine.doExternalAction(new ErrorAction(e)); } } else { stateMachine.doExternalAction(new ErrorAction(new IllegalArgumentException("Invalid transition"))); } } @Override public void doAction(StateMachine stateMachine, RmcpMessage message) { // No action is needed } } ``` |

| File | Line |
| --- | --- |
| org/metricshub/ipmi/core/coding/commands/session/GetChannelAuthenticationCapabilities.java | [72](./xref/org/metricshub/ipmi/core/coding/commands/session/GetChannelAuthenticationCapabilities.html#L72) |
| org/metricshub/ipmi/core/coding/commands/session/GetChannelCipherSuites.java | [59](./xref/org/metricshub/ipmi/core/coding/commands/session/GetChannelCipherSuites.html#L59) |
| ``` public void setChannelNumber(int channelNumber) { if (channelNumber < 0 \|\| channelNumber > 0xF \|\| channelNumber == 0xC \|\| channelNumber == 0xD) { throw new IllegalArgumentException("Invalid channel number"); } this.channelNumber = TypeConverter.intToByte(channelNumber); } public int getChannelNumber() { return TypeConverter.byteToInt(channelNumber); } ``` |

| File | Line |
| --- | --- |
| org/metricshub/ipmi/core/coding/commands/session/OpenSession.java | [142](./xref/org/metricshub/ipmi/core/coding/commands/session/OpenSession.html#L142) |
| org/metricshub/ipmi/core/coding/commands/session/Rakp1.java | [233](./xref/org/metricshub/ipmi/core/coding/commands/session/Rakp1.html#L233) |
| ``` message.setPayloadType(PayloadType.RmcpOpenSessionRequest); message.setSessionID(0); message.setSessionSequenceNumber(0); message.setAuthenticationType(getAuthenticationType()); message.setPayloadAuthenticated(false); message.setPayloadEncrypted(false); message.setPayload(preparePayload(messageSequenceNumber)); return message; } @Override protected IpmiPayload preparePayload(int sequenceNumber) { byte[] payload = new byte[32]; ``` |

| File | Line |
| --- | --- |
| org/metricshub/ipmi/core/coding/commands/sdr/ReserveSdrRepository.java | [73](./xref/org/metricshub/ipmi/core/coding/commands/sdr/ReserveSdrRepository.html#L73) |
| org/metricshub/ipmi/core/coding/commands/sel/ReserveSel.java | [74](./xref/org/metricshub/ipmi/core/coding/commands/sel/ReserveSel.html#L74) |
| ``` ReserveSdrRepositoryResponseData responseData = new ReserveSdrRepositoryResponseData(); byte[] buffer = new byte[4]; buffer[0] = raw[0]; buffer[1] = raw[1]; buffer[2] = 0; buffer[3] = 0; responseData.setReservationId(TypeConverter.littleEndianByteArrayToInt(buffer)); return responseData; } } ``` |

| File | Line |
| --- | --- |
| org/metricshub/ipmi/core/coding/commands/session/OpenSession.java | [64](./xref/org/metricshub/ipmi/core/coding/commands/session/OpenSession.html#L64) |
| org/metricshub/ipmi/core/coding/commands/session/SetSessionPrivilegeLevel.java | [125](./xref/org/metricshub/ipmi/core/coding/commands/session/SetSessionPrivilegeLevel.html#L125) |
| ``` switch (requestedPrivilegeLevel) { case MaximumAvailable: return 0; case Callback: return TypeConverter.intToByte(0x1); case User: return TypeConverter.intToByte(0x2); case Operator: return TypeConverter.intToByte(0x3); case Administrator: return TypeConverter.intToByte(0x4); default: throw new IllegalArgumentException("Invalid privilege level"); } } ``` |

| File | Line |
| --- | --- |
| org/metricshub/ipmi/core/coding/commands/sdr/record/FruDeviceLocatorRecord.java | [85](./xref/org/metricshub/ipmi/core/coding/commands/sdr/record/FruDeviceLocatorRecord.html#L85) |
| org/metricshub/ipmi/core/coding/commands/sdr/record/ManagementControllerDeviceLocatorRecord.java | [116](./xref/org/metricshub/ipmi/core/coding/commands/sdr/record/ManagementControllerDeviceLocatorRecord.html#L116) |
| ``` setFruEntityInstance(TypeConverter.byteToInt(recordData[13])); byte[] nameData = new byte[recordData.length - 16]; System.arraycopy(recordData, 16, nameData, 0, nameData.length); setName(decodeName(recordData[15], nameData)); } /** * Returns the slave address of the controller used to access the FRU device, in its 7-bit form (byte 6 bits 7:1 of * the record), 0 when the device is directly on the IPMB. * {@link org.metricshub.ipmi.core.coding.commands.app.SendMessage} takes the slave address in its 8-bit form: this * value shifted left by one. * * @return the 7-bit slave address of the controller */ public int getDeviceAccessAddress() { ``` |

| File | Line |
| --- | --- |
| org/metricshub/ipmi/core/coding/commands/fru/record/BaseCompatibilityInfo.java | [53](./xref/org/metricshub/ipmi/core/coding/commands/fru/record/BaseCompatibilityInfo.html#L53) |
| org/metricshub/ipmi/core/coding/commands/fru/record/OemInfo.java | [46](./xref/org/metricshub/ipmi/core/coding/commands/fru/record/OemInfo.html#L46) |
| ``` public BaseCompatibilityInfo(byte[] fruData, int offset, int length) { super(); byte[] buffer = new byte[4]; System.arraycopy(fruData, offset, buffer, 0, 3); buffer[3] = 0; manufacturerId = TypeConverter.littleEndianByteArrayToInt(buffer); ``` |

| File | Line |
| --- | --- |
| org/metricshub/ipmi/core/coding/commands/payload/DeactivatePayload.java | [74](./xref/org/metricshub/ipmi/core/coding/commands/payload/DeactivatePayload.html#L74) |
| org/metricshub/ipmi/core/coding/commands/payload/GetPayloadActivationStatus.java | [63](./xref/org/metricshub/ipmi/core/coding/commands/payload/GetPayloadActivationStatus.html#L63) |
| ``` } @Override public NetworkFunction getNetworkFunction() { return NetworkFunction.ApplicationRequest; } @Override protected IpmiPayload preparePayload(int sequenceNumber) throws NoSuchAlgorithmException, InvalidKeyException { // We put just 2 bytes into the 6-bytes array, as specification for this command says to leave the rest 4 bytes as // zeros byte[] message = MessageComposer.get(REQUEST_DATA_LENGTH) .appendField(TypeConverter.intToByte(payloadType.getCode())) .appendField(TypeConverter.intToByte(payloadInstance)) ``` |

| File | Line |
| --- | --- |
| org/metricshub/ipmi/core/coding/commands/fru/record/OemInfo.java | [58](./xref/org/metricshub/ipmi/core/coding/commands/fru/record/OemInfo.html#L58) |
| org/metricshub/ipmi/core/coding/commands/sdr/record/OemRecord.java | [68](./xref/org/metricshub/ipmi/core/coding/commands/sdr/record/OemRecord.html#L68) |
| ``` System.arraycopy(fruData, offset + 3, oemData, 0, length - 3); } /** * Returns the manufacturer ID of the record, which identifies the vendor that defines it. * * @return the IANA manufacturer ID (3 bytes in the record, least significant byte first) */ public int getManufacturerId() { return manufacturerId; } /** * Sets the manufacturer ID of the record. * * @param manufacturerId the IANA manufacturer ID */ public void setManufacturerId(int manufacturerId) { this.manufacturerId = manufacturerId; } /** * Returns the OEM data of the record. * * @return the bytes that follow the manufacturer ID */ public byte[] getOemData() { return oemData; } /** * Sets the OEM data of the record. * * @param oemData the bytes that follow the manufacturer ID */ public void setOemData(byte[] oemData) { this.oemData = oemData; } } ``` |

| File | Line |
| --- | --- |
| org/metricshub/ipmi/core/coding/commands/sdr/GetSdrRepositoryInfo.java | [52](./xref/org/metricshub/ipmi/core/coding/commands/sdr/GetSdrRepositoryInfo.html#L52) |
| org/metricshub/ipmi/core/coding/commands/sdr/ReserveSdrRepository.java | [50](./xref/org/metricshub/ipmi/core/coding/commands/sdr/ReserveSdrRepository.html#L50) |
| org/metricshub/ipmi/core/coding/commands/sel/GetSelInfo.java | [50](./xref/org/metricshub/ipmi/core/coding/commands/sel/GetSelInfo.html#L50) |
| org/metricshub/ipmi/core/coding/commands/sel/GetSelTimeUtcOffset.java | [53](./xref/org/metricshub/ipmi/core/coding/commands/sel/GetSelTimeUtcOffset.html#L53) |
| org/metricshub/ipmi/core/coding/commands/sel/ReserveSel.java | [50](./xref/org/metricshub/ipmi/core/coding/commands/sel/ReserveSel.html#L50) |
| ``` } @Override public NetworkFunction getNetworkFunction() { return NetworkFunction.StorageRequest; } @Override protected IpmiPayload preparePayload(int sequenceNumber) throws NoSuchAlgorithmException, InvalidKeyException { return new IpmiLanRequest(getNetworkFunction(), getCommandCode(), null, TypeConverter.intToByte(sequenceNumber)); } @Override public GetSdrRepositoryInfoResponseData getResponseData(IpmiMessage message) ``` |

| File | Line |
| --- | --- |
| org/metricshub/ipmi/core/coding/commands/sdr/GetSdrRepositoryInfo.java | [77](./xref/org/metricshub/ipmi/core/coding/commands/sdr/GetSdrRepositoryInfo.html#L77) |
| org/metricshub/ipmi/core/coding/commands/sel/GetSelInfo.java | [75](./xref/org/metricshub/ipmi/core/coding/commands/sel/GetSelInfo.html#L75) |
| ``` responseData.setSdrVersion(TypeConverter.littleEndianBcdByteToInt(raw[0])); byte[] buffer = new byte[4]; buffer[0] = raw[1]; buffer[1] = raw[2]; buffer[2] = 0; buffer[3] = 0; responseData.setRecordCount(TypeConverter.littleEndianByteArrayToInt(buffer)); ``` |

| File | Line |
| --- | --- |
| org/metricshub/ipmi/core/coding/commands/sel/SelRecord.java | [155](./xref/org/metricshub/ipmi/core/coding/commands/sel/SelRecord.html#L155) |
| org/metricshub/ipmi/core/coding/commands/sel/SelRecord.java | [182](./xref/org/metricshub/ipmi/core/coding/commands/sel/SelRecord.html#L182) |
| ``` System.arraycopy(data, 3, buffer, 0, 4); record.setTimestamp(TypeConverter.decodeDate(TypeConverter.littleEndianByteArrayToInt(buffer))); buffer[0] = data[7]; buffer[1] = data[8]; buffer[2] = data[9]; ``` |

| File | Line |
| --- | --- |
| org/metricshub/ipmi/core/coding/commands/sdr/record/DeviceRelativeEntityAssiciationRecord.java | [151](./xref/org/metricshub/ipmi/core/coding/commands/sdr/record/DeviceRelativeEntityAssiciationRecord.html#L151) |
| org/metricshub/ipmi/core/coding/commands/sdr/record/EntityAssociationRecord.java | [114](./xref/org/metricshub/ipmi/core/coding/commands/sdr/record/EntityAssociationRecord.html#L114) |
| ``` setEntityRangeInstance4(TypeConverter.byteToInt(recordData[25])); } public int getContainerEntityId() { return containerEntityId; } public void setContainerEntityId(int containerEntityId) { this.containerEntityId = containerEntityId; } public int getContainerEntityInstance() { return containerEntityInstance; } public void setContainerEntityInstance(int containerEntityInstance) { this.containerEntityInstance = containerEntityInstance; } public int getContainerEntityDeviceAddress() { ``` |

| File | Line |
| --- | --- |
| org/metricshub/ipmi/core/sm/states/CiphersWaiting.java | [89](./xref/org/metricshub/ipmi/core/sm/states/CiphersWaiting.html#L89) |
| org/metricshub/ipmi/core/sm/states/OpenSessionWaiting.java | [63](./xref/org/metricshub/ipmi/core/sm/states/OpenSessionWaiting.html#L63) |
| org/metricshub/ipmi/core/sm/states/Rakp1Waiting.java | [73](./xref/org/metricshub/ipmi/core/sm/states/Rakp1Waiting.html#L73) |
| org/metricshub/ipmi/core/sm/states/Rakp3Waiting.java | [85](./xref/org/metricshub/ipmi/core/sm/states/Rakp3Waiting.html#L85) |
| ``` stateMachine.setCurrent(new Ciphers()); } else { stateMachine.doExternalAction(new ErrorAction(new IllegalArgumentException("Invalid transition"))); } } @Override public void doAction(StateMachine stateMachine, RmcpMessage message) { if (ProtocolDecoder.decodeAuthenticationType(message) != AuthenticationType.RMCPPlus) { return; // this isn't IPMI v2.0 message so we ignore it } ``` |
