sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1826327 [2/5] - in /sis/branches/JDK9: ./ application/sis-console/src/main/java/org/apache/sis/console/ core/sis-build-helper/src/main/resources/org/apache/sis/ core/sis-metadata/ core/sis-metadata/src/main/java/org/apache/sis/internal/jax...
Date Fri, 09 Mar 2018 11:00:28 GMT
Modified: sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MX_DataFile.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MX_DataFile.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MX_DataFile.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MX_DataFile.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -60,7 +60,7 @@ public final class MX_DataFile extends P
 
     /**
      * Invoked by {@link PropertyType} at marshalling time for wrapping the given metadata value
-     * in a {@code <gmx:MX_DataFile>} XML element.
+     * in a {@code <gcx:MX_DataFile>} XML element.
      *
      * @param  metadata  the metadata element to marshall.
      * @return a {@code PropertyType} wrapping the given the metadata element.
@@ -72,7 +72,7 @@ public final class MX_DataFile extends P
 
     /**
      * Invoked by JAXB at marshalling time for getting the actual metadata to write
-     * inside the {@code <gmx:MX_DataFile>} XML element.
+     * inside the {@code <gcx:MX_DataFile>} XML element.
      * This is the value or a copy of the value given in argument to the {@code wrap} method.
      *
      * @return the metadata to be marshalled.

Modified: sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -79,7 +79,8 @@ public class ReferencingServices extends
 
     /**
      * The GRS80 {@linkplain org.apache.sis.referencing.datum.DefaultEllipsoid#getAuthalicRadius() authalic radius},
-     * which is {@value} metres.
+     * which is {@value} metres. This is close to the WGS84 authalic radius, which is about 6371007.180918474 when
+     * computed with {@code double} precision.
      */
     public static final double AUTHALIC_RADIUS = 6371007;
 

Modified: sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ServicesForUtility.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ServicesForUtility.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ServicesForUtility.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ServicesForUtility.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -27,11 +27,12 @@ import org.opengis.metadata.citation.Rol
 import org.opengis.metadata.citation.Citation;
 import org.opengis.metadata.citation.PresentationForm;
 import org.opengis.metadata.citation.Responsibility;
-import org.apache.sis.internal.simple.CitationConstant;
+import org.opengis.util.ControlledVocabulary;
 import org.apache.sis.internal.util.Constants;
 import org.apache.sis.internal.util.MetadataServices;
 import org.apache.sis.internal.metadata.sql.Initializer;
 import org.apache.sis.internal.system.Loggers;
+import org.apache.sis.internal.jaxb.Context;
 import org.apache.sis.metadata.iso.ImmutableIdentifier;
 import org.apache.sis.metadata.iso.citation.Citations;
 import org.apache.sis.metadata.iso.citation.DefaultCitation;
@@ -49,7 +50,7 @@ import static java.util.Collections.sing
  * Implements the metadata services needed by the {@code "sis-utility"} module.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.0
  * @since   0.6
  * @module
  */
@@ -61,15 +62,28 @@ public final class ServicesForUtility ex
     }
 
     /**
-     * Returns the constant defined in the {@link Citations} class for the given name.
+     * {@code true} if this thread is in the process of reading a XML document with JAXB.
      *
-     * @param  name  the name of one of the citation constants defined in the {@code Citations} class.
-     * @return the requested citation, or {@code null} if there is no constant for the given name.
+     * @return if XML unmarshalling is in progress in current thread.
      */
     @Override
-    public CitationConstant getCitationConstant(final String name) {
-        final Citation c = Citations.fromName(name);
-        return (c instanceof CitationConstant) ? (CitationConstant) c : null;
+    public boolean isUnmarshalling() {
+        final Context context = Context.current();
+        return (context != null) && !Context.isFlagSet(context, Context.MARSHALLING);
+    }
+
+    /**
+     * Returns the title of the given enumeration or code list value.
+     *
+     * @param  code    the code for which to get the title.
+     * @param  locale  desired locale for the title.
+     * @return the title.
+     *
+     * @see org.apache.sis.util.iso.Types#getCodeTitle(ControlledVocabulary)
+     */
+    @Override
+    public String getCodeTitle(final ControlledVocabulary code, final Locale locale) {
+        return Types.getCodeTitle(code).toString(locale);
     }
 
     /**
@@ -83,8 +97,7 @@ public final class ServicesForUtility ex
      *       need to make sure that the given key is present in the alternate titles, since we rely on that when
      *       checking for code spaces.
      */
-    @Override
-    public Citation createCitation(final String key) {
+    public static Citation createCitation(final String key) {
         CharSequence     title;
         CharSequence     alternateTitle        = null;
         CharSequence     edition               = null;
@@ -182,7 +195,7 @@ public final class ServicesForUtility ex
                 title = "S-57";
                 break;
             }
-            default: return super.createCitation(key);
+            default: return null;
         }
         /*
          * Do not use the 'c.getFoo().add(foo)' pattern below. Use the 'c.setFoo(singleton(foo))' pattern instead.

Modified: sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/WKTKeywords.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/WKTKeywords.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/WKTKeywords.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/WKTKeywords.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -35,7 +35,7 @@ import org.apache.sis.util.Static;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Johann Sorel (Geomatys)
- * @version 0.7
+ * @version 1.0
  *
  * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html">WKT 2 specification</a>
  * @see <a href="http://www.geoapi.org/3.0/javadoc/org/opengis/referencing/doc-files/WKT.html">Legacy WKT 1</a>
@@ -214,4 +214,10 @@ public final class WKTKeywords extends S
             spherical   = "spherical",
             temporal    = "temporal",
             vertical    = "vertical";
+
+    /**
+     * Geometries.
+     */
+    public static final String
+            Point       = "Point";
 }

Modified: sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/package-info.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/package-info.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/package-info.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -24,7 +24,7 @@
  * may change in incompatible ways in any future version without notice.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.7
+ * @version 1.0
  * @since   0.3
  * @module
  */

Modified: sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Formatter.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -36,6 +36,7 @@ import javax.measure.Unit;
 import javax.measure.Quantity;
 
 import org.opengis.util.InternationalString;
+import org.opengis.util.ControlledVocabulary;
 import org.opengis.metadata.Identifier;
 import org.opengis.metadata.citation.Citation;
 import org.opengis.metadata.extent.Extent;
@@ -53,7 +54,6 @@ import org.opengis.referencing.operation
 import org.opengis.referencing.operation.CoordinateOperation;
 import org.opengis.referencing.operation.ConcatenatedOperation;
 import org.opengis.referencing.operation.MathTransform;
-import org.opengis.util.ControlledVocabulary;
 
 import org.apache.sis.measure.Units;
 import org.apache.sis.math.DecimalFunctions;
@@ -68,7 +68,9 @@ import org.apache.sis.util.CharSequences
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.resources.Vocabulary;
+import org.apache.sis.util.collection.IntegerList;
 import org.apache.sis.internal.util.X364;
+import org.apache.sis.internal.util.Numerics;
 import org.apache.sis.internal.util.Citations;
 import org.apache.sis.internal.util.Constants;
 import org.apache.sis.internal.util.StandardDateFormat;
@@ -97,7 +99,7 @@ import org.apache.sis.metadata.iso.exten
  * </ul>
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
- * @version 0.8
+ * @version 1.0
  *
  * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html">WKT 2 specification</a>
  * @see <a href="http://www.geoapi.org/3.0/javadoc/org/opengis/referencing/doc-files/WKT.html">Legacy WKT 1</a>
@@ -146,9 +148,9 @@ public class Formatter implements Locali
 
     /**
      * The value of {@link Symbols#getSeparator()} without trailing spaces, followed by the system line separator.
-     * Computed by {@link Symbols#lineSeparator()} and stored for reuse.
+     * Computed by {@link Symbols#separatorNewLine()} and stored for reuse.
      */
-    private final String lineSeparator;
+    private final String separatorNewLine;
 
     /**
      * The colors to use for this formatter, or {@code null} for no syntax coloring.
@@ -287,6 +289,14 @@ public class Formatter implements Locali
     private int margin;
 
     /**
+     * Indices where to insert additional margin, or {@code null} if none. The margin to insert will be
+     * the the width of the keyword (e.g. {@code "BOX"}), which is usually unknown to {@code Formatter}
+     * until {@link FormattableObject} finished to write the element. This field is usually {@code null},
+     * unless formatting geometries.
+     */
+    private IntegerList keywordSpaceAt;
+
+    /**
      * {@code true} if a new line were requested during the execution of {@link #append(FormattableObject)}.
      * This is used to determine if the next {@code UNIT} and {@code ID} elements shall appear on a new line.
      */
