sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1553455 - in /sis/branches/JDK7/core: sis-metadata/src/test/java/org/apache/sis/metadata/iso/ sis-metadata/src/test/java/org/apache/sis/metadata/iso/constraint/ sis-metadata/src/test/java/org/apache/sis/test/suite/ sis-utility/src/main/jav...
Date Thu, 26 Dec 2013 05:33:40 GMT
Author: desruisseaux
Date: Thu Dec 26 05:33:40 2013
New Revision: 1553455

URL: http://svn.apache.org/r1553455
Log:
Make CodeListSet tolerant to empty 'codeListValue' attribute at unmarshalling time (SIS-157).
A warning message will be emitted.

Added:
    sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/constraint/
    sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/constraint/DefaultLegalConstraintsTest.java
  (with props)
Modified:
    sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java
    sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/CheckedArrayList.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/CheckedHashSet.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/collection/CodeListSet.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java
    sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/util/CheckedArrayListTest.java

Modified: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java?rev=1553455&r1=1553454&r2=1553455&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/DefaultMetadataTest.java
[UTF-8] Thu Dec 26 05:33:40 2013
@@ -16,10 +16,14 @@
  */
 package org.apache.sis.metadata.iso;
 
+import java.util.logging.LogRecord;
+import javax.xml.bind.Unmarshaller;
 import javax.xml.bind.JAXBException;
-import org.apache.sis.test.XMLTestCase;
-import org.apache.sis.xml.Namespaces;
 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.test.XMLTestCase;
 import org.junit.Test;
 
 import static org.apache.sis.test.Assert.*;
@@ -36,7 +40,56 @@ import static org.apache.sis.test.Assert
  * @version 0.4
  * @module
  */
-public final strictfp class DefaultMetadataTest extends XMLTestCase {
+public final strictfp class DefaultMetadataTest 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());
+    }
+
+    /**
+     * 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.
@@ -47,11 +100,18 @@ public final strictfp class DefaultMetad
      */
     @Test
     public void testEmptyCollection() throws JAXBException {
-        final String xml =
+        final DefaultMetadata metadata = unmarshal(
                 "<gmd:MD_Metadata xmlns:gmd=\"" + Namespaces.GMD + "\">\n" +
                 "  <gmd:contact/>\n" +
-                "</gmd:MD_Metadata>";
-        final DefaultMetadata metadata = (DefaultMetadata) XML.unmarshal(xml);
+                "</gmd:MD_Metadata>");
+        /*
+         * Verify metadata property.
+         */
         assertTrue(metadata.getContacts().isEmpty());
+        /*
+         * Verify warning message emitted during unmarshalling.
+         */
+        assertEquals("warning", "NullCollectionElement_1", resourceKey);
+        assertArrayEquals("warning", new String[] {"CheckedArrayList<ResponsibleParty>"},
parameters);
     }
 }

Added: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/constraint/DefaultLegalConstraintsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/constraint/DefaultLegalConstraintsTest.java?rev=1553455&view=auto
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/constraint/DefaultLegalConstraintsTest.java
(added)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/constraint/DefaultLegalConstraintsTest.java
[UTF-8] Thu Dec 26 05:33:40 2013
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+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.test.XMLTestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+import static org.apache.sis.test.TestUtilities.getSingleton;
+
+
+/**
+ * Tests {@link DefaultLegalConstraints}.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.4
+ * @version 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());
+    }
+
+    /**
+     * Unmarshalls 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;
+    }
+
+    /**
+     * Tests unmarshalling of an element containing an empty {@code codeListValue} attribute.
+     * This was used to cause a {@code NullPointerException} prior SIS-157 fix.
+     *
+     * @throws JAXBException If an error occurred during the during unmarshalling processes.
+     *
+     * @see <a href="https://issues.apache.org/jira/browse/SIS-157">SIS-157</a>
+     */
+    @Test
+    public void testUnmarshallEmptyCodeListValue() throws JAXBException {
+        final DefaultLegalConstraints c = unmarshal(
+                "<gmd:MD_LegalConstraints xmlns:gmd=\"" + Namespaces.GMD + "\">\n"
+
+                "  <gmd:accessConstraints>\n" +
+                "    <gmd:MD_RestrictionCode codeListValue=\"intellectualPropertyRights\"
codeList=\"http://www.isotc211.org/2005/resources/codeList.xml#MD_RestrictionCode\"/>\n"
+
+                "  </gmd:accessConstraints>\n" +
+                "  <gmd:useConstraints>\n" + // Below is an intentionally empty code
list value (SIS-157)
+                "    <gmd:MD_RestrictionCode codeListValue=\"\" codeList=\"http://www.isotc211.org/2005/resources/codeList.xml#MD_RestrictionCode\"/>\n"
+
+                "  </gmd:useConstraints>\n" +
+                "</gmd:MD_LegalConstraints>");
+        /*
+         * Verify metadata property.
+         */
+        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);
+    }
+}

