1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-25 22:37:33 +00:00

Merge pull request #168 from robertbrignull/lgtm_alerts

Fix a few alerts from LGTM.com
This commit is contained in:
arnaudroques 2019-01-30 21:17:58 +01:00 committed by GitHub
commit 8b34df222b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 15 deletions

View File

@ -60,7 +60,7 @@ class IncompleteItem implements Item {
if (caract.getNumericType() != value.getNumericType()) { if (caract.getNumericType() != value.getNumericType()) {
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }
if (data.containsKey(caract.getNumericType())) { if (data.containsKey(caract)) {
throw new IllegalStateException(); throw new IllegalStateException();
} }
data.put(caract, value); data.put(caract, value);

View File

@ -45,9 +45,7 @@ class HumanDuration {
@Override @Override
public String toString() { public String toString() {
long time = duration; long time = duration / 1000;
final long ms = time % 1000L;
time = time / 1000;
final long sec = time % 60; final long sec = time % 60;
time = time / 60; time = time / 60;
final long min = time % 60; final long min = time % 60;
@ -55,15 +53,15 @@ class HumanDuration {
final long hour = time % 24; final long hour = time % 24;
final long day = time / 24; final long day = time / 24;
if (day > 0) { if (day > 0) {
return String.format("%dd %02dh%02dm%02ds", day, hour, min, sec, ms); return String.format("%dd %02dh%02dm%02ds", day, hour, min, sec);
} }
if (hour > 0) { if (hour > 0) {
return String.format("%dh%02dm%02ds", hour, min, sec, ms); return String.format("%dh%02dm%02ds", hour, min, sec);
} }
if (min > 0) { if (min > 0) {
return String.format("%dm%02ds", min, sec, ms); return String.format("%dm%02ds", min, sec);
} }
return String.format("%ds", sec, ms); return String.format("%ds", sec);
} }
} }

View File

@ -71,13 +71,7 @@ public class SuggestEngineResult {
} }
private static boolean sameString(String a, String b) { private static boolean sameString(String a, String b) {
if (a == null && b == null) { return (a == null && b == null) || (a != null && a.equals(b));
return true;
}
if (a != null || b != null) {
return false;
}
return a.equals(b);
} }
public SuggestEngineResult(String suggestedLine) { public SuggestEngineResult(String suggestedLine) {