sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1813747 [9/13] - in /sis/branches/JDK9: ./ application/ application/sis-console/ application/sis-console/src/main/artifact/ application/sis-console/src/main/artifact/lib/ application/sis-console/src/main/artifact/lib/darwin/ application/si...
Date Mon, 30 Oct 2017 10:25:10 GMT
Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/collection/IntegerList.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/collection/IntegerList.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/collection/IntegerList.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/collection/IntegerList.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -20,12 +20,21 @@ import java.util.Arrays;
 import java.util.AbstractList;
 import java.util.RandomAccess;
 import java.util.NoSuchElementException;
+import java.util.ConcurrentModificationException;
 import java.io.IOException;
 import java.io.Serializable;
 import java.io.ObjectOutputStream;
 import org.apache.sis.util.ArraysExt;
 import org.apache.sis.util.ArgumentChecks;
 
+// Branch-dependent imports
+import java.util.Spliterator;
+import java.util.PrimitiveIterator;
+import java.util.function.Consumer;
+import java.util.function.IntConsumer;
+import java.util.stream.IntStream;
+import java.util.stream.StreamSupport;
+
 
 /**
  * A list of unsigned integer values. This class packs the values in the minimal amount of bits
@@ -34,7 +43,8 @@ import org.apache.sis.util.ArgumentCheck
  * <p>This class is <strong>not</strong> thread-safe. Synchronizations (if wanted) are user's responsibility.</p>
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.7
+ * @author  Alexis Manin (Geomatys)
+ * @version 0.8
  *
  * @see org.apache.sis.math.Vector
  *
@@ -154,9 +164,12 @@ public class IntegerList extends Abstrac
      * the previous one, then the extra elements are initialized to 0.
      *
      * @param  size  the new size.
+     *
+     * @see #trimToSize()
      */
     public void resize(final int size) {
         ArgumentChecks.ensurePositive("size", size);
+        modCount++;
         if (size > this.size) {
             int base = this.size * bitCount;
             final int offset = base & OFFSET_MASK;
@@ -176,13 +189,14 @@ public class IntegerList extends Abstrac
 
     /**
      * Fills the list with the given value.
-     * Every existing values are overwritten from index 0 inclusive up to {@link #size} exclusive.
+     * Every existing values are overwritten from index 0 inclusive up to {@link #size()} exclusive.
      *
      * @param  value  the value to set.
      */
     @SuppressWarnings("fallthrough")
     public void fill(int value) {
         ArgumentChecks.ensureBetween("value", 0, mask, value);
+        modCount++;
         final long p;
         if (value == 0) {
             p = 0;                              // All bits set to 0.
@@ -210,6 +224,7 @@ public class IntegerList extends Abstrac
      */
     @Override
     public void clear() {
+        modCount++;
         size = 0;
     }
 
@@ -237,6 +252,7 @@ public class IntegerList extends Abstrac
      */
     public void addInt(final int value) throws IllegalArgumentException {
         ArgumentChecks.ensureBetween("value", 0, mask, value);
+        modCount++;
         final int last = size;
         final int length = length(++size);
         if (length > values.length) {
@@ -271,7 +287,8 @@ public class IntegerList extends Abstrac
 
     /**
      * Returns the element at the given index as the {@code int} primitive type.
-     * This argument does not check argument validity, since it is assumed already done.
+     * This argument does not check argument validity, since the verification is
+     * assumed already done.
      *
      * @param  index  the element index.
      * @return the value at the given index.
@@ -318,12 +335,14 @@ public class IntegerList extends Abstrac
     public void setInt(int index, int value) throws IndexOutOfBoundsException {
         ArgumentChecks.ensureValidIndex(size, index);
         ArgumentChecks.ensureBetween("value", 0, mask, value);
+        modCount++;
         setUnchecked(index, value);
     }
 
     /**
      * Sets the element at the given index as the {@code int} primitive type.
-     * This argument does not check argument validity, since it is assumed already done.
+     * This argument does not check argument validity, since the verification
+     * is assumed already done.
      *
      * @param  index  the element index.
      * @param  value  the value at the given index.
@@ -352,6 +371,7 @@ public class IntegerList extends Abstrac
     @Override
     public Integer remove(final int index) throws IndexOutOfBoundsException {
         final Integer old = get(index);
+        modCount++;
         removeRange(index, index+1);
         return old;
     }
@@ -364,6 +384,7 @@ public class IntegerList extends Abstrac
      */
     public int removeLast() throws NoSuchElementException {
         if (size != 0) {
+            modCount++;
             return getUnchecked(--size);
         }
         throw new NoSuchElementException();
@@ -423,7 +444,233 @@ public class IntegerList extends Abstrac
     }
 
     /**
+     * Returns an iterator over the elements in this list in increasing index order.
+     * The iterator is <cite>fail-fast</cite> and supports the remove operation.
+     *
+     * @return iterator over the integer values in this list.
+     *
+     * @since 0.8-jdk8
+     */
+    @Override
+    public PrimitiveIterator.OfInt iterator() {
+        return new PrimitiveSpliterator();
+    }
+
+    /**
+     * Returns an spliterator over the elements in this list in increasing index order.
+     * The iterator is <cite>fail-fast</cite>.
+     *
+     * @return spliterator over the integer values in this list.
+     *
+     * @since 0.8-jdk8
+     */
+    @Override
+    public Spliterator.OfInt spliterator() {
+        return new PrimitiveSpliterator();
+    }
+
+    /**
+     * Returns a stream of integers with this {@code IntegerList} as its source.
+     * This method is similar to {@link #stream()}, but does not box the values.
+     * The returned stream is <cite>fail-fast</cite>, meaning that any modification to the list
+     * while using the stream will cause a {@link ConcurrentModificationException} to be thrown.
+     *
+     * <p>The default implementation creates a parallel or sequential stream from {@link #spliterator()}.</p>
+     *
+     * @param parallel  {@code true} for a parallel stream, or {@code false} for a sequential stream.
+     * @return a stream of values in this list as primitive types.
+     *
+     * @since 0.8-jdk8
+     */
+    public IntStream stream(boolean parallel) {
+        return StreamSupport.intStream(spliterator(), parallel);
+    }
+
+    /**
+     * Same as {@link #spliterator()}, but without value boxing.
+     * This spliterator provides a fail-fast way to traverse list content, which means
+     * that any alteration to the list content causes a failure of the advance operation
+     * with a {@link ConcurrentModificationException}.
+     *
+     * <p>This implementation opportunistically provides an iterator implementation on
+     * integer values too, but only one of the {@code Iterator} or {@code Spliterator}
+     * API should be used on a given instance.</p>
+     */
+    private final class PrimitiveSpliterator implements Spliterator.OfInt, PrimitiveIterator.OfInt {
+        /**
+         * Index after the last element returned by this spliterator. This is initially {@link IntegerList#size},
+         * but may be set to a smaller value by call to {@link #trySplit()}.
+         */
+        private int stopAt;
+
+        /**
+         * Index of the next element to be returned.
+         */
+        private int nextIndex;
+
+        /**
+         * The {@link IntegerList#modCount} value as iterator construction time.
+         * Used for detecting modification in the backing list during traversal.
+         */
+        private int expectedModCount;
+
+        /**
+         * Index of the last elements removed by a {@link #remove()} operation.
+         * This is used for checking that {@code remove()} is not invoked twice
+         * before the next advance.
+         */
+        private int lastRemove;
+
+        /**
+         * Creates a new iterator for the whole content of the backing list.
+         */
+        PrimitiveSpliterator() {
+            expectedModCount = modCount;
+            stopAt           = size;
+        }
+
+        /**
+         * Creates the prefix spliterator in a call to {@link #trySplit()}.
+         *
+         * @param  suffix   the spliterator which will continue iteration after this spliterator.
+         * @param  startAt  index of the first element to be returned by this prefix spliterator.
+         */
+        private PrimitiveSpliterator(final PrimitiveSpliterator suffix, final int startAt) {
+            expectedModCount = suffix.expectedModCount;
+            stopAt           = suffix.nextIndex;
+            nextIndex        = startAt;
+        }
+
+        /**
+         * Declares that this split iterator does not return null elements, that all elements are
+         * traversed in a fixed order (which is increasing index values) and that {@link #size()}
+         * represents an exact count of elements.
+         */
+        @Override
+        public int characteristics() {
+            return NONNULL | ORDERED | SIZED | SUBSIZED;
+        }
+
+        /**
+         * Returns the exact number of values to be encountered by a {@code forEachRemaining(…)} traversal.
+         */
+        @Override
+        public long estimateSize() {
+            return stopAt - nextIndex;
+        }
+
+        /**
+         * @todo for now, we keep it simple and forbid parallelism. In the future,
+         *       we could use an approach as the one in java standard array lists.
+         */
+        @Override
+        public Spliterator.OfInt trySplit() {
+            final int startAt = nextIndex;
+            final int halfSize = (stopAt - startAt) >>> 1;
+            if (halfSize > 1) {
+                nextIndex += halfSize;
+                return new PrimitiveSpliterator(this, startAt);
+            }
+            return null;
+        }
+
+        /**
+         * Returns {@code true} if there is one more value to return. This method
+         * also ensures that no alteration has happened on the backing list since
+         * the spliterator creation.
+         */
+        @Override
+        public boolean hasNext() {
+            if (modCount == expectedModCount) {
+                return nextIndex < stopAt;
+            } else {
+                throw new ConcurrentModificationException();
+            }
+        }
+
+        /**
+         * Returns the next integer values in iterator order.
+         */
+        @Override
+        public int nextInt() {
+            if (hasNext()) {
+                return getUnchecked(nextIndex++);
+            } else {
+                throw new NoSuchElementException();
+            }
+        }
+
+        /**
+         * If a remaining element exists, performs the given action on it and returns {@code true}.
+         * Otherwise returns {@code false}.
+         */
+        @Override
+        public boolean tryAdvance(IntConsumer action) {
+            final boolean canAdvance = hasNext();
+            if (canAdvance) {
+                action.accept(getUnchecked(nextIndex++));
+            }
+            return canAdvance;
+        }
+
+        /**
+         * Performs the given action on all remaining elements. This implementation
+         * is shared by both {@code Iterator} and {@code Spliterator} interfaces.
+         */
+        @Override
+        public void forEachRemaining(final IntConsumer action) {
+            while (hasNext()) {
+                action.accept(getUnchecked(nextIndex++));
+            }
+        }
+
+        /**
+         * Performs the given action on all remaining elements. This implementation
+         * is shared by both {@code Iterator} and {@code Spliterator} interfaces.
+         */
+        @Override
+        public void forEachRemaining(final Consumer<? super Integer> action) {
+            if (action instanceof IntConsumer) {
+                forEachRemaining((IntConsumer) action);
+            } else while (hasNext()) {
+                action.accept(getUnchecked(nextIndex++));
+            }
+        }
+
+        /**
+         * Removes the last element returned by {@link #nextInt()}.
+         */
+        @Override
+        public void remove() {
+            if (nextIndex < lastRemove || nextIndex > stopAt) {
+                throw new IllegalStateException();
+            }
+            if (modCount != expectedModCount) {
+                throw new ConcurrentModificationException();
+            }
+            expectedModCount = ++modCount;
+            removeRange(nextIndex - 1, nextIndex);
+            lastRemove = --nextIndex;
+            stopAt--;
+        }
+    }
+
+    /**
+     * Invokes {@link #trimToSize()} before serialization in order to make the stream more compact.
+     *
+     * @param  out  the output stream where to serialize this list.
+     * @throws IOException if an I/O error occurred while writing.
+     */
+    private void writeObject(final ObjectOutputStream out) throws IOException {
+        trimToSize();
+        out.defaultWriteObject();
+    }
+
+    /**
      * Trims the capacity of this list to be its current size.
+     *
+     * @see #size()
+     * @see #resize(int)
      */
     public void trimToSize() {
         values = ArraysExt.resize(values, length(size));
@@ -442,18 +689,8 @@ public class IntegerList extends Abstrac
         } catch (CloneNotSupportedException e) {
             throw new AssertionError(e);
         }
-        clone.values = clone.values.clone();
+        clone.values = Arrays.copyOf(values, length(size));
+        clone.modCount = 0;
         return clone;
     }
-
-    /**
-     * Invokes {@link #trimToSize()} before serialization in order to make the stream more compact.
-     *
-     * @param  out  the output stream where to serialize this list.
-     * @throws IOException if an I/O error occurred while writing.
-     */
-    private void writeObject(final ObjectOutputStream out) throws IOException {
-        trimToSize();
-        out.defaultWriteObject();
-    }
 }

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/collection/RangeSet.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/collection/RangeSet.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/collection/RangeSet.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/collection/RangeSet.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -1133,10 +1133,8 @@ public class RangeSet<E extends Comparab
             if (object instanceof Range<?>) {
                 @SuppressWarnings("unchecked")              // Type will actally be checked on the line after.
                 final Range<E> range = (Range<E>) object;
-                if (range.getElementType() == elementType) {
-                    if (!subRange.contains(range)) {
-                        return false;
-                    }
+                if (range.getElementType() == elementType && !subRange.contains(range)) {
+                    return false;
                 }
             }
             return RangeSet.this.contains(object);

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -91,10 +91,25 @@ public class DefaultLocalName extends Ab
      * The name, either as a {@link String} or an {@link InternationalString}.
      *
      * <div class="section">Note on JAXB annotation</div>
-     * The {@link XmlElement} annotation applied here is appropriate for subclasses only ({@link DefaultTypeName}
-     * and {@link DefaultMemberName}). It is <strong>not</strong> appropriate when (un)marshalling directly this
-     * {@code DefaultLocalName} class. In this later case, we will rather rely on the {@link String} conversion
-     * performed by {@link org.apache.sis.internal.jaxb.gco.GO_GenericName}.
+     * The {@link XmlElement} annotation applied here is appropriate for {@code TypeName} and {@code MemberName}
+     * subtypes only. It is <strong>not</strong> appropriate when (un)marshalling directly a {@code LocalName}.
+     * The distinction between the two cases is done by {@link org.apache.sis.internal.jaxb.gco.GO_LocalName},
+     * which replace the {@code LocalName} instance by an internal {@code NameValue} object (so the XML element
+     * declared here is never marshalled). Example:
+     *
+     * {@preformat xml
+     *   <gco:LocalName codeSpace=\"A code space\">A name in a scope</gco:LocalName>
+     * }
+     *
+     * versus
+     *
+     * {@preformat xml
+     *   <gco:TypeName>
+     *     <gco:aName>
+     *       <gco:CharacterString>An other local name</gco:CharacterString>
+     *     </gco:aName>
+     *   </gco:TypeName>
+     * }
      */
     @XmlJavaTypeAdapter(CharSequenceAdapter.class)
     @XmlElement(name = "aName", namespace = Namespaces.GCO)

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/TypeNames.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/TypeNames.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/TypeNames.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/TypeNames.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -67,7 +67,7 @@ final class TypeNames {
         m.put("Real",            Double.class);
         m.put("Decimal",         Double.class);
         m.put("Integer",         Integer.class);
-    };
+    }
 
     /**
      * The "OGC" namespace.

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/package-info.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/package-info.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/package-info.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -128,4 +128,4 @@ import javax.xml.bind.annotation.XmlAcce
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters;
 import org.apache.sis.xml.Namespaces;
-import org.apache.sis.internal.jaxb.gco.*;
+import org.apache.sis.internal.jaxb.gco.GO_GenericName;

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -360,7 +360,7 @@ public final class Logging extends Stati
         }
         /*
          * Now prepare the log message. If we have been unable to figure out a source class and
-         * method name, we will fallback on JDK logging default mechanism, which may returns a
+         * method name, we will fallback on JDK logging default mechanism, which may return a
          * less relevant name than our attempt to use the logger name as the package name.
          *
          * The message is fetched using Exception.getMessage() instead than getLocalizedMessage()

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/logging/QuietLogRecord.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/logging/QuietLogRecord.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/logging/QuietLogRecord.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/logging/QuietLogRecord.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -24,7 +24,7 @@ import java.util.logging.LogRecord;
  * A log record to be logged without stack trace, unless the user specified it explicitely.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.3
+ * @version 0.8
  * @since   0.3
  * @module
  */
@@ -43,8 +43,8 @@ final class QuietLogRecord extends LogRe
     /**
      * Creates a new log record for the given message and exception.
      */
-    QuietLogRecord(final String message, final Exception exception) {
-        super(Level.WARNING, message);
+    QuietLogRecord(final Level level, final String message, final Exception exception) {
+        super(level, message);
         super.setThrown(exception);
     }
 

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -120,6 +120,18 @@ public class WarningListeners<S> impleme
     }
 
     /**
+     * Returns the source declared source of warnings.
+     * This value is specified at construction time.
+     *
+     * @return the declared source of warnings.
+     *
+     * @since 0.8
+     */
+    public S getSource() {
+        return source;
+    }
+
+    /**
      * The locale to use for formatting warning messages, or {@code null} for the default locale.
      * If the {@code source} object given to the constructor implements the {@link Localized} interface,
      * then this method delegates to its {@code getLocale()} method. Otherwise this method returns {@code null}.
@@ -191,6 +203,24 @@ public class WarningListeners<S> impleme
      * Reports a warning represented by the given message and exception.
      * At least one of {@code message} and {@code exception} shall be non-null.
      * If both are non-null, then the exception message will be concatenated after the given message.
+     * If the exception is non-null, its stack trace will be omitted at logging time for avoiding to
+     * pollute console output (keeping in mind that this method should be invoked only for non-fatal
+     * warnings). See {@linkplain #warning(Level, String, Exception) below} for more explanation.
+     *
+     * <p>This method is a shortcut for <code>{@linkplain #warning(Level, String, Exception)
+     * warning}({@linkplain Level#WARNING}, message, exception)</code>.
+     *
+     * @param message    the message to log, or {@code null} if none.
+     * @param exception  the exception to log, or {@code null} if none.
+     */
+    public void warning(String message, Exception exception) {
+        warning(Level.WARNING, message, exception);
+    }
+
+    /**
+     * Reports a warning at the given level represented by the given message and exception.
+     * At least one of {@code message} and {@code exception} shall be non-null.
+     * If both are non-null, then the exception message will be concatenated after the given message.
      *
      * <div class="section">Stack trace omission</div>
      * If there is no registered listener, then the {@link #warning(LogRecord)} method will send the record to the
@@ -204,10 +234,12 @@ public class WarningListeners<S> impleme
      *   <li>register a listener which will log the record itself.</li>
      * </ul>
      *
+     * @param level      the warning level.
      * @param message    the message to log, or {@code null} if none.
      * @param exception  the exception to log, or {@code null} if none.
      */
-    public void warning(String message, final Exception exception) {
+    public void warning(final Level level, String message, final Exception exception) {
+        ArgumentChecks.ensureNonNull("level", level);
         final LogRecord record;
         final StackTraceElement[] trace;
         if (exception != null) {
@@ -216,11 +248,11 @@ public class WarningListeners<S> impleme
             if (message == null) {
                 message = exception.toString();
             }
-            record = new QuietLogRecord(message, exception);
+            record = new QuietLogRecord(level, message, exception);
         } else {
             ArgumentChecks.ensureNonEmpty("message", message);
             trace = Thread.currentThread().getStackTrace();
-            record = new LogRecord(Level.WARNING, message);
+            record = new LogRecord(level, message);
         }
         for (final StackTraceElement e : trace) {
             if (isPublic(e)) {

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/xml/NilReason.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/xml/NilReason.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/xml/NilReason.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/xml/NilReason.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -253,7 +253,7 @@ public final class NilReason implements
                 }
                 String result = buffer.toString();
                 if (result.equals(reason)) {
-                    result = reason; // Use the existing instance.
+                    result = reason;                            // Use the existing instance.
                 }
                 return POOL.unique(new NilReason(result));
             }
@@ -422,7 +422,7 @@ public final class NilReason implements
                 PrimitiveTypeProperties.associate(object, this);
             }
             if (nilObjects.put(type, object) != null) {
-                throw new AssertionError(type); // Should never happen.
+                throw new AssertionError(type);                                 // Should never happen.
             }
         }
         return type.cast(object);

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -399,11 +399,9 @@ abstract class Pooled {
         if (internal) {
             name = Implementation.toInternal(name);
         }
-        if (!initialProperties.containsKey(name)) {
-            if (initialProperties.put(name, getStandardProperty(name)) != null) {
-                // Should never happen, unless on concurrent changes in a backgroung thread.
-                throw new ConcurrentModificationException(name);
-            }
+        if (!initialProperties.containsKey(name) && initialProperties.put(name, getStandardProperty(name)) != null) {
+            // Should never happen, unless on concurrent changes in a backgroung thread.
+            throw new ConcurrentModificationException(name);
         }
         setStandardProperty(name, value);
     }

Modified: sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/converter/PathConverterTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/converter/PathConverterTest.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/converter/PathConverterTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/converter/PathConverterTest.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -30,7 +30,7 @@ import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
-import static org.junit.Assume.*;
+import static org.junit.Assume.assumeTrue;
 import static org.apache.sis.test.Assert.*;
 
 
@@ -49,7 +49,7 @@ public final strictfp class PathConverte
      * Windows platform has driver letters instead, like "C:\\",
      * which are not correctly tested by this class.
      */
-    static void assumeUnixRoot() {
+    private static void assumeUnixRoot() {
         assumeTrue(ArraysExt.contains(File.listRoots(), new File("/")));
     }
 

Modified: sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/util/CitationsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/util/CitationsTest.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/util/CitationsTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/util/CitationsTest.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -23,8 +23,6 @@ import org.opengis.metadata.Identifier;
 import org.opengis.metadata.citation.Citation;
 import org.apache.sis.internal.simple.SimpleCitation;
 import org.apache.sis.internal.simple.SimpleIdentifier;
-import org.apache.sis.xml.IdentifierSpace;
-import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
@@ -114,40 +112,4 @@ public final strictfp class CitationsTes
         assertEquals("OGC:06-042", Citations.getIdentifier(citation, false));
         assertEquals("ISO_19128",  Citations.getIdentifier(citation, true));
     }
-
-    /**
-     * Tests {@link Citations#getCodeSpace(Citation)} with some ignorable characters.
-     * Ignorable character used in this test are:
-     *
-     * <ul>
-     *   <li>200B: zero width space</li>
-     *   <li>2060: word joiner</li>
-     * </ul>
-     */
-    @Test
-    @DependsOnMethod("testGetIdentifier")
-    public void testGetCodeSpace() {
-        final SimpleCitation citation = new SimpleCitation(" Valid\u2060Id\u200Bentifier ");
-        assertEquals("ValidIdentifier", Citations.getCodeSpace(citation));
-
-        assertNull("Shall not be taken as a valid identifier.",
-                Citations.getCodeSpace(new SimpleCitation("Proj.4")));
-        assertEquals("Shall fallback on the the identifier space name.",
-                "TheProj4Space", Citations.getCodeSpace(new Proj4()));
-    }
-
-    /**
-     * A citation which is also an {@link IdentifierSpace}, for {@link #testGetCodeSpace()} purpose.
-     */
-     @SuppressWarnings("serial")
-     private static final class Proj4 extends SimpleCitation implements IdentifierSpace<Integer> {
-        Proj4() {
-            super("Proj.4");
-        }
-
-        @Override
-        public String getName() {
-            return "TheProj4Space";         // Intentionally a very different name than "Proj4".
-        }
-    }
 }

Modified: sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/util/DefinitionURITest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/util/DefinitionURITest.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/util/DefinitionURITest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/util/DefinitionURITest.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -27,7 +27,7 @@ import static org.junit.Assert.*;
  * Tests {@link DefinitionURI}.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.7
+ * @version 0.8
  * @since   0.4
  * @module
  */
@@ -143,6 +143,51 @@ public final strictfp class DefinitionUR
     }
 
     /**
+     * Tests comma-separated URNs in the {@code "urn:ogc:def"} namespace.
+     * Example: {@code "urn:ogc:def:crs,crs:EPSG:6.3:27700,crs:EPSG:6.3:5701"}.
+     */
+    @Test
+    @DependsOnMethod("testParse")
+    public void testCompoundURN() {
+        DefinitionURI parsed = DefinitionURI.parse("urn:ogc:def:crs, crs :EPSG:9.1:27700, crs:EPSG: 9.1 :5701");
+        assertNotNull("components",                    parsed.components);
+        assertEquals("components.length", 2,           parsed.components.length);
+        assertEquals("urn:ogc:def:crs:EPSG:9.1:27700", parsed.components[0].toString());
+        assertEquals("urn:ogc:def:crs:EPSG:9.1:5701",  parsed.components[1].toString());
+        assertEquals("urn:ogc:def:crs,crs:EPSG:9.1:27700,crs:EPSG:9.1:5701", parsed.toString());
+        /*
+         * The following URN is malformed, but Apache SIS should be tolerant to some errors.
+         *
+         *   - the "urn:ogc:def" prefix should be omitted in components, but SIS should be able to skip them.
+         *   - the "ogc:crs" parts should not be accepted because "def" is missing between "ogc" and "crs".
+         */
+        parsed = DefinitionURI.parse("urn:ogc:def:crs,urn:ogc:def:crs:EPSG:9.1:27700,ogc:crs:EPSG:9.1:5701,def:crs:OGC::AnsiDate");
+        assertNotNull("components",                    parsed.components);
+        assertEquals("components.length", 3,           parsed.components.length);
+        assertEquals("urn:ogc:def:crs:EPSG:9.1:27700", parsed.components[0].toString());
+        assertNull  ("urn:ogc:def:crs:EPSG:9.1:5701",  parsed.components[1]);
+        assertEquals("urn:ogc:def:crs:OGC::AnsiDate",  parsed.components[2].toString());
+    }
+
+    /**
+     * Tests compound CRS in HTTP URL.
+     */
+    @Test
+    @DependsOnMethod("testParseHTTP")
+    public void testCompoundHTTP() {
+        DefinitionURI parsed = DefinitionURI.parse("http://www.opengis.net/def/crs-compound?"
+                + "1=http://www.opengis.net/def/crs/EPSG/9.1/27700&"
+                + "2=http://www.opengis.net/def/crs/EPSG/9.1/5701");
+        assertEquals("type", "crs-compound", parsed.type);
+        assertEquals("components.length", 2, parsed.components.length);
+        assertEquals("http://www.opengis.net/def/crs/EPSG/9.1/27700", parsed.components[0].toString());
+        assertEquals("http://www.opengis.net/def/crs/EPSG/9.1/5701",  parsed.components[1].toString());
+        assertEquals("http://www.opengis.net/def/crs-compound?"
+                 + "1=http://www.opengis.net/def/crs/EPSG/9.1/27700&"
+                 + "2=http://www.opengis.net/def/crs/EPSG/9.1/5701", parsed.toString());
+    }
+
+    /**
      * Tests {@link DefinitionURI#codeOf(String, String, String)} with URI like {@code "EPSG:4326"}.
      */
     @Test
@@ -187,13 +232,4 @@ public final strictfp class DefinitionUR
         assertNull  (        DefinitionURI.codeOf("uom", "EPSG", "http://www.opengis.net/gml/srs/epsg.xml#4326"));
         assertNull  (        DefinitionURI.codeOf("uom", "EPSG", "http://schemas.opengis.net/iso/19139/20070417/resources/uom/gmxUom.xml#xpointer(//*[@gml:id='m'])"));
     }
-
-    /**
-     * Tests {@link DefinitionURI#format(String, String, String, String)}.
-     */
-    @Test
-    public void testToURN() {
-        assertEquals("urn:ogc:def:crs:EPSG::4326", DefinitionURI.format("crs", "EPSG", null, "4326"));
-        assertNull  ("Authority is not optional.", DefinitionURI.format("crs", null,   null, "4326"));
-    }
 }

Modified: sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/measure/RangeTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/measure/RangeTest.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/measure/RangeTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/measure/RangeTest.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -20,7 +20,7 @@ import java.util.Locale;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
-import static org.junit.Assume.*;
+import static org.junit.Assume.assumeTrue;
 import static org.apache.sis.test.Assert.*;
 
 

Modified: sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -276,7 +276,7 @@ public final strictfp class UnitsTest ex
 
     /**
      * Tests {@link Units#valueOf(String)} with more advanced units.
-     * Those units are found in NetCDF files among others.
+     * Those units are found in netCDF files among others.
      */
     @Test
     public void testAdvancedValueOf() {

Modified: sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -19,10 +19,13 @@ package org.apache.sis.test;
 import java.util.Set;
 import java.util.Map;
 import java.util.Objects;
+import java.util.Iterator;
 import java.util.Collection;
 import java.util.Enumeration;
 import java.util.LinkedHashSet;
 import java.util.LinkedHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ConcurrentHashMap;
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
@@ -37,12 +40,17 @@ import org.apache.sis.util.ComparisonMod
 import org.apache.sis.util.Exceptions;
 import org.apache.sis.util.Classes;
 
+// Branch-dependent imports
+import java.util.stream.Stream;
+import java.util.function.Consumer;
+
 
 /**
  * Assertion methods used by the SIS project in addition of the JUnit and GeoAPI assertions.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.7
+ * @author  Alexis Manin (Geomatys)
+ * @version 0.8
  * @since   0.3
  * @module
  */
@@ -169,6 +177,77 @@ public strictfp class Assert extends org
         }
     }
 