Propchange: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/constraint/DefaultLegalConstraintsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/constraint/DefaultLegalConstraintsTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8

Modified: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java?rev=1553455&r1=1553454&r2=1553455&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
[UTF-8] Thu Dec 26 05:33:40 2013
@@ -76,6 +76,7 @@ import org.junit.BeforeClass;
     org.apache.sis.metadata.iso.quality.AbstractPositionalAccuracyTest.class,
     org.apache.sis.metadata.iso.lineage.DefaultLineageTest.class,
     org.apache.sis.metadata.iso.lineage.DefaultProcessStepTest.class,
+    org.apache.sis.metadata.iso.constraint.DefaultLegalConstraintsTest.class,
     org.apache.sis.metadata.iso.DefaultIdentifierTest.class,
     org.apache.sis.metadata.iso.ImmutableIdentifierTest.class,
     org.apache.sis.metadata.iso.DefaultMetadataTest.class,

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/CheckedArrayList.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/CheckedArrayList.java?rev=1553455&r1=1553454&r2=1553455&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/CheckedArrayList.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/CheckedArrayList.java
[UTF-8] Thu Dec 26 05:33:40 2013
@@ -22,7 +22,9 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import org.apache.sis.internal.jaxb.Context;
+import org.apache.sis.util.Classes;
 import org.apache.sis.util.ArraysExt;
+import org.apache.sis.util.NullArgumentException;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.collection.CheckedContainer;
 
@@ -93,21 +95,48 @@ public final class CheckedArrayList<E> e
     }
 
     /**
-     * Returns {@code true} if a unmarshalling process is under way.
-     * In the later case, logs a warning for non-null element of the wrong type.
+     * Invoked when an illegal element has been given to the {@code add(E)} method.
+     * The element may be illegal either because null or because of invalid type.
+     * This method will perform only one of the following actions:
+     *
+     * <ul>
+     *   <li>If a unmarshalling process is under way, then this method logs a warning
and returns {@code null}.
+     *       The {@code add(E)} caller method shall return {@code false} without throwing
exception. This is a
+     *       violation of {@link Collection#add(Object)} contract, but is required for unmarshalling
of empty
+     *       XML elements (see SIS-139 and SIS-157).</li>
+     *   <li>If no unmarshalling process is under way, then this method returns a {@code
String} containing the
+     *       error message to give to the exception to be thrown. The {@code add(E)} caller
method is responsible
+     *       to thrown an exception with that message. We let the caller throw the exception
for reducing the
+     *       stack trace depth, so the first element on the stack trace is the public {@code
add(E)} method.</li>
+     * </ul>
+     *
+     * @param  collection   The collection in which the user attempted to add an invalid
element.
+     * @param  element      The element that the user attempted to add (may be {@code null}).
+     * @param  expectedType The type of elements that the collection expected.
+     * @return The message to give to the exception to be thrown, or {@code null} if no message
shall be thrown.
      *
      * @see <a href="https://issues.apache.org/jira/browse/SIS-139">SIS-139</a>
+     * @see <a href="https://issues.apache.org/jira/browse/SIS-157">SIS-157</a>
      */
