Refactoring after review

- removed else when not needed
- return the if statement directly in the isDirectory method

Signed-off-by: Jonathan Philip Knoblauch <JonathanPhilip.Knoblauch@bosch-si.com>
This commit is contained in:
Jonathan Philip Knoblauch
2016-04-05 10:50:31 +02:00
parent 87661624ba
commit 16fff8db97
3 changed files with 9 additions and 14 deletions

View File

@@ -222,10 +222,7 @@ public class UploadLayout extends VerticalLayout {
} }
private boolean isDirectory(final Html5File file) { private boolean isDirectory(final Html5File file) {
if (Strings.isNullOrEmpty(file.getType()) && file.getFileSize() % 4096 == 0) { return Strings.isNullOrEmpty(file.getType()) && file.getFileSize() % 4096 == 0;
return true;
}
return false;
} }
} }

View File

@@ -306,11 +306,10 @@ public class BulkUploadHandler extends CustomComponent
final DistributionSetIdName dsSelected = (DistributionSetIdName) comboBox.getValue(); final DistributionSetIdName dsSelected = (DistributionSetIdName) comboBox.getValue();
if (distributionSetManagement.findDistributionSetById(dsSelected.getId()) == null) { if (distributionSetManagement.findDistributionSetById(dsSelected.getId()) == null) {
return i18n.get("message.bulk.upload.assignment.failed"); return i18n.get("message.bulk.upload.assignment.failed");
} else {
deploymentManagement.assignDistributionSet(targetBulkUpload.getDsNameAndVersion().getId(), actionType,
forcedTimeStamp, targetsList.toArray(new String[targetsList.size()]));
return null;
} }
deploymentManagement.assignDistributionSet(targetBulkUpload.getDsNameAndVersion().getId(), actionType,
forcedTimeStamp, targetsList.toArray(new String[targetsList.size()]));
return null;
} }
private String tagAssignment() { private String tagAssignment() {
@@ -330,9 +329,8 @@ public class BulkUploadHandler extends CustomComponent
} }
if (deletedTags.size() == 1) { if (deletedTags.size() == 1) {
return i18n.get("message.bulk.upload.tag.assignment.failed", deletedTags.get(0)); return i18n.get("message.bulk.upload.tag.assignment.failed", deletedTags.get(0));
} else {
return i18n.get("message.bulk.upload.tag.assignments.failed");
} }
return i18n.get("message.bulk.upload.tag.assignments.failed");
} }
private boolean ifTagsSelected() { private boolean ifTagsSelected() {

View File

@@ -248,13 +248,13 @@ public class RolloutGroupTargetsListGrid extends AbstractGrid {
if (rolloutGroup != null && rolloutGroup.getStatus() == RolloutGroupStatus.READY) { if (rolloutGroup != null && rolloutGroup.getStatus() == RolloutGroupStatus.READY) {
return HawkbitCommonUtil.getStatusLabelDetailsInString( return HawkbitCommonUtil.getStatusLabelDetailsInString(
Integer.toString(FontAwesome.DOT_CIRCLE_O.getCodepoint()), "statusIconLightBlue", null); Integer.toString(FontAwesome.DOT_CIRCLE_O.getCodepoint()), "statusIconLightBlue", null);
} else if (rolloutGroup != null && rolloutGroup.getStatus() == RolloutGroupStatus.FINISHED) { }
if (rolloutGroup != null && rolloutGroup.getStatus() == RolloutGroupStatus.FINISHED) {
return HawkbitCommonUtil.getStatusLabelDetailsInString( return HawkbitCommonUtil.getStatusLabelDetailsInString(
Integer.toString(FontAwesome.MINUS_CIRCLE.getCodepoint()), "statusIconBlue", null); Integer.toString(FontAwesome.MINUS_CIRCLE.getCodepoint()), "statusIconBlue", null);
} else {
return HawkbitCommonUtil.getStatusLabelDetailsInString(
Integer.toString(FontAwesome.QUESTION_CIRCLE.getCodepoint()), "statusIconBlue", null);
} }
return HawkbitCommonUtil.getStatusLabelDetailsInString(
Integer.toString(FontAwesome.QUESTION_CIRCLE.getCodepoint()), "statusIconBlue", null);
} }
} }