[PATCH] micro review
Wald Commits
scm-commit at wald.intevation.org
Thu Aug 16 12:04:51 CEST 2018
# HG changeset patch
# User gernotbelger
# Date 1534413886 -7200
# Node ID b534a4f4e4f6e8011f5de04112f1f4c0c1e2cfca
# Parent 0fb76f2d4e5bffd1462d08efffbecfba61929491
micro review
diff -r 0fb76f2d4e5b -r b534a4f4e4f6 artifacts/src/main/java/org/dive4elements/river/artifacts/services/DynamicMainValuesTimeRangeDeterminationService.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/services/DynamicMainValuesTimeRangeDeterminationService.java Thu Aug 16 11:40:28 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/services/DynamicMainValuesTimeRangeDeterminationService.java Thu Aug 16 12:04:46 2018 +0200
@@ -38,8 +38,6 @@
private static final String ROOT_NODE = "dynamic-mainvalues-input";
- private static final Long DATE_DELTA_ERROR_MSG = (long) (60 * 60 * 24 * 1000);
-
public static final class ServiceException extends Exception {
private static final long serialVersionUID = 1L;
@@ -115,8 +113,8 @@
// common Range and correct errorMsg
final List<GaugeInfoResult.GaugeInfo> gaugeResultsSecondTurn = new ArrayList<>();
for (final GaugeInfoResult.GaugeInfo gi : gaugeResults) {
- gaugeResultsSecondTurn.add(new GaugeInfoResult.GaugeInfo(gi.errorMsg, gi.gauge, gi.startdate != null ? min : null,
- gi.enddate != null ? max : null));
+ gaugeResultsSecondTurn
+ .add(new GaugeInfoResult.GaugeInfo(gi.errorMsg, gi.gauge, gi.startdate != null ? min : null, gi.enddate != null ? max : null));
}
if (globalErrorMsg.isEmpty() && (min.getTime() > max.getTime()))
globalErrorMsg = getMsg(meta, "bundu.wst.gauge_timeranges_disjoint");
@@ -127,11 +125,11 @@
private String makeDoesNotCoverErrorMsg(final Date start, final Date end, final CallMeta meta) {
final Calendar cal = Calendar.getInstance();
- cal.setTime(start);
- final String startyear = String.valueOf(cal.get(Calendar.YEAR));
- cal.setTime(end);
- final String endyear = String.valueOf(cal.get(Calendar.YEAR));
- return Resources.getMsg(meta, "bundu.wst.range_does_not_cover", new Object[] { startyear, endyear });
+ return Resources.getMsg(meta, "bundu.wst.range_does_not_cover", new Object[] { getYear(start, cal), getYear(end, cal) });
+ }
+
+ private String getYear(final Date d, final Calendar cal) {
+ return String.valueOf(cal.get(Calendar.YEAR));
}
@Override
More information about the Dive4Elements-commits
mailing list