+    /**
+     * Verifies that the given stream produces the same values than the given iterator, in same order.
+     * This method assumes that the given stream is sequential.
+     *
+     * @param  <E>       the type of values to test.
+     * @param  expected  the expected values.
+     * @param  actual    the stream to compare with the expected values.
+     *
+     * @since 0.8
+     */
+    public static <E> void assertSequentialStreamEquals(final Iterator<E> expected, final Stream<E> actual) {
+        actual.forEach(new Consumer<E>() {
+            private int count;
+
+            @Override
+            public void accept(final Object value) {
+                if (!expected.hasNext()) {
+                    fail("Expected " + count + " elements, but the stream contains more.");
+                }
+                final Object ex = expected.next();
+                if (!Objects.equals(ex, value)) {
+                    fail("Expected " + ex + " at index " + count + " but got " + value);
+                }
+                count++;
+            }
+        });
+        assertFalse("Unexpected end of stream.", expected.hasNext());
+    }
+
+    /**
+     * Verifies that the given stream produces the same values than the given iterator, in any order.
+     * This method is designed for use with parallel streams, but works with sequential streams too.
+     *
+     * @param  <E>       the type of values to test.
+     * @param  expected  the expected values.
+     * @param  actual    the stream to compare with the expected values.
+     *
+     * @since 0.8
+     */
+    public static <E> void assertParallelStreamEquals(final Iterator<E> expected, final Stream<E> actual) {
+        final Integer ONE = 1;          // For doing autoboxing only once.
+        final ConcurrentMap<E,Integer> count = new ConcurrentHashMap<>();
+        while (expected.hasNext()) {
+            count.merge(expected.next(), ONE, (old, one) -> old + 1);
+        }
+        /*
+         * Following may be parallelized in an arbitrary amount of threads.
+         */
+        actual.forEach((value) -> {
+            if (count.computeIfPresent(value, (key, old) -> old - 1) == null) {
+                fail("Stream returned unexpected value: " + value);
+            }
+        });
+        /*
+         * Back to sequential order, verify that all elements have been traversed
+         * by the stream and no more.
+         */
+        for (final Map.Entry<E,Integer> entry : count.entrySet()) {
+            int n = entry.getValue();
+            if (n != 0) {
+                final String message;
+                if (n < 0) {
+                    message = "Stream returned too many occurrences of %s%n%d extraneous were found.";
+                } else {
+                    message = "Stream did not returned all expected occurrences of %s%n%d are missing.";
+                }
+                fail(String.format(message, entry.getKey(), StrictMath.abs(n)));
+            }
+        }
+    }
+
     /**
      * Asserts that the given set contains the same elements, ignoring order.
      * In case of failure, this method lists the missing or unexpected elements.

Modified: sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/test/Assume.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/test/Assume.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/test/Assume.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/test/Assume.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -16,11 +16,9 @@
  */
 package org.apache.sis.test;
 
