fix sonar issues

Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>
This commit is contained in:
SirWayne
2016-08-05 14:58:17 +02:00
parent 59490d80cd
commit c71cf4852a
5 changed files with 26 additions and 53 deletions

View File

@@ -104,7 +104,7 @@ public class EntityInterceptorListener {
notifyAll(interceptor -> interceptor.postUpdate(entity));
}
private void notifyAll(final Consumer<? super EntityInterceptor> action) {
private static void notifyAll(final Consumer<? super EntityInterceptor> action) {
EntityInterceptorHolder.getInstance().getEntityInterceptors().forEach(action);
}
}

View File

@@ -69,13 +69,10 @@ public class ByteRange {
return total;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() { // NOSONAR - as this is generated
// NOSONAR - as this is generated
@SuppressWarnings("squid:S864")
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (int) (end ^ end >>> 32);
@@ -85,11 +82,6 @@ public class ByteRange {
return result;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(final Object obj) { // NOSONAR - as this is generated
if (this == obj) {

View File

@@ -8,7 +8,10 @@
*/
package org.eclipse.hawkbit.ui.artifacts.smtype;
import java.util.EnumSet;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleTypeEvent;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleTypeEvent.SoftwareModuleTypeEnum;
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
import org.eclipse.hawkbit.ui.artifacts.event.UploadViewAcceptCriteria;
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
@@ -46,12 +49,11 @@ public class SMTypeFilterButtons extends AbstractFilterButtons {
@EventBusListenerMethod(scope = EventScope.SESSION)
void onEvent(final SoftwareModuleTypeEvent event) {
if (event.getSoftwareModuleTypeEnum() == SoftwareModuleTypeEvent.SoftwareModuleTypeEnum.ADD_SOFTWARE_MODULE_TYPE
|| event.getSoftwareModuleTypeEnum() == SoftwareModuleTypeEvent.SoftwareModuleTypeEnum.UPDATE_SOFTWARE_MODULE_TYPE
|| event.getSoftwareModuleTypeEnum() == SoftwareModuleTypeEvent.SoftwareModuleTypeEnum.DELETE_SOFTWARE_MODULE_TYPE
&& event.getSoftwareModuleType() != null) {
if (event.getSoftwareModuleType() != null
&& EnumSet.allOf(SoftwareModuleTypeEnum.class).contains(event.getSoftwareModuleTypeEnum())) {
refreshTable();
}
}
@EventBusListenerMethod(scope = EventScope.SESSION)

View File

@@ -108,7 +108,7 @@ public class UploadConfirmationwindow implements Button.ClickListener {
private UploadResultWindow currentUploadResultWindow;
private int redErrorLabelCount = 0;
private int redErrorLabelCount;
private final ArtifactUploadState artifactUploadState;
@@ -353,11 +353,8 @@ public class UploadConfirmationwindow implements Button.ClickListener {
* label
* @return Boolean
*/
private Boolean isWarningIcon(final Label icon) {
if (icon.isVisible() && !icon.getStyleName().contains(SPUIStyleDefinitions.ERROR_LABEL)) {
return true;
}
return false;
private static Boolean isWarningIcon(final Label icon) {
return !isErrorIcon(icon);
}
/**
@@ -367,14 +364,11 @@ public class UploadConfirmationwindow implements Button.ClickListener {
* label
* @return Boolean
*/
private Boolean isErrorIcon(final Label icon) {
if (icon.isVisible() && icon.getStyleName().contains(SPUIStyleDefinitions.ERROR_LABEL)) {
return true;
}
return false;
private static Boolean isErrorIcon(final Label icon) {
return icon.isVisible() && icon.getStyleName().contains(SPUIStyleDefinitions.ERROR_LABEL);
}
private Label getWarningLabel() {
private static Label getWarningLabel() {
final Label warningIconLabel = new Label();
warningIconLabel.addStyleName(ValoTheme.LABEL_SMALL);
warningIconLabel.setHeightUndefined();
@@ -436,7 +430,7 @@ public class UploadConfirmationwindow implements Button.ClickListener {
private void hideErrorIcon(final Label warningLabel, final int errorLabelCount, final int duplicateCount,
final Label errorLabel, final String oldFileName, final Long currentSwId) {
if (warningLabel == null && (errorLabelCount > 1 || duplicateCount == 1 && errorLabelCount == 1)) {
if (warningLabel == null && (errorLabelCount > 1 || (duplicateCount == 1 && errorLabelCount == 1))) {
final ArtifactManagement artifactManagement = SpringContextHelper.getBean(ArtifactManagement.class);
final List<LocalArtifact> artifactList = artifactManagement.findByFilenameAndSoftwareModule(oldFileName,
currentSwId);
@@ -486,12 +480,12 @@ public class UploadConfirmationwindow implements Button.ClickListener {
uploadDetailsTable.setColumnHeader(SIZE, i18n.get("upload.size"));
uploadDetailsTable.setColumnHeader(ACTION, i18n.get("upload.action"));
uploadDetailsTable.setColumnExpandRatio(FILE_NAME_LAYOUT, 0.25f);
uploadDetailsTable.setColumnExpandRatio(SW_MODULE_NAME, 0.17f);
uploadDetailsTable.setColumnExpandRatio(SHA1_CHECKSUM, 0.2f);
uploadDetailsTable.setColumnExpandRatio(MD5_CHECKSUM, 0.2f);
uploadDetailsTable.setColumnExpandRatio(SIZE, 0.12f);
uploadDetailsTable.setColumnExpandRatio(ACTION, 0.06f);
uploadDetailsTable.setColumnExpandRatio(FILE_NAME_LAYOUT, 0.25F);
uploadDetailsTable.setColumnExpandRatio(SW_MODULE_NAME, 0.17F);
uploadDetailsTable.setColumnExpandRatio(SHA1_CHECKSUM, 0.2F);
uploadDetailsTable.setColumnExpandRatio(MD5_CHECKSUM, 0.2F);
uploadDetailsTable.setColumnExpandRatio(SIZE, 0.12F);
uploadDetailsTable.setColumnExpandRatio(ACTION, 0.06F);
final Object[] visibileColumn = { FILE_NAME_LAYOUT, SW_MODULE_NAME, SHA1_CHECKSUM, MD5_CHECKSUM, SIZE, ACTION };
uploadDetailsTable.setVisibleColumns(visibileColumn);
@@ -548,9 +542,7 @@ public class UploadConfirmationwindow implements Button.ClickListener {
uploadConfrimationWindow.close();
} else if (event.getComponent().getId().equals(SPUIComponentIdProvider.UPLOAD_BUTTON)) {
processArtifactUpload();
}
else if (event.getComponent().getId().startsWith(SPUIComponentIdProvider.UPLOAD_DELETE_ICON)) {
} else if (event.getComponent().getId().startsWith(SPUIComponentIdProvider.UPLOAD_DELETE_ICON)) {
final String itemId = ((Button) event.getComponent()).getData().toString();
final Item item = uploadDetailsTable.getItem(((Button) event.getComponent()).getData());
final Long swId = (Long) item.getItemProperty(BASE_SOFTWARE_ID).getValue();
@@ -667,7 +659,7 @@ public class UploadConfirmationwindow implements Button.ClickListener {
}
private void closeFileStream(final FileInputStream fis, final File newFile) {
private static void closeFileStream(final FileInputStream fis, final File newFile) {
if (fis != null) {
try {

View File

@@ -8,7 +8,6 @@
*/
package org.eclipse.hawkbit.ui.common.tagdetails;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -86,23 +85,11 @@ public class DistributionTagToken extends AbstractTagToken<DistributionSet> {
@Override
protected void unassignTag(final String tagName) {
final DistributionSetTagAssignmentResult result = toggleAssignment(tagName);
if (result.getUnassigned() >= 1 && (isClickedTagListEmpty() || getClickedTagList().contains(tagName))) {
if (result.getUnassigned() >= 1) {
eventBus.publish(this, ManagementUIEvent.UNASSIGN_DISTRIBUTION_TAG);
}
}
private Boolean isClickedTagListEmpty() {
if (getClickedTagList() == null || getClickedTagList() != null && !getClickedTagList().isEmpty()) {
return true;
}
return false;
}
/* To Be Done : this implementation will vary in views */
private List<String> getClickedTagList() {
return new ArrayList<>();
}
@Override
protected Boolean isToggleTagAssignmentAllowed() {
return checker.hasUpdateDistributionPermission();