@@ -337,16 +347,16 @@ public class Formatter implements Locali
         ArgumentChecks.ensureNonNull("convention",  convention);
         ArgumentChecks.ensureNonNull("symbols",     symbols);
         ArgumentChecks.ensureBetween("indentation", WKTFormat.SINGLE_LINE, Byte.MAX_VALUE, indentation);
-        this.locale        = Locale.getDefault(Locale.Category.DISPLAY);
-        this.convention    = convention;
-        this.authority     = convention.getNameAuthority();
-        this.symbols       = symbols.immutable();
-        this.lineSeparator = this.symbols.lineSeparator();
-        this.indentation   = (byte) indentation;
-        this.numberFormat  = symbols.createNumberFormat();
-        this.dateFormat    = new StandardDateFormat(symbols.getLocale());
-        this.unitFormat    = new UnitFormat(symbols.getLocale());
-        this.buffer        = new StringBuffer();
+        this.locale           = Locale.getDefault(Locale.Category.DISPLAY);
+        this.convention       = convention;
+        this.authority        = convention.getNameAuthority();
+        this.symbols          = symbols.immutable();
+        this.separatorNewLine = this.symbols.separatorNewLine();
+        this.indentation      = (byte) indentation;
+        this.numberFormat     = symbols.createNumberFormat();
+        this.dateFormat       = new StandardDateFormat(symbols.getLocale());
+        this.unitFormat       = new UnitFormat(symbols.getLocale());
+        this.buffer           = new StringBuffer();
         unitFormat.setStyle(UnitFormat.Style.NAME);
         if (convention.usesCommonUnits) {
             unitFormat.setLocale(Locale.US);
@@ -360,15 +370,15 @@ public class Formatter implements Locali
     Formatter(final Locale locale, final Symbols symbols, final NumberFormat numberFormat,
             final DateFormat dateFormat, final UnitFormat unitFormat)
     {
-        this.locale        = locale;
-        this.convention    = Convention.DEFAULT;
-        this.authority     = Convention.DEFAULT.getNameAuthority();
-        this.symbols       = symbols;
-        this.lineSeparator = this.symbols.lineSeparator();
-        this.indentation   = Constants.DEFAULT_INDENTATION;
-        this.numberFormat  = numberFormat;                      // No clone needed.
-        this.dateFormat    = dateFormat;
-        this.unitFormat    = unitFormat;
+        this.locale           = locale;
+        this.convention       = Convention.DEFAULT;
+        this.authority        = Convention.DEFAULT.getNameAuthority();
+        this.symbols          = symbols;
+        this.separatorNewLine = symbols.separatorNewLine();
+        this.indentation      = Constants.DEFAULT_INDENTATION;
+        this.numberFormat     = numberFormat;                      // No clone needed.
+        this.dateFormat       = dateFormat;
+        this.unitFormat       = unitFormat;
         // Do not set the buffer. It will be set by WKTFormat.format(…).
     }
 
@@ -557,7 +567,7 @@ public class Formatter implements Locali
     private void appendSeparator() {
         if (buffer.length() != elementStart) {
             if (requestNewLine) {
-                buffer.append(lineSeparator).append(CharSequences.spaces(margin));
+                buffer.append(separatorNewLine).append(CharSequences.spaces(margin));
             } else {
                 buffer.append(symbols.getSeparator());
             }
@@ -638,7 +648,7 @@ public class Formatter implements Locali
             }
         }
         enclosingElements.add(object);
-        if (hasContextualUnit < 0) { // Test if leftmost bit is set to 1.
+        if (hasContextualUnit < 0) {                            // Test if leftmost bit is set to 1.
             throw new IllegalStateException(Errors.getResources(locale).getString(Errors.Keys.TreeDepthExceedsMaximum));
         }
         hasContextualUnit <<= 1;
@@ -682,6 +692,24 @@ public class Formatter implements Locali
         highlightError = false;
         buffer.insert(base, keyword);
         /*
+         * When formatting geometry coordinates, we may need to shift all numbers by the width
+         * of the keyword inserted above in order to keep numbers properly aligned. Exemple:
+         *
+         *     BOX[ 4.000 -10.000
+         *         50.000   2.000]
+         */
+        if (keywordSpaceAt != null) {
+            final int length = keyword.length();
+            final CharSequence additionalMargin = CharSequences.spaces(keyword.codePointCount(0, length));
+            final int n = keywordSpaceAt.size();
+            for (int i=0; i<n;) {
+                int p = keywordSpaceAt.getInt(i);
+                p += (++i * length);                    // Take in account spaces added previously.
+                buffer.insert(p, additionalMargin);
+            }
+            keywordSpaceAt.clear();
+        }
+        /*
          * Format the SCOPE["…"], AREA["…"] and other elements. Some of those information
          * are available only for Datum, CoordinateOperation and ReferenceSystem objects.
          */
@@ -692,6 +720,9 @@ public class Formatter implements Locali
             appendComplement(info, (stackDepth >= 1) ? enclosingElements.get(stackDepth - 1) : null,
                                    (stackDepth >= 2) ? enclosingElements.get(stackDepth - 2) : null);
         }
+        /*
+         * Close the bracket, then update the queue of enclosed elements by removing this element.
+         */
         buffer.appendCodePoint(symbols.getClosingBracket(0));
         indent(-1);
         enclosingElements.remove(stackDepth);
@@ -1170,7 +1201,7 @@ public class Formatter implements Locali
              * maximum of 8 fraction digits, which is more than enough.
              */
             numberFormat.setMaximumFractionDigits(DecimalFunctions.fractionDigitsForValue(number, 2));
-            numberFormat.setMinimumFractionDigits(1); // Must be after setMaximumFractionDigits(…).
+            numberFormat.setMinimumFractionDigits(1);   // Must be after setMaximumFractionDigits(…).
             numberFormat.setRoundingMode(RoundingMode.HALF_EVEN);
             numberFormat.format(number, buffer, dummy);
         }
