You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2016/08/30 14:15:27 UTC
svn commit: r1758394 - in /sis/branches/JDK8/core:
sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/
sis-referencing/src/test/java/org/apache/sis/referencing/crs/
sis-referencing/src/test/java/org/apache/sis/referencing/datum/ sis-u...
Author: desruisseaux
Date: Tue Aug 30 14:15:26 2016
New Revision: 1758394
URL: http://svn.apache.org/viewvc?rev=1758394&view=rev
Log:
Omit the clock part if hours, minutes, seconds and milliseconds are zero in UTC timezone.
This is in anticipation to a change to use to java.time packages in some future SIS version.
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultTemporalCRSTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultTemporalDatumTest.java
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/UniversalTimeAdapter.java
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/StandardDateFormat.java
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/io/CompoundFormat.java
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/setup/About.java
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/logging/MonolineFormatter.java
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gmd/LanguageCodeTest.java
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/util/StandardDateFormatTest.java
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/measure/RangeFormatTest.java
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java?rev=1758394&r1=1758393&r2=1758394&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java [UTF-8] Tue Aug 30 14:15:26 2016
@@ -116,6 +116,7 @@ import org.apache.sis.measure.NumberRang
import org.apache.sis.measure.Units;
import static org.apache.sis.util.Utilities.equalsIgnoreMetadata;
+import static org.apache.sis.internal.util.StandardDateFormat.UTC;
import static org.apache.sis.internal.referencing.ServicesForMetadata.CONNECTION;
// Branch-dependent imports
@@ -384,7 +385,7 @@ public class EPSGDataAccess extends Geod
@SuppressWarnings("ReturnOfDateField")
private Calendar getCalendar() {
if (calendar == null) {
- calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"), Locale.CANADA);
+ calendar = Calendar.getInstance(TimeZone.getTimeZone(UTC), Locale.CANADA);
// Canada locale is closer to ISO than US.
}
calendar.clear();
Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java?rev=1758394&r1=1758393&r2=1758394&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultCompoundCRSTest.java [UTF-8] Tue Aug 30 14:15:26 2016
@@ -190,7 +190,7 @@ public final strictfp class DefaultCompo
" AXIS[\u201cGravity-related height\u201d, UP],\n" +
" AUTHORITY[\u201cEPSG\u201d, \u201c5714\u201d]],\n" + // SIS includes Identifier for component of CompoundCRS.
" TIMECRS[\u201cTime\u201d,\n" +
- " TDATUM[\u201cModified Julian\u201d, TIMEORIGIN[1858-11-17T00:00:00.000Z]],\n" +
+ " TDATUM[\u201cModified Julian\u201d, TIMEORIGIN[1858-11-17]],\n" +
" TIMEUNIT[\u201cday\u201d, 86400],\n" +
" AXIS[\u201cTime\u201d, FUTURE]]]",
HardCodedCRS.GEOID_4D);
@@ -219,7 +219,7 @@ public final strictfp class DefaultCompo
" LENGTHUNIT[\u201cmetre\u201d, 1],\n" +
" ID[\u201cEPSG\u201d, 5714]],\n" + // SIS includes Identifier for component of CompoundCRS.
" TIMECRS[\u201cTime\u201d,\n" +
- " TDATUM[\u201cModified Julian\u201d, TIMEORIGIN[1858-11-17T00:00:00.000Z]],\n" +
+ " TDATUM[\u201cModified Julian\u201d, TIMEORIGIN[1858-11-17]],\n" +
" CS[temporal, 1],\n" +
" AXIS[\u201cTime (t)\u201d, future, ORDER[1]],\n" +
" TIMEUNIT[\u201cday\u201d, 86400]],\n" +
@@ -250,7 +250,7 @@ public final strictfp class DefaultCompo
" Unit[\u201cmetre\u201d, 1],\n" +
" Id[\u201cEPSG\u201d, 5714]],\n" + // SIS includes Identifier for component of CompoundCRS.
" TimeCRS[\u201cTime\u201d,\n" +
- " TimeDatum[\u201cModified Julian\u201d, TimeOrigin[1858-11-17T00:00:00.000Z]],\n" +
+ " TimeDatum[\u201cModified Julian\u201d, TimeOrigin[1858-11-17]],\n" +
" CS[temporal, 1],\n" +
" Axis[\u201cTime (t)\u201d, future],\n" +
" TimeUnit[\u201cday\u201d, 86400]],\n" +
Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultTemporalCRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultTemporalCRSTest.java?rev=1758394&r1=1758393&r2=1758394&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultTemporalCRSTest.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultTemporalCRSTest.java [UTF-8] Tue Aug 30 14:15:26 2016
@@ -40,7 +40,7 @@ public final strictfp class DefaultTempo
public void testWKT1() {
assertWktEquals(Convention.WKT1,
"TIMECRS[\u201cTime\u201d,\n" +
- " TDATUM[\u201cModified Julian\u201d, TIMEORIGIN[1858-11-17T00:00:00.000Z]],\n" +
+ " TDATUM[\u201cModified Julian\u201d, TIMEORIGIN[1858-11-17]],\n" +
" TIMEUNIT[\u201cday\u201d, 86400],\n" +
" AXIS[\u201cTime\u201d, FUTURE]]",
HardCodedCRS.TIME);
@@ -53,7 +53,7 @@ public final strictfp class DefaultTempo
public void testWKT2() {
assertWktEquals(Convention.WKT2,
"TIMECRS[\u201cTime\u201d,\n" +
- " TDATUM[\u201cModified Julian\u201d, TIMEORIGIN[1858-11-17T00:00:00.000Z]],\n" +
+ " TDATUM[\u201cModified Julian\u201d, TIMEORIGIN[1858-11-17]],\n" +
" CS[temporal, 1],\n" +
" AXIS[\u201cTime (t)\u201d, future, ORDER[1]],\n" +
" TIMEUNIT[\u201cday\u201d, 86400]]",
@@ -67,7 +67,7 @@ public final strictfp class DefaultTempo
public void testWKT2_Simplified() {
assertWktEquals(Convention.WKT2_SIMPLIFIED,
"TimeCRS[\u201cTime\u201d,\n" +
- " TimeDatum[\u201cModified Julian\u201d, TimeOrigin[1858-11-17T00:00:00.000Z]],\n" +
+ " TimeDatum[\u201cModified Julian\u201d, TimeOrigin[1858-11-17]],\n" +
" CS[temporal, 1],\n" +
" Axis[\u201cTime (t)\u201d, future],\n" +
" TimeUnit[\u201cday\u201d, 86400]]", // ISO 19162 does not allow "Unit" keyword here.
Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultTemporalDatumTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultTemporalDatumTest.java?rev=1758394&r1=1758393&r2=1758394&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultTemporalDatumTest.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/datum/DefaultTemporalDatumTest.java [UTF-8] Tue Aug 30 14:15:26 2016
@@ -35,7 +35,7 @@ import static org.apache.sis.test.TestUt
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.4
- * @version 0.5
+ * @version 0.8
* @module
*/
public final strictfp class DefaultTemporalDatumTest extends XMLTestCase {
@@ -76,14 +76,19 @@ public final strictfp class DefaultTempo
/**
* Tests {@link DefaultTemporalDatum#toWKT()}.
*
+ * <p><b>Note:</b> ISO 19162 uses ISO 8601:2004 for the dates. Any precision is allowed:
+ * the date could have only the year, or only the year and month, <i>etc</i>. The clock
+ * part is optional and also have optional fields: can be only hours, or only hours and minutes, <i>etc</i>.
+ * ISO 19162 said that the timezone is restricted to UTC but nevertheless allows to specify a timezone.</p>
+ *
* @since 0.5
*/
@Test
public void testToWKT() {
final DefaultTemporalDatum datum = create();
- assertWktEquals(Convention.WKT1, "TDATUM[\u201cModified Julian\u201d, TIMEORIGIN[1858-11-17T00:00:00.000Z], AUTHORITY[\u201cSIS\u201d, \u201cMJ\u201d]]", datum);
- assertWktEquals(Convention.WKT2, "TDATUM[\u201cModified Julian\u201d, TIMEORIGIN[1858-11-17T00:00:00.000Z], ID[\u201cSIS\u201d, \u201cMJ\u201d]]", datum);
- assertWktEquals(Convention.WKT2_SIMPLIFIED, "TimeDatum[\u201cModified Julian\u201d, TimeOrigin[1858-11-17T00:00:00.000Z], Id[\u201cSIS\u201d, \u201cMJ\u201d]]", datum);
+ assertWktEquals(Convention.WKT1, "TDATUM[\u201cModified Julian\u201d, TIMEORIGIN[1858-11-17], AUTHORITY[\u201cSIS\u201d, \u201cMJ\u201d]]", datum);
+ assertWktEquals(Convention.WKT2, "TDATUM[\u201cModified Julian\u201d, TIMEORIGIN[1858-11-17], ID[\u201cSIS\u201d, \u201cMJ\u201d]]", datum);
+ assertWktEquals(Convention.WKT2_SIMPLIFIED, "TimeDatum[\u201cModified Julian\u201d, TimeOrigin[1858-11-17], Id[\u201cSIS\u201d, \u201cMJ\u201d]]", datum);
}
/**
Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/UniversalTimeAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/UniversalTimeAdapter.java?rev=1758394&r1=1758393&r2=1758394&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/UniversalTimeAdapter.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/UniversalTimeAdapter.java [UTF-8] Tue Aug 30 14:15:26 2016
@@ -46,7 +46,7 @@ public final class UniversalTimeAdapter
/**
* The timezone of the date to marshal with this adapter.
*/
- private static final TimeZone UTC = TimeZone.getTimeZone("UTC");
+ private static final TimeZone UTC = TimeZone.getTimeZone(org.apache.sis.internal.util.StandardDateFormat.UTC);
/**
* Empty constructor for JAXB only.
Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/StandardDateFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/StandardDateFormat.java?rev=1758394&r1=1758393&r2=1758394&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/StandardDateFormat.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/StandardDateFormat.java [UTF-8] Tue Aug 30 14:15:26 2016
@@ -32,6 +32,12 @@ import java.text.SimpleDateFormat;
* <p>External users should use nothing else than the parsing and formating methods. The methods for
* configuring the {@code DateFormat} may not be available between different SIS branches.</p>
*
+ * <p>The main usage for this class is Well Known Text (WKT) parsing and formatting.
+ * ISO 19162 uses ISO 8601:2004 for the dates. Any precision is allowed: the date could have only the year,
+ * or only the year and month, <i>etc</i>. The clock part is optional and also have optional fields: can be
+ * only hours, or only hours and minutes, <i>etc</i>. ISO 19162 said that the timezone is restricted to UTC
+ * but nevertheless allows to specify a timezone.</p>
+ *
* @author Martin Desruisseaux (Geomatys)
* @since 0.6
* @version 0.8
@@ -44,6 +50,11 @@ public final class StandardDateFormat ex
private static final long serialVersionUID = 1552761359761440473L;
/**
+ * The {@value} timezone ID.
+ */
+ public static final String UTC = "UTC";
+
+ /**
* Short version of {@link #PATTERN}, to be used when formatting temporal extents
* if the duration is greater than some threshold (typically one day). This pattern must
* be a prefix of {@link #PATTERN}, since we will use that condition for deciding
@@ -72,9 +83,9 @@ public final class StandardDateFormat ex
public static final String PATTERN = SHORT_PATTERN + "'T'" + TIME_PATTERN;
/**
- * {@code false} if this {@code StandardDateFormat} object is parsing only the days, without time.
+ * {@code true} if the user has invoked {@link #applyPattern(String)} or {@link #applyLocalizedPattern(String)}.
*/
- private boolean hasTime;
+ private boolean isUserSpecifiedPattern;
/**
* Creates a new format for a default locale in the UTC timezone.
@@ -89,23 +100,45 @@ public final class StandardDateFormat ex
* @param locale the locale of the format to create.
*/
public StandardDateFormat(final Locale locale) {
- this(locale, TimeZone.getTimeZone("UTC"));
+ this(locale, TimeZone.getTimeZone(UTC));
}
/**
* Creates a new format for the given locale.
*
- * @param locale the locale of the format to create.
- * @param timezone the timezone.
+ * @param locale the locale of the format to create.
+ * @param zone the timezone.
*/
- public StandardDateFormat(final Locale locale, final TimeZone timezone) {
+ public StandardDateFormat(final Locale locale, final TimeZone zone) {
super(PATTERN, locale);
- super.setTimeZone(timezone);
- hasTime = true;
+ super.setTimeZone(zone);
+ }
+
+ /**
+ * Sets a user-specified pattern.
+ *
+ * @param pattern the user-specified pattern.
+ */
+ @Override
+ public void applyPattern(final String pattern) {
+ super.applyPattern(pattern);
+ isUserSpecifiedPattern = true;
}
/**
- * Formats the given date.
+ * Sets a user-specified pattern.
+ *
+ * @param pattern the user-specified pattern.
+ */
+ @Override
+ public void applyLocalizedPattern(final String pattern) {
+ super.applyLocalizedPattern(pattern);
+ isUserSpecifiedPattern = true;
+ }
+
+ /**
+ * Formats the given date. If hours, minutes, seconds and milliseconds are zero and the timezone is UTC,
+ * then this method omits the clock part (unless the user has overridden the pattern).
*
* @param date the date to format.
* @param buffer where to format the date.
@@ -114,9 +147,13 @@ public final class StandardDateFormat ex
*/
@Override
public StringBuffer format(final Date date, final StringBuffer buffer, final FieldPosition pos) {
- if (!hasTime) {
- applyPattern(PATTERN);
- hasTime = true;
+ if (!isUserSpecifiedPattern && (date.getTime() % (24*60*60*1000)) == 0 && UTC.equals(getTimeZone().getID())) {
+ try {
+ super.applyPattern(SHORT_PATTERN);
+ return super.format(date, buffer, pos);
+ } finally {
+ super.applyPattern(PATTERN);
+ }
}
return super.format(date, buffer, pos);
}
@@ -129,18 +166,18 @@ public final class StandardDateFormat ex
* @return the date, or {@code null} if we failed to parse it.
*/
@Override
- public Date parse(final String text, final ParsePosition position) {
+ public Date parse(String text, final ParsePosition position) {
+ if (isUserSpecifiedPattern) {
+ return super.parse(text, position);
+ }
final Fix fix = Fix.apply(text, position.getIndex(), 0);
if (fix == null) {
- if (hasTime) {
- applyPattern(SHORT_PATTERN);
- hasTime = false;
+ try {
+ super.applyPattern(SHORT_PATTERN);
+ return super.parse(text, position);
+ } finally {
+ super.applyPattern(PATTERN);
}
- return super.parse(text, position);
- }
- if (!hasTime) {
- applyPattern(PATTERN);
- hasTime = true;
}
final Date date = super.parse(fix.text, position);
position.setIndex (fix.adjustIndex(position.getIndex()));
Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/io/CompoundFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/io/CompoundFormat.java?rev=1758394&r1=1758393&r2=1758394&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/io/CompoundFormat.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/io/CompoundFormat.java [UTF-8] Tue Aug 30 14:15:26 2016
@@ -43,6 +43,8 @@ import org.apache.sis.util.ArgumentCheck
import org.apache.sis.util.collection.BackingStoreException;
import org.apache.sis.internal.util.LocalizedParseException;
+import static org.apache.sis.internal.util.StandardDateFormat.UTC;
+
/**
* Base class of {@link Format} implementations which delegate part of their work to other
@@ -169,7 +171,7 @@ public abstract class CompoundFormat<T>
* @return The timezone used for this format, or UTC for unlocalized format.
*/
public TimeZone getTimeZone() {
- return timezone != null ? (TimeZone) timezone.clone() : TimeZone.getTimeZone("UTC");
+ return timezone != null ? (TimeZone) timezone.clone() : TimeZone.getTimeZone(UTC);
}
/**
Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/setup/About.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/setup/About.java?rev=1758394&r1=1758393&r2=1758394&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/setup/About.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/setup/About.java [UTF-8] Tue Aug 30 14:15:26 2016
@@ -60,6 +60,7 @@ import org.apache.sis.internal.system.Da
import static java.lang.System.getProperty;
import static org.apache.sis.util.collection.TableColumn.NAME;
import static org.apache.sis.util.collection.TableColumn.VALUE_AS_TEXT;
+import static org.apache.sis.internal.util.StandardDateFormat.UTC;
// Branch-dependent imports
import java.nio.file.Path;
@@ -266,7 +267,7 @@ fill: for (int i=0; ; i++) {
final boolean inDaylightTime = current.inDaylightTime(now);
value = concatenate(current.getDisplayName(inDaylightTime, TimeZone.LONG, locale), current.getID(), true);
final DateFormat df = DateFormat.getTimeInstance(DateFormat.SHORT, formatLocale);
- df.setTimeZone(TimeZone.getTimeZone("UTC"));
+ df.setTimeZone(TimeZone.getTimeZone(UTC));
int offset = current.getOffset(now.getTime());
StringBuffer buffer = format(df, offset, new StringBuffer("UTC "));
offset -= current.getRawOffset();
Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/logging/MonolineFormatter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/logging/MonolineFormatter.java?rev=1758394&r1=1758393&r2=1758394&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/logging/MonolineFormatter.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/logging/MonolineFormatter.java [UTF-8] Tue Aug 30 14:15:26 2016
@@ -41,6 +41,8 @@ import org.apache.sis.util.CharSequences
import org.apache.sis.util.Configuration;
import org.apache.sis.util.Debug;
+import static org.apache.sis.internal.util.StandardDateFormat.UTC;
+
/**
* A formatter writing log messages on a single line. Compared to the JDK {@link SimpleFormatter},
@@ -423,7 +425,7 @@ loop: for (int i=0; ; i++) {
timeFormat = null;
} else if (timeFormat == null) {
timeFormat = new SimpleDateFormat(pattern);
- timeFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
+ timeFormat.setTimeZone(TimeZone.getTimeZone(UTC));
} else {
timeFormat.applyPattern(pattern);
}
Modified: sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gmd/LanguageCodeTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gmd/LanguageCodeTest.java?rev=1758394&r1=1758393&r2=1758394&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gmd/LanguageCodeTest.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gmd/LanguageCodeTest.java [UTF-8] Tue Aug 30 14:15:26 2016
@@ -37,6 +37,7 @@ import org.junit.Test;
import static org.apache.sis.test.Assert.*;
import static org.apache.sis.test.TestUtilities.getSingleton;
+import static org.apache.sis.internal.util.StandardDateFormat.UTC;
/**
@@ -82,7 +83,7 @@ public final strictfp class LanguageCode
public static void createMarshallerPool() throws JAXBException {
final Map<String,Object> properties = new HashMap<>(4);
assertNull(properties.put(XML.LOCALE, Locale.UK));
- assertNull(properties.put(XML.TIMEZONE, "UTC"));
+ assertNull(properties.put(XML.TIMEZONE, UTC));
pool = new MarshallerPool(JAXBContext.newInstance(MetadataMock.class), properties);
}
Modified: sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/util/StandardDateFormatTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/util/StandardDateFormatTest.java?rev=1758394&r1=1758393&r2=1758394&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/util/StandardDateFormatTest.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/util/StandardDateFormatTest.java [UTF-8] Tue Aug 30 14:15:26 2016
@@ -65,6 +65,7 @@ public final strictfp class StandardDate
public void testParse() throws ParseException {
final long day = 1466985600000L;
final StandardDateFormat f = new StandardDateFormat();
+ assertEquals("millis", day + ((16*60 + 48)*60 )*1000, f.parse("2016-06-27T16:48Z") .getTime());
assertEquals("millis", day + ((16*60 + 48)*60 + 12)*1000, f.parse("2016-06-27T16:48:12Z") .getTime());
assertEquals("millis", day, f.parse("2016-06-27") .getTime());
assertEquals("millis", day + (( 3*60 + 2)*60 + 1)*1000 + 90, f.parse("2016-06-27T03:02:01.09Z").getTime());
Modified: sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/measure/RangeFormatTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/measure/RangeFormatTest.java?rev=1758394&r1=1758393&r2=1758394&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/measure/RangeFormatTest.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/measure/RangeFormatTest.java [UTF-8] Tue Aug 30 14:15:26 2016
@@ -34,6 +34,7 @@ import static org.junit.Assert.*;
import static java.lang.StrictMath.*;
import static java.lang.Double.POSITIVE_INFINITY;
import static java.lang.Double.NEGATIVE_INFINITY;
+import static org.apache.sis.internal.util.StandardDateFormat.UTC;
/**
@@ -306,7 +307,7 @@ public final strictfp class RangeFormatT
*/
@Test
public void testFormatDatesToCharacterIterator() {
- format = new RangeFormat(Locale.FRANCE, TimeZone.getTimeZone("UTC"));
+ format = new RangeFormat(Locale.FRANCE, TimeZone.getTimeZone(UTC));
minPos = new FieldPosition(RangeFormat.Field.MIN_VALUE);
maxPos = new FieldPosition(RangeFormat.Field.MAX_VALUE);
parsePos = new ParsePosition(0);
Modified: sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java?rev=1758394&r1=1758393&r2=1758394&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/test/TestUtilities.java [UTF-8] Tue Aug 30 14:15:26 2016
@@ -38,6 +38,7 @@ import org.apache.sis.util.collection.Tr
import org.apache.sis.internal.util.X364;
import static org.junit.Assert.*;
+import static org.apache.sis.internal.util.StandardDateFormat.UTC;
/**
@@ -69,7 +70,7 @@ public final strictfp class TestUtilitie
private static final DateFormat dateFormat;
static {
dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CANADA);
- dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
+ dateFormat.setTimeZone(TimeZone.getTimeZone(UTC));
dateFormat.setLenient(false);
};