Skip to content
This repository has been archived by the owner on Sep 1, 2024. It is now read-only.

Commit

Permalink
Fix Sonarqube violations
Browse files Browse the repository at this point in the history
  • Loading branch information
dariol83 committed Sep 9, 2023
1 parent e14c192 commit ba2a894
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ private void computeRealProgress() {
if(!this.gapDetected) {
this.realProgress = this.receivedContiguousFileBytes;
} else {
long realProgress = this.receivedContiguousFileBytes;
long tempRealProgress = this.receivedContiguousFileBytes;
long temporaryStartOffset = this.receivedContiguousFileBytes;
long temporaryEndOffset = this.receivedContiguousFileBytes;
// Iterate on received file PDUs: if the offset is less than this.receivedContiguousFileBytes, then ignore (already computed)
Expand All @@ -245,8 +245,8 @@ private void computeRealProgress() {
temporaryEndOffset += e.getValue().length;
} else if(e.getKey() > temporaryEndOffset) {
// It is not contiguous and it is after the end of the part under current process, so we have to
// increase the realProgress with what we computed so far, and re-initialise the counters
realProgress += (temporaryEndOffset - temporaryStartOffset);
// increase the tempRealProgress with what we computed so far, and re-initialise the counters
tempRealProgress += (temporaryEndOffset - temporaryStartOffset);
temporaryStartOffset = e.getValue().offset;
temporaryEndOffset = e.getValue().offset + e.getValue().length;
} else {
Expand All @@ -260,9 +260,9 @@ private void computeRealProgress() {
}
}
// The last part must be considered here (it is zero if no FilePDU were received or processed)
realProgress += (temporaryEndOffset - temporaryStartOffset);
tempRealProgress += (temporaryEndOffset - temporaryStartOffset);
// Set the value
this.realProgress = realProgress;
this.realProgress = tempRealProgress;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -629,8 +629,9 @@ private void handleCltuGetParameterV1toV3Return(CltuGetParameterReturnV1toV3 pdu
}
} else {
// Dump warning with diagnostic
LOG.warning(getServiceInstanceIdentifier() + ": Get parameter return received, negative result: "
+ CltuDiagnosticsStrings.getGetParameterDiagnostic(pdu.getResult().getNegativeResult()));
if(LOG.isLoggable(Level.WARNING)) {
LOG.warning(String.format("%s: Get parameter return received, negative result: %s", getServiceInstanceIdentifier(), CltuDiagnosticsStrings.getGetParameterDiagnostic(pdu.getResult().getNegativeResult())));
}

}
// Notify PDU
Expand Down Expand Up @@ -732,8 +733,9 @@ private void handleCltuGetParameterV4Return(CltuGetParameterReturnV4 pdu) {
}
} else {
// Dump warning with diagnostic
LOG.warning(getServiceInstanceIdentifier() + ": Get parameter return received, negative result: "
+ CltuDiagnosticsStrings.getGetParameterDiagnostic(pdu.getResult().getNegativeResult()));
if(LOG.isLoggable(Level.WARNING)) {
LOG.warning(String.format("%s: Get parameter return received, negative result: %s", getServiceInstanceIdentifier(), CltuDiagnosticsStrings.getGetParameterDiagnostic(pdu.getResult().getNegativeResult())));
}

}
// Notify PDU
Expand Down Expand Up @@ -767,8 +769,9 @@ private void handleCltuStartReturn(CltuStartReturn pdu) {
if (pdu.getResult().getPositiveResult() != null) {
setServiceInstanceState(ServiceInstanceBindingStateEnum.ACTIVE);
} else {
LOG.warning(getServiceInstanceIdentifier() + ": Start return received, negative result: "
+ CltuDiagnosticsStrings.getStartDiagnostic(pdu.getResult().getNegativeResult()));
if(LOG.isLoggable(Level.WARNING)) {
LOG.warning(String.format("%s: Start return received, negative result: %s", getServiceInstanceIdentifier(), CltuDiagnosticsStrings.getStartDiagnostic(pdu.getResult().getNegativeResult())));
}
// Reset requested GVCID
this.firstCltuIdentification = null;

Expand Down Expand Up @@ -808,8 +811,9 @@ private void handleCltuStopReturn(SleAcknowledgement pdu) {
// Reset requested GVCID
this.firstCltuIdentification = null;
} else {
LOG.warning(getServiceInstanceIdentifier() + ": Stop return received, negative result: "
+ CltuDiagnosticsStrings.getDiagnostic(pdu.getResult().getNegativeResult()));
if(LOG.isLoggable(Level.WARNING)) {
LOG.warning(String.format("%s: Stop return received, negative result: %s", getServiceInstanceIdentifier(), CltuDiagnosticsStrings.getDiagnostic(pdu.getResult().getNegativeResult())));
}
// If problems (result negative), ACTIVE
setServiceInstanceState(ServiceInstanceBindingStateEnum.ACTIVE);
}
Expand Down Expand Up @@ -988,8 +992,9 @@ private void handleCltuScheduleStatusReportReturn(SleScheduleStatusReportReturn
//
LOG.info(getServiceInstanceIdentifier() + ": Schedule status report return received, positive result");
} else {
LOG.warning(getServiceInstanceIdentifier() + ": Schedule status report return received, negative result: "
+ CltuDiagnosticsStrings.getScheduleStatusReportDiagnostic(pdu.getResult().getNegativeResult()));
if(LOG.isLoggable(Level.WARNING)) {
LOG.warning(String.format("%s: Schedule status report return received, negative result: %s", getServiceInstanceIdentifier(), CltuDiagnosticsStrings.getScheduleStatusReportDiagnostic(pdu.getResult().getNegativeResult())));
}
}
// Notify PDU
pduReceptionOk(pdu, SCHEDULE_STATUS_REPORT_RETURN_NAME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,10 @@ private void handleRafGetParameterReturn(RafGetParameterReturn pdu) {
LOG.warning(getServiceInstanceIdentifier() + ": Get parameter return received, positive result but unknown/unsupported parameter found");
}
} else {
// Dump warning with diagnostic
LOG.warning(getServiceInstanceIdentifier() + ": Get parameter return received, negative result: "
+ RafDiagnosticsStrings.getGetParameterDiagnostic(pdu.getResult().getNegativeResult()));
if(LOG.isLoggable(Level.WARNING)) {
// Dump warning with diagnostic
LOG.warning(String.format("%s: Get parameter return received, negative result: %s", getServiceInstanceIdentifier(), RafDiagnosticsStrings.getGetParameterDiagnostic(pdu.getResult().getNegativeResult())));
}

}
// Notify PDU
Expand Down Expand Up @@ -447,9 +448,10 @@ private void handleRafGetParameterV1toV4Return(RafGetParameterReturnV1toV4 pdu)
LOG.warning(getServiceInstanceIdentifier() + ": Get parameter return received, positive result but unknown/unsupported parameter found");
}
} else {
// Dump warning with diagnostic
LOG.warning(getServiceInstanceIdentifier() + ": Get parameter return received, negative result: "
+ RafDiagnosticsStrings.getGetParameterDiagnostic(pdu.getResult().getNegativeResult()));
if(LOG.isLoggable(Level.WARNING)) {
// Dump warning with diagnostic
LOG.warning(String.format("%s: Get parameter return received, negative result: %s", getServiceInstanceIdentifier(), RafDiagnosticsStrings.getGetParameterDiagnostic(pdu.getResult().getNegativeResult())));
}

}
// Notify PDU
Expand Down Expand Up @@ -483,8 +485,9 @@ private void handleRafStartReturn(RafStartReturn pdu) {
if (pdu.getResult().getPositiveResult() != null) {
setServiceInstanceState(ServiceInstanceBindingStateEnum.ACTIVE);
} else {
LOG.warning(getServiceInstanceIdentifier() + ": Start return received, negative result: "
+ RafDiagnosticsStrings.getStartDiagnostic(pdu.getResult().getNegativeResult()));
if(LOG.isLoggable(Level.WARNING)) {
LOG.warning(String.format("%s: Start return received, negative result: %s", getServiceInstanceIdentifier(), RafDiagnosticsStrings.getStartDiagnostic(pdu.getResult().getNegativeResult())));
}
// Reset requested frame quality
this.requestedFrameQuality = null;
// Set times
Expand Down Expand Up @@ -530,7 +533,9 @@ private void handleRafStopReturn(SleAcknowledgement pdu) {
this.startTime = null;
this.endTime = null;
} else {
LOG.warning(getServiceInstanceIdentifier() + ": Stop return received, negative result: " + RafDiagnosticsStrings.getDiagnostic(pdu.getResult().getNegativeResult()));
if(LOG.isLoggable(Level.WARNING)) {
LOG.warning(String.format("%s: Stop return received, negative result: %s", getServiceInstanceIdentifier(), RafDiagnosticsStrings.getDiagnostic(pdu.getResult().getNegativeResult())));
}
// If problems (result negative), ACTIVE
setServiceInstanceState(ServiceInstanceBindingStateEnum.ACTIVE);
}
Expand Down Expand Up @@ -692,8 +697,9 @@ private void handleRafScheduleStatusReportReturn(SleScheduleStatusReportReturn p
//
LOG.info(getServiceInstanceIdentifier() + ": Schedule status report return received, positive result");
} else {
LOG.warning(getServiceInstanceIdentifier() + ": Schedule status report return received, negative result: "
+ RafDiagnosticsStrings.getScheduleStatusReportDiagnostic(pdu.getResult().getNegativeResult()));
if(LOG.isLoggable(Level.WARNING)) {
LOG.warning(String.format("%s: Schedule status report return received, negative result: %s", getServiceInstanceIdentifier(), RafDiagnosticsStrings.getScheduleStatusReportDiagnostic(pdu.getResult().getNegativeResult())));
}
}
// Notify PDU
pduReceptionOk(pdu, SCHEDULE_STATUS_REPORT_RETURN_NAME);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,10 @@ private void handleRocfGetParameterReturn(RocfGetParameterReturn pdu) {
LOG.warning(getServiceInstanceIdentifier() + ": Get parameter return received, positive result but unknown/unsupported parameter found");
}
} else {
// Dump warning with diagnostic
LOG.warning(getServiceInstanceIdentifier() + ": Get parameter return received, negative result: "
+ RocfDiagnosticsStrings.getGetParameterDiagnostic(pdu.getResult().getNegativeResult()));
if(LOG.isLoggable(Level.WARNING)) {
// Dump warning with diagnostic
LOG.warning(String.format("%s: Get parameter return received, negative result: %s", getServiceInstanceIdentifier(), RocfDiagnosticsStrings.getGetParameterDiagnostic(pdu.getResult().getNegativeResult())));
}
}
// Notify PDU
pduReceptionOk(pdu, GET_PARAMETER_RETURN_NAME);
Expand Down Expand Up @@ -596,9 +597,10 @@ private void handleRocfGetParameterV1toV4Return(RocfGetParameterReturnV1toV4 pdu
LOG.warning(getServiceInstanceIdentifier() + ": Get parameter return received, positive result but unknown/unsupported parameter found");
}
} else {
// Dump warning with diagnostic
LOG.warning(getServiceInstanceIdentifier() + ": Get parameter return received, negative result: "
+ RocfDiagnosticsStrings.getGetParameterDiagnostic(pdu.getResult().getNegativeResult()));
if(LOG.isLoggable(Level.WARNING)) {
// Dump warning with diagnostic
LOG.warning(String.format("%s: Get parameter return received, negative result: %s", getServiceInstanceIdentifier(), RocfDiagnosticsStrings.getGetParameterDiagnostic(pdu.getResult().getNegativeResult())));
}
}
// Notify PDU
pduReceptionOk(pdu, GET_PARAMETER_RETURN_NAME);
Expand Down Expand Up @@ -631,8 +633,9 @@ private void handleRocfStartReturn(RocfStartReturn pdu) {
if (pdu.getResult().getPositiveResult() != null) {
setServiceInstanceState(ServiceInstanceBindingStateEnum.ACTIVE);
} else {
LOG.warning("Start return received, negative result: "
+ RocfDiagnosticsStrings.getStartDiagnostic(pdu.getResult().getNegativeResult()));
if(LOG.isLoggable(Level.WARNING)) {
LOG.warning(String.format("%s: Start return received, negative result: %s", getServiceInstanceIdentifier(), RocfDiagnosticsStrings.getStartDiagnostic(pdu.getResult().getNegativeResult())));
}
// Reset requested GVCID
this.requestedGvcid = null;
this.requestedControlWordType = null;
Expand Down Expand Up @@ -684,8 +687,9 @@ private void handleRocfStopReturn(SleAcknowledgement pdu) {
this.startTime = null;
this.endTime = null;
} else {
LOG.warning(getServiceInstanceIdentifier() + ": Stop return received, negative result: "
+ RocfDiagnosticsStrings.getDiagnostic(pdu.getResult().getNegativeResult()));
if(LOG.isLoggable(Level.WARNING)) {
LOG.warning(String.format("%s: Stop return received, negative result: %s", getServiceInstanceIdentifier(), RocfDiagnosticsStrings.getDiagnostic(pdu.getResult().getNegativeResult())));
}
// If problems (result negative), ACTIVE
setServiceInstanceState(ServiceInstanceBindingStateEnum.ACTIVE);
}
Expand Down Expand Up @@ -815,8 +819,9 @@ private void handleRocfScheduleStatusReportReturn(SleScheduleStatusReportReturn
//
LOG.info(getServiceInstanceIdentifier() + ": Schedule status report return received, positive result");
} else {
LOG.warning(getServiceInstanceIdentifier() + ": Schedule status report return received, negative result: "
+ RocfDiagnosticsStrings.getScheduleStatusReportDiagnostic(pdu.getResult().getNegativeResult()));
if(LOG.isLoggable(Level.WARNING)) {
LOG.warning(String.format("%s: Schedule status report return received, negative result: %s", getServiceInstanceIdentifier(), RocfDiagnosticsStrings.getScheduleStatusReportDiagnostic(pdu.getResult().getNegativeResult())));
}
}
// Notify PDU
pduReceptionOk(pdu, SCHEDULE_STATUS_REPORT_RETURN_NAME);
Expand Down

0 comments on commit ba2a894

Please sign in to comment.