@@ -1178,6 +1209,124 @@ public class Formatter implements Locali
     }
 
     /**
+     * Appends rows of numbers. Each number is separated by a space, and each row is separated by a comma.
+     * This method is mostly for formatting geometries, but it could be used for other objects like matrix
+     * as well. Each row usually have the same length, but this is not mandatory.
+     *
+     * @param  rows            rows to append, or {@code null} if none.
+     * @param  fractionDigits  the number of fraction digits for each number in a row, or {@code null} for default.
+     *         If a row contains more numbers than {@code fractionDigits.length}, then the last value in this array
+     *         is repeated for all remaining row numbers.
+     *
+     * @since 1.0
+     */
+    public void append(final double[][] rows, int... fractionDigits) {
+        if (rows == null || rows.length == 0) {
+            return;
+        }
+        if (fractionDigits == null || fractionDigits.length == 0) {
+            fractionDigits = Numerics.suggestFractionDigits(rows);
+        }
+        numberFormat.setRoundingMode(RoundingMode.HALF_EVEN);
+        /*
+         * If the rows are going to be formatted on many lines, then we will need to put some margin before each row.
+         * If the first row starts on its own line, then the margin will be the usual indentation. But if the first
+         * row starts on the same line than previous elements (or the keyword of this element, e.g. "BOX["), then we
+         * will need a different amount of spaces if we want to have the numbers properly aligned.
+         */
+        final boolean isMultiLines = (indentation > WKTFormat.SINGLE_LINE) && (rows.length > 1);
+        final boolean needsAlignment = !requestNewLine;
+        final CharSequence marginBeforeRow;
+        if (isMultiLines) {
+            int currentLineLength = margin;
+            if (needsAlignment) {
+                final int length = buffer.length();
+                int i = length;
+                while (i > 0) {                                         // Locate beginning of current line.
+                    final int c = buffer.codePointBefore(i);
+                    if (Characters.isLineOrParagraphSeparator(c)) break;
+                    i -= Character.charCount(c);
+                }
+                currentLineLength = buffer.codePointCount(i, length);
+            }
+            marginBeforeRow = CharSequences.spaces(currentLineLength);
+        } else {
+            marginBeforeRow = "";
+        }
+        /*
+         * 'formattedNumberMarks' contains, for each number in each row, positions in the 'buffer' where
+         * the number starts and position where it ends. Those positions are stored as (start,end) pairs.
+         * We compute those marks unconditionally for simplicity, but will ignore them if formatting on
+         * a single line.
+         */
+        final int[][] formattedNumberMarks = new int[rows.length][];
+        int numColumns = 0;
+        for (int j=0; j<rows.length; j++) {
+            if (j == 0) {
+                appendSeparator();      // It is up to the caller to decide if we begin with a new line.
+            } else {
+                buffer.append(separatorNewLine).append(marginBeforeRow);
+            }
+            final double[] numbers = rows[j];
+            numColumns = Math.max(numColumns, numbers.length);      // Store the length of longest row.
+            final int[] marks = new int[numbers.length << 1];       // Positions where numbers are formatted.
+            formattedNumberMarks[j] = marks;
+            for (int i=0; i<numbers.length; i++) {
+                if (i != 0) buffer.append(Symbols.NUMBER_SEPARATOR);
+                if (i < fractionDigits.length) {                    // Otherwise, same than previous number.
+                    final int f = fractionDigits[i];
+                    numberFormat.setMaximumFractionDigits(f);
+                    numberFormat.setMinimumFractionDigits(f);
+                }
+                marks[i << 1] = buffer.length();                    // Store the start position where number is formatted.
+                setColor(ElementKind.NUMBER);
+                numberFormat.format(numbers[i], buffer, dummy);
+                resetColor();
+                marks[(i << 1) | 1] = buffer.length();              // Store the end position where number is formatted.
+            }
+        }
+        /*
+         * If formatting on more than one line, insert the amount of spaces required for aligning numbers.
+         * This is possible because we wrote the coordinate values with fixed number of fraction digits.
+         */
+        if (isMultiLines) {
+            final int base = elementStart;
+            final String toWrite = buffer.substring(base);          // Save what we formatted in above loop.
+            buffer.setLength(base);                                 // Discard what we formatted - we will rewrite.
+            final int[] columnWidths = new int[numColumns];
+            for (final int[] marks : formattedNumberMarks) {        // Compute the maximal width of each column.
+                for (int i=0; i<marks.length; i += 2) {
+                    final int k = i >> 1;
+                    final int w = toWrite.codePointCount(marks[i  ] -= base,
+                                                         marks[i+1] -= base);
+                    if (w > columnWidths[k]) columnWidths[k] = w;
+                }
+            }
+            if (needsAlignment && keywordSpaceAt == null) {
+                keywordSpaceAt = new IntegerList(formattedNumberMarks.length, Integer.MAX_VALUE);
+            }
+            boolean requestAlignment = false;
+            int lastPosition = 0;
+            for (int[] marks : formattedNumberMarks) {              // Recopy the formatted text, with more spaces.
+                for (int i = 0; i<marks.length;) {
+                    final int w = columnWidths[i >> 1];
+                    final int s = marks[i++];
+                    final int e = marks[i++];
+                    buffer.append(toWrite, lastPosition, s)
+                          .append(CharSequences.spaces(w - toWrite.codePointCount(s, e)));
+                    if (requestAlignment) {
+                        requestAlignment = false;
+                        keywordSpaceAt.add(buffer.length());
+                    }
+                    buffer.append(toWrite, s, e);
+                    lastPosition = e;
+                }
+                requestAlignment = needsAlignment;
+            }
+        }
+    }
+
+    /**
      * Appends the given number without any change to the {@link NumberFormat} setting.
      * Caller shall ensure that the following method has been invoked prior this method call:
      *
@@ -1693,6 +1842,7 @@ public class Formatter implements Locali
         elementStart      = 0;
         colorApplied      = 0;
         margin            = 0;
+        keywordSpaceAt    = null;
         requestNewLine    = false;
         isComplement      = false;
         highlightError    = false;

Modified: sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Symbols.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Symbols.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Symbols.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Symbols.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -67,7 +67,7 @@ import static org.apache.sis.util.Argume
  * Users can create their own {@code Symbols} instance for parsing or formatting a WKT with different symbols.
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
- * @version 0.6
+ * @version 1.0
  *
  * @see WKTFormat#getSymbols()
  * @see WKTFormat#setSymbols(Symbols)
@@ -92,6 +92,12 @@ public class Symbols implements Localize
     static final boolean SCIENTIFIC_NOTATION = true;
 
     /**
+     * Separator between numbers in a sequence of numbers.
+     * This is used for example between the coordinates of a point.
+     */
+    static final char NUMBER_SEPARATOR = ' ';
+
+    /**
      * The prefix character for the value of a WKT fragment.
      */
     static final char FRAGMENT_VALUE = '$';
