sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1707366 - in /sis/branches/JDK8/core: sis-referencing/src/main/java/org/apache/sis/referencing/ sis-referencing/src/test/java/org/apache/sis/referencing/ sis-utility/src/main/java/org/apache/sis/internal/jaxb/ sis-utility/src/main/java/org...
Date Wed, 07 Oct 2015 19:38:33 GMT
Author: desruisseaux
Date: Wed Oct  7 19:38:33 2015
New Revision: 1707366

URL: http://svn.apache.org/viewvc?rev=1707366&view=rev
Log:
Ensure that gml:id in all AbstractIdentifiedObject subtypes are unique in a XML document.

Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/GMLAdapter.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/package-info.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/xml/XLink.java
    sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gco/StringAdapterTest.java

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java?rev=1707366&r1=1707365&r2=1707366&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/AbstractIdentifiedObject.java
[UTF-8] Wed Oct  7 19:38:33 2015
@@ -41,6 +41,7 @@ import org.opengis.referencing.ObjectFac
 import org.opengis.referencing.AuthorityFactory;
 import org.opengis.referencing.IdentifiedObject;
 import org.apache.sis.internal.metadata.NameMeaning;
+import org.apache.sis.internal.jaxb.Context;
 import org.apache.sis.internal.jaxb.referencing.Code;
 import org.apache.sis.internal.util.Numerics;
 import org.apache.sis.internal.util.UnmodifiableArrayList;
