mirror of
https://github.com/octoleo/plantuml.git
synced 2024-11-22 04:55:10 +00:00
Merge pull request #168 from robertbrignull/lgtm_alerts
Fix a few alerts from LGTM.com
This commit is contained in:
commit
8b34df222b
@ -60,7 +60,7 @@ class IncompleteItem implements Item {
|
||||
if (caract.getNumericType() != value.getNumericType()) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
if (data.containsKey(caract.getNumericType())) {
|
||||
if (data.containsKey(caract)) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
data.put(caract, value);
|
||||
|
@ -45,9 +45,7 @@ class HumanDuration {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
long time = duration;
|
||||
final long ms = time % 1000L;
|
||||
time = time / 1000;
|
||||
long time = duration / 1000;
|
||||
final long sec = time % 60;
|
||||
time = time / 60;
|
||||
final long min = time % 60;
|
||||
@ -55,15 +53,15 @@ class HumanDuration {
|
||||
final long hour = time % 24;
|
||||
final long day = time / 24;
|
||||
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) {
|
||||
return String.format("%dh%02dm%02ds", hour, min, sec, ms);
|
||||
return String.format("%dh%02dm%02ds", hour, min, sec);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -71,13 +71,7 @@ public class SuggestEngineResult {
|
||||
}
|
||||
|
||||
private static boolean sameString(String a, String b) {
|
||||
if (a == null && b == null) {
|
||||
return true;
|
||||
}
|
||||
if (a != null || b != null) {
|
||||
return false;
|
||||
}
|
||||
return a.equals(b);
|
||||
return (a == null && b == null) || (a != null && a.equals(b));
|
||||
}
|
||||
|
||||
public SuggestEngineResult(String suggestedLine) {
|
||||
|
Loading…
Reference in New Issue
Block a user