@@ -256,6 +256,7 @@ class RuleActivatorContext { | |||
void verifyForActivation() { | |||
checkRequest(RuleStatus.REMOVED != rule.getStatus(), "Rule was removed: %s", rule.getKey()); | |||
checkRequest(!rule.isTemplate(), "Rule template can't be activated on a Quality profile: %s", rule.getKey()); | |||
checkRequest(rulesProfile.getLanguage().equals(rule.getLanguage()), "Rule %s and profile %s have different languages", rule.getKey(), profile != null ? profile.getKee() : rulesProfile.getKee()); | |||
checkRequest(rulesProfile.getLanguage().equals(rule.getLanguage()), | |||
"Rule %s and profile %s have different languages", rule.getKey(), profile != null ? profile.getKee() : rulesProfile.getKee()); | |||
} | |||
} |
@@ -30,15 +30,11 @@ import org.sonar.api.utils.DateUtils; | |||
public class UtcDateUtils { | |||
private static final ThreadLocal<DateFormat> format = | |||
new ThreadLocal<DateFormat>() { | |||
@Override | |||
protected DateFormat initialValue() { | |||
DateFormat f = new SimpleDateFormat(DateUtils.DATETIME_FORMAT); | |||
f.setTimeZone(TimeZone.getTimeZone("UTC")); | |||
return f; | |||
} | |||
}; | |||
ThreadLocal.withInitial(() -> { | |||
DateFormat f = new SimpleDateFormat(DateUtils.DATETIME_FORMAT); | |||
f.setTimeZone(TimeZone.getTimeZone("UTC")); | |||
return f; | |||
}); | |||
private UtcDateUtils() { | |||
// only static stuff |
@@ -59,7 +59,7 @@ final class AesCipher implements Cipher { | |||
} catch (RuntimeException e) { | |||
throw e; | |||
} catch (Exception e) { | |||
throw new RuntimeException(e); | |||
throw new IllegalStateException(e); | |||
} | |||
} | |||
@@ -73,7 +73,7 @@ final class AesCipher implements Cipher { | |||
} catch (RuntimeException e) { | |||
throw e; | |||
} catch (Exception e) { | |||
throw new RuntimeException(e); | |||
throw new IllegalStateException(e); | |||
} | |||
} | |||
@@ -218,7 +218,7 @@ public class Version implements Comparable<Version> { | |||
c = patch - other.patch; | |||
if (c == 0) { | |||
long diff = buildNumber - other.buildNumber; | |||
c = diff > 0 ? 1 : (diff < 0 ? -1 : 0); | |||
c = (diff > 0) ? 1 : ((diff < 0) ? -1 : 0); | |||
} | |||
} | |||
} |
@@ -65,10 +65,10 @@ public class LineRange { | |||
@Override | |||
public int hashCode() { | |||
final int prime = 31; | |||
final int PRIME = 31; | |||
int result = 1; | |||
result = prime * result + from; | |||
result = prime * result + to; | |||
result = PRIME * result + from; | |||
result = PRIME * result + to; | |||
return result; | |||
} | |||
@@ -227,9 +227,9 @@ public class TrackedIssue implements Trackable, Serializable { | |||
@Override | |||
public int hashCode() { | |||
final int prime = 31; | |||
final int PRIME = 31; | |||
int result = 1; | |||
result = prime * result + ((key == null) ? 0 : key.hashCode()); | |||
result = PRIME * result + ((key == null) ? 0 : key.hashCode()); | |||
return result; | |||
} | |||