-import org.apache.sis.internal.system.DataDirectory;
-
-// Branch-specific imports
 import java.nio.file.Path;
 import java.nio.file.Files;
+import org.apache.sis.internal.system.DataDirectory;
 
 
 /**
@@ -52,11 +50,12 @@ public final strictfp class Assume exten
      * @return the path to the given file.
      */
     public static Path assumeDataExists(final DataDirectory type, final String file) {
-        assumeNotNull(System.getenv(DataDirectory.ENV));
+        assumeNotNull("$SIS_DATA environment variable not set.", System.getenv(DataDirectory.ENV));
         Path path = type.getDirectory();
-        assumeNotNull(path);
+        assumeNotNull("$SIS_DATA/" + type + " directory not found.", path);
         path = path.resolve(file);
-        assumeTrue(Files.isReadable(path));
+        assumeTrue("Specified directory not found.", Files.isDirectory(path));
+        assumeTrue("Specified directory not readable.", Files.isReadable(path));
         return path;
     }
 }

Modified: sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -83,7 +83,6 @@ import org.junit.BeforeClass;
     org.apache.sis.util.collection.CodeListSetTest.class,
     org.apache.sis.internal.util.CollectionsExtTest.class,
     org.apache.sis.internal.util.AbstractMapTest.class,
