case 1: defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_1; break;
case 2: defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_2; break;
case 3: defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_3; break;
- case 4: defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_4; break;
- case 5: defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_5; break;// NOSONAR false-positive: constant 5 is the same than 4 (empty string)
+ case 4: defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_4; break; // NOSONAR false-positive: constant 4 is the same than 5 (empty string)
+ case 5: defaultValue = CoreProperties.TIMEMACHINE_DEFAULT_PERIOD_5; break; // NOSONAR false-positive: constant 5 is the same than 4 (empty string)
}
return conf.getString(CoreProperties.TIMEMACHINE_PERIOD_PREFIX + index, defaultValue);
}
public Connection getConnection() throws SQLException {
try {
/*
- The sonar batch downloads the JDBC driver in a separated classloader.
- This is a well-know problem of java.sql.DriverManager. The workaround
- is to use a proxy.
- See http://stackoverflow.com/questions/288828/how-to-use-a-jdbc-driver-from-an-arbitrary-location
+ * The sonar batch downloads the JDBC driver in a separated classloader.
+ * This is a well-know problem of java.sql.DriverManager. The workaround
+ * is to use a proxy.
+ * See http://stackoverflow.com/questions/288828/how-to-use-a-jdbc-driver-from-an-arbitrary-location
*/
- Driver driver = (Driver)classloader.loadClass(getDriver()).newInstance();
+ Driver driver = (Driver) classloader.loadClass(getDriver()).newInstance();
DriverManager.registerDriver(new DriverProxy(driver));
} catch (Exception e) {
SQLException ex = new SQLException("SQL driver not found " + getDriver());
- ex.initCause(e);
- throw ex;
+ throw (SQLException) ex.initCause(e);
}
return DriverManager.getConnection(getUrl(), getUsername(), getPassword());
}
DriverProxy(Driver target) {
if (target == null) {
- throw new NullPointerException();
+ throw new IllegalArgumentException();
}
this.target = target;
}
return target.acceptsURL(url);
}
- public Connection connect(
- String url, Properties info
- ) throws SQLException {
+ public Connection connect(String url, Properties info) throws SQLException {
return target.connect(url, info);
}
return target.getMinorVersion();
}
- public java.sql.DriverPropertyInfo[] getPropertyInfo(
- String url, Properties info
- ) throws SQLException {
+ public java.sql.DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException {
return target.getPropertyInfo(url, info);
}
startTransaction();
return entityManager.createQuery(hql);
}
-
+
@Override
public Query createNativeQuery(String sql) {
startTransaction();
} catch (NonUniqueResultException ex) {
NonUniqueResultException e = new NonUniqueResultException("Expected single result for entitiy " + entityClass.getSimpleName()
+ " with criterias : " + StringUtils.join(criterias, ","));
- e.initCause(ex);
- throw e;
+ throw (NonUniqueResultException) e.initCause(ex);
}
}
private boolean useMeasureValueToSort = true; // only if sortedMetricId is not null
private boolean ascendingSort = true;
-
-
public Filter setPath(Integer rootSnapshotId, Integer snapshotId, String snapshotPath, boolean isViewContext) {
this.baseSnapshotId = snapshotId;
if (rootSnapshotId == null) {
}
public boolean isOnPeriod() {
- return periodIndex>0;
+ return periodIndex > 0;
}
static String getVariationColumn(int periodIndex) {
return "variation_value_4";
case 5:
return "variation_value_5";
+ default:
+ return null;
}
- return null;
}
String getColumnToSort() {
String col = "text_value";
if (useMeasureValueToSort()) {
- col = (sortedByMeasureVariation==Boolean.TRUE ? getVariationColumn (periodIndex) : "value");
+ col = (sortedByMeasureVariation == Boolean.TRUE ? getVariationColumn(periodIndex) : "value");
}
return col;
}
public boolean mustReturnEmptyResult() {
boolean hasCriterionOnVariation = false;
for (MeasureCriterion criterion : measureCriteria) {
- if (criterion.isVariation()==Boolean.TRUE) {
+ if (criterion.isVariation() == Boolean.TRUE) {
hasCriterionOnVariation = true;
}
}
*/
public final class DefaultPages {
- private static final View[] PAGES = {new SourceTab(), new CoverageTab(), new ViolationsTab()};
+ private static final View[] PAGES = { new SourceTab(), new CoverageTab(), new ViolationsTab() };
+
+ private DefaultPages() {
+ }
public static View[] getPages() {
return PAGES.clone();
* @deprecated since 2.9. Use {@link #getFalsePositive()} instead.
* @return the type
*/
+ @Deprecated
public String getType() {
return type;
}
* @param s
* the type to set
*/
+ @Deprecated
public Review setType(String s) {
this.type = s;
// the following code is only here to ensure backward compatibility with 2.8
this.falsePositive = falsePositive;
return this;
}
-
+
/**
* @since 2.9
* @return the violation id
public static final String OUTPUT_PLAIN = "PLAIN";
public static final String OUTPUT_HTML = "HTML";
+ /**
+ * @deprecated since 2.9, but kept for backward compatibility
+ */
@Deprecated
private String reviewType;
private Long id;
* @deprecated since 2.9
* @return NULL
*/
+ @Deprecated
public String getReviewType() {
return reviewType;
}
* @param reviewType
* the reviewType to set
*/
+ @Deprecated
public ReviewQuery setReviewType(String reviewType) {
this.reviewType = reviewType;
return this;