@@ -121,7 +122,7 @@ import java.util.Objects;
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4
- * @version 0.6
+ * @version 0.7
  * @module
  */
 @XmlType(name="IdentifiedObjectType", propOrder={
@@ -495,32 +496,50 @@ public class AbstractIdentifiedObject ex
     @XmlAttribute(name = "id", namespace = Namespaces.GML, required = true)
     @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
     final String getID() {
-        final StringBuilder id = new StringBuilder();
-        /*
-         * We will iterate over the identifiers first. Only after the iteration is over,
-         * if we found no suitable ID, then we will use the primary name as a last resort.
-         */
-        if (identifiers != null) {
-            for (final Identifier identifier : identifiers) {
-                if (appendUnicodeIdentifier(id, '-', identifier.getCodeSpace(), ":", true)
| // Really |, not ||
-                    appendUnicodeIdentifier(id, '-', NameMeaning.toObjectType(getClass()),
":", false) |
-                    appendUnicodeIdentifier(id, '-', identifier.getCode(), ":", true))
-                {
-                    /*
-                     * TODO: If we want to check for ID uniqueness or any other condition
before to accept the ID,
-                     * we would do that here. If the ID is rejected, then we just need to
clear the buffer and let
-                     * the iteration continue the search for an other ID.
-                     */
-                    return id.toString();
+        final Context context = Context.current();
+        String candidate = Context.getExistingID(context, this);
+        if (candidate == null) {
+            final StringBuilder id = new StringBuilder();
+            /*
+             * We will iterate over the identifiers first. Only after the iteration is over,
+             * if we found no suitable ID, then we will use the primary name as a last resort.
+             */
+            if (identifiers != null) {
+                for (final Identifier identifier : identifiers) {
+                    if (appendUnicodeIdentifier(id, '-', identifier.getCodeSpace(), ":",
true) | // Really |, not ||
+                        appendUnicodeIdentifier(id, '-', NameMeaning.toObjectType(getClass()),
":", false) |
+                        appendUnicodeIdentifier(id, '-', identifier.getCode(), ":", true))
+                    {
+                        /*
+                         * Check for ID uniqueness. If the ID is rejected, then we just need
to clear
+                         * the buffer and let the iteration continue the search for another
ID.
+                         */
+                        candidate = id.toString();
+                        if (Context.isAvailableID(context, this, candidate)) {
+                            return candidate;
+                        }
+                    }
+                    id.setLength(0);    // Clear the buffer for another try.
+                }
+            }
+            /*
+             * In last ressort, append code without codespace since the name are often verbose.
+             * If that name is also used, append a number until we find a free ID.
+             */
+            if (name != null && appendUnicodeIdentifier(id, '-', name.getCode(),
":", false)) {
+                candidate = id.toString();
+                if (!Context.isAvailableID(context, this, candidate)) {
+                    final int s = id.append('-').length();
+                    int n = 0;
+                    do {
+                        if (++n == 100) return null;    //  Arbitrary limit.
+                        candidate = id.append(n).toString();
+                        id.setLength(s);
+                    } while (!Context.isAvailableID(context, this, candidate));
                 }
-                id.setLength(0); // Clear the buffer for an other try.
             }
         }
-        // In last ressort, append code without codespace since the name are often verbose.
-        if (name != null && appendUnicodeIdentifier(id, '-', name.getCode(), ":",
false)) {
-            return id.toString();
-        }
-        return null;
+        return candidate;
     }
 
     /**

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java?rev=1707366&r1=1707365&r2=1707366&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/AbstractIdentifiedObjectTest.java
[UTF-8] Wed Oct  7 19:38:33 2015
@@ -27,6 +27,7 @@ import org.opengis.metadata.Identifier;
 import org.apache.sis.metadata.iso.ImmutableIdentifier;
 import org.apache.sis.referencing.datum.AbstractDatum;
 import org.apache.sis.internal.jaxb.referencing.Code;
+import org.apache.sis.internal.jaxb.Context;
 import org.apache.sis.test.DependsOnMethod;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
@@ -42,7 +43,7 @@ import static org.apache.sis.metadata.is
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.7
  * @module
  */
 @DependsOn({
@@ -99,6 +100,7 @@ public final strictfp class AbstractIden
      * This is invalid and should thrown an exception.
      */
     @Test
+    @SuppressWarnings("ResultOfObjectAllocationIgnored")
     public void testMissingName() {
         final Map<String,Object> properties = new HashMap<>(4);
         assertNull(properties.put(AbstractIdentifiedObject.REMARKS_KEY, "Not a name."));
@@ -194,6 +196,35 @@ public final strictfp class AbstractIden
     }
 
     /**
+     * Tests two {@code AbstractIdentifiedObject} declaring the same identifier in the same
XML document.
+     * The {@code getID()} method should detect the collision and select different identifier.
+     *
+     * @since 0.7
+     */
+    @Test
+    @DependsOnMethod("testWithManyIdentifiers")
+    public void testIdentifierCollision() {
+        final Map<String,Object> properties = new HashMap<>(4);
+        assertNull(properties.put("name", "GRS 1980"));
+        assertNull(properties.put("identifiers", new NamedIdentifier(EPSG, "7019")));
+        final AbstractIdentifiedObject o1 = new AbstractIdentifiedObject(properties);
+        final AbstractIdentifiedObject o2 = new AbstractIdentifiedObject(properties);
+        final AbstractIdentifiedObject o3 = new AbstractIdentifiedObject(properties);
+        final Context context = new Context(0, null, null, null, null, null, null, null);
+        try {
+            final String c1, c2, c3;
+            assertEquals("o1", "epsg-7019", c1 = o1.getID());
+            assertEquals("o2", "GRS1980",   c2 = o2.getID());
+            assertEquals("o3", "GRS1980-1", c3 = o3.getID());
+            assertSame  ("o1", c1, o1.getID());  // Verify that values are remembered.
+            assertSame  ("o2", c2, o2.getID());
+            assertSame  ("o3", c3, o3.getID());
+        } finally {
+            context.finish();
+        }
+    }
+
+    /**
      * Tests serialization.
      */
     @Test

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java?rev=1707366&r1=1707365&r2=1707366&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/Context.java
[UTF-8] Wed Oct  7 19:38:33 2015
@@ -17,8 +17,12 @@
 package org.apache.sis.internal.jaxb;
 
 import java.util.Map;
+import java.util.Deque;
+import java.util.HashMap;
+import java.util.IdentityHashMap;
 import java.util.Locale;
 import java.util.TimeZone;
+import java.util.LinkedList;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 import java.util.logging.LogRecord;
@@ -32,6 +36,7 @@ import org.apache.sis.util.resources.Ind
 import org.apache.sis.internal.jaxb.gco.PropertyType;
 import org.apache.sis.internal.system.Semaphores;
 import org.apache.sis.internal.system.Loggers;
+import org.apache.sis.xml.IdentifierSpace;
 import org.apache.sis.xml.MarshalContext;
 import org.apache.sis.xml.ValueConverter;
 import org.apache.sis.xml.ReferenceResolver;
@@ -41,12 +46,12 @@ import org.apache.sis.xml.ReferenceResol
  * Thread-local status of a marshalling or unmarshalling processes.
  * All non-static methods in this class except {@link #finish()} are implementation of public
API.
  * All static methods are internal API. Those methods expect a {@code Context} instance as
their first argument.
- * They should be though as if they were normal member methods, except that they accept {@code
null} instance
+ * They can be though as if they were normal member methods, except that they accept {@code
null} instance
  * if no (un)marshalling is in progress.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.6
+ * @version 0.7
  * @module
  */
 public final class Context extends MarshalContext {
@@ -109,9 +114,9 @@ public final class Context extends Marsh
     private int bitMasks;
 
     /**
-     * The locale to use for marshalling, or {@code null} if no locale were explicitly specified.
+     * The locale to use for marshalling, or an empty queue if no locale were explicitly
specified.
      */
-    private Locale locale;
+    private final Deque<Locale> locales;
 
     /**
      * The timezone, or {@code null} if unspecified.
@@ -142,6 +147,24 @@ public final class Context extends Marsh
     private final ValueConverter converter;
 
     /**
+     * The objects associated to XML identifiers. At marhalling time, this is used for avoiding
duplicated identifiers
+     * in the same XML document. At unmarshalling time, this is used for getting a previous
object from its identifier.
+     *
+     * @since 0.7
+     */
+    private final Map<String,Object> identifiers;
+
+    /**
+     * The identifiers used for marshalled objects. This is the converse of {@link #identifiers},
used in order to
+     * identify which {@code gml:id} to use for the given object. The {@code gml:id} to use
are not necessarily the
+     * same than the one associated to {@link IdentifierSpace#ID} if the identifier was already
used for another
+     * object in the same XML document.
+     *
+     * @since 0.7
+     */
+    private final Map<Object,String> identifiedObjects;
+
+    /**
      * The object to inform about warnings, or {@code null} if none.
      */
     private final WarningListener<?> warningListener;
@@ -160,7 +183,7 @@ public final class Context extends Marsh
 
     /**
      * The context which was previously used. This form a linked list allowing to push properties
-     * (e.g. {@link #push(Locale)}) and pull back the context to its previous state once
finished.
+     * and pull back the context to its previous state once finished.
      */
     private final Context previous;
 
@@ -193,50 +216,25 @@ public final class Context extends Marsh
                    final ReferenceResolver  resolver, final ValueConverter converter,
                    final WarningListener<?> warningListener)
     {
-        this.bitMasks        = bitMasks;
-        this.locale          = locale;
-        this.timezone        = timezone;
-        this.schemas         = schemas; // No clone, because this class is internal.
-        this.versionGML      = versionGML;
-        this.resolver        = resolver;
-        this.converter       = converter;
-        this.warningListener = warningListener;
+        this.bitMasks          = bitMasks;
+        this.locales           = new LinkedList<>();
+        this.timezone          = timezone;
+        this.schemas           = schemas; // No clone, because this class is internal.
+        this.versionGML        = versionGML;
+        this.resolver          = resolver;
+        this.converter         = converter;
+        this.warningListener   = warningListener;
+        this.identifiers       = new HashMap<>();
+        this.identifiedObjects = new IdentityHashMap<>();
         if ((bitMasks & MARSHALLING) != 0) {
             if (!Semaphores.queryAndSet(Semaphores.NULL_COLLECTION)) {
                 this.bitMasks |= CLEAR_SEMAPHORE;
             }
         }
-        previous = current();
-        CURRENT.set(this);
-    }
-
-    /**
-     * Inherits all configuration from the previous context, if any.
-     *
-     * @param previous The context from which to inherit the configuration, or {@code null}.
-     *
-     * @see #push(Locale)
-     */
-    @SuppressWarnings("ThisEscapedInObjectConstruction")
-    private Context(final Context previous) {
-        if (previous != null) {
-            bitMasks        = previous.bitMasks;
-            locale          = previous.locale;
-            timezone        = previous.timezone;
-            schemas         = previous.schemas;
-            versionGML      = previous.versionGML;
-            resolver        = previous.resolver;
-            converter       = previous.converter;
-            warningListener = previous.warningListener;
-        } else {
-            timezone        = null;
-            schemas         = null;
-            versionGML      = null;
-            resolver        = null;
-            converter       = null;
-            warningListener = null;
+        if (locale != null) {
+            locales.add(locale);
         }
-        this.previous = previous;
+        previous = CURRENT.get();
         CURRENT.set(this);
     }
 
@@ -247,7 +245,7 @@ public final class Context extends Marsh
      */
     @Override
     public final Locale getLocale() {
-        return locale;
+        return locales.peekLast();
     }
 
     /**
@@ -275,12 +273,18 @@ public final class Context extends Marsh
         return null;
     }
 
-    /*
-     * ---- END OF PUBLIC API --------------------------------------------------------------
-     *
-     * Following are internal API. They are provided as static methods with a Context
-     * argument rather than normal member methods in order to accept null context.
-     */
+
+
+
+    ////////////////////////////////////////////////////////////////////////////////////////
+    ////////                                                                        ////////
+    ////////    END OF PUBLIC (non-internal) API.                                   ////////
+    ////////                                                                        ////////
+    ////////    Following are internal API. They are provided as static methods     ////////
+    ////////    with a Context argument rather than normal member methods           ////////
+    ////////    in order to accept null context.                                    ////////
+    ////////                                                                        ////////
+    ////////////////////////////////////////////////////////////////////////////////////////
 
     /**
      * Returns the context of the XML (un)marshalling currently progressing in the current
thread,
@@ -293,6 +297,45 @@ public final class Context extends Marsh
     }
 
     /**
+     * Sets the locale to the given value. The old locales are remembered and will
+     * be restored by the next call to {@link #pull()}. This method can be invoked
+     * when marshalling object that need to marshall their children in a different
+     * locale, like below:
+     *
+     * {@preformat java
+     *     private void beforeMarshal(Marshaller marshaller) {
+     *         Context.push(language);
+     *     }
+     *
+     *     private void afterMarshal(Marshaller marshaller) {
+     *         Context.pull();
+     *     }
+     * }
+     *
+     * @param locale The locale to set, or {@code null}.
+     */
+    public static void push(Locale locale) {
+        final Context current = current();
+        if (current != null) {
+            if (locale == null) {
+                locale = current.getLocale();
+            }
+            current.locales.addLast(locale);
+        }
+    }
+
+    /**
+     * Restores the locale which was used prior the call to {@link #push(Locale)}.
+     * It is not necessary to invoke this method in a {@code finally} block.
+     */
+    public static void pull() {
+        final Context current = current();
+        if (current != null) {
+            current.locales.removeLast();
+        }
+    }
+
+    /**
      * Returns {@code true} if the given flag is set.
      *
      * @param  context The current context, or {@code null} if none.
@@ -305,6 +348,30 @@ public final class Context extends Marsh
     }
 
     /**
+     * Returns {@code true} if the GML version is equals or newer than the specified version.
+     * If no GML version were specified, then this method returns {@code true}, i.e. newest
+     * version is assumed.
+     *
+     * <div class="note"><b>API note:</b>
+     * This method is static for the convenience of performing the check for null context.</div>
+     *
+     * @param  context The current context, or {@code null} if none.
+     * @param  version The version to compare to.
+     * @return {@code true} if the GML version is equals or newer than the specified version.
+     *
+     * @see #getVersion(String)
+     */
+    public static boolean isGMLVersion(final Context context, final Version version) {
+        if (context != null) {
+            final Version versionGML = context.versionGML;
+            if (versionGML != null) {
+                return versionGML.compareTo(version) >= 0;
+            }
+        }
+        return true;
+    }
+
+    /**
      * Returns the base URL of ISO 19139 (or other standards) schemas.
      * The valid values are documented in the {@link org.apache.sis.xml.XML#SCHEMAS} property.
      * If the returned value is not empty, then this method guarantees it ends with {@code
'/'}.
@@ -389,24 +456,41 @@ public final class Context extends Marsh
     }
 
     /**
-     * Returns {@code true} if the GML version is equals or newer than the specified version.
-     * If no GML version were specified, then this method returns {@code true}, i.e. newest
-     * version is assumed.
+     * If a {@code gml:id} value has already been used for the given object in the current
XML document,
+     * returns that identifier. Otherwise returns {@code null}.
      *
-     * <div class="note"><b>API note:</b>
-     * This method is static for the convenience of performing the check for null context.</div>
+     * @param  context The current context, or {@code null} if none.
+     * @param  object  The object for which to get the {@code gml:id}.
+     * @return The identifier used in the current XML document for the given object, or {@code
null} if none.
+     *
+     * @since 0.7
+     */
+    public static String getExistingID(final Context context, final Object object) {
+        return (context != null) ? context.identifiedObjects.get(object) : null;
+    }
+
+    /**
+     * Returns {@code true} if the given identifier is available, or {@code false} if it
is used by another object.
+     * If this method returns {@code true}, then the given identifier is associated to the
given object for future
+     * invocation of {@code Context} method.  If this method returns {@code false}, then
the caller is responsible
+     * for computing an other identifier candidate.
      *
      * @param  context The current context, or {@code null} if none.
-     * @param  version The version to compare to.
-     * @return {@code true} if the GML version is equals or newer than the specified version.
+     * @param  object  The object for which to assign the {@code gml:id}.
+     * @param  id      The identifier to assign to the given object.
+     * @return {@code true} if the given identifier can be used.
      *
-     * @see #getVersion(String)
+     * @since 0.7
      */
-    public static boolean isGMLVersion(final Context context, final Version version) {
+    public static boolean isAvailableID(final Context context, final Object object, final
String id) {
         if (context != null) {
-            final Version versionGML = context.versionGML;
-            if (versionGML != null) {
-                return versionGML.compareTo(version) >= 0;
+            final Object existing = context.identifiers.putIfAbsent(id, object);
+            if (existing == null) {
+                if (context.identifiedObjects.put(object, id) != null) {
+                    throw new AssertionError(id);   // Caller forgot to invoke getExistingID(context,
object).
+                }
+            } else if (existing != object) {
+                return false;
             }
         }
         return true;
@@ -544,44 +628,6 @@ public final class Context extends Marsh
     }
 
     /**
-     * Sets the locale to the given value. The old locales are remembered and will
-     * be restored by the next call to {@link #pull()}. This method can be invoked
-     * when marshalling object that need to marshall their children in a different
-     * locale, like below:
-     *
-     * {@preformat java
-     *     private void beforeMarshal(Marshaller marshaller) {
-     *         Context.push(language);
-     *     }
-     *
-     *     private void afterMarshal(Marshaller marshaller) {
-     *         Context.pull();
-     *     }
-     * }
-     *
-     * @param locale The locale to set, or {@code null}.
-     */
-    public static void push(final Locale locale) {
-        final Context context = new Context(current());
-        if (locale != null) {
-            context.locale = locale;
-        }
-    }
-
-    /**
-     * Restores the locale (or any other setting) which was used prior the call
-     * to {@link #push(Locale)}. It is not necessary to invoke this method in a
-     * {@code finally} block if the parent {@code Context} is itself
-     * disposed in a {@code finally} block.
-     */
-    public static void pull() {
-        final Context current = current();
-        if (current != null) {
-            current.finish();
-        }
-    }
-
-    /**
      * Invoked in a {@code finally} block when a unmarshalling process is finished.
      */
     public final void finish() {

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java?rev=1707366&r1=1707365&r2=1707366&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/PropertyType.java
[UTF-8] Wed Oct  7 19:38:33 2015
@@ -131,9 +131,8 @@ public abstract class PropertyType<Value
      * Either {@code null}, an {@link ObjectReference} or a {@link String}.
      *
      * <ul>
-     *   <li>{@link ObjectReference} defines the {@code idref}, {@code uuidref}, {@code
xlink:href},
-     *       {@code xlink:role}, {@code xlink:arcrole}, {@code xlink:title}, {@code xlink:show}
and
-     *       {@code xlink:actuate} attributes.</li>
+     *   <li>{@link ObjectReference} defines the {@code uuidref}, {@code xlink:href},
{@code xlink:role},
+     *       {@code xlink:arcrole}, {@code xlink:title}, {@code xlink:show} and {@code xlink:actuate}
attributes.</li>
      *   <li>{@link String} defines the {@code nilReason} attribute.</li>
      * </ul>
      *
@@ -350,8 +349,8 @@ public abstract class PropertyType<Value
 
     /**
      * A URN to an external resources, or to an other part of a XML document, or an identifier.
-     * The {@code idref} attribute allows an XML element to refer to another XML element
that
-     * has a corresponding {@code id} attribute.
+     * The {@code xlink:href} attribute allows an XML element to refer to another XML element
+     * that has a corresponding {@code id} attribute.
      *
      * @return the current value, or {@code null} if none.
      * @category xlink

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/GMLAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/GMLAdapter.java?rev=1707366&r1=1707365&r2=1707366&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/GMLAdapter.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gml/GMLAdapter.java
[UTF-8] Wed Oct  7 19:38:33 2015
@@ -59,7 +59,7 @@ public abstract class GMLAdapter {
      * </ul>
      *
      * @see <a href="https://www.seegrid.csiro.au/wiki/bin/view/AppSchemas/GmlIdentifiers">GML
identifiers</a>
-     * @see org.apache.sis.internal.jaxb.gco.ObjectReference#getUUIDREF()
+     * @see org.apache.sis.internal.jaxb.gco.PropertyType#getUUIDREF()
      */
     @XmlID
     @XmlAttribute(namespace = Namespaces.GML, required = true)
@@ -94,7 +94,7 @@ public abstract class GMLAdapter {
     }
 
     /**
-     * Assign the {@link #id} value (if non-null) to the given object. This method
+     * Assigns the {@link #id} value (if non-null) to the given object. This method
      * is typically invoked at unmarshalling time in order to assign the ID of this
      * temporary wrapper to the "real" GeoAPI implementation instance.
      *

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/package-info.java?rev=1707366&r1=1707365&r2=1707366&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/package-info.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/package-info.java
[UTF-8] Wed Oct  7 19:38:33 2015
@@ -34,7 +34,7 @@
  *
  * @author  Cédric Briançon (Geomatys)
  * @since   0.3
- * @version 0.3
+ * @version 0.7
  * @module
  */
 package org.apache.sis.internal.jaxb;

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/xml/XLink.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/xml/XLink.java?rev=1707366&r1=1707365&r2=1707366&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/xml/XLink.java [UTF-8]
(original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/xml/XLink.java [UTF-8]
Wed Oct  7 19:38:33 2015
@@ -416,12 +416,7 @@ public class XLink implements Serializab
     }
 
     /**
-     * Returns a URN to an external resources, or to an other part of a XML document, or
an
-     * identifier.
-     *
-     * <div class="note"><b>Note:</b>
-     * This serves a role similar to {@code idref}. The {@code idref} attribute allows an
XML element
-     * to refer to another XML element that has a corresponding {@code id} attribute.</div>
+     * Returns a URN to an external resources, or to an other part of a XML document, or
an identifier.
      *
      * @return A URN to a resources, or {@code null} if none.
      *

Modified: sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gco/StringAdapterTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gco/StringAdapterTest.java?rev=1707366&r1=1707365&r2=1707366&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gco/StringAdapterTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gco/StringAdapterTest.java
[UTF-8] Wed Oct  7 19:38:33 2015
@@ -32,7 +32,7 @@ import static org.junit.Assert.*;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.3
+ * @version 0.7
  * @module
  */
 public final strictfp class StringAdapterTest extends TestCase {
@@ -48,7 +48,7 @@ public final strictfp class StringAdapte
 
     /**
      * Tests {@link StringAdapter#toString(CharSequence)} for an {@link InternationalString}
-     * having loalization in different languages.
+     * having localizations in different languages.
      */
     @Test
     @DependsOnMethod("testToUnlocalizedString")
@@ -57,25 +57,16 @@ public final strictfp class StringAdapte
         i18n.add(Locale.ENGLISH,  "A word");
         i18n.add(Locale.FRENCH,   "Un mot");
         i18n.add(Locale.JAPANESE, "言葉");
-        Context.push(Locale.JAPANESE);
+        final Context context = new Context(0, Locale.ENGLISH, null, null, null, null, null,
null);
         try {
-            assertEquals("言葉", StringAdapter.toString(i18n));
-            Context.push(Locale.FRENCH);
-            try {
-                assertEquals("Un mot", StringAdapter.toString(i18n));
-                Context.push(Locale.ENGLISH);
-                try {
-                    assertEquals("A word", StringAdapter.toString(i18n));
-                } finally {
-                    Context.pull();
-                }
-                assertEquals("Un mot", StringAdapter.toString(i18n));
-            } finally {
-                Context.pull();
-            }
-            assertEquals("言葉", StringAdapter.toString(i18n));
+            Context.push(Locale.JAPANESE);  assertEquals("言葉",    StringAdapter.toString(i18n));
+            Context.push(Locale.FRENCH);    assertEquals("Un mot", StringAdapter.toString(i18n));
+            Context.push(Locale.ENGLISH);   assertEquals("A word", StringAdapter.toString(i18n));
+            Context.pull();                 assertEquals("Un mot", StringAdapter.toString(i18n));
+            Context.pull();                 assertEquals("言葉",    StringAdapter.toString(i18n));
+            Context.pull();                 assertEquals("A word", StringAdapter.toString(i18n));
         } finally {
-            Context.pull();
+            context.finish();
         }
     }
 }



Mime
View raw message