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());
}
}
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
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
}
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
- throw new RuntimeException(e);
+ throw new IllegalStateException(e);
}
}
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);
}
}
}
@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;
}
@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;
}