@@ -541,7 +547,7 @@ public class Symbols implements Localize
      * Returns the value of {@link #getSeparator()} without trailing spaces,
      * followed by the system line separator.
      */
-    final String lineSeparator() {
+    final String separatorNewLine() {
         final String separator = getSeparator();
         return separator.substring(0, CharSequences.skipTrailingWhitespaces(separator, 0, separator.length()))
                 .concat(System.lineSeparator());

Modified: sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -106,7 +106,7 @@ import org.apache.sis.internal.util.Stan
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Rémi Eve (IRD)
- * @version 0.8
+ * @version 1.0
  *
  * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html">WKT 2 specification</a>
  * @see <a href="http://www.geoapi.org/3.0/javadoc/org/opengis/referencing/doc-files/WKT.html">Legacy WKT 1</a>

Modified: sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/package-info.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/package-info.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/package-info.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -82,7 +82,7 @@
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @author  Rémi Eve (IRD)
  * @author  Rueben Schulz (UBC)
- * @version 0.6
+ * @version 1.0
  *
  * @see <a href="http://docs.opengeospatial.org/is/12-063r5/12-063r5.html">WKT 2 specification</a>
  * @see <a href="http://www.geoapi.org/3.0/javadoc/org/opengis/referencing/doc-files/WKT.html">Legacy WKT 1</a>

Modified: sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultMetadata.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -66,7 +66,7 @@ import org.apache.sis.internal.metadata.
 import org.apache.sis.internal.metadata.OtherLocales;
 import org.apache.sis.internal.metadata.Dependencies;
 import org.apache.sis.internal.util.CollectionsExt;
-import org.apache.sis.internal.jaxb.gmd.LocaleAdapter;
+import org.apache.sis.internal.jaxb.lan.LocaleAdapter;
 import org.apache.sis.internal.jaxb.LegacyNamespaces;
 import org.apache.sis.internal.jaxb.FilterByVersion;
 import org.apache.sis.internal.jaxb.Context;

Modified: sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -689,9 +689,9 @@ public final class Citations extends Sta
      *
      * @since 0.6
      */
-    @SuppressWarnings("deprecation")
     public static String getUnicodeIdentifier(final Citation citation) {
-        return org.apache.sis.internal.util.Citations.getUnicodeIdentifier(citation);
+        return org.apache.sis.internal.util.Citations.removeIgnorableCharacters(
+               org.apache.sis.internal.util.Citations.getIdentifier(citation, true));
     }
 
     /**

Modified: sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultContact.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultContact.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultContact.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultContact.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -246,6 +246,10 @@ public class DefaultContact extends ISOM
                     }
                 }
                 if (ignored != null) {
+                    /*
+                     * Log a warning for ignored property using a call to 'ignored.toString()' instead than 'ignored'
+                     * because we want the property to appear as "TelephoneType[FOO]" instead than "FOO".
+                     */
                     Context.warningOccured(Context.current(), DefaultContact.class, "getPhone",
                             Messages.class, Messages.Keys.IgnoredPropertyAssociatedTo_1, ignored.toString());
                 }

Modified: sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultResponsibility.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultResponsibility.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultResponsibility.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultResponsibility.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -22,14 +22,16 @@ import javax.xml.bind.annotation.XmlElem
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlSeeAlso;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import org.opengis.metadata.citation.Party;
-import org.opengis.metadata.citation.Responsibility;
 import org.opengis.metadata.citation.Role;
 import org.opengis.metadata.extent.Extent;
 import org.apache.sis.metadata.iso.ISOMetadata;
 import org.apache.sis.internal.jaxb.FilterByVersion;
 import org.apache.sis.internal.jaxb.code.CI_RoleCode;
 
+// Branch-specific imports
+import org.opengis.metadata.citation.Party;
+import org.opengis.metadata.citation.Responsibility;
+
 
 /**
  * Information about the party and their role.

Modified: sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultFeatureCatalogueDescription.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultFeatureCatalogueDescription.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultFeatureCatalogueDescription.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/DefaultFeatureCatalogueDescription.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -28,7 +28,7 @@ import org.opengis.metadata.content.Feat
 import org.opengis.metadata.content.FeatureTypeInfo;
 import org.apache.sis.internal.jaxb.FilterByVersion;
 import org.apache.sis.internal.jaxb.LegacyNamespaces;
-import org.apache.sis.internal.jaxb.gmd.LocaleAdapter;
+import org.apache.sis.internal.jaxb.lan.LocaleAdapter;
 import org.apache.sis.internal.metadata.Dependencies;
 import org.apache.sis.internal.metadata.LegacyPropertyAdapter;
 

Modified: sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/package-info.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/package-info.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/content/package-info.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -130,6 +130,7 @@ import javax.xml.bind.annotation.adapter
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters;
 import org.apache.sis.xml.Namespaces;
 import org.apache.sis.internal.jaxb.LegacyNamespaces;
+import org.apache.sis.internal.jaxb.lan.PT_Locale;
 import org.apache.sis.internal.jaxb.gco.*;
 import org.apache.sis.internal.jaxb.code.*;
 import org.apache.sis.internal.jaxb.metadata.*;

Modified: sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultDataFile.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultDataFile.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultDataFile.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/DefaultDataFile.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -29,7 +29,7 @@ import org.apache.sis.xml.Namespaces;
 import org.apache.sis.metadata.iso.ISOMetadata;
 import org.apache.sis.internal.jaxb.FilterByVersion;
 import org.apache.sis.internal.jaxb.LegacyNamespaces;
-import org.apache.sis.internal.jaxb.gmx.MimeFileTypeAdapter;
+import org.apache.sis.internal.jaxb.gcx.MimeFileTypeAdapter;
 import org.opengis.util.InternationalString;
 
 

Modified: sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/package-info.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/package-info.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/distribution/package-info.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -89,7 +89,7 @@
     @XmlJavaTypeAdapter(CI_Responsibility.class),
     @XmlJavaTypeAdapter(GO_DateTime.class),
     @XmlJavaTypeAdapter(GO_Integer.class),
-    @XmlJavaTypeAdapter(GO_LocalName.class),
+    @XmlJavaTypeAdapter(GO_GenericName.class),
     @XmlJavaTypeAdapter(GO_Real.class),
     @XmlJavaTypeAdapter(MD_DigitalTransferOptions.class),
     @XmlJavaTypeAdapter(MD_Distributor.class),

Modified: sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultBrowseGraphic.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultBrowseGraphic.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultBrowseGraphic.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultBrowseGraphic.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -27,7 +27,7 @@ import org.opengis.metadata.citation.Onl
 import org.opengis.metadata.constraint.Constraints;
 import org.opengis.metadata.identification.BrowseGraphic;
 import org.apache.sis.metadata.iso.ISOMetadata;
-import org.apache.sis.internal.jaxb.gmx.MimeFileTypeAdapter;
+import org.apache.sis.internal.jaxb.gcx.MimeFileTypeAdapter;
 import org.apache.sis.internal.jaxb.FilterByVersion;
 import org.apache.sis.xml.Namespaces;
 

Modified: sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentification.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentification.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentification.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultDataIdentification.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -28,7 +28,7 @@ import org.opengis.metadata.citation.Cit
 import org.opengis.metadata.identification.TopicCategory;
 import org.opengis.metadata.identification.DataIdentification;
 import org.apache.sis.internal.metadata.OtherLocales;
-import org.apache.sis.internal.jaxb.gmd.LocaleAdapter;
+import org.apache.sis.internal.jaxb.lan.LocaleAdapter;
 import org.apache.sis.internal.jaxb.LegacyNamespaces;
 import org.apache.sis.internal.jaxb.FilterByVersion;
 import org.apache.sis.internal.util.CollectionsExt;

Modified: sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultResolution.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultResolution.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultResolution.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/DefaultResolution.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -293,9 +293,9 @@ public class DefaultResolution extends I
      * @since 0.5
      */
     @Override
-    @ValueRange(minimum=0, isMinIncluded=false)
     @XmlElement(name = "vertical")
     @XmlJavaTypeAdapter(GO_Real.Since2014.class)
+    @ValueRange(minimum=0, isMinIncluded=false)
     public Double getVertical() {
         return (property == VERTICAL) ? (Double) value : null;
     }
@@ -326,9 +326,9 @@ public class DefaultResolution extends I
      * @since 0.5
      */
     @Override
-    @ValueRange(minimum=0, isMinIncluded=false)
     @XmlElement(name = "angularDistance")
     @XmlJavaTypeAdapter(GO_Real.Since2014.class)
+    @ValueRange(minimum=0, isMinIncluded=false)
     public Double getAngularDistance() {
         return (property == ANGULAR) ? (Double) value : null;
     }

Modified: sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/package-info.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/package-info.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/package-info.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -162,6 +162,7 @@ import javax.xml.bind.annotation.adapter
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters;
 import org.apache.sis.xml.Namespaces;
 import org.apache.sis.internal.jaxb.LegacyNamespaces;
+import org.apache.sis.internal.jaxb.lan.PT_Locale;
 import org.apache.sis.internal.jaxb.gco.*;
 import org.apache.sis.internal.jaxb.gts.*;
 import org.apache.sis.internal.jaxb.code.*;

Modified: sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/package-info.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/package-info.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/package-info.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -142,6 +142,7 @@ import javax.xml.bind.annotation.adapter
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters;
 import org.apache.sis.xml.Namespaces;
 import org.apache.sis.internal.jaxb.LegacyNamespaces;
+import org.apache.sis.internal.jaxb.lan.PT_Locale;
 import org.apache.sis.internal.jaxb.gco.*;
 import org.apache.sis.internal.jaxb.code.*;
 import org.apache.sis.internal.jaxb.metadata.*;

Modified: sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameterTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameterTest.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameterTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameterTest.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -24,7 +24,7 @@ import org.apache.sis.util.iso.Names;
 import org.apache.sis.test.XMLTestCase;
 import org.junit.Test;
 
-import static org.apache.sis.test.Assert.*;
+import static org.apache.sis.test.MetadataAssert.*;
 
 
 /**

Modified: sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/NameMapTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/NameMapTest.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/NameMapTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/NameMapTest.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -117,7 +117,7 @@ public final strictfp class NameMapTest
         assertEquals("getAverageAirTemperature", name);
         assertSame  ("getAverageAirTemperature", name);
         /*
-         * Tests an other intern.
+         * Tests another intern.
          */
         map = MetadataStandard.ISO_19115.asNameMap(EnvironmentalRecord.class, SENTENCE, UML_IDENTIFIER);
         name = map.get("Average air temperature");

Modified: sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -21,18 +21,13 @@ import java.util.Locale;
 import java.util.Arrays;
 import java.util.Iterator;
 import java.util.Collection;
-import java.util.logging.LogRecord;
 import java.net.URISyntaxException;
-import javax.xml.bind.Unmarshaller;
 import javax.xml.bind.JAXBException;
 import org.opengis.metadata.MetadataScope;
 import org.opengis.metadata.citation.Citation;
 import org.opengis.metadata.citation.DateType;
 import org.opengis.metadata.maintenance.ScopeCode;
-import org.apache.sis.xml.XML;
 import org.apache.sis.xml.Namespaces;
-import org.apache.sis.xml.MarshallerPool;
-import org.apache.sis.util.logging.WarningListener;
 import org.apache.sis.util.iso.SimpleInternationalString;
 import org.apache.sis.metadata.iso.citation.DefaultCitation;
 import org.apache.sis.metadata.iso.citation.DefaultCitationDate;
@@ -59,7 +54,7 @@ import static org.apache.sis.test.TestUt
  * @module
  */
 @DependsOn(org.apache.sis.internal.metadata.OtherLocalesTest.class)
-public final strictfp class DefaultMetadataTest extends XMLTestCase implements WarningListener<Object> {
+public final strictfp class DefaultMetadataTest extends XMLTestCase {
     /**
      * A flag for tracing workarounds for allowing some tests to pass despite regression.
      * This boolean should be set to {@code false} and removed after the following issues has been fixed:
@@ -71,55 +66,6 @@ public final strictfp class DefaultMetad
     public static final boolean REGRESSION = true;
 
     /**
-     * The resource key for the message of the warning that occurred while unmarshalling a XML fragment,
-     * or {@code null} if none.
-     */
-    private Object resourceKey;
-
-    /**
-     * The parameter of the warning that occurred while unmarshalling a XML fragment, or {@code null} if none.
-     */
-    private Object[] parameters;
-
-    /**
-     * For internal {@code DefaultMetadata} usage.
-     *
-     * @return {@code Object.class}.
-     */
-    @Override
-    public Class<Object> getSourceClass() {
-        return Object.class;
-    }
-
-    /**
-     * Invoked when a warning occurred while unmarshalling a test XML fragment. This method ensures that no other
-     * warning occurred before this method call (i.e. each test is allowed to cause at most one warning), then
-     * remember the warning parameters for verification by the test method.
-     *
-     * @param source   ignored.
-     * @param warning  the warning.
-     */
-    @Override
-    public void warningOccured(final Object source, final LogRecord warning) {
-        assertNull(resourceKey);
-        assertNull(parameters);
-        assertNotNull(resourceKey = warning.getMessage());
-        assertNotNull(parameters  = warning.getParameters());
-    }
-
-    /**
-     * Unmarshalls the given XML fragment.
-     */
-    private DefaultMetadata unmarshal(final String xml) throws JAXBException {
-        final MarshallerPool pool = getMarshallerPool();
-        final Unmarshaller unmarshaller = pool.acquireUnmarshaller();
-        unmarshaller.setProperty(XML.WARNING_LISTENER, this);
-        final Object c = unmarshal(unmarshaller, xml);
-        pool.recycle(unmarshaller);
-        return (DefaultMetadata) c;
-    }
-
-    /**
      * Tests unmarshalling of a metadata having a collection that contains no element.
      * This was used to cause a {@code NullPointerException} prior SIS-139 fix.
      *
@@ -129,7 +75,7 @@ public final strictfp class DefaultMetad
      */
     @Test
     public void testEmptyCollection() throws JAXBException {
-        final DefaultMetadata metadata = unmarshal(
+        final DefaultMetadata metadata = unmarshal(DefaultMetadata.class,
                 "<mdb:MD_Metadata xmlns:mdb=\"" + Namespaces.MDB + "\">\n" +
                 "  <mdb:contact/>\n" +
                 "</mdb:MD_Metadata>");
@@ -137,11 +83,6 @@ public final strictfp class DefaultMetad
          * Verify metadata property.
          */
         assertTrue(metadata.getContacts().isEmpty());
-        /*
-         * Verify warning message emitted during unmarshalling.
-         */
-        assertEquals("warning", "NullCollectionElement_1", resourceKey);
-        assertArrayEquals("warning", new String[] {"CheckedArrayList<Responsibility>"}, parameters);
     }
 
     /**

Modified: sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/MarshallingTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/MarshallingTest.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/MarshallingTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/MarshallingTest.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -55,7 +55,7 @@ import org.apache.sis.util.logging.Warni
 import org.apache.sis.measure.Units;
 import org.apache.sis.xml.XML;
 import org.apache.sis.xml.MarshallerPool;
-import org.apache.sis.internal.jaxb.gmx.Anchor;
+import org.apache.sis.internal.jaxb.gcx.Anchor;
 import org.apache.sis.internal.jaxb.metadata.replace.ReferenceSystemMetadata;
 import org.apache.sis.test.XMLTestCase;
 import org.junit.Test;

Modified: sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultResponsibilityTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultResponsibilityTest.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultResponsibilityTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/DefaultResponsibilityTest.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -23,7 +23,7 @@ import org.apache.sis.internal.jaxb.Lega
 import org.junit.Test;
 
 import static java.util.Collections.singleton;
-import static org.apache.sis.test.Assert.*;
+import static org.apache.sis.test.MetadataAssert.*;
 
 
 /**

Modified: sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/constraint/DefaultLegalConstraintsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/constraint/DefaultLegalConstraintsTest.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/constraint/DefaultLegalConstraintsTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/constraint/DefaultLegalConstraintsTest.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -16,20 +16,15 @@
  */
 package org.apache.sis.metadata.iso.constraint;
 
-import java.util.logging.LogRecord;
-import javax.xml.bind.Unmarshaller;
 import javax.xml.bind.JAXBException;
 import org.opengis.metadata.constraint.Restriction;
-import org.apache.sis.xml.XML;
 import org.apache.sis.xml.Namespaces;
-import org.apache.sis.xml.MarshallerPool;
-import org.apache.sis.util.logging.WarningListener;
 import org.apache.sis.internal.jaxb.LegacyNamespaces;
 import org.apache.sis.test.XMLTestCase;
 import org.junit.Test;
 
 import static java.util.Collections.singleton;
-import static org.apache.sis.test.Assert.*;
+import static org.apache.sis.test.MetadataAssert.*;
 import static org.apache.sis.test.TestUtilities.getSingleton;
 
 
@@ -42,56 +37,7 @@ import static org.apache.sis.test.TestUt
  * @since   0.4
  * @module
  */
-public final strictfp class DefaultLegalConstraintsTest extends XMLTestCase implements WarningListener<Object> {
-    /**
-     * The resource key for the message of the warning that occurred while unmarshalling a XML fragment,
-     * or {@code null} if none.
-     */
-    private Object resourceKey;
-
-    /**
-     * The parameter of the warning that occurred while unmarshalling a XML fragment, or {@code null} if none.
-     */
-    private Object[] parameters;
-
-    /**
-     * For internal {@code DefaultLegalConstraints} usage.
-     *
-     * @return {@code Object.class}.
-     */
-    @Override
-    public Class<Object> getSourceClass() {
-        return Object.class;
-    }
-
-    /**
-     * Invoked when a warning occurred while unmarshalling a test XML fragment. This method ensures that no other
-     * warning occurred before this method call (i.e. each test is allowed to cause at most one warning), then
-     * remember the warning parameters for verification by the test method.
-     *
-     * @param source   ignored.
-     * @param warning  the warning.
-     */
-    @Override
-    public void warningOccured(final Object source, final LogRecord warning) {
-        assertNull(resourceKey);
-        assertNull(parameters);
-        assertNotNull(resourceKey = warning.getMessage());
-        assertNotNull(parameters  = warning.getParameters());
-    }
-
-    /**
-     * Unmarshals the given XML fragment.
-     */
-    private DefaultLegalConstraints unmarshal(final String xml) throws JAXBException {
-        final MarshallerPool pool = getMarshallerPool();
-        final Unmarshaller unmarshaller = pool.acquireUnmarshaller();
-        unmarshaller.setProperty(XML.WARNING_LISTENER, this);
-        final Object c = unmarshal(unmarshaller, xml);
-        pool.recycle(unmarshaller);
-        return (DefaultLegalConstraints) c;
-    }
-
+public final strictfp class DefaultLegalConstraintsTest extends XMLTestCase {
     /**
      * Tests unmarshalling of an element containing an empty {@code codeListValue} attribute.
      * This was used to cause a {@code NullPointerException} prior SIS-157 fix.
@@ -102,7 +48,7 @@ public final strictfp class DefaultLegal
      */
     @Test
     public void testUnmarshallEmptyCodeListValue() throws JAXBException {
-        final DefaultLegalConstraints c = unmarshal(
+        final DefaultLegalConstraints c = unmarshal(DefaultLegalConstraints.class,
                 "<mco:MD_LegalConstraints xmlns:mco=\"" + Namespaces.MCO + "\">\n" +
                 "  <mco:accessConstraints>\n" +
                 "    <mco:MD_RestrictionCode codeListValue=\"intellectualPropertyRights\" codeList=\"http://standards.iso.org/iso/19115/resources/Codelist/cat/codelists.xml#MD_RestrictionCode\"/>\n" +
@@ -116,11 +62,6 @@ public final strictfp class DefaultLegal
          */
         assertEquals("accessConstraints", Restriction.INTELLECTUAL_PROPERTY_RIGHTS, getSingleton(c.getAccessConstraints()));
         assertTrue("useConstraints", c.getUseConstraints().isEmpty());
-        /*
-         * Verify warning message emitted during unmarshalling.
-         */
-        assertEquals("warning", "NullCollectionElement_1", resourceKey);
-        assertArrayEquals("warning", new String[] {"CodeListSet<Restriction>"}, parameters);
     }
 
     /**
@@ -145,7 +86,7 @@ public final strictfp class DefaultLegal
         final DefaultLegalConstraints c = new DefaultLegalConstraints();
         c.setUseConstraints(singleton(Restriction.LICENCE));
         assertXmlEquals(xml, marshal(c), "xmlns:*");
-        DefaultLegalConstraints actual = unmarshal(xml);
+        DefaultLegalConstraints actual = unmarshal(DefaultLegalConstraints.class, xml);
         assertSame(Restriction.LICENCE, getSingleton(actual.getUseConstraints()));
         assertEquals(c, actual);
         /*
@@ -163,7 +104,7 @@ public final strictfp class DefaultLegal
                 "</gmd:MD_LegalConstraints>\n";
 
         assertXmlEquals(xml, marshal(c, VERSION_2007), "xmlns:*");
-        actual = unmarshal(xml);
+        actual = unmarshal(DefaultLegalConstraints.class, xml);
         assertSame(Restriction.LICENCE, getSingleton(actual.getUseConstraints()));
         assertEquals(c, actual);
     }

Modified: sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/DefaultExtentTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/DefaultExtentTest.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/DefaultExtentTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/extent/DefaultExtentTest.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -29,7 +29,7 @@ import org.apache.sis.test.XMLTestCase;
 import org.apache.sis.test.DependsOn;
 import org.junit.Test;
 
-import static org.apache.sis.test.Assert.*;
+import static org.apache.sis.test.MetadataAssert.*;
 import static org.apache.sis.test.TestUtilities.date;
 
 

Modified: sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultBrowseGraphicTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultBrowseGraphicTest.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultBrowseGraphicTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultBrowseGraphicTest.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -33,7 +33,7 @@ import org.apache.sis.test.XMLTestCase;
 import org.apache.sis.test.DependsOnMethod;
 import org.junit.Test;
 
-import static org.apache.sis.test.Assert.*;
+import static org.apache.sis.test.MetadataAssert.*;
 import static java.util.Collections.singletonMap;
 
 

Modified: sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultRepresentativeFractionTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultRepresentativeFractionTest.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultRepresentativeFractionTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultRepresentativeFractionTest.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -25,7 +25,7 @@ import org.apache.sis.test.XMLTestCase;
 import org.apache.sis.test.DependsOnMethod;
 import org.junit.Test;
 
-import static org.apache.sis.test.Assert.*;
+import static org.apache.sis.test.MetadataAssert.*;
 
 
 /**

Modified: sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultResolutionTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultResolutionTest.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultResolutionTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultResolutionTest.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -29,7 +29,7 @@ import org.junit.After;
 import org.junit.Rule;
 import org.junit.Test;
 
-import static org.apache.sis.test.Assert.*;
+import static org.apache.sis.test.MetadataAssert.*;
 
 
 /**

Modified: sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/lineage/DefaultLineageTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/lineage/DefaultLineageTest.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/lineage/DefaultLineageTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/lineage/DefaultLineageTest.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -27,7 +27,7 @@ import org.apache.sis.test.TestUtilities
 import org.apache.sis.test.XMLTestCase;
 import org.junit.Test;
 
-import static org.apache.sis.test.Assert.*;
+import static org.apache.sis.test.MetadataAssert.*;
 
 
 /**

Modified: sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/quality/AbstractPositionalAccuracyTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/quality/AbstractPositionalAccuracyTest.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/quality/AbstractPositionalAccuracyTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/quality/AbstractPositionalAccuracyTest.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -20,7 +20,7 @@ import java.util.Locale;
 import javax.xml.bind.JAXBException;
 import org.opengis.metadata.quality.Result;
 import org.opengis.util.InternationalString;
-import org.apache.sis.xml.FreeTextMarshallingTest;
+import org.apache.sis.internal.jaxb.lan.FreeTextMarshallingTest;
 import org.apache.sis.util.Version;
 import org.apache.sis.test.XMLTestCase;
 import org.apache.sis.test.DependsOn;

Modified: sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/test/MetadataAssert.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/test/MetadataAssert.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/test/MetadataAssert.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/test/MetadataAssert.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -17,12 +17,17 @@
 package org.apache.sis.test;
 
 import java.util.Locale;
+import java.io.IOException;
+import org.xml.sax.SAXException;
+import javax.xml.parsers.ParserConfigurationException;
 import org.opengis.util.InternationalString;
 import org.opengis.metadata.citation.Citation;
 import org.opengis.referencing.IdentifiedObject;
 import org.apache.sis.io.wkt.Symbols;
 import org.apache.sis.io.wkt.WKTFormat;
 import org.apache.sis.io.wkt.Convention;
+import org.apache.sis.xml.Namespaces;
+import org.apache.sis.internal.jaxb.LegacyNamespaces;
 
 // Branch-specific imports
 import org.opengis.metadata.citation.Responsibility;
@@ -33,7 +38,7 @@ import org.opengis.metadata.citation.Res
  * from other modules and libraries.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.0
  * @since   0.4
  * @module
  */
@@ -154,4 +159,100 @@ public strictfp class MetadataAssert ext
             }
         }
     }
+
+    /**
+     * Parses two XML trees as DOM documents, and compares the nodes.
+     * The inputs given to this method can be any of the following types:
+     *
+     * <ul>
+     *   <li>{@link org.w3c.dom.Node}: used directly without further processing.</li>
+     *   <li>{@link java.io.File}, {@link java.net.URL} or {@link java.net.URI}: the
+     *       stream is opened and parsed as a XML document.</li>
+     *   <li>{@link String}: The string content is parsed directly as a XML document.</li>
+     * </ul>
+     *
+     * The comparison will ignore comments and the optional attributes given in arguments.
+     *
+     * <div class="section">Ignored attributes substitution</div>
+     * For convenience, this method replaces some well known prefixes in the {@code ignoredAttributes}
+     * array by their full namespace URLs. For example this method replaces{@code "xsi:schemaLocation"}
+     * by {@code "http://www.w3.org/2001/XMLSchema-instance:schemaLocation"}.
+     * If such substitution is not desired, consider using {@link XMLComparator} directly instead.
+     *
+     * <p>The current substitution map is as below (may be expanded in any future SIS version):</p>
+     *
+     * <table class="sis">
+     *   <caption>Predefined prefix mapping</caption>
+     *   <tr><th>Prefix</th> <th>URL</th></tr>
+     *   <tr><td>xmlns</td>  <td>{@code "http://www.w3.org/2000/xmlns"}</td></tr>
+     *   <tr><td>xlink</td>  <td>{@value Namespaces#XLINK}</td></tr>
+     *   <tr><td>xsi</td>    <td>{@value Namespaces#XSI}</td></tr>
+     *   <tr><td>gml</td>    <td>{@value Namespaces#GML}</td></tr>
+     *   <tr><td>gco</td>    <td>{@value Namespaces#GCO}</td></tr>
+     *   <tr><td>gmd</td>    <td>{@value LegacyNamespaces#GMD}</td></tr>
+     *   <tr><td>gmx</td>    <td>{@value LegacyNamespaces#GMX}</td></tr>
+     *   <tr><td>gmi</td>    <td>{@value LegacyNamespaces#GMI}</td></tr>
+     * </table>
+     *
+     * <p>For example in order to ignore the namespace, type and schema location declaration,
+     * the following strings can be given to the {@code ignoredAttributes} argument:</p>
+     *
+     * {@preformat text
+     *   "xmlns:*", "xsi:schemaLocation", "xsi:type"
+     * }
+     *
+     * @param  expected           the expected XML document.
+     * @param  actual             the XML document to compare.
+     * @param  ignoredAttributes  the fully-qualified names of attributes to ignore
+     *                            (typically {@code "xmlns:*"} and {@code "xsi:schemaLocation"}).
+     *
+     * @see XMLComparator
+     */
+    public static void assertXmlEquals(final Object expected, final Object actual, final String... ignoredAttributes) {
+        assertXmlEquals(expected, actual, TestCase.STRICT, null, ignoredAttributes);
+    }
+
+    /**
+     * Parses two XML trees as DOM documents, and compares the nodes with the given tolerance
+     * threshold for numerical values. The inputs given to this method can be any of the types
+     * documented {@linkplain #assertXmlEquals(Object, Object, String[]) above}. This method
+     * will ignore comments and the optional attributes given in arguments as documented in the
+     * above method.
+     *
+     * @param  expected           the expected XML document.
+     * @param  actual             the XML document to compare.
+     * @param  tolerance          the tolerance threshold for comparison of numerical values.
+     * @param  ignoredNodes       the fully-qualified names of the nodes to ignore, or {@code null} if none.
+     * @param  ignoredAttributes  the fully-qualified names of attributes to ignore
+     *                            (typically {@code "xmlns:*"} and {@code "xsi:schemaLocation"}).
+     *
+     * @see XMLComparator
+     */
+    public static void assertXmlEquals(final Object expected, final Object actual,
+            final double tolerance, final String[] ignoredNodes, final String[] ignoredAttributes)
+    {
+        final XMLComparator comparator;
+        try {
+            comparator = new XMLComparator(expected, actual);
+        } catch (IOException | ParserConfigurationException | SAXException e) {
+            // We don't throw directly those exceptions since failing to parse the XML file can
+            // be considered as part of test failures and the JUnit exception for such failures
+            // is AssertionError. Having no checked exception in "assert" methods allow us to
+            // declare the checked exceptions only for the library code being tested.
+            throw new AssertionError(e);
+        }
+        comparator.tolerance = tolerance;
+        comparator.ignoreComments = true;
+        if (ignoredNodes != null) {
+            for (final String node : ignoredNodes) {
+                comparator.ignoredNodes.add(XMLComparator.substitutePrefix(node));
+            }
+        }
+        if (ignoredAttributes != null) {
+            for (final String attribute : ignoredAttributes) {
+                comparator.ignoredAttributes.add(XMLComparator.substitutePrefix(attribute));
+            }
+        }
+        comparator.compare();
+    }
 }

Modified: sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -25,7 +25,7 @@ import org.junit.BeforeClass;
  * All tests from the {@code sis-metadata} module, in approximative dependency order.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 0.8
+ * @version 1.0
  * @since   0.3
  * @module
  */
@@ -56,15 +56,46 @@ import org.junit.BeforeClass;
     org.apache.sis.internal.metadata.MergerTest.class,
 
     // XML marshalling.
-    org.apache.sis.internal.jaxb.code.EnumMarshallingTest.class,
-    org.apache.sis.internal.jaxb.code.CodeListMarshallingTest.class,
-    org.apache.sis.internal.jaxb.code.PT_LocaleTest.class,
-    org.apache.sis.xml.FreeTextMarshallingTest.class,
+    org.apache.sis.internal.test.XMLComparatorTest.class,
+    org.apache.sis.xml.NamespacesTest.class,
+    org.apache.sis.xml.XLinkTest.class,
+    org.apache.sis.xml.NilReasonTest.class,
+    org.apache.sis.xml.LegacyCodesTest.class,
+    org.apache.sis.xml.ValueConverterTest.class,
+    org.apache.sis.xml.OGCNamespacePrefixMapperTest.class,
+    org.apache.sis.xml.MarshallerPoolTest.class,
+    org.apache.sis.xml.TransformingNamespacesTest.class,
+    org.apache.sis.internal.jaxb.XmlUtilitiesTest.class,
+    org.apache.sis.internal.jaxb.IdentifierMapAdapterTest.class,
+    org.apache.sis.internal.jaxb.ModifiableIdentifierMapTest.class,
+    org.apache.sis.internal.jaxb.gco.StringAdapterTest.class,
+    org.apache.sis.internal.jaxb.gco.PropertyTypeTest.class,
+    org.apache.sis.internal.jaxb.lan.PT_LocaleTest.class,
+    org.apache.sis.internal.jaxb.lan.LanguageCodeTest.class,
+    org.apache.sis.internal.jaxb.lan.FreeTextMarshallingTest.class,
+    org.apache.sis.internal.jaxb.cat.EnumAdapterTest.class,
+    org.apache.sis.internal.jaxb.cat.EnumMarshallingTest.class,
+    org.apache.sis.internal.jaxb.cat.CodeListMarshallingTest.class,
+    org.apache.sis.internal.jaxb.gml.TimePeriodTest.class,
+    org.apache.sis.internal.jaxb.gml.MeasureTest.class,
     org.apache.sis.xml.NilReasonMarshallingTest.class,
     org.apache.sis.xml.CharSequenceSubstitutionTest.class,
     org.apache.sis.xml.UUIDMarshallingTest.class,
     org.apache.sis.xml.XLinkMarshallingTest.class,
 
+    // GeoAPI most basic types.
+    org.apache.sis.internal.simple.SimpleIdentifierTest.class,
+    org.apache.sis.util.iso.TypesTest.class,
+    org.apache.sis.util.iso.DefaultLocalNameTest.class,
+    org.apache.sis.util.iso.DefaultScopedNameTest.class,
+    org.apache.sis.util.iso.DefaultNameFactoryTest.class,
+    org.apache.sis.util.iso.NamesTest.class,
+    org.apache.sis.util.iso.TypeNamesTest.class,
+    org.apache.sis.util.iso.DefaultRecordTypeTest.class,
+    org.apache.sis.util.iso.DefaultRecordSchemaTest.class,
+    org.apache.sis.util.iso.DefaultRecordTest.class,
+    org.apache.sis.util.iso.NameMarshallingTest.class,
+
     // ISO implementations.
     org.apache.sis.metadata.iso.citation.DefaultContactTest.class,
     org.apache.sis.metadata.iso.citation.DefaultResponsibilityTest.class,

Modified: sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/xml/CharSequenceSubstitutionTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/xml/CharSequenceSubstitutionTest.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/xml/CharSequenceSubstitutionTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/xml/CharSequenceSubstitutionTest.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -29,7 +29,7 @@ import org.apache.sis.test.DependsOnMeth
 import org.apache.sis.test.XMLTestCase;
 import org.junit.Test;
 
-import static org.apache.sis.test.Assert.*;
+import static org.apache.sis.test.MetadataAssert.*;
 
 
 /**

Modified: sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/xml/XLinkMarshallingTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/xml/XLinkMarshallingTest.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/xml/XLinkMarshallingTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-metadata/src/test/java/org/apache/sis/xml/XLinkMarshallingTest.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -29,7 +29,7 @@ import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.XMLTestCase;
 import org.junit.Test;
 
-import static org.apache.sis.test.Assert.*;
+import static org.apache.sis.test.MetadataAssert.*;
 import static org.apache.sis.test.TestUtilities.getSingleton;
 
 
@@ -44,7 +44,7 @@ import static org.apache.sis.test.TestUt
  * @since 0.4
  * @module
  */
-@DependsOn(NilReasonMarshallingTest.class)
+@DependsOn({XLinkTest.class, NilReasonMarshallingTest.class})
 public final strictfp class XLinkMarshallingTest extends XMLTestCase {
     /**
      * A XML with a {@code xlink:href} without element definition.

Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractDirectPosition.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -35,6 +35,10 @@ import org.apache.sis.util.Utilities;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.internal.util.Numerics;
+import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.WKTUtilities;
+import org.apache.sis.io.wkt.FormattableObject;
+import org.apache.sis.io.wkt.Formatter;
 
 import static java.lang.Double.doubleToLongBits;
 import static org.apache.sis.util.StringBuilders.trimFractionalPart;
@@ -53,11 +57,11 @@ import static org.apache.sis.util.Argume
  * serializable, is left to subclasses.</p>
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
- * @version 0.3
+ * @version 1.0
  * @since   0.3
  * @module
  */
-public abstract class AbstractDirectPosition implements DirectPosition {
+public abstract class AbstractDirectPosition extends FormattableObject implements DirectPosition {
     /**
      * Constructs a direct position.
      */
@@ -65,6 +69,24 @@ public abstract class AbstractDirectPosi
     }
 
     /**
+     * Returns the given position as an {@code AbstractDirectPosition} instance.
+     * If the given position is already an instance of {@code AbstractDirectPosition},
+     * then it is returned unchanged. Otherwise the coordinate values and the CRS
+     * of the given position are copied in a new position.
+     *
+     * @param  position  the position to cast, or {@code null}.
+     * @return the values of the given position as an {@code AbstractDirectPosition} instance.
+     *
+     * @since 1.0
+     */
+    public static AbstractDirectPosition castOrCopy(final DirectPosition position) {
+        if (position == null || position instanceof AbstractDirectPosition) {
+            return (AbstractDirectPosition) position;
+        }
+        return new GeneralDirectPosition(position);
+    }
+
+    /**
      * Returns always {@code this}, the direct position for this
      * {@linkplain org.opengis.geometry.coordinate.Position position}.
      *
@@ -181,22 +203,28 @@ public abstract class AbstractDirectPosi
     }
 
     /**
-     * Returns {@code true} if every values in the given {@code double} array could be casted
-     * to the {@code float} type without precision lost. This method treats all {@code NaN} values
-     * as equal.
-     *
-     * @param  values  the value to test for their precision.
-     * @return {@code true} if every values can be casted to the {@code float} type without precision lost.
-     *
-     * @see #toString(DirectPosition, boolean)
-     */
-    static boolean isSimplePrecision(final double... values) {
-        for (final double value : values) {
-            if (Double.doubleToLongBits(value) != Double.doubleToLongBits((float) value)) {
-                return false;
-            }
-        }
-        return true;
+     * Formats this position in the <cite>Well Known Text</cite> (WKT) format.
+     * The format is like below, where {@code x₀}, {@code x₁}, {@code x₂}, <i>etc.</i>
+     * are the ordinate values at index 0, 1, 2, <i>etc.</i>:
+     *
+     * {@preformat wkt
+     *   POINT[x₀ x₁ x₂ …]
+     * }
+     *
+     * If the coordinate reference system is geodetic or projected, then coordinate values are formatted
+     * with a precision equivalent to one centimetre on Earth (the actual number of fraction digits is
+     * adjusted for the axis unit of measurement and the planet size if different than Earth).
+     *
+     * @param  formatter  the formatter where to format the inner content of this point.
+     * @return the WKT keyword, which is {@code "Point"} for this element.
+     *
+     * @since 1.0
+     */
+    @Override
+    protected String formatTo(final Formatter formatter) {
+        final double[][] points = new double[][] {getCoordinate()};
+        formatter.append(points, WKTUtilities.suggestFractionDigits(getCoordinateReferenceSystem(), points));
+        return WKTKeywords.Point;
     }
 
     /**
@@ -208,10 +236,11 @@ public abstract class AbstractDirectPosi
      *   POINT(x₀ x₁ x₂ …)
      * }
      *
+     * This method formats the numbers as with {@link Double#toString(double)} (i.e. without fixed number of fraction digits).
      * The string returned by this method can be {@linkplain GeneralDirectPosition#GeneralDirectPosition(CharSequence) parsed}
      * by the {@code GeneralDirectPosition} constructor.
      *
-     * @return This position as a {@code POINT} in <cite>Well Known Text</cite> (WKT) format.
+     * @return this position as a {@code POINT} in <cite>Well Known Text</cite> (WKT) format.
      */
     @Override
     public String toString() {
@@ -227,7 +256,7 @@ public abstract class AbstractDirectPosi
      * @param  isSimplePrecision  {@code true} if every ordinate values can be casted to {@code float}.
      * @return the point as a {@code POINT} in WKT format.
      *
-     * @see #isSimplePrecision(double[])
+     * @see Numerics#isSimplePrecision(double[])
      */
     static String toString(final DirectPosition position, final boolean isSimplePrecision) {
         final StringBuilder buffer = new StringBuilder(32).append("POINT");

Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractEnvelope.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractEnvelope.java?rev=1826327&r1=1826326&r2=1826327&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractEnvelope.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/geometry/AbstractEnvelope.java [UTF-8] Fri Mar  9 11:00:27 2018
@@ -40,6 +40,9 @@ import org.apache.sis.util.Emptiable;
 import org.apache.sis.util.Utilities;
 import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.util.resources.Errors;
+import org.apache.sis.io.wkt.Formatter;
+import org.apache.sis.io.wkt.FormattableObject;
+import org.apache.sis.internal.referencing.WKTUtilities;
 
 import static java.lang.Double.doubleToLongBits;
 import static org.apache.sis.internal.util.Numerics.SIGN_BIT_MASK;
@@ -109,12 +112,12 @@ import static org.apache.sis.math.MathFu
  * </ul>
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
- * @version 0.8
+ * @version 1.0
  * @since   0.3
  * @module
  */
 @XmlTransient
-public abstract class AbstractEnvelope implements Envelope, Emptiable {
+public abstract class AbstractEnvelope extends FormattableObject implements Envelope, Emptiable {
     /**
      * An empty array of envelopes, to be returned by {@link #toSimpleEnvelopes()}
      * when en envelope is empty.
@@ -692,6 +695,7 @@ public abstract class AbstractEnvelope i
 
     /**
      * Tests if a specified coordinate is inside the boundary of this envelope.
+     * Both lower and upper values of this envelope are considered inclusive.
      * If it least one ordinate value in the given point is {@link Double#NaN NaN},
      * then this method returns {@code false}.
      *
@@ -707,7 +711,7 @@ public abstract class AbstractEnvelope i
      *
      * @param  position  the point to text.
      * @return {@code true} if the specified coordinate is inside the boundary of this envelope; {@code false} otherwise.
-     * @throws MismatchedDimensionException if the specified point doesn't have the expected dimension.
+     * @throws MismatchedDimensionException if the specified point does not have the expected number of dimensions.
      * @throws AssertionError if assertions are enabled and the envelopes have mismatched CRS.
      */
     public boolean contains(final DirectPosition position) throws MismatchedDimensionException {
@@ -1133,6 +1137,7 @@ public abstract class AbstractEnvelope i
      * The {@code BOX} element is not part of the standard <cite>Well Known Text</cite> (WKT) format.
      * However it is understood by many software libraries, for example GDAL and PostGIS.</div>
      *
+     * This method formats the numbers as with {@link Double#toString(double)} (i.e. without fixed number of fraction digits).
      * The string returned by this method can be {@linkplain GeneralEnvelope#GeneralEnvelope(CharSequence) parsed}
      * by the {@code GeneralEnvelope} constructor.
      *
@@ -1185,6 +1190,41 @@ public abstract class AbstractEnvelope i
     }
 
     /**
+     * Formats this envelope as a "{@code BOX}" element.
+     * The output is of the form "{@code BOX}<var>n</var>{@code D[}{@linkplain #getLowerCorner()
+     * lower corner}{@code ,}{@linkplain #getUpperCorner() upper corner}{@code ]}"
+     * where <var>n</var> is the {@linkplain #getDimension() number of dimensions}.
+     * The number of dimension is written only if different than 2.
+     *
+     * <div class="note"><b>Note:</b>
+     * The {@code BOX} element is not part of the standard <cite>Well Known Text</cite> (WKT) format.
+     * However it is understood by many software libraries, for example GDAL and PostGIS.</div>
+     *
+     * If the coordinate reference system is geodetic or projected, then coordinate values are formatted
+     * with a precision equivalent to one centimetre on Earth (the actual number of fraction digits is
+     * adjusted for the axis unit of measurement and the planet size if different than Earth).
+     *
+     * @param  formatter  the formatter where to format the inner content of this envelope.
+     * @return the pseudo-WKT keyword, which is {@code "Box"} for this element.
+     *
+     * @since 1.0
+     */
+    @Override
+    protected String formatTo(final Formatter formatter) {
+        final double[][] points = new double[][] {
+            getLowerCorner().getCoordinate(),
+            getUpperCorner().getCoordinate()
+        };
+        formatter.append(points, WKTUtilities.suggestFractionDigits(getCoordinateReferenceSystem(), points));
+        final int dimension = getDimension();
+        String keyword = "Box";
+        if (dimension != 2) {
+            keyword = new StringBuilder(keyword).append(dimension).append('D').toString();
+        }
+        return keyword;
+    }
+
+    /**
      * Base class for unmodifiable direct positions backed by the enclosing envelope.
      * Subclasses must override the {@link #getOrdinate(int)} method in order to delegate
      * the work to the appropriate {@link AbstractEnvelope} method.



Mime
View raw message