-    static boolean warning(final Collection<?> source, final Object element, final
Class<?> type) {
-        final Context context = Context.current();
-        if (context == null) {
-            return false;
+    public static String illegalElement(final Collection<?> collection, final Object
element, final Class<?> expectedType) {
+        final short key;
+        final Object[] arguments;
+        if (element == null) {
+            key = Errors.Keys.NullCollectionElement_1;
+            arguments = new Object[] {
+                Classes.getShortClassName(collection) + '<' + Classes.getShortName(expectedType)
+ '>'
+            };
+        } else {
+            key = Errors.Keys.IllegalArgumentClass_3;
+            arguments = new Object[] {"element", expectedType, element.getClass()};
         }
-        if (element != null) {
-            Context.warningOccured(context, source.getClass(), "add",
-                    Errors.class, Errors.Keys.IllegalArgumentClass_3, "element", type, element.getClass());
+        final Context context = Context.current();
+        if (context != null) {
+            Context.warningOccured(context, collection.getClass(), "add", Errors.class, key,
arguments);
+            return null;
+        } else {
+            return Errors.format(key, arguments);
         }
-        return true;
     }
 
     /**
@@ -122,7 +151,8 @@ public final class CheckedArrayList<E> e
         if (type.isInstance(element)) {
             return true;
         }
-        if (warning(this, element, type)) {
+        final String message = illegalElement(this, element, type);
+        if (message == null) {
             /*
              * If a unmarshalling process is under way, silently discard null element.
              * This case happen when a XML element for a collection contains no child.
@@ -130,9 +160,11 @@ public final class CheckedArrayList<E> e
              */
             return false;
         }
-        ensureNonNull("element", element);
-        throw new IllegalArgumentException(Errors.format(
-                Errors.Keys.IllegalArgumentClass_3, "element", type, element.getClass()));
+        if (element == null) {
+            throw new NullArgumentException(message);
+        } else {
+            throw new IllegalArgumentException(message);
+        }
     }
 
     /**

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/CheckedHashSet.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/CheckedHashSet.java?rev=1553455&r1=1553454&r2=1553455&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/CheckedHashSet.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/CheckedHashSet.java
[UTF-8] Thu Dec 26 05:33:40 2013
@@ -19,7 +19,7 @@ package org.apache.sis.internal.util;
 import java.util.Set;
 import java.util.Collections;
 import java.util.LinkedHashSet;
-import org.apache.sis.util.resources.Errors;
+import org.apache.sis.util.NullArgumentException;
 import org.apache.sis.util.collection.CheckedContainer;
 
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
@@ -97,20 +97,23 @@ public final class CheckedHashSet<E> ext
      */
     @Override
     public boolean add(final E element) throws IllegalArgumentException {
-        if (!type.isInstance(element)) {
-            if (CheckedArrayList.warning(this, element, type)) {
-                /*
-                 * If a unmarshalling process is under way, silently discard null element.
-                 * This case happen when a XML element for a collection contains no child.
-                 * See https://issues.apache.org/jira/browse/SIS-139
-                 */
-                return false;
-            }
-            ensureNonNull("element", element);
-            throw new IllegalArgumentException(Errors.format(
-                    Errors.Keys.IllegalArgumentClass_3, "element", type, element.getClass()));
+        if (type.isInstance(element)) {
+            return super.add(element);
+        }
+        final String message = CheckedArrayList.illegalElement(this, element, type);
+        if (message == null) {
+            /*
+             * If a unmarshalling process is under way, silently discard null element.
+             * This case happen when a XML element for a collection contains no child.
+             * See https://issues.apache.org/jira/browse/SIS-139
+             */
+            return false;
+        }
+        if (element == null) {
+            throw new NullArgumentException(message);
+        } else {
+            throw new IllegalArgumentException(message);
         }
-        return super.add(element);
     }
 
     /*

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/collection/CodeListSet.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/collection/CodeListSet.java?rev=1553455&r1=1553454&r2=1553455&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/collection/CodeListSet.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/collection/CodeListSet.java
[UTF-8] Thu Dec 26 05:33:40 2013
@@ -26,6 +26,8 @@ import java.lang.reflect.Modifier;
 import org.opengis.util.CodeList;
 import org.apache.sis.util.iso.Types;
 import org.apache.sis.util.resources.Errors;
+import org.apache.sis.util.NullArgumentException;
+import org.apache.sis.internal.util.CheckedArrayList;
 
 
 /**
@@ -52,7 +54,7 @@ import org.apache.sis.util.resources.Err
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.3
+ * @version 0.4
  * @module
  *
  * @see java.util.EnumSet
@@ -76,7 +78,7 @@ public class CodeListSet<E extends CodeL
      *
      * @see #getElementType()
      */
-    private final Class<E>  elementType;
+    private final Class<E> elementType;
 
     /**
      * A bitmask of code list values present in this map.
@@ -215,6 +217,22 @@ public class CodeListSet<E extends CodeL
      */
     @Override
     public boolean add(final E element) {
+        if (element == null) {
+            final String message = CheckedArrayList.illegalElement(this, element, elementType);
+            if (message == null) {
+                /*
+                 * If a unmarshalling process is under way, silently discard null element.
+                 * This case happen when a codeListValue attribute in a XML file is empty.
+                 * See https://issues.apache.org/jira/browse/SIS-157
+                 */
+                return false;
+            }
+            if (element == null) {
+                throw new NullArgumentException(message);
+            } else {
+                throw new IllegalArgumentException(message);
+            }
+        }
         int ordinal = element.ordinal();
         if (ordinal < Long.SIZE) {
             return values != (values |= (1L << ordinal));

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java?rev=1553455&r1=1553454&r2=1553455&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
[UTF-8] Thu Dec 26 05:33:40 2013
@@ -546,6 +546,11 @@ public final class Errors extends Indexe
         public static final short NullArgument_1 = 95;
 
         /**
+         * ‘{0}’ collection does not accept null elements.
+         */
+        public static final short NullCollectionElement_1 = 134;
+
+        /**
          * Null key is not allowed in this dictionary.
          */
         public static final short NullMapKey = 96;

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties?rev=1553455&r1=1553454&r2=1553455&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
[ISO-8859-1] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
[ISO-8859-1] Thu Dec 26 05:33:40 2013
@@ -120,6 +120,7 @@ NoSuchElement_1                   = Elem
 NoSuchProperty_2                  = No property named \u201c{0}\u201d has been found in \u201c{1}\u201d.
 NoUnit                            = No unit of measurement has been specified.
 NullArgument_1                    = Argument \u2018{0}\u2019 shall not be null.
+NullCollectionElement_1           = \u2018{0}\u2019 collection does not accept null elements.
 # Use the OGC/ISO "Dictionary" word instead of "Map" for avoiding confusion with geographic
map.
 NullMapKey                        = Null key is not allowed in this dictionary.
 NullMapValue                      = Null values are not allowed in this dictionary.

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties?rev=1553455&r1=1553454&r2=1553455&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
[ISO-8859-1] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
[ISO-8859-1] Thu Dec 26 05:33:40 2013
@@ -110,6 +110,7 @@ NoSuchElement_1                   = L\u2
 NoSuchProperty_2                  = Aucune propri\u00e9t\u00e9 nomm\u00e9e \u201c{0}\u201d
n\u2019a \u00e9t\u00e9 trouv\u00e9e dans \u201c{1}\u201d.
 NoUnit                            = Aucune unit\u00e9 de mesure n\u2019a \u00e9t\u00e9 sp\u00e9cifi\u00e9e.
 NullArgument_1                    = L\u2019argument \u2018{0}\u2019 ne doit pas \u00eatre
nul.
+NullCollectionElement_1           = La collection \u2018{0}\u2019 n\u2019accepte pas les
valeurs nulles.
 NullMapKey                        = La cl\u00e9 nulle n\u2019est pas autoris\u00e9e dans
ce dictionnaire.
 NullMapValue                      = Les valeurs nulles ne sont pas autoris\u00e9es dans ce
dictionnaire.
 OddArrayLength_1                  = La longueur du tableau est {0}, alors qu\u2019on attendait
une longueur paire.

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java?rev=1553455&r1=1553454&r2=1553455&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java [UTF-8]
(original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java [UTF-8]
Thu Dec 26 05:33:40 2013
@@ -33,7 +33,7 @@ import org.apache.sis.util.ArgumentCheck
  * URLs determined by the SIS version available at compile-time, not runtime, because the
  * {@code javac} compiler inlines string constants.</p>
  *
- * <p>The following table list the URLs, their usual prefix, and the SIS versions when
each URL changed.</p>
+ * <p>The following table lists the URLs, their usual prefix, and the SIS versions
when each URL changed.</p>
  * <table class="sis">
  *   <tr><th>Prefix</th> <th>XML Namespace</th>   <th>Changes
history</th></tr>
  *   <tr><td>gco</td>    <td>{@value #GCO}</td>   <td></td></tr>

Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/util/CheckedArrayListTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/util/CheckedArrayListTest.java?rev=1553455&r1=1553454&r2=1553455&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/util/CheckedArrayListTest.java
[UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/util/CheckedArrayListTest.java
[UTF-8] Thu Dec 26 05:33:40 2013
@@ -67,7 +67,7 @@ public final strictfp class CheckedArray
             list.add(null);
         } catch (NullArgumentException e) {
             final String message = e.getMessage();
-            assertTrue("element", message.contains("element"));
+            assertTrue(message.contains("CheckedArrayList<String>"));
         }
     }
 
@@ -82,7 +82,7 @@ public final strictfp class CheckedArray
             list.addAll(toAdd);
         } catch (NullArgumentException e) {
             final String message = e.getMessage();
-            assertTrue("element", message.contains("element"));
+            assertTrue(message.contains("CheckedArrayList<String>"));
         }
     }
 



Mime
View raw message