-    org.apache.sis.internal.util.LazySetTest.class,
 
     // GeoAPI most basic types.
     org.apache.sis.internal.util.DefinitionURITest.class,

Modified: sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/util/collection/IntegerListTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/util/collection/IntegerListTest.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/util/collection/IntegerListTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/util/collection/IntegerListTest.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -21,7 +21,9 @@ import java.util.ArrayList;
 import java.util.Set;
 import java.util.HashSet;
 import java.util.Collections;
+import java.util.Iterator;
 import java.util.Random;
+import java.util.ConcurrentModificationException;
 import org.apache.sis.test.TestCase;
 import org.apache.sis.test.TestUtilities;
 import org.junit.Test;
@@ -29,66 +31,105 @@ import org.junit.Test;
 import static java.lang.StrictMath.*;
 import static org.apache.sis.test.Assert.*;
 
+// Branch-dependent imports
+import java.util.function.IntConsumer;
+import java.util.PrimitiveIterator;
+import java.util.stream.IntStream;
+
 
 /**
  * Tests {@link IntegerList} implementations.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.7
+ * @author  Alexis Manin (Geomatys)
+ * @version 0.8
  * @since   0.7
  * @module
  */
 public final strictfp class IntegerListTest extends TestCase {
     /**
-     * The list of integers.
+     * The list of integers being tested.
      */
     private IntegerList list;
 
     /**
      * Writes values and read them again for making sure they are the expected ones.
+     * This method tests also split iterators.
      *
      * @param maximalValue  the maximal value allowed.
      */
     private void testReadWrite(final int maximalValue) {
         final Random random = TestUtilities.createRandomNumberGenerator();
-        final int length = 400;
-        // Use half the lenght as initial capacity in order to test dynamic resizing.
+        final int length = 350 + random.nextInt(101);
+        /*
+         * Use half the lenght as initial capacity in order to test dynamic resizing.
+         * Dynamic resizing should happen in one of the call to list.add(value) after
+         * about 200 values.
+         */
         list = new IntegerList(length / 2, maximalValue);
-        assertTrue(list.maximalValue() >= maximalValue);
+        assertTrue("maximalValue()", list.maximalValue() >= maximalValue);
         final List<Integer> copy = new ArrayList<>(length);
         for (int i=0; i<length; i++) {
-            assertEquals(i, list.size());
+            assertEquals("size()", i, list.size());
             final Integer value = nextInt(random, maximalValue);
-            assertTrue(copy.add(value));
-            assertTrue(list.add(value));
+            assertTrue("add(Integer)", copy.add(value));
+            assertTrue("add(Integer)", list.add(value));
         }
-        assertEquals(copy, list);
-        assertEquals(copy.hashCode(), list.hashCode());
+        assertEquals("Comparison with reference implementation", copy, list);
+        assertEquals("hashCode()", copy.hashCode(), list.hashCode());
         /*
-         * Overwrite 1/10 of the values.
+         * Overwrite about 1/10 of the values in both the tested IntegerList and the
+         * reference ArrayList. Then compare the IntegerList against the reference.
          */
-        for (int i=0; i<length; i+=10) {
+        for (int i=0; i<length; i += 8 + random.nextInt(5)) {
             final Integer value = nextInt(random, maximalValue);
             final Integer old = copy.set(i, value);
-            assertNotNull(old);
-            assertEquals(old, list.set(i, value));
+            assertNotNull("set(Integer)", old);
+            assertEquals ("set(Integer)", old, list.set(i, value));
         }
         for (int i=0; i<length; i++) {
-            assertEquals(String.valueOf(i), copy.get(i), list.get(i));
+            if (!copy.get(i).equals(list.get(i))) {
+                fail("Mismatched value at index " + i);
+            }
         }
-        assertEquals(copy, list);
-        assertEquals(copy.hashCode(), list.hashCode());
-        assertNotSame(list, assertSerializedEquals(list));
-        /*
-         * Tests cloning and removal of values.
-         */
-        final List<Integer> clone = list.clone();
-        assertEquals(copy, clone);
-        assertEquals(copy.remove(100), clone.remove(100));
-        assertEquals(copy, clone);
+        assertEquals("Comparison with reference implementation", copy, list);
+        assertEquals("hashCode()", copy.hashCode(), list.hashCode());
+        /*
+         * Test the stream, using the ArrayList as a reference implementation. This will indirectly
+         * use the PrimitiveSpliterator.forEachRemaining(Consumer<? super Integer>) method. A more
+         * specific test using forEachRemaining(IntConsumer) is done by the testInts() method.
+         */
+        assertSequentialStreamEquals(copy.iterator(), list.stream());
+        /*
+         * Tests cloning and removal of values in a range of indices. The IntegerList.removeRange(…)
+         * method is invoked indirectly by subList(…).clear(). Again, we use ArrayList as a reference.
+         */
+        final IntegerList clone = list.clone();
+        assertEquals("clone()", copy, clone);
+        assertEquals("remove(int)", copy.remove(100), clone.remove(100));
+        assertEquals("remove(int)", copy, clone);
         copy .subList(128, 256).clear();
         clone.subList(128, 256).clear();
-        assertEquals(copy, clone);
+        assertEquals("After removeRange(…)", copy, clone);
+        /*
+         * Tests iterator on primitive integers, with random removal of some elements during traversal.
+         */
+        final PrimitiveIterator.OfInt it = clone.iterator();
+        final Iterator<Integer> itRef = copy.iterator();
+        while (itRef.hasNext()) {
+            assertTrue("hasNext()", it.hasNext());
+            assertEquals(itRef.next().intValue(), it.nextInt());
+            if (random.nextInt(10) == 0) {
+                itRef.remove();
+                it.remove();
+            }
+        }
+        assertFalse("hasNext()", it.hasNext());
+        assertEquals("After remove()", copy, clone);
+        /*
+         * Verify that serialization and deserialization gives a new list with identical content.
+         */
+        assertNotSame("Serialization", list, assertSerializedEquals(list));
     }
 
     /**
@@ -107,15 +148,14 @@ public final strictfp class IntegerListT
      * already filled with random values prior this method call.
      */
     private void testFill(final int value) {
-        assertEquals(400, list.size());
         final Set<Integer> set = new HashSet<>();
         list.fill(value);
         set.addAll(list);
-        assertEquals(Collections.singleton(value), set);
+        assertEquals("fill(value)", Collections.singleton(value), set);
         list.fill(0);
         set.clear();
         set.addAll(list);
-        assertEquals(Collections.singleton(0), set);
+        assertEquals("fill(0)", Collections.singleton(0), set);
     }
 
     /**
@@ -160,14 +200,13 @@ public final strictfp class IntegerListT
     @Test
     public void test100() {
         testReadWrite(100);
-        assertEquals(400, list.size());
         final int old100 = list.getInt(100);
         list.resize(101);
-        assertEquals(old100, list.getInt(100));
+        assertEquals("getInt(last)", old100, list.getInt(100));
         list.resize(200);
-        assertEquals(200, list.size());
-        assertEquals(old100, list.getInt(100));
-        assertEquals(0, list.getInt(101));
+        assertEquals("size()",              200, list.size());
+        assertEquals("getInt(existing)", old100, list.getInt(100));
+        assertEquals("getInt(new)",           0, list.getInt(101));
         for (int i=101; i<200; i++) {
             assertEquals(0, list.getInt(i));
         }
@@ -192,4 +231,68 @@ public final strictfp class IntegerListT
         testReadWrite(Integer.MAX_VALUE);
         testFill(17);
     }
+
+    /**
+     * Tests that primitive stream traversal is coherent with its list value.
+     * This method tests sequential stream only.
+     */
+    @Test
+    public void testStream() {
+        list = createRandomlyFilled(42, 404);
+        list.stream(false).forEach(new IntConsumer() {
+            private int index = 0;
+
+            @Override
+            public void accept(int value) {
+                assertEquals("Spliterator value differs from its original list", list.getInt(index++), value);
+            }
+        });
+    }
+
+    /**
+     * Tests that primitive stream traversal with parallelization.
+     */
+    @Test
+    public void testIntsParallel() {
+        list = createRandomlyFilled(80, 321);
+        assertParallelStreamEquals(list.iterator(), list.stream().parallel());
+    }
+
+    /**
+     * Ensures our stream is a fail-fast operator, i.e: it fails when the list has
+     * been modified before the end of its iteration.
+     */
+    @Test
+    public void testErrorOnCoModification() {
+        list = createRandomlyFilled(4, 10);
+        final PrimitiveIterator.OfInt values = list.stream(false).iterator();
+
+        // Start iteration normally.
+        assertEquals(list.getInt(0), values.nextInt());
+        assertEquals(list.getInt(1), values.nextInt());
+
+        // Now, if we alter the list and then try to use previously created stream, we should get an error.
+        list.add(0);
+        try {
+            values.next();
+            fail("Concurrent modification has not been detected.");
+        } catch (ConcurrentModificationException expected) {
+            // Expected behavior
+        }
+    }
+
+    /**
+     * Creates a new list whose capacity and value magnitude are defined as input.
+     * The list is filled by a random integer generator before return.
+     *
+     * @param  size      number of elements to insert in the list.
+     * @param  maxValue  maximum value to use for value insertion.
+     * @return a fresh and filled list.
+     */
+    private static IntegerList createRandomlyFilled(final int size, final int maxValue) {
+        final Random random = TestUtilities.createRandomNumberGenerator();
+        return IntStream.generate(() -> random.nextInt(maxValue))
+                .limit(size)
+                .collect(() -> new IntegerList(size, maxValue), IntegerList::addInt, null);
+    }
 }

Modified: sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/xml/OGCNamespacePrefixMapperTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/xml/OGCNamespacePrefixMapperTest.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/xml/OGCNamespacePrefixMapperTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/xml/OGCNamespacePrefixMapperTest.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -22,8 +22,8 @@ import org.apache.sis.util.Numbers;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
-import static org.junit.Assume.*;
 import static org.junit.Assert.*;
+import static org.junit.Assume.assumeTrue;
 
 
 /**

Modified: sis/branches/JDK9/ide-project/NetBeans/build.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/ide-project/NetBeans/build.xml?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/ide-project/NetBeans/build.xml (original)
+++ sis/branches/JDK9/ide-project/NetBeans/build.xml Mon Oct 30 10:25:08 2017
@@ -62,6 +62,9 @@
         <include name="**/*.utf"/>
       </fileset>
       -->
+      <fileset dir="${project.root}/application/sis-javafx/target/generated-resources">
+        <include name="**/*.utf"/>
+      </fileset>
 
       <!-- Other resources (properties files, SQL scripts, native libraries). -->
       <fileset dir="${project.root}/core/sis-utility/src/main/resources">
@@ -80,6 +83,10 @@
         <include name="**/*.dll"/>
         <include name="**/*.so"/>
       </fileset>
+      <fileset dir="${project.root}/application/sis-javafx/src/main/resources">
+        <include name="**/*.fxml"/>
+        <include name="**/*.png"/>
+      </fileset>
       <fileset dir="${project.root}/application/sis-console/src/main/resources">
         <include name="**/*.properties"/>
       </fileset>
@@ -228,6 +235,7 @@
       </fileset>
       <fileset dir="${project.root}/storage/sis-storage/src/test/resources">
         <include name="**/*.txt"/>
+        <include name="**/*.xml"/>
       </fileset>
       <fileset dir="${project.root}/storage/sis-xmlstore/src/test/resources">
         <include name="**/*.gpx"/>

Modified: sis/branches/JDK9/ide-project/NetBeans/nbproject/project.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/ide-project/NetBeans/nbproject/project.properties?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/ide-project/NetBeans/nbproject/project.properties [ISO-8859-1] (original)
+++ sis/branches/JDK9/ide-project/NetBeans/nbproject/project.properties [ISO-8859-1] Mon Oct 30 10:25:08 2017
@@ -97,24 +97,25 @@ project.GeoAPI       = ../../../../GeoAP
 #
 jsr363.version       = 1.0
 jama.version         = 1.0.3
-geometry.version     = 1.2.1
+geometry.version     = 2.0.0
 georss.version       = 0.9.8
 rome.version         = 0.9
 jdom1.version        = 1.0
 jdom2.version        = 2.0.4
 jee.version          = 7.0
 osgi.version         = 6.0.0
-netcdf.version       = 4.6.9
+netcdf.version       = 4.6.10
 joda-time.version    = 2.8.1
 httpclient.version   = 4.5.1
 httpcore.version     = 4.4.4
 cm-logging.version   = 1.2
-slf4j.version        = 1.7.7
+slf4j.version        = 1.7.22
 junit.version        = 4.12
 hamcrest.version     = 1.3
 jaxb-ns-mapper       = 2.2.4
 hsqldb.version       = 2.4.0
-postgresql.version   = 42.1.1
+postgresql.version   = 42.1.4
+icons.version        = 3.0.1
 
 #
 # Classpaths for compilation, execution and tests.
@@ -153,7 +154,8 @@ javac.test.modulepath=\
     ${javac.modulepath}
 run.classpath=\
     ${javac.classpath}:\
-    ${build.classes.dir}
+    ${build.classes.dir}:\
+    ${maven.repository}/org/webjars/material-design-icons/${icons.version}/material-design-icons-${icons.version}.jar
 run.modulepath=\
     ${javac.modulepath}
 run.test.classpath=\

Modified: sis/branches/JDK9/ide-project/NetBeans/nbproject/project.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/ide-project/NetBeans/nbproject/project.xml?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/ide-project/NetBeans/nbproject/project.xml (original)
+++ sis/branches/JDK9/ide-project/NetBeans/nbproject/project.xml Mon Oct 30 10:25:08 2017
@@ -85,6 +85,7 @@
             <word>deserialized</word>
             <word>endianness</word>
             <word>geoidal</word>
+            <word>geospatial</word>
             <word>grayscale</word>
             <word>hectopascals</word>
             <word>initially</word>

Modified: sis/branches/JDK9/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/pom.xml?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/pom.xml (original)
+++ sis/branches/JDK9/pom.xml Mon Oct 30 10:25:08 2017
@@ -87,25 +87,25 @@ Apache SIS is a free software, Java lang
 
   <mailingLists>
     <mailingList>
+      <name>User mailing list</name>
+      <subscribe>user-subscribe@sis.apache.org</subscribe>
+      <unsubscribe>user-unsubscribe@sis.apache.org</unsubscribe>
+      <post>user@sis.apache.org</post>
+      <archive>https://lists.apache.org/list.html?user@sis.apache.org</archive>
+    </mailingList>
+    <mailingList>
       <name>Development mailing list</name>
       <subscribe>dev-subscribe@sis.apache.org</subscribe>
       <unsubscribe>dev-unsubscribe@sis.apache.org</unsubscribe>
       <post>dev@sis.apache.org</post>
-      <archive>http://mail-archives.apache.org/mod_mbox/sis-dev/</archive>
+      <archive>https://lists.apache.org/list.html?dev@sis.apache.org</archive>
     </mailingList>
     <mailingList>
       <name>Commit mailing list</name>
       <subscribe>commits-subscribe@sis.apache.org</subscribe>
       <unsubscribe>commits-unsubscribe@sis.apache.org</unsubscribe>
       <post>commits@sis.apache.org</post>
-      <archive>http://mail-archives.apache.org/mod_mbox/sis-commits/</archive>
-    </mailingList>
-    <mailingList>
-      <name>User mailing list</name>
-      <subscribe>user-subscribe@sis.apache.org</subscribe>
-      <unsubscribe>user-unsubscribe@sis.apache.org</unsubscribe>
-      <post>user@sis.apache.org</post>
-      <archive>http://mail-archives.apache.org/mod_mbox/sis-user/</archive>
+      <archive>https://lists.apache.org/list.html?commits@sis.apache.org</archive>
     </mailingList>
   </mailingLists>
 
@@ -408,7 +408,7 @@ Apache SIS is a free software, Java lang
       <dependency>
         <groupId>com.esri.geometry</groupId>
         <artifactId>esri-geometry-api</artifactId>
-        <version>1.2.1</version>
+        <version>2.0.0</version>
         <optional>true</optional>
       </dependency>
       <dependency>
@@ -431,6 +431,11 @@ Apache SIS is a free software, Java lang
 
       <!-- Databases -->
       <dependency>
+        <groupId>org.apache.derby</groupId>
+        <artifactId>derby</artifactId>
+        <version>10.13.1.1</version>
+      </dependency>
+      <dependency>
         <groupId>org.hsqldb</groupId>
         <artifactId>hsqldb</artifactId>
         <version>2.4.0</version>
@@ -439,7 +444,7 @@ Apache SIS is a free software, Java lang
       <dependency>
         <groupId>org.postgresql</groupId>
         <artifactId>postgresql</artifactId>
-        <version>42.1.1</version>
+        <version>42.1.4</version>
         <scope>test</scope>
       </dependency>
 
@@ -459,7 +464,7 @@ Apache SIS is a free software, Java lang
       <dependency>
         <groupId>org.slf4j</groupId>
         <artifactId>slf4j-jdk14</artifactId>
-        <version>1.7.7</version>                <!-- Must matches the version used by NetCDF. -->
+        <version>1.7.22</version>               <!-- Must matches the version used by netCDF. -->
         <scope>runtime</scope>                  <!-- Should never be needed at compile time.  -->
       </dependency>
     </dependencies>
@@ -485,7 +490,7 @@ Apache SIS is a free software, Java lang
          The last properties in this list depend on the Apache SIS branch.
        =================================================================== -->
   <properties>
-    <netcdf.version>4.6.9</netcdf.version>
+    <netcdf.version>4.6.10</netcdf.version>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <website.encoding>UTF-8</website.encoding>
     <website.locale>en</website.locale>
@@ -545,7 +550,7 @@ Apache SIS is a free software, Java lang
       <!-- Compile -->
       <plugin>
         <artifactId>maven-compiler-plugin</artifactId>
-        <version>3.6.2</version>
+        <version>3.7.0</version>
         <configuration>
           <source>${maven.compile.source}</source>
           <target>${maven.compile.target}</target>
@@ -564,7 +569,7 @@ Apache SIS is a free software, Java lang
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
-        <version>2.20</version>
+        <version>2.20.1</version>
         <configuration>
           <includes>
             <include>**/*TestSuite.java</include>
@@ -653,7 +658,7 @@ Apache SIS is a free software, Java lang
           <dependency>
             <groupId>com.puppycrawl.tools</groupId>
             <artifactId>checkstyle</artifactId>
-            <version>7.6.1</version>
+            <version>8.2</version>
           </dependency>
         </dependencies>
         <executions>
@@ -865,7 +870,7 @@ Apache SIS is a free software, Java lang
       <plugin>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>findbugs-maven-plugin</artifactId>
-        <version>3.0.4</version>
+        <version>3.0.5</version>
         <dependencies>
           <dependency>
             <groupId>org.apache.sis.core</groupId>
@@ -887,7 +892,7 @@ Apache SIS is a free software, Java lang
         <plugin>
           <groupId>org.eclipse.jetty</groupId>
           <artifactId>jetty-maven-plugin</artifactId>
-          <version>9.4.3.v20170317</version>
+          <version>9.4.7.v20170914</version>
         </plugin>
       </plugins>
     </pluginManagement>

Modified: sis/branches/JDK9/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java [UTF-8] (original)
+++ sis/branches/JDK9/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -465,7 +465,7 @@ final class LandsatReader {
              * Example: "LC81230522014071LGN00".
              */
             case "LANDSAT_SCENE_ID": {
-                metadata.addIdentifier(null, value, MetadataBuilder.Scope.ALL);
+                metadata.addTitleOrIdentifier(value, MetadataBuilder.Scope.ALL);
                 break;
             }
             /*

Modified: sis/branches/JDK9/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java [UTF-8] (original)
+++ sis/branches/JDK9/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatStore.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -130,8 +130,8 @@ public class LandsatStore extends DataSt
 
     /**
      * Returns the parameters used to open this Landsat data store.
-     * If non-null, the parameters are described by {@link LandsatStoreProvider#getOpenParameters()}
-     * and contains at least a parameter named {@value LandsatStoreProvider#LOCATION} with a {@link URI} value.
+     * If non-null, the parameters are described by {@link LandsatStoreProvider#getOpenParameters()} and contains at
+     * least a parameter named {@value org.apache.sis.storage.DataStoreProvider#LOCATION} with a {@link URI} value.
      * This method may return {@code null} if the storage input can not be described by a URI
      * (for example a Landsat file reading directly from a {@link java.nio.channels.ReadableByteChannel}).
      *

Modified: sis/branches/JDK9/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java [UTF-8] (original)
+++ sis/branches/JDK9/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -113,10 +113,9 @@ public class LandsatReaderTest extends T
                 + "  │   └─Check point availability……………………………………… false\n"
                 + "  ├─Reference system info………………………………………………………… EPSG:WGS 84 / UTM zone 49N\n"
                 + "  ├─Identification info\n"
-                + "  │   ├─Citation\n"
-                + "  │   │   ├─Date………………………………………………………………………………… 2016-06-27 16:48:12\n"
-                + "  │   │   │   └─Date type………………………………………………………… Creation\n"
-                + "  │   │   └─Identifier………………………………………………………………… LandsatTest\n"
+                + "  │   ├─Citation………………………………………………………………………………… LandsatTest\n"
+                + "  │   │   └─Date………………………………………………………………………………… 2016-06-27 16:48:12\n"
+                + "  │   │       └─Date type………………………………………………………… Creation\n"
                 + "  │   ├─Credit……………………………………………………………………………………… Derived from U.S. Geological Survey data\n"
                 + "  │   ├─Resource format\n"
                 + "  │   │   └─Format specification citation……………… GeoTIFF Coverage Encoding Profile\n"

Modified: sis/branches/JDK9/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4.java [UTF-8] (original)
+++ sis/branches/JDK9/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -188,9 +188,9 @@ public final class Proj4 extends Static
                         }
                     }
                     final String pn = name(parameter.getDescriptor());
-                    hasSemiMajor |= pn.equals("+a");
-                    hasSemiMinor |= pn.equals("+b");
-                    definition.append(' ').append(pn).append('=').append(value);
+                    hasSemiMajor |= pn.equals("a");
+                    hasSemiMinor |= pn.equals("b");
+                    definition.append(" +").append(pn).append('=').append(value);
                 }
             }
         }

Modified: sis/branches/JDK9/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Factory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Factory.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Factory.java [UTF-8] (original)
+++ sis/branches/JDK9/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4Factory.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -52,7 +52,7 @@ import org.apache.sis.internal.metadata.
 import org.apache.sis.internal.system.DefaultFactories;
 import org.apache.sis.internal.system.Modules;
 import org.apache.sis.internal.util.CollectionsExt;
-import org.apache.sis.internal.util.LazySet;
+import org.apache.sis.internal.referencing.LazySet;
 import org.apache.sis.util.iso.SimpleInternationalString;
 import org.apache.sis.util.collection.WeakValueHashMap;
 import org.apache.sis.util.resources.Vocabulary;

Modified: sis/branches/JDK9/storage/sis-gdal/src/test/java/org/apache/sis/storage/gdal/PJTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-gdal/src/test/java/org/apache/sis/storage/gdal/PJTest.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/storage/sis-gdal/src/test/java/org/apache/sis/storage/gdal/PJTest.java [UTF-8] (original)
+++ sis/branches/JDK9/storage/sis-gdal/src/test/java/org/apache/sis/storage/gdal/PJTest.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -23,7 +23,7 @@ import org.apache.sis.test.TestCase;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import static org.junit.Assume.*;
+import static org.junit.Assume.assumeTrue;
 import static org.apache.sis.test.Assert.*;
 
 

Modified: sis/branches/JDK9/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java [UTF-8] (original)
+++ sis/branches/JDK9/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -34,6 +34,7 @@ import org.apache.sis.storage.DataStoreE
 import org.apache.sis.storage.DataStoreContentException;
 import org.apache.sis.storage.UnsupportedStorageException;
 import org.apache.sis.internal.storage.io.ChannelDataInput;
+import org.apache.sis.internal.storage.io.IOUtilities;
 import org.apache.sis.internal.storage.MetadataBuilder;
 import org.apache.sis.internal.storage.URIDataStore;
 import org.apache.sis.internal.util.Constants;
@@ -130,20 +131,29 @@ public class GeoTiffStore extends DataSt
                 while ((dir = reader.getImageFileDirectory(n++)) != null) {
                     dir.completeMetadata(builder, locale);
                 }
-                metadata = builder.build(true);
             } catch (IOException e) {
                 throw new DataStoreException(errors().getString(Errors.Keys.CanNotRead_1, reader.input.filename), e);
             } catch (FactoryException | ArithmeticException e) {
                 throw new DataStoreContentException(getLocale(), Constants.GEOTIFF, reader.input.filename, null).initCause(e);
             }
+            /*
+             * Add the filename as an identifier only if the input was something convertible to URI (URL, File or Path),
+             * otherwise reader.input.filename may not be useful; it may be just the InputStream classname. If the TIFF
+             * file did not specified any ImageDescription tag, then we will had the filename as a title instead than an
+             * identifier because the title is mandatory in ISO 19115 metadata.
+             */
+            if (location != null) {
+                builder.addTitleOrIdentifier(IOUtilities.filenameWithoutExtension(reader.input.filename), MetadataBuilder.Scope.ALL);
+            }
+            metadata = builder.build(true);
         }
         return metadata;
     }
 
     /**
      * Returns the parameters used to open this GeoTIFF data store.
-     * If non-null, the parameters are described by {@link GeoTiffStoreProvider#getOpenParameters()}
-     * and contains at least a parameter named {@value GeoTiffStoreProvider#LOCATION} with a {@link URI} value.
+     * If non-null, the parameters are described by {@link GeoTiffStoreProvider#getOpenParameters()} and contains at
+     * least a parameter named {@value org.apache.sis.storage.DataStoreProvider#LOCATION} with a {@link URI} value.
      * This method may return {@code null} if the storage input can not be described by a URI
      * (for example a GeoTIFF file reading directly from a {@link java.nio.channels.ReadableByteChannel}).
      *

Modified: sis/branches/JDK9/storage/sis-geotiff/src/test/java/org/apache/sis/storage/geotiff/CRSBuilderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-geotiff/src/test/java/org/apache/sis/storage/geotiff/CRSBuilderTest.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/storage/sis-geotiff/src/test/java/org/apache/sis/storage/geotiff/CRSBuilderTest.java [UTF-8] (original)
+++ sis/branches/JDK9/storage/sis-geotiff/src/test/java/org/apache/sis/storage/geotiff/CRSBuilderTest.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -41,9 +41,9 @@ public final strictfp class CRSBuilderTe
     @Test
     public void testSplitName() {
         final String[] names = CRSBuilder.splitName("GCS Name = wgs84|Datum = unknown|Ellipsoid = WGS_1984|Primem = Greenwich|");
-        assertEquals("GCRS",      "wgs84",    names[CRSBuilder.GCRS]);
-        assertEquals("DATUM",     "unknown",  names[CRSBuilder.DATUM]);
-        assertEquals("ELLIPSOID", "WGS_1984", names[CRSBuilder.ELLIPSOID]);
+        assertEquals("GCRS",      "wgs84",     names[CRSBuilder.GCRS]);
+        assertEquals("DATUM",     "unknown",   names[CRSBuilder.DATUM]);
+        assertEquals("ELLIPSOID", "WGS_1984",  names[CRSBuilder.ELLIPSOID]);
         assertEquals("PRIMEM",    "Greenwich", names[CRSBuilder.PRIMEM]);
     }
 

Modified: sis/branches/JDK9/storage/sis-netcdf/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-netcdf/pom.xml?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/storage/sis-netcdf/pom.xml (original)
+++ sis/branches/JDK9/storage/sis-netcdf/pom.xml Mon Oct 30 10:25:08 2017
@@ -38,11 +38,11 @@
   <groupId>org.apache.sis.storage</groupId>
   <artifactId>sis-netcdf</artifactId>
   <packaging>bundle</packaging>
-  <name>Apache SIS NetCDF storage</name>
+  <name>Apache SIS netCDF storage</name>
   <description>
   <!-- Left alignment because this description will be copied in META-INF/MANIFEST.MF
        The leading space after the first line is necessary for proper formatting. -->
-Bridge between NetCDF Climate and Forecast (CF) convention and ISO 19115 metadata.
+Bridge between netCDF Climate and Forecast (CF) convention and ISO 19115 metadata.
   </description>
 
 
@@ -153,7 +153,7 @@ Bridge between NetCDF Climate and Foreca
     </dependency>
   </dependencies>
 
-  <!--  UCAR repository from which to download the NetCDF library. -->
+  <!--  UCAR repository from which to download the netCDF library. -->
   <repositories>
     <repository>
       <id>UCAR</id>

Modified: sis/branches/JDK9/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Axis.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Axis.java?rev=1813747&r1=1813746&r2=1813747&view=diff
==============================================================================
--- sis/branches/JDK9/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Axis.java [UTF-8] (original)
+++ sis/branches/JDK9/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Axis.java [UTF-8] Mon Oct 30 10:25:08 2017
@@ -23,9 +23,9 @@ import org.apache.sis.storage.DataStoreE
 
 
 /**
- * Information about a coordinate system axes. In NetCDF files, all axes can be related to 1 or more dimensions
+ * Information about a coordinate system axes. In netCDF files, all axes can be related to 1 or more dimensions
  * of the grid domain. Those grid domain dimensions are specified by the {@link #sourceDimensions} array.
- * Whether the array length is 1 or 2 depends on whether the wrapped NetCDF axis is an instance of
+ * Whether the array length is 1 or 2 depends on whether the wrapped netCDF axis is an instance of
  * {@link ucar.nc2.dataset.CoordinateAxis1D} or {@link ucar.nc2.dataset.CoordinateAxis2D} respectively.
  *
  * @author  Martin Desruisseaux (Geomatys)
@@ -44,7 +44,7 @@ public final class Axis {
 
     /**
      * The indices of the grid dimension associated to this axis. The length of this array is often 1.
-     * But if more than one grid dimension is associated to this axis (i.e. if the wrapped NetCDF axis
+     * But if more than one grid dimension is associated to this axis (i.e. if the wrapped netCDF axis
      * is an instance of {@link ucar.nc2.dataset.CoordinateAxis2D}),  then the first value is the grid
      * dimension which seems most closely oriented toward this axis direction. We do that for allowing
      * {@code MetadataReader.addSpatialRepresentationInfo(…)} method to get the most appropriate value



Mime
View raw message