From commits-return-10259-apmail-sis-commits-archive=sis.apache.org@sis.apache.org Fri Jan 26 10:48:36 2018 Return-Path: X-Original-To: apmail-sis-commits-archive@www.apache.org Delivered-To: apmail-sis-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6A4F017DE7 for ; Fri, 26 Jan 2018 10:48:36 +0000 (UTC) Received: (qmail 92704 invoked by uid 500); 26 Jan 2018 10:48:36 -0000 Delivered-To: apmail-sis-commits-archive@sis.apache.org Received: (qmail 92645 invoked by uid 500); 26 Jan 2018 10:48:36 -0000 Mailing-List: contact commits-help@sis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: sis-dev@sis.apache.org Delivered-To: mailing list commits@sis.apache.org Received: (qmail 92629 invoked by uid 99); 26 Jan 2018 10:48:36 -0000 Received: from Unknown (HELO svn01-us-west.apache.org) (209.188.14.144) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Jan 2018 10:48:36 +0000 Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 9C8663A060B for ; Fri, 26 Jan 2018 10:48:33 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1822268 [7/7] - in /sis/trunk: ./ application/sis-console/src/main/java/org/apache/sis/console/ application/sis-javafx/ core/sis-build-helper/ core/sis-build-helper/src/main/java/org/apache/sis/internal/doclet/ core/sis-build-helper/src/ma... Date: Fri, 26 Jan 2018 10:48:29 -0000 To: commits@sis.apache.org From: desruisseaux@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20180126104833.9C8663A060B@svn01-us-west.apache.org> Modified: sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxStreamReader.java URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxStreamReader.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxStreamReader.java [UTF-8] (original) +++ sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxStreamReader.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -43,12 +43,11 @@ import org.apache.sis.util.collection.Ba import org.apache.sis.util.resources.Errors; // Branch-dependent imports -import org.apache.sis.internal.jdk8.Spliterator; -import org.apache.sis.internal.jdk8.Consumer; -import org.apache.sis.internal.jdk8.Predicate; -import org.apache.sis.internal.jdk8.Temporal; -import org.apache.sis.internal.jdk8.Instant; -import java.text.ParseException; +import java.util.Spliterator; +import java.util.function.Consumer; +import java.util.function.Predicate; +import java.time.temporal.Temporal; +import java.time.format.DateTimeParseException; import org.apache.sis.feature.AbstractFeature; @@ -129,11 +128,6 @@ public abstract class StaxStreamReader e private Unmarshaller unmarshaller; /** - * Object to use for parsing dates. Created when first needed. - */ - private transient StandardDateFormat dateFormat; - - /** * Creates a new XML reader for the given data store. * * @param owner the data store for which this reader is created. @@ -384,17 +378,11 @@ public abstract class StaxStreamReader e * * @return the current text element as a date, or {@code null} if empty. * @throws XMLStreamException if a text element can not be returned. - * @throws ParseException if the text can not be parsed as a date. + * @throws DateTimeParseException if the text can not be parsed as a date. */ - protected final Date getElementAsDate() throws XMLStreamException, ParseException { + protected final Date getElementAsDate() throws XMLStreamException { final String text = getElementText(); - if (text != null) { - if (dateFormat == null) { - dateFormat = new StandardDateFormat(); - } - return dateFormat.parse(text); - } - return null; + return (text != null) ? StandardDateFormat.toDate(StandardDateFormat.FORMAT.parse(text)) : null; } /** @@ -403,10 +391,10 @@ public abstract class StaxStreamReader e * * @return the current text element as a temporal object, or {@code null} if empty. * @throws XMLStreamException if a text element can not be returned. - * @throws ParseException if the text can not be parsed as a date. + * @throws DateTimeParseException if the text can not be parsed as a date. */ - protected final Temporal getElementAsTemporal() throws XMLStreamException, ParseException { - return Instant.create(getElementAsDate()); + protected final Temporal getElementAsTemporal() throws XMLStreamException { + return StandardDateFormat.parseBest(getElementText()); } /** Modified: sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxStreamWriter.java URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxStreamWriter.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxStreamWriter.java [UTF-8] (original) +++ sis/trunk/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxStreamWriter.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -32,9 +32,8 @@ import org.apache.sis.util.collection.Ba import org.apache.sis.util.resources.Errors; // Branch-dependent imports -import org.apache.sis.internal.jdk8.UncheckedIOException; -import org.apache.sis.internal.jdk8.Consumer; -import org.apache.sis.internal.jdk8.Instant; +import java.io.UncheckedIOException; +import java.util.function.Consumer; import org.apache.sis.feature.AbstractFeature; @@ -228,7 +227,7 @@ public abstract class StaxStreamWriter e */ protected final void writeSingle(final String localName, final Date value) throws XMLStreamException { if (value != null) { - writeSingleValue(localName, Instant.create(value)); + writeSingleValue(localName, value.toInstant()); } } Modified: sis/trunk/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/ReaderTest.java URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/ReaderTest.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/ReaderTest.java [UTF-8] (original) +++ sis/trunk/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/ReaderTest.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -39,8 +39,8 @@ import static org.apache.sis.test.TestUt import static org.apache.sis.test.TestUtilities.getSingleton; // Branch-dependent imports -import org.apache.sis.internal.jdk8.Stream; -import org.apache.sis.internal.jdk8.Instant; +import java.time.Instant; +import java.util.stream.Stream; import org.apache.sis.feature.AbstractFeature; import org.opengis.util.GenericName; Modified: sis/trunk/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/WriterTest.java URL: http://svn.apache.org/viewvc/sis/trunk/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/WriterTest.java?rev=1822268&r1=1822267&r2=1822268&view=diff ============================================================================== --- sis/trunk/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/WriterTest.java [UTF-8] (original) +++ sis/trunk/storage/sis-xmlstore/src/test/java/org/apache/sis/internal/storage/gpx/WriterTest.java [UTF-8] Fri Jan 26 10:48:27 2018 @@ -38,8 +38,7 @@ import org.junit.Test; import static org.apache.sis.test.Assert.*; // Branch-dependent imports -import org.apache.sis.internal.jdk8.Instant; -import org.apache.sis.internal.jdk8.Stream; +import java.time.Instant; import org.apache.sis.feature.AbstractFeature; @@ -352,7 +351,7 @@ public final strictfp class WriterTest e final Metadata metadata = new Metadata(); metadata.bounds = bounds; metadata.creator = "DataProducer"; - store.write(metadata, Stream.create(features)); + store.write(metadata, features.stream()); } /**