sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1411577 [2/2] - in /sis/branches/JDK6: ./ sis-build-helper/src/main/java/org/apache/sis/util/resources/ sis-utility/src/main/java/org/apache/sis/internal/util/ sis-utility/src/main/java/org/apache/sis/io/ sis-utility/src/main/java/org/apac...
Date Tue, 20 Nov 2012 08:15:34 GMT
Copied: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/UnmodifiableArrayList.java
(from r1411573, sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/UnmodifiableArrayList.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/UnmodifiableArrayList.java?p2=sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/UnmodifiableArrayList.java&p1=sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/UnmodifiableArrayList.java&r1=1411573&r2=1411577&rev=1411577&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/UnmodifiableArrayList.java
(original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/UnmodifiableArrayList.java
Tue Nov 20 08:15:31 2012
@@ -21,7 +21,7 @@ import java.util.AbstractList;
 import org.apache.sis.util.ArgumentChecks;
 
 // Related to JDK7
-import java.util.Objects;
+import org.apache.sis.internal.util.Objects;
 
 
 /**
@@ -68,7 +68,6 @@ public class UnmodifiableArrayList<E> ex
      *
      * @param array The array to wrap.
      */
-    @SafeVarargs
     protected UnmodifiableArrayList(final E... array) {
         ArgumentChecks.ensureNonNull("array", array);
         this.array = array;
@@ -84,9 +83,8 @@ public class UnmodifiableArrayList<E> ex
      * @return The given array wrapped in an unmodifiable list, or {@code null} if the given
      *         array was null.
      */
-    @SafeVarargs
     public static <E> UnmodifiableArrayList<E> wrap(final E... array) {
-        return (array != null) ? new UnmodifiableArrayList<>(array) : null;
+        return (array != null) ? new UnmodifiableArrayList<E>(array) : null;
     }
 
     /**
@@ -108,9 +106,9 @@ public class UnmodifiableArrayList<E> ex
         ArgumentChecks.ensureNonNull("array", array);
         ArgumentChecks.ensureValidIndexRange(array.length, lower, upper);
         if (lower == 0 && upper == array.length) {
-            return new UnmodifiableArrayList<>(array);
+            return new UnmodifiableArrayList<E>(array);
         }
-        return new UnmodifiableArrayList.SubList<>(array, lower, upper - lower);
+        return new UnmodifiableArrayList.SubList<E>(array, lower, upper - lower);
     }
 
     /**
@@ -245,7 +243,7 @@ public class UnmodifiableArrayList<E> ex
             throws IndexOutOfBoundsException
     {
         ArgumentChecks.ensureValidIndexRange(size(), lower, upper);
-        return new SubList<>(array, lower + lower(), upper - lower);
+        return new SubList<E>(array, lower + lower(), upper - lower);
     }
 
     /**

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java?rev=1411577&r1=1411576&r2=1411577&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
(original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
Tue Nov 20 08:15:31 2012
@@ -46,6 +46,16 @@ public final class Errors extends Indexe
         }
 
         /**
+         * Value “{0}” is duplicated.
+         */
+        public static final int DuplicatedValue_1 = 38;
+
+        /**
+         * Element “{0}” is already present.
+         */
+        public static final int ElementAlreadyPresent_1 = 36;
+
+        /**
          * Argument ‘{0}’ shall not be empty.
          */
         public static final int EmptyArgument_1 = 1;
@@ -107,6 +117,11 @@ public final class Errors extends Indexe
         public static final int InconsistentAttribute_2 = 27;
 
         /**
+         * Inconsistent table columns.
+         */
+        public static final int InconsistentTableColumns = 40;
+
+        /**
          * Index {0} is out of bounds.
          */
         public static final int IndexOutOfBounds_1 = 4;
@@ -127,6 +142,26 @@ public final class Errors extends Indexe
         public static final int NegativeArgument_2 = 8;
 
         /**
+         * Node “{0}” can not be a child of itself.
+         */
+        public static final int NodeChildOfItself_1 = 37;
+
+        /**
+         * Node “{0}” already has another parent.
+         */
+        public static final int NodeHasAnotherParent_1 = 35;
+
+        /**
+         * Node “{0}” has no parent.
+         */
+        public static final int NodeHasNoParent_1 = 34;
+
+        /**
+         * No “{0}” node found.
+         */
+        public static final int NodeNotFound_1 = 39;
+
+        /**
          * Argument ‘{0}’ shall not be NaN (Not-a-Number).
          */
         public static final int NotANumber_1 = 9;
@@ -192,6 +227,11 @@ public final class Errors extends Indexe
         public static final int UnparsableStringForClass_3 = 32;
 
         /**
+         * No format is specified for objects of class ‘{0}’.
+         */
+        public static final int UnspecifiedFormatForClass_1 = 41;
+
+        /**
          * Can not handle instances of ‘{0}’ because arbitrary implementations
are not yet supported.
          */
         public static final int UnsupportedImplementation_1 = 28;

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties?rev=1411577&r1=1411576&r2=1411577&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
(original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
Tue Nov 20 08:15:31 2012
@@ -14,6 +14,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+DuplicatedValue_1               = Value \u201c{0}\u201d is duplicated.
+ElementAlreadyPresent_1         = Element \u201c{0}\u201d is already present.
 EmptyArgument_1                 = Argument \u2018{0}\u2019 shall not be empty.
 ForbiddenAttribute_2            = Attribute \u201c{0}\u201d is not allowed for an object
of type \u2018{1}\u2019.
 IllegalArgument_1               = Illegal value for argument \u2018{0}\u2019.
@@ -26,10 +28,15 @@ IllegalFormatPatternForClass_2  = The \u
 IllegalLanguageCode_1           = The \u201c{0}\u201d language is not recognized.
 IllegalRange_2                  = Range [{0} \u2026 {1}] is not valid.
 InconsistentAttribute_2         = Value \u201c{1}\u201d of attribute \u2018{0}\u2019 is inconsistent
with other attributes.
+InconsistentTableColumns        = Inconsistent table columns.
 IndexOutOfBounds_1              = Index {0} is out of bounds.
 KeyCollision_1                  = A different value is already associated to the \u201c{0}\u201d
key.
 MandatoryAttribute_2            = Attribute \u201c{0}\u201d is mandatory for an object of
type \u2018{1}\u2019.
 NegativeArgument_2              = Argument \u2018{0}\u2019 shall not be negative. The given
value was {1}.
+NodeChildOfItself_1             = Node \u201c{0}\u201d can not be a child of itself.
+NodeHasAnotherParent_1          = Node \u201c{0}\u201d already has another parent.
+NodeHasNoParent_1               = Node \u201c{0}\u201d has no parent.
+NodeNotFound_1                  = No \u201c{0}\u201d node found.
 NotANumber_1                    = Argument \u2018{0}\u2019 shall not be NaN (Not-a-Number).
 NotAPrimitiveWrapper_1          = Class \u2018{0}\u2019 is not a primitive type wrapper.
 NullArgument_1                  = Argument \u2018{0}\u2019 shall not be null.
@@ -43,6 +50,7 @@ UnmodifiableMetadata            = This m
 UnmodifiableObject_1            = Object \u2018{0}\u2019 is unmodifiable.
 UnparsableStringForClass_2      = Text \u201c{1}\u201d can not be parsed as an object of
type \u2018{0}\u2019.
 UnparsableStringForClass_3      = Text \u201c{1}\u201d can not be parsed as an object of
type \u2018{0}\u2019, because of the \u201c{2}\u201d characters.
+UnspecifiedFormatForClass_1     = No format is specified for objects of class \u2018{0}\u2019.
 UnsupportedImplementation_1     = Can not handle instances of \u2018{0}\u2019 because arbitrary
implementations are not yet supported.
 UnsupportedOperation_1          = The \u2018{0}\u2019 operation is unsupported.
 ValueAlreadyDefined_1           = A value is already defined for \u201c{0}\u201d.

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties?rev=1411577&r1=1411576&r2=1411577&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
(original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
Tue Nov 20 08:15:31 2012
@@ -14,6 +14,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+DuplicatedValue_1               = La valeur \u201c{0}\u201d est dupliqu\u00e9e.
+ElementAlreadyPresent_1         = L\u2019\u00e9lement \u201c{0}\u201d est d\u00e9j\u00e0
pr\u00e9sent.
 EmptyArgument_1                 = L\u2019argument \u2018{0}\u2019 ne doit pas \u00eatre vide.
 ForbiddenAttribute_2            = L\u2019attribut \u201c{0}\u201d n\u2019est pas autoris\u00e9
pour un objet de type \u2018{1}\u2019.
 IllegalArgument_1               = Valeur ill\u00e9gale pour l\u2019argument \u2018{0}\u2019.
@@ -26,10 +28,15 @@ IllegalFormatPatternForClass_2  = Le mod
 IllegalLanguageCode_1           = Le code de langue \u201c{0}\u201d n\u2019est pas reconnu.
 IllegalRange_2                  = La plage [{0} \u2026 {1}] n\u2019est pas valide.
 InconsistentAttribute_2         = La valeur \u201c{1}\u201d de l\u2019attribut \u2018{0}\u2019
n\u2019est pas coh\u00e9rente avec celles des autres attributs.
+InconsistentTableColumns        = Les colonnes des tables ne sont pas coh\u00e9rentes.
 IndexOutOfBounds_1              = L\u2019index {0} est en dehors des limites permises.
 KeyCollision_1                  = Une valeur diff\u00e9rente est d\u00e9j\u00e0 associ\u00e9e
\u00e0 la cl\u00e9 \u201c{0}\u201d.
 MandatoryAttribute_2            = L\u2019attribut \u201c{0}\u201d est obligatoire pour un
objet de type \u2018{1}\u2019.
 NegativeArgument_2              = L\u2019argument \u2018{0}\u2019 ne doit pas \u00eatre n\u00e9gatif.
La valeur donn\u00e9e \u00e9tait {1}.
+NodeChildOfItself_1             = Le n\u0153ud \u201c{0}\u201d ne peut pas \u00eatre un enfant
de lui-m\u00eame.
+NodeHasAnotherParent_1          = Le n\u0153ud \u201c{0}\u201d a d\u00e9j\u00e0 un autre
parent.
+NodeHasNoParent_1               = Le n\u0153ud \u201c{0}\u201d n\u2019a pas de parent.
+NodeNotFound_1                  = Aucun n\u0153ud \u201c{0}\u201d n\u2019a \u00e9t\u00e9
trouv\u00e9.
 NotANumber_1                    = L\u2019argument \u2018{0}\u2019 ne doit pas \u00eatre NaN
(Not-a-Number).
 NotAPrimitiveWrapper_1          = La classe \u2018{0}\u2019 n\u2019est pas un adaptateur
d\u2019un type primitif.
 NullArgument_1                  = L\u2019argument \u2018{0}\u2019 ne doit pas \u00eatre nul.
@@ -41,6 +48,7 @@ UnmodifiableAffineTransform     = Cette 
 UnmodifiableGeometry            = Cette g\u00e9om\u00e9trie n\u2019est pas modifiable.
 UnmodifiableMetadata            = Cette m\u00e9ta-donn\u00e9e n\u2019est pas modifiable.
 UnmodifiableObject_1            = L\u2019objet \u2018{0}\u2019 n\u2019est pas modifiable.
+UnspecifiedFormatForClass_1     = Aucun format n\u2019est sp\u00e9cifi\u00e9 pour les objets
de classe \u2018{0}\u2019.
 UnparsableStringForClass_2      = Le texte \u201c{1}\u201d n\u2019est pas reconnu comme un
objet de type \u2018{0}\u2019.
 UnparsableStringForClass_3      = Le texte \u201c{1}\u201d n\u2019est pas reconnu comme un
objet de type \u2018{0}\u2019, \u00e0 cause des caract\u00e8res \u201c{2}\u201d.
 UnsupportedImplementation_1     = Les instances de \u2018{0}\u2019 ne peuvent pas \u00eatre
g\u00e9r\u00e9es parce que les impl\u00e9mentations arbitraires ne sont pas encore support\u00e9es.

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java?rev=1411577&r1=1411576&r2=1411577&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java
(original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java
Tue Nov 20 08:15:31 2012
@@ -559,6 +559,7 @@ public class IndexedResourceBundle exten
                  * Constructs a new MessageFormat for formatting the arguments.
                  */
                 format = new MessageFormat(pattern, getFormatLocale());
+                lastKey = key;
             } else if (key != lastKey) {
                 /*
                  * Method MessageFormat.applyPattern(...) is costly! We will avoid

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/type/AbstractInternationalString.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/type/AbstractInternationalString.java?rev=1411577&r1=1411576&r2=1411577&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/type/AbstractInternationalString.java
(original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/type/AbstractInternationalString.java
Tue Nov 20 08:15:31 2012
@@ -67,13 +67,15 @@ public abstract class AbstractInternatio
      */
     @Override
     public int length() {
-        if (defaultValue == null) {
-            defaultValue = toString();
-            if (defaultValue == null) {
+        String text = defaultValue;
+        if (text == null) {
+            text = toString();
+            if (text == null) {
                 return 0;
             }
+            defaultValue = text;
         }
-        return defaultValue.length();
+        return text.length();
     }
 
     /**
@@ -86,13 +88,15 @@ public abstract class AbstractInternatio
      */
     @Override
     public char charAt(final int index) throws IndexOutOfBoundsException {
-        if (defaultValue == null) {
-            defaultValue = toString();
-            if (defaultValue == null) {
+        String text = defaultValue;
+        if (text == null) {
+            text = toString();
+            if (text == null) {
                 throw new StringIndexOutOfBoundsException();
             }
+            defaultValue = text;
         }
-        return defaultValue.charAt(index);
+        return text.charAt(index);
     }
 
     /**
@@ -107,16 +111,18 @@ public abstract class AbstractInternatio
      */
     @Override
     public CharSequence subSequence(final int start, final int end) {
-        if (defaultValue == null) {
-            defaultValue = toString();
-            if (defaultValue == null) {
+        String text = defaultValue;
+        if (text == null) {
+            text = toString();
+            if (text == null) {
                 if (start == 0 && end == 0) {
                     return "";
                 }
                 throw new StringIndexOutOfBoundsException();
             }
+            defaultValue = text;
         }
-        return defaultValue.substring(start, end);
+        return text.substring(start, end);
     }
 
     /**
@@ -142,13 +148,15 @@ public abstract class AbstractInternatio
      */
     @Override
     public String toString() {
-        if (defaultValue == null) {
-            defaultValue = toString(Locale.getDefault());
-            if (defaultValue == null) {
+        String text = defaultValue;
+        if (text == null) {
+            text = toString(Locale.getDefault());
+            if (text == null) {
                 return "";
             }
+            defaultValue = text;
         }
-        return defaultValue;
+        return text;
     }
 
     /**

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/type/DefaultInternationalString.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/type/DefaultInternationalString.java?rev=1411577&r1=1411576&r2=1411577&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/type/DefaultInternationalString.java
(original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/type/DefaultInternationalString.java
Tue Nov 20 08:15:31 2012
@@ -266,8 +266,7 @@ public class DefaultInternationalString 
      *       {@code null} locale, then that string is returned.</li>
      *   <li>Otherwise, acknowledging that UML identifiers in OGC/ISO specifications
are primarily
      *       expressed in the English language, this method looks for an English string as
an
-     *       approximation of a "unlocalized" string. The {@link Locale#UK} variant is
-     *       preferred because ISO specifications seem to use that language.</li>
+     *       approximation of a "unlocalized" string.</li>
      *   <li>If no English string was found, this method looks for a string for the
      *       {@linkplain Locale#getDefault() system default locale}.</li>
      *   <li>If none of the above steps found a string, then this method returns
@@ -295,7 +294,7 @@ public class DefaultInternationalString 
              */
             text = localeMap.get(null);
             if (text == null) {
-                Locale def = Locale.UK; // The default language for "unlocalized" string.
+                Locale def = Locale.US; // The default language for "unlocalized" string.
                 if (locale != def) { // Avoid requesting the same locale twice (optimization).
                     text = getString(def);
                     if (text != null) {
@@ -303,7 +302,7 @@ public class DefaultInternationalString 
                     }
                 }
                 def = Locale.getDefault();
-                if (locale != def && def != Locale.UK) {
+                if (locale != def && def != Locale.US) {
                     text = getString(def);
                     if (text != null) {
                         return text;

Modified: sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/measure/FormattedCharacterIteratorTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/measure/FormattedCharacterIteratorTest.java?rev=1411577&r1=1411576&r2=1411577&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/measure/FormattedCharacterIteratorTest.java
(original)
+++ sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/measure/FormattedCharacterIteratorTest.java
Tue Nov 20 08:15:31 2012
@@ -109,15 +109,15 @@ public final strictfp class FormattedCha
     /**
      * Returns all expected attribute keys for the tests in this class.
      *
-     * @param overlapping {@code true} for including the keys for overlapping attributes.
+     * @param withNumberFields {@code true} for including the keys for {@code NumberFormat}
fields.
      */
-    private static Set<Attribute> getAllAttributeKeys(final boolean overlapping) {
+    private static Set<Attribute> getAllAttributeKeys(final boolean withNumberFields)
{
         final Set<Attribute> keys = new HashSet<Attribute>(8);
         assertTrue(keys.add(DEGREES));
         assertTrue(keys.add(MINUTES));
         assertTrue(keys.add(SECONDS));
         assertTrue(keys.add(HEMISPHERE));
-        if (overlapping) {
+        if (withNumberFields) {
             assertTrue(keys.add(INTEGER));
             assertTrue(keys.add(FRACTION));
             assertTrue(keys.add(DECIMAL_SEPARATOR));
@@ -149,7 +149,7 @@ public final strictfp class FormattedCha
             start=upper; upper= 8; if (o) it.addFieldLimit(INTEGER,            15, start);
             start=upper; upper= 9; if (o) it.addFieldLimit(DECIMAL_SEPARATOR, '.', start);
             start=upper; upper=10; if (o) it.addFieldLimit(FRACTION,            0, start);
-            start=6;     upper=11;        it.addFieldLimit(SECONDS,            15, start);
+            start=6;     upper=11;        it.addFieldLimit(SECONDS,           15f, start);
             start=upper; upper=12;        it.addFieldLimit(HEMISPHERE,        'N', start);
             assertEquals(text.length(), upper);
             return it;
@@ -164,8 +164,8 @@ public final strictfp class FormattedCha
      * <p>This test is leveraged by {@link AngleFormatTest#testFormatToCharacterIterator()}.</p>
      */
     @SuppressWarnings("fallthrough")
-    static void testAttributes(final AttributedCharacterIterator it, final boolean overlapping)
{
-        assertEquals(getAllAttributeKeys(overlapping), it.getAllAttributeKeys());
+    static void testAttributes(final AttributedCharacterIterator it, final boolean withNumberFields)
{
+        assertEquals(getAllAttributeKeys(withNumberFields), it.getAllAttributeKeys());
         assertEquals(0, it.getIndex());
         assertEquals(3, it.getRunLimit(MINUTES));
         assertEquals(6, it.getRunLimit(SECONDS));
@@ -175,9 +175,9 @@ public final strictfp class FormattedCha
             final AngleFormat.Field key;
             final Comparable<?> value;
             final int start, limit;
-                 if (index <  3) {key=DEGREES;    value= 45; start= 0; limit= 3;}
-            else if (index <  6) {key=MINUTES;    value= 30; start= 3; limit= 6;}
-            else if (index < 11) {key=SECONDS;    value= 15; start= 6; limit=11;}
+                 if (index <  3) {key=DEGREES;    value=45 ; start= 0; limit= 3;}
+            else if (index <  6) {key=MINUTES;    value=30 ; start= 3; limit= 6;}
+            else if (index < 11) {key=SECONDS;    value=15f; start= 6; limit=11;}
             else                 {key=HEMISPHERE; value='N'; start=11; limit=12;}
             /*
              * Expected values when asking for a NumberFormat field.
@@ -194,7 +194,7 @@ public final strictfp class FormattedCha
             int     startFraction  =  0;
             int     limitFraction  = 12;
             int     numAttributes  =  1;
-            if (overlapping) {
+            if (withNumberFields) {
                 /*
                  * Update the above expected values when the current position
                  * is inside a NumberFormat field.

Modified: sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/test/Assert.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/test/Assert.java?rev=1411577&r1=1411576&r2=1411577&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/test/Assert.java (original)
+++ sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/test/Assert.java Tue Nov 20
08:15:31 2012
@@ -79,13 +79,7 @@ public strictfp class Assert extends org
      * @param actual   The actual string.
      */
     public static void assertMultilinesEquals(final String message, final CharSequence expected,
final CharSequence actual) {
-        final CharSequence[] a1 = CharSequences.split(expected, '\n');
-        final CharSequence[] a2 = CharSequences.split(actual,   '\n');
-        final int length = Math.min(a1.length, a2.length);
-        for (int i=0; i<length; i++) {
-            assertEquals("Line " + (i+1) + ':', a1[i], a2[i]);
-        }
-        assertArrayEquals(message, a1, a2);
+        assertArrayEquals(message, CharSequences.split(expected, '\n'), CharSequences.split(actual,
'\n'));
     }
 
     /**

Modified: sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java?rev=1411577&r1=1411576&r2=1411577&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
(original)
+++ sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
Tue Nov 20 08:15:31 2012
@@ -51,6 +51,7 @@ import org.junit.runners.Suite;
   org.apache.sis.util.collection.CacheTest.class,
   org.apache.sis.util.collection.DerivedSetTest.class,
   org.apache.sis.util.collection.DerivedMapTest.class,
+  org.apache.sis.util.collection.DefaultTreeTableTest.class,
 
   // GeoAPI most basic types.
   org.apache.sis.util.type.TypesTest.class,
@@ -58,12 +59,14 @@ import org.junit.runners.Suite;
   org.apache.sis.util.type.DefaultInternationalStringTest.class,
 
   // Formatting
+  org.apache.sis.internal.util.LocalizedParseExceptionTest.class,
   org.apache.sis.measure.FormattedCharacterIteratorTest.class,
   org.apache.sis.measure.AngleFormatTest.class,
   org.apache.sis.measure.AngleTest.class,
   org.apache.sis.internal.util.X364Test.class,
   org.apache.sis.io.LineFormatterTest.class,
   org.apache.sis.io.TableFormatterTest.class,
+  org.apache.sis.util.collection.TreeTableFormatTest.class,
 
   // XML most basic types.
   org.apache.sis.xml.XLinkTest.class,

Modified: sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/util/CharSequencesTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/util/CharSequencesTest.java?rev=1411577&r1=1411576&r2=1411577&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/util/CharSequencesTest.java
(original)
+++ sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/util/CharSequencesTest.java
Tue Nov 20 08:15:31 2012
@@ -87,11 +87,12 @@ public final strictfp class CharSequence
                 case 3:  string = new SimpleInternationalString((String) string); break;
                 default: throw new AssertionError(i);
             }
-            assertEquals(-1, indexOf(string, "dummy",        0));
-            assertEquals( 0, indexOf(string, "An",           0));
-            assertEquals(-1, indexOf(string, "An",           1));
-            assertEquals(12, indexOf(string, "sentence.",    0));
-            assertEquals(-1, indexOf(string, "sentence;",    0));
+            final int length = string.length();
+            assertEquals(-1, indexOf(string, "dummy",     0, length));
+            assertEquals( 0, indexOf(string, "An",        0, length));
+            assertEquals(-1, indexOf(string, "An",        1, length));
+            assertEquals(12, indexOf(string, "sentence.", 0, length));
+            assertEquals(-1, indexOf(string, "sentence;", 0, length));
         }
     }
 

Modified: sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/util/resources/IndexedResourceBundleTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/util/resources/IndexedResourceBundleTest.java?rev=1411577&r1=1411576&r2=1411577&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/util/resources/IndexedResourceBundleTest.java
(original)
+++ sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/util/resources/IndexedResourceBundleTest.java
Tue Nov 20 08:15:31 2012
@@ -17,6 +17,7 @@
 package org.apache.sis.util.resources;
 
 import java.io.IOException;
+import java.io.PrintStream;
 import java.util.Locale;
 import java.util.Enumeration;
 import java.util.logging.Level;
@@ -27,6 +28,7 @@ import org.apache.sis.test.DependsOnMeth
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
+import org.junit.After;
 
 import static org.junit.Assert.*;
 
@@ -41,6 +43,13 @@ import static org.junit.Assert.*;
 @DependsOn(org.apache.sis.util.ArraysTest.class)
 public final strictfp class IndexedResourceBundleTest extends TestCase {
     /**
+     * The resource bundle in process of being tested. Shall be reset to {@code null} after
every
+     * test. If non-null, then {@link #dumpResourcesOnError()} will consider that the test
failed
+     * and will dump the resource bundle content to the standard error stream.
+     */
+    private IndexedResourceBundle testing;
+
+    /**
      * Tests the {@link Errors#getResources(Locale)} method on different locales.
      */
     @Test
@@ -80,7 +89,8 @@ public final strictfp class IndexedResou
     @Test
     @DependsOnMethod("testGetResources")
     public void testGetKeys() {
-        final Enumeration<String> e=Errors.getResources(Locale.ENGLISH).getKeys();
+        testing = Errors.getResources(Locale.ENGLISH);
+        final Enumeration<String> e = testing.getKeys();
         int count = 0;
         boolean foundNullArgument_1 = false;
         while (e.hasMoreElements()) {
@@ -92,6 +102,7 @@ public final strictfp class IndexedResou
         }
         assertTrue("foundNullArgument_1:", foundNullArgument_1);
         assertTrue("count > 5", count > 5);
+        testing = null;
     }
 
     /**
@@ -103,8 +114,9 @@ public final strictfp class IndexedResou
         final Errors english = Errors.getResources(Locale.ENGLISH);
         final Errors french  = Errors.getResources(Locale.FRENCH);
 
-        assertEquals("Argument ‘{0}’ shall not be null.",     english.getString(Errors.Keys.NullArgument_1));
-        assertEquals("L’argument ‘{0}’ ne doit pas être nul.", french.getString(Errors.Keys.NullArgument_1));
+        assertEquals("Argument ‘{0}’ shall not be null.",      (testing = english).getString(Errors.Keys.NullArgument_1));
+        assertEquals("L’argument ‘{0}’ ne doit pas être nul.", (testing
= french) .getString(Errors.Keys.NullArgument_1));
+        testing = null;
     }
 
     /**
@@ -116,8 +128,9 @@ public final strictfp class IndexedResou
         final Errors english = Errors.getResources(Locale.ENGLISH);
         final Errors french  = Errors.getResources(Locale.FRENCH);
 
-        assertEquals("Argument ‘{0}’ shall not be null.",     english.getString("NullArgument_1"));
-        assertEquals("L’argument ‘{0}’ ne doit pas être nul.", french.getString("NullArgument_1"));
+        assertEquals("Argument ‘{0}’ shall not be null.",      (testing = english).getString("NullArgument_1"));
+        assertEquals("L’argument ‘{0}’ ne doit pas être nul.", (testing
= french) .getString("NullArgument_1"));
+        testing = null;
     }
 
     /**
@@ -126,10 +139,11 @@ public final strictfp class IndexedResou
     @Test
     @DependsOnMethod("testGetString")
     public void testGetStringWithParameter() {
-        assertEquals("Argument ‘CRS’ shall not be null.",
-                Errors.getResources(Locale.ENGLISH).getString(Errors.Keys.NullArgument_1,
"CRS"));
-        assertEquals("L’argument ‘CRS’ ne doit pas être nul.",
-                Errors.getResources(Locale.FRENCH).getString(Errors.Keys.NullArgument_1,
"CRS"));
+        testing = Errors.getResources(Locale.ENGLISH);
+        assertEquals("Argument ‘CRS’ shall not be null.", testing.getString(Errors.Keys.NullArgument_1,
"CRS"));
+        testing = Errors.getResources(Locale.FRENCH);
+        assertEquals("L’argument ‘CRS’ ne doit pas être nul.", testing.getString(Errors.Keys.NullArgument_1,
"CRS"));
+        testing = null;
     }
 
     /**
@@ -153,12 +167,31 @@ public final strictfp class IndexedResou
     @Test
     @DependsOnMethod("testGetResources")
     public void testGetLogRecord() {
-        final IndexedResourceBundle resources = Errors.getResources(Locale.ENGLISH);
-        final LogRecord record = resources.getLogRecord(Level.FINE, Errors.Keys.NullArgument_1,
"CRS");
+        testing = Errors.getResources(Locale.ENGLISH);
+        final LogRecord record = testing.getLogRecord(Level.FINE, Errors.Keys.NullArgument_1,
"CRS");
         assertEquals("NullArgument_1", record.getMessage());
 
         final SimpleFormatter formatter = new SimpleFormatter();
         final String message = formatter.format(record);
         assertTrue(message.contains("Argument ‘CRS’ shall not be null."));
+        testing = null;
+    }
+
+    /**
+     * If a test failed, lists the resource bundle content to the
+     * {@linkplain System#err standard error stream}.
+     *
+     * @throws IOException Should never happen.
+     */
+    @After
+    public void dumpResourcesOnError() throws IOException {
+        if (testing != null) {
+            final PrintStream err = System.err;
+            err.print("Error while testing ");
+            err.print(testing);
+            err.println(". Bundle content is:");
+            testing.list(err);
+            err.flush();
+        }
     }
 }



Mime
View raw message