sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1569926 [5/6] - in /sis/branches/JDK6: ./ core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ core/sis-metadata/src/main/java/org/apache/sis/io/ core/sis-metadata/src/main/java/org/apache/sis/io/wkt/ core/sis-metadata/src/mai...
Date Wed, 19 Feb 2014 21:32:00 GMT
Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/Numbers.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/Numbers.java?rev=1569926&r1=1569925&r2=1569926&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/Numbers.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/Numbers.java [UTF-8] Wed Feb 19 21:31:56 2014
@@ -27,6 +27,7 @@ import java.lang.reflect.Array;
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import org.apache.sis.util.resources.Errors;
+import org.apache.sis.internal.util.Numerics;
 import org.apache.sis.internal.util.CollectionsExt;
 
 import static java.lang.Double.doubleToLongBits;
@@ -65,7 +66,7 @@ public final class Numbers extends Stati
     static {
         new Numbers(BigDecimal.class, true, false, BIG_DECIMAL);
         new Numbers(BigInteger.class, false, true, BIG_INTEGER);
-        new Numbers(Double   .TYPE, Double   .class, true,  false, (byte) Double   .SIZE, DOUBLE,    'D', Double   .valueOf(Double.NaN));
+        new Numbers(Double   .TYPE, Double   .class, true,  false, (byte) Double   .SIZE, DOUBLE,    'D', Numerics .valueOf(Double.NaN));
         new Numbers(Float    .TYPE, Float    .class, true,  false, (byte) Float    .SIZE, FLOAT,     'F', Float    .valueOf(Float .NaN));
         new Numbers(Long     .TYPE, Long     .class, false, true,  (byte) Long     .SIZE, LONG,      'J', Long     .valueOf(        0L));
         new Numbers(Integer  .TYPE, Integer  .class, false, true,  (byte) Integer  .SIZE, INTEGER,   'I', Integer  .valueOf(        0));
@@ -409,8 +410,8 @@ public final class Numbers extends Stati
                 final float  floatValue  = (float) doubleValue;
                 isFloat = (doubleToLongBits(floatValue) == doubleToLongBits(doubleValue));
                 if (doubleValue != longValue) {
-                    candidate = isFloat ? ((Number) Float .valueOf(floatValue))
-                                        : ((Number) Double.valueOf(doubleValue));
+                    candidate = isFloat ? ((Number) Float   .valueOf(floatValue))
+                                        : ((Number) Numerics.valueOf(doubleValue));
                     break;
                 }
                 // Fall through everywhere.
@@ -501,12 +502,12 @@ public final class Numbers extends Stati
             return (N) number;
         }
         switch (getEnumConstant(type)) {
-            case BYTE:    return (N) Byte   .valueOf(number.  byteValue());
-            case SHORT:   return (N) Short  .valueOf(number. shortValue());
-            case INTEGER: return (N) Integer.valueOf(number.   intValue());
-            case LONG:    return (N) Long   .valueOf(number.  longValue());
-            case FLOAT:   return (N) Float  .valueOf(number. floatValue());
-            case DOUBLE:  return (N) Double .valueOf(number.doubleValue());
+            case BYTE:    return (N) Byte    .valueOf(number.  byteValue());
+            case SHORT:   return (N) Short   .valueOf(number. shortValue());
+            case INTEGER: return (N) Integer .valueOf(number.   intValue());
+            case LONG:    return (N) Long    .valueOf(number.  longValue());
+            case FLOAT:   return (N) Float   .valueOf(number. floatValue());
+            case DOUBLE:  return (N) Numerics.valueOf(number.doubleValue());
             case BIG_INTEGER: {
                 final BigInteger c;
                 if (number instanceof BigInteger) {
@@ -566,7 +567,7 @@ public final class Numbers extends Stati
             case INTEGER:     number = (N) Integer   .valueOf((int)   value); break;
             case LONG:        number = (N) Long      .valueOf((long)  value); break;
             case FLOAT:       number = (N) Float     .valueOf((float) value); break;
-            case DOUBLE:      return   (N) Double    .valueOf(value); // No need to verify.
+            case DOUBLE:      return   (N) Numerics  .valueOf(value); // No need to verify.
             case BIG_INTEGER: number = (N) BigInteger.valueOf((long) value); break;
             case BIG_DECIMAL: return   (N) BigDecimal.valueOf(value); // No need to verify.
             default: throw unknownType(type);

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/Static.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/Static.java?rev=1569926&r1=1569925&r2=1569926&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/Static.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/Static.java [UTF-8] Wed Feb 19 21:31:56 2014
@@ -67,6 +67,8 @@ package org.apache.sis.util;
  * <tr><td>{@link org.apache.sis.referencing.cs.CoordinateSystems}</td>
  *     <td>Parses axis names and creates transforms between {@link org.opengis.referencing.cs.CoordinateSystem}
  *         instances.</td></tr>
+ * <tr><td>{@link org.apache.sis.parameter.Parameters}</td>
+ *     <td>Creates, searches or modifies {@link org.opengis.parameter.ParameterValue} instances.</td></tr>
  *
  * <tr><th colspan="2" class="hsep">Input / Output (including CRS, XML, images)</th></tr>
  * <tr><td>{@link org.apache.sis.io.IO}</td>

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/collection/Containers.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/collection/Containers.java?rev=1569926&r1=1569925&r2=1569926&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/collection/Containers.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/collection/Containers.java [UTF-8] Wed Feb 19 21:31:56 2014
@@ -245,7 +245,8 @@ public final class Containers extends St
         }
         final Object value = properties.get(key);
         if (value != null && !type.isInstance(value)) {
-            throw new IllegalArgumentException(Errors.format(Errors.Keys.IllegalPropertyClass_2, key, value.getClass()));
+            throw new IllegalArgumentException(Errors.getResources(properties)
+                    .getString(Errors.Keys.IllegalPropertyClass_2, key, value.getClass()));
         }
         return (T) value;
     }

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/collection/RangeSet.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/collection/RangeSet.java?rev=1569926&r1=1569925&r2=1569926&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/collection/RangeSet.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/collection/RangeSet.java [UTF-8] Wed Feb 19 21:31:56 2014
@@ -20,7 +20,6 @@ import java.io.IOException;
 import java.io.Serializable;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
-import java.io.ObjectStreamException;
 import java.lang.reflect.Array;
 import java.util.Arrays;
 import java.util.Iterator;
@@ -185,7 +184,7 @@ public class RangeSet<E extends Comparab
         /**
          * Returns the singleton instance on deserialization.
          */
-        Object readResolve() throws ObjectStreamException {
+        Object readResolve() {
             return INSTANCE;
         }
     };

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/collection/TableColumn.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/collection/TableColumn.java?rev=1569926&r1=1569925&r2=1569926&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/collection/TableColumn.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/collection/TableColumn.java [UTF-8] Wed Feb 19 21:31:56 2014
@@ -77,7 +77,7 @@ import org.apache.sis.util.resources.Voc
  *                 this.field = field;
  *             }
  *
- *             private Object readResolve() throws InvalidObjectException {
+ *             private Object readResolve() throws ObjectStreamException {
  *                 try {
  *                     return CityLocation.class.getField(field).get(null);
  *                 } catch (Exception cause) { // Many exceptions, including unchecked ones.

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java?rev=1569926&r1=1569925&r2=1569926&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java [UTF-8] Wed Feb 19 21:31:56 2014
@@ -190,6 +190,8 @@ public class TreeTableFormat extends Tab
 
     /**
      * Returns the type of object formatted by this class, which is {@link TreeTable}.
+     *
+     * @return {@inheritDoc}
      */
     @Override
     public final Class<TreeTable> getValueType() {
@@ -282,6 +284,13 @@ public class TreeTableFormat extends Tab
     }
 
     /**
+     * Returns the locale to use for code lists, international strings and exception messages.
+     */
+    final Locale getDisplayLocale() {
+        return getLocale(); // Implemented as getLocale(Locale.Category.DISPLAY) on the JDK7 branch.
+    }
+
+    /**
      * Returns the formats to use for parsing and formatting the values of each column.
      * The returned array may contain {@code null} elements, which means that the values
      * in that column can be stored as {@code String}s.
@@ -420,7 +429,7 @@ public class TreeTableFormat extends Tab
                      */
                     if (--indentationLevel < 0) {
                         pos.setErrorIndex(indexOfLineStart);
-                        throw new LocalizedParseException(getLocale(),
+                        throw new LocalizedParseException(getDisplayLocale(),
                                 Errors.Keys.NodeHasNoParent_1, new Object[] {node}, 0);
                     }
                     lastNode = lastNode.getParent();
@@ -434,7 +443,7 @@ public class TreeTableFormat extends Tab
                     final TreeTable.Node parent = lastNode.getParent();
                     if (parent == null) {
                         pos.setErrorIndex(indexOfLineStart);
-                        throw new LocalizedParseException(getLocale(),
+                        throw new LocalizedParseException(getDisplayLocale(),
                                 Errors.Keys.NodeHasNoParent_1, new Object[] {node}, 0);
                     }
                     parent.getChildren().add(node);
@@ -618,11 +627,11 @@ public class TreeTableFormat extends Tab
                 }
                 text = format.format(value);
             } else if (value instanceof InternationalString) {
-                text = ((InternationalString) value).toString(getLocale());
+                text = ((InternationalString) value).toString(getDisplayLocale());
             } else if (value instanceof CharSequence) {
                 text = value.toString();
             } else if (value instanceof CodeList<?>) {
-                text = Types.getCodeTitle((CodeList<?>) value).toString(getLocale());
+                text = Types.getCodeTitle((CodeList<?>) value).toString(getDisplayLocale());
             } else if (value instanceof Enum<?>) {
                 text = CharSequences.upperCaseToSentence(((Enum<?>) value).name());
             } else {
@@ -705,7 +714,7 @@ public class TreeTableFormat extends Tab
                 for (int i=0; i<level; i++) {
                     out.append(getTreeSymbols(true, isLast[i]));
                 }
-                final Locale locale = getLocale();
+                final Locale locale = getDisplayLocale();
                 out.append('(').append(Vocabulary.getResources(locale)
                    .getString(Vocabulary.Keys.CycleOmitted).toLowerCase(locale))
                    .append(')').append(lineSeparator);

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractInternationalString.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractInternationalString.java?rev=1569926&r1=1569925&r2=1569926&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractInternationalString.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractInternationalString.java [UTF-8] Wed Feb 19 21:31:56 2014
@@ -61,7 +61,7 @@ public abstract class AbstractInternatio
     /**
      * Constructs an international string.
      */
-    public AbstractInternationalString() {
+    protected AbstractInternationalString() {
     }
 
     /**

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java?rev=1569926&r1=1569925&r2=1569926&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java [UTF-8] Wed Feb 19 21:31:56 2014
@@ -426,7 +426,7 @@ public abstract class AbstractName imple
             final LocalName thatNext = thatNames.next();
             if (thisNext == this && thatNext == name) {
                 // Never-ending loop: usually an implementation error
-                throw new IllegalStateException(Errors.format(Errors.Keys.InfiniteRecursivity));
+                throw new IllegalStateException(Errors.format(Errors.Keys.CircularReference));
             }
             final int compare = thisNext.compareTo(thatNext);
             if (compare != 0) {

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java?rev=1569926&r1=1569925&r2=1569926&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java [UTF-8] Wed Feb 19 21:31:56 2014
@@ -19,7 +19,6 @@ package org.apache.sis.util.iso;
 import java.util.List;
 import java.util.Collections;
 import java.util.Locale;
-import java.io.ObjectStreamException;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
@@ -213,6 +212,8 @@ public class DefaultLocalName extends Ab
 
     /**
      * Returns {@code this} since this object is already a local name.
+     *
+     * @return {@code this}.
      */
     @Override
     public final LocalName head() {
@@ -221,6 +222,8 @@ public class DefaultLocalName extends Ab
 
     /**
      * Returns {@code this} since this object is already a local name.
+     *
+     * @return {@code this}.
      */
     @Override
     public final LocalName tip() {
@@ -231,6 +234,8 @@ public class DefaultLocalName extends Ab
      * Returns a locale-independent string representation of this local name.
      * This string does not include the scope, which is consistent with the
      * {@linkplain #getParsedNames() parsed names} definition.
+     *
+     * @return A local-independent string representation of this name.
      */
     @Override
     public synchronized String toString() {
@@ -316,9 +321,8 @@ public class DefaultLocalName extends Ab
      * to replace an instance of a user-defined class.</p>
      *
      * @return The unique instance.
-     * @throws ObjectStreamException Should never happen.
      */
-    private Object readResolve() throws ObjectStreamException {
+    private Object readResolve() {
         final DefaultNameSpace ns;
         if (scope == null) { // Not a bug: readResolve() is intentionally private.
             ns = GlobalNameSpace.GLOBAL;

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java?rev=1569926&r1=1569925&r2=1569926&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java [UTF-8] Wed Feb 19 21:31:56 2014
@@ -497,9 +497,8 @@ public class DefaultNameSpace implements
      * behavior since we don't want to replace an instance of a user-defined class.</p>
      *
      * @return The unique instance.
-     * @throws ObjectStreamException Should never happen.
      */
-    Object readResolve() throws ObjectStreamException {
+    Object readResolve() {
         final DefaultNameSpace p = (parent != null) ? parent : GlobalNameSpace.GLOBAL;
         final String key = key(name);
         final WeakValueHashMap<String,Object> pool = p.childs;

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/GlobalNameSpace.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/GlobalNameSpace.java?rev=1569926&r1=1569925&r2=1569926&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/GlobalNameSpace.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/GlobalNameSpace.java [UTF-8] Wed Feb 19 21:31:56 2014
@@ -16,8 +16,6 @@
  */
 package org.apache.sis.util.iso;
 
-import java.io.ObjectStreamException;
-
 
 /**
  * The global namespace. Only one instance of this class is allowed to exists. We do not expose
@@ -61,10 +59,9 @@ final class GlobalNameSpace extends Defa
      * Returns the unique instance of global name space on deserialization.
      *
      * @return The unique instance.
-     * @throws ObjectStreamException Should never happen.
      */
     @Override
-    Object readResolve() throws ObjectStreamException {
+    Object readResolve() {
         return GLOBAL;
     }
 }

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java?rev=1569926&r1=1569925&r2=1569926&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java [UTF-8] Wed Feb 19 21:31:56 2014
@@ -652,15 +652,15 @@ public final class Types extends Static 
                 try {
                     locale = Locales.parse(key, s);
                 } catch (RuntimeException e) { // IllformedLocaleException on the JDK7 branch.
-                    throw new IllegalArgumentException(Errors.format(Errors.Keys.IllegalLanguageCode_1,
-                            '(' + key.substring(0, s) + ')' + key.substring(s), e));
+                    throw new IllegalArgumentException(Errors.getResources(properties).getString(
+                            Errors.Keys.IllegalLanguageCode_1, '(' + key.substring(0, s) + ')' + key.substring(s), e));
                 }
             }
             final Object value = entry.getValue();
             if (value != null) {
                 if (!(value instanceof CharSequence)) {
-                    throw new IllegalArgumentException(Errors.format(
-                            Errors.Keys.IllegalPropertyClass_2, key, value.getClass()));
+                    throw new IllegalArgumentException(Errors.getResources(properties)
+                            .getString(Errors.Keys.IllegalPropertyClass_2, key, value.getClass()));
                 }
                 if (i18n == null) {
                     i18n = (CharSequence) value;

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java?rev=1569926&r1=1569925&r2=1569926&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java [UTF-8] Wed Feb 19 21:31:56 2014
@@ -313,14 +313,12 @@ public final class Logging extends Stati
          */
         if (logger==null || classe==null || method==null) {
             String paquet = (logger != null) ? logger.getName() : null;
-            final StackTraceElement[] elements = error.getStackTrace();
-            for (int i=0; i<elements.length; i++) {
+            for (final StackTraceElement element : error.getStackTrace()) {
                 /*
                  * Searches for the first stack trace element with a classname matching the
                  * expected one. We compare preferably against the name of the class given
                  * in argument, or against the logger name (taken as the package name) otherwise.
                  */
-                final StackTraceElement element = elements[i];
                 final String classname = element.getClassName();
                 if (classe != null) {
                     if (!classname.equals(classe)) {

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/logging/MonolineFormatter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/logging/MonolineFormatter.java?rev=1569926&r1=1569925&r2=1569926&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/logging/MonolineFormatter.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/logging/MonolineFormatter.java [UTF-8] Wed Feb 19 21:31:56 2014
@@ -20,6 +20,7 @@ import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.io.IOException;
 import java.text.FieldPosition;
+import java.text.MessageFormat;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.TimeZone;
@@ -28,6 +29,7 @@ import java.util.Arrays;
 import java.util.TreeMap;
 import java.util.SortedMap;
 import java.util.Comparator;
+import java.util.ResourceBundle;
 import java.util.logging.*;
 import org.apache.sis.internal.system.OS;
 import org.apache.sis.internal.util.X364;
@@ -223,6 +225,18 @@ public class MonolineFormatter extends F
     private SimpleDateFormat timeFormat;
 
     /**
+     * The message format, or {@code null} if not yet created.
+     */
+    private transient MessageFormat messageFormat;
+
+    /**
+     * Value of the last call to {@link MessageFormat#applyPattern(String)}. Saved in order to avoid
+     * calling {@code applyPattern(String)} in the common case where the same message is logged many
+     * times with different arguments.
+     */
+    private transient String messagePattern;
+
+    /**
      * One of the following constants: {@link #NO_SOURCE}, {@link #LOGGER_SHORT},
      * {@link #LOGGER_LONG}, {@link #CLASS_SHORT} or {@link #CLASS_LONG}.
      */
@@ -231,6 +245,10 @@ public class MonolineFormatter extends F
     /**
      * Buffer for formatting messages. We will reuse this buffer in order to reduce memory allocations.
      * This is the buffer used internally by {@link #writer}.
+     *
+     * <p>This buffer is also arbitrarily chosen as our synchronization lock. The rational is that all
+     * operations on {@code StringBuffer} are synchronized anyway. So by reusing it for our lock, we
+     * will take only one monitor instead of two.</p>
      */
     private final StringBuffer buffer;
 
@@ -342,7 +360,11 @@ loop:   for (int i=0; ; i++) {
      *
      * @return The string to write on the left side of the first line of every log records, or {@code null} if none.
      */
-    public synchronized String getHeader() {
+    public String getHeader() {
+        final String header;
+        synchronized (buffer) {
+            header = this.header;
+        }
         // All other properties in MonolineFormatter are defined in such a way
         // that null means "none", so we do the same here for consistency.
         return header.isEmpty() ? null : header;
@@ -354,11 +376,13 @@ loop:   for (int i=0; ; i++) {
      * @param header The string to write on the left side of the first line of every log records,
      *        or {@code null} if none.
      */
-    public synchronized void setHeader(String header) {
+    public void setHeader(String header) {
         if (header == null) { // See comment in getHeader().
             header = "";
         }
-        this.header = header;
+        synchronized (buffer) {
+            this.header = header;
+        }
     }
 
     /**
@@ -370,8 +394,10 @@ loop:   for (int i=0; ; i++) {
      *
      * @return The time pattern, or {@code null} if elapsed time is not formatted.
      */
-    public synchronized String getTimeFormat() {
-        return (timeFormat != null) ? timeFormat.toPattern() : null;
+    public String getTimeFormat() {
+        synchronized (buffer) {
+            return (timeFormat != null) ? timeFormat.toPattern() : null;
+        }
     }
 
     /**
@@ -384,8 +410,10 @@ loop:   for (int i=0; ; i++) {
      * @param  pattern The time pattern, or {@code null} to disable time formatting.
      * @throws IllegalArgumentException If the given pattern is invalid.
      */
-    public synchronized void setTimeFormat(final String pattern) throws IllegalArgumentException {
-        timeFormat(pattern);
+    public void setTimeFormat(final String pattern) throws IllegalArgumentException {
+        synchronized (buffer) {
+            timeFormat(pattern);
+        }
     }
 
     /**
@@ -411,8 +439,10 @@ loop:   for (int i=0; ; i++) {
      *
      * @return The source format, or {@code null} if source is not formatted.
      */
-    public synchronized String getSourceFormat() {
-        return FORMAT_LABELS[sourceFormat];
+    public String getSourceFormat() {
+        synchronized (buffer) {
+            return FORMAT_LABELS[sourceFormat];
+        }
     }
 
     /**
@@ -433,8 +463,10 @@ loop:   for (int i=0; ; i++) {
      * @param  format The format for displaying the source, or {@code null} if the source shall not be formatted.
      * @throws IllegalArgumentException If the given argument is not one of the recognized format names.
      */
-    public synchronized void setSourceFormat(final String format) throws IllegalArgumentException {
-        sourceFormat(format);
+    public void setSourceFormat(final String format) throws IllegalArgumentException {
+        synchronized (buffer) {
+            sourceFormat(format);
+        }
     }
 
     /**
@@ -463,11 +495,13 @@ loop:   for (int i=0; ; i++) {
      * @param  level The level for which to get the color.
      * @return The color for the given level, or {@code null} if none.
      */
-    public synchronized String getLevelColor(final Level level) {
-        if (colors != null) {
-            final X364 code = colors.get(level);
-            if (code != null) {
-                return code.color;
+    public String getLevelColor(final Level level) {
+        synchronized (buffer) {
+            if (colors != null) {
+                final X364 code = colors.get(level);
+                if (code != null) {
+                    return code.color;
+                }
             }
         }
         return null;
@@ -486,20 +520,22 @@ loop:   for (int i=0; ; i++) {
      * @param  color The case-insensitive new color, or {@code null} if none.
      * @throws IllegalArgumentException If the given color is not one of the recognized values.
      */
-    public synchronized void setLevelColor(final Level level, final String color) throws IllegalArgumentException {
+    public void setLevelColor(final Level level, final String color) throws IllegalArgumentException {
         boolean changed = false;
-        if (color != null) {
-            final X364 code = X364.forColorName(color).background();
-            changed = (colors().put(level, code) != code);
-        } else if (colors != null) {
-            changed = (colors.remove(level) != null);
-            if (colors.isEmpty()) {
-                colors = null;
+        synchronized (buffer) {
+            if (color != null) {
+                final X364 code = X364.forColorName(color).background();
+                changed = (colors().put(level, code) != code);
+            } else if (colors != null) {
+                changed = (colors.remove(level) != null);
+                if (colors.isEmpty()) {
+                    colors = null;
+                }
+            }
+            if (changed) {
+                colorLevels = null;
+                colorSequences = null;
             }
-        }
-        if (changed) {
-            colorLevels = null;
-            colorSequences = null;
         }
     }
 
@@ -541,13 +577,15 @@ loop:   for (int i=0; ; i++) {
      *
      * @param enabled {@code true} for defining a default set of colors, or {@code false} for removing all colors.
      */
-    public synchronized void resetLevelColors(final boolean enabled) {
-        if (enabled) {
-            resetLevelColors();
-        } else {
-            colors = null;
-            colorLevels = null;
-            colorSequences = null;
+    public void resetLevelColors(final boolean enabled) {
+        synchronized (buffer) {
+            if (enabled) {
+                resetLevelColors();
+            } else {
+                colors = null;
+                colorLevels = null;
+                colorSequences = null;
+            }
         }
     }
 
@@ -580,120 +618,176 @@ loop:   for (int i=0; ; i++) {
      * @return A formatted log record.
      */
     @Override
-    public synchronized String format(final LogRecord record) {
+    public String format(final LogRecord record) {
         final Level level = record.getLevel();
-        final boolean colors  = (this.colors != null);
-        final boolean emphase = !faintSupported || (level.intValue() >= LEVEL_THRESHOLD.intValue());
         final StringBuffer buffer = this.buffer;
-        buffer.setLength(header.length());
-        /*
-         * Appends the time (e.g. "00:00:12.365"). The time pattern can be set either
-         * programmatically by a call to 'setTimeFormat(…)', or in logging.properties
-         * file with the "org.apache.sis.util.logging.MonolineFormatter.time" property.
-         */
-        if (timeFormat != null) {
-            Date time = new Date(Math.max(0, record.getMillis() - startMillis));
-            timeFormat.format(time, buffer, new FieldPosition(0));
-            buffer.append(' ');
-        }
-        /*
-         * Appends the level (e.g. "FINE"). We do not provide the option to turn level off for now.
-         * This level will be formatted with a colorized background if ANSI escape sequences are enabled.
-         */
-        int margin = buffer.length();
-        if (SHOW_LEVEL) {
-            if (colors) {
-                buffer.append(colorAt(level));
-            }
-            final int offset = buffer.length();
-            buffer.append(level.getLocalizedName())
-                  .append(CharSequences.spaces(levelWidth - (buffer.length() - offset)));
-            margin += buffer.length() - offset;
-            if (colors) {
-                buffer.append(X364.BACKGROUND_DEFAULT.sequence());
+        synchronized (buffer) {
+            final boolean colors  = (this.colors != null);
+            final boolean emphase = !faintSupported || (level.intValue() >= LEVEL_THRESHOLD.intValue());
+            buffer.setLength(header.length());
+            /*
+             * Appends the time (e.g. "00:00:12.365"). The time pattern can be set either
+             * programmatically by a call to 'setTimeFormat(…)', or in logging.properties
+             * file with the "org.apache.sis.util.logging.MonolineFormatter.time" property.
+             */
+            if (timeFormat != null) {
+                Date time = new Date(Math.max(0, record.getMillis() - startMillis));
+                timeFormat.format(time, buffer, new FieldPosition(0));
+                buffer.append(' ');
             }
-            buffer.append(' ');
-            margin++;
-        }
-        /*
-         * Appends the logger name or source class name, in long of short form.
-         * The name may be formatted in bold characters if ANSI escape sequences are enabled.
-         */
-        String source;
-        switch (sourceFormat) {
-            case LOGGER_SHORT: // Fall through
-            case LOGGER_LONG:  source = record.getLoggerName(); break;
-            case CLASS_SHORT:  // Fall through
-            case CLASS_LONG:   source = record.getSourceClassName(); break;
-            default:           source = null; break;
-        }
-        if (source != null) {
+            /*
+             * Appends the level (e.g. "FINE"). We do not provide the option to turn level off for now.
+             * This level will be formatted with a colorized background if ANSI escape sequences are enabled.
+             */
+            int margin = buffer.length();
+            if (SHOW_LEVEL) {
+                if (colors) {
+                    buffer.append(colorAt(level));
+                }
+                final int offset = buffer.length();
+                buffer.append(level.getLocalizedName())
+                      .append(CharSequences.spaces(levelWidth - (buffer.length() - offset)));
+                margin += buffer.length() - offset;
+                if (colors) {
+                    buffer.append(X364.BACKGROUND_DEFAULT.sequence());
+                }
+                buffer.append(' ');
+                margin++;
+            }
+            /*
+             * Appends the logger name or source class name, in long of short form.
+             * The name may be formatted in bold characters if ANSI escape sequences are enabled.
+             */
+            String source;
             switch (sourceFormat) {
                 case LOGGER_SHORT: // Fall through
-                case CLASS_SHORT: {
-                    // Works even if there is no '.' since we get -1 as index.
-                    source = source.substring(source.lastIndexOf('.') + 1);
-                    break;
+                case LOGGER_LONG:  source = record.getLoggerName(); break;
+                case CLASS_SHORT:  // Fall through
+                case CLASS_LONG:   source = record.getSourceClassName(); break;
+                default:           source = null; break;
+            }
+            if (source != null) {
+                switch (sourceFormat) {
+                    case LOGGER_SHORT: // Fall through
+                    case CLASS_SHORT: {
+                        // Works even if there is no '.' since we get -1 as index.
+                        source = source.substring(source.lastIndexOf('.') + 1);
+                        break;
+                    }
+                }
+                if (colors && emphase) {
+                    buffer.append(X364.BOLD.sequence());
+                }
+                buffer.append('[').append(source).append(']');
+                if (colors && emphase) {
+                    buffer.append(X364.NORMAL.sequence());
                 }
+                buffer.append(' ');
             }
-            if (colors && emphase) {
-                buffer.append(X364.BOLD.sequence());
+            /*
+             * Now prepare the LineAppender for the message. We set a line separator prefixed by some
+             * amount of spaces in order to align message body on the column after the level name.
+             */
+            String bodyLineSeparator = writer.getLineSeparator();
+            final String lineSeparator = JDK7.lineSeparator();
+            if (bodyLineSeparator.length() != lineSeparator.length() + margin) {
+                bodyLineSeparator = lineSeparator + CharSequences.spaces(margin);
+                writer.setLineSeparator(bodyLineSeparator);
+            }
+            if (colors && !emphase) {
+                buffer.append(X364.FAINT.sequence());
+            }
+            final Throwable exception = record.getThrown();
+            String message = formatMessage(record);
+            int length = 0;
+            if (message != null) {
+                length = CharSequences.skipTrailingWhitespaces(message, 0, message.length());
             }
-            buffer.append('[').append(source).append(']');
-            if (colors && emphase) {
+            /*
+             * Up to this point, we wrote directly in the StringBuilder for performance reasons.
+             * Now for the message part, we need to use the LineAppender in order to replace EOL
+             * and tabulations.
+             */
+            try {
+                if (message != null) {
+                    writer.append(message, 0, length);
+                }
+                if (exception != null) {
+                    if (message != null) {
+                        writer.append("\nCaused by: "); // LineAppender will replace '\n' by the system EOL.
+                    }
+                    if (level.intValue() >= LEVEL_THRESHOLD.intValue()) {
+                        exception.printStackTrace(printer);
+                    } else {
+                        printAbridged(exception, writer, record.getLoggerName(),
+                                record.getSourceClassName(), record.getSourceMethodName());
+                    }
+                }
+                writer.flush();
+            } catch (IOException e) {
+                throw new AssertionError(e);
+            }
+            buffer.setLength(CharSequences.skipTrailingWhitespaces(buffer, 0, buffer.length()));
+            if (colors && !emphase) {
                 buffer.append(X364.NORMAL.sequence());
             }
-            buffer.append(' ');
-        }
-        /*
-         * Now prepare the LineAppender for the message. We set a line separator prefixed by some
-         * amount of spaces in order to align message body on the column after the level name.
-         */
-        String bodyLineSeparator = writer.getLineSeparator();
-        final String lineSeparator = JDK7.lineSeparator();
-        if (bodyLineSeparator.length() != lineSeparator.length() + margin) {
-            bodyLineSeparator = lineSeparator + CharSequences.spaces(margin);
-            writer.setLineSeparator(bodyLineSeparator);
-        }
-        if (colors && !emphase) {
-            buffer.append(X364.FAINT.sequence());
-        }
-        final Throwable exception = record.getThrown();
-        String message = formatMessage(record);
-        int length = 0;
-        if (message != null) {
-            length = CharSequences.skipTrailingWhitespaces(message, 0, message.length());
+            buffer.append(lineSeparator);
+            return buffer.toString();
         }
+    }
+
+    /**
+     * Returns the localized message from the given log record.
+     * First this method gets the {@linkplain LogRecord#getMessage() raw message} from the given record.
+     * Then there is choices:
+     *
+     * <ul>
+     *   <li>If the given record specifies a {@linkplain LogRecord#getResourceBundle() resource bundle},
+     *       then the message is used as a key for fetching the localized resources in the given bundle.</li>
+     *   <li>If the given record specifies one or more {@linkplain LogRecord#getParameters() parameters}
+     *       and if the message seems to use the {@link MessageFormat} syntax, then the message is formatted
+     *       by {@code MessageFormat}.</li>
+     * </ul>
+     *
+     * @param  record The log record from which to get a localized message.
+     * @return The localized message.
+     */
+    @Override
+    public String formatMessage(final LogRecord record) {
         /*
-         * Up to this point, we wrote directly in the StringBuilder for performance reasons.
-         * Now for the message part, we need to use the LineAppender in order to replace EOL
-         * and tabulations.
+         * Same work than java.util.logging.Formatter.formatMessage(LogRecord) except for the synchronization lock,
+         * the reuse of existing MessageFormat and StringBuffer instances, and not catching formatting exceptions
+         * (we want to know if our messages have a problem).
          */
-        try {
-            if (message != null) {
-                writer.append(message, 0, length);
-            }
-            if (exception != null) {
-                if (message != null) {
-                    writer.append("\nCaused by: "); // LineAppender will replace '\n' by the system EOL.
-                }
-                if (level.intValue() >= LEVEL_THRESHOLD.intValue()) {
-                    exception.printStackTrace(printer);
-                } else {
-                    printAbridged(exception, writer, record.getLoggerName(),
-                            record.getSourceClassName(), record.getSourceMethodName());
+        String message = record.getMessage();
+        ResourceBundle resources = record.getResourceBundle();
+        if (resources != null) {
+            message = resources.getString(message);
+        }
+        final Object parameters[] = record.getParameters();
+        if (parameters != null && parameters.length != 0) {
+            int i = message.indexOf('{');
+            if (i >= 0 && ++i < message.length()) {
+                final char c = message.charAt(i);
+                if (c >= '0' && c <= '9') {
+                    synchronized (buffer) {
+                        if (messageFormat == null) {
+                            messageFormat = new MessageFormat(message);
+                        } else if (!message.equals(messagePattern)) {
+                            messageFormat.applyPattern(message);
+                        }
+                        messagePattern = message;
+                        final int base = buffer.length();
+                        try {
+                            message = messageFormat.format(parameters, buffer, new FieldPosition(0)).substring(base);
+                        } finally {
+                            buffer.setLength(base);
+                        }
+                    }
                 }
             }
-            writer.flush();
-        } catch (IOException e) {
-            throw new AssertionError(e);
-        }
-        buffer.setLength(CharSequences.skipTrailingWhitespaces(buffer, 0, buffer.length()));
-        if (colors && !emphase) {
-            buffer.append(X364.NORMAL.sequence());
         }
-        buffer.append(lineSeparator);
-        return buffer.toString();
+        return message;
     }
 
     /**

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java?rev=1569926&r1=1569925&r2=1569926&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] Wed Feb 19 21:31:56 2014
@@ -17,6 +17,7 @@
 package org.apache.sis.util.resources;
 
 import java.net.URL;
+import java.util.Map;
 import java.util.Locale;
 import java.util.MissingResourceException;
 import org.opengis.util.InternationalString;
@@ -124,6 +125,11 @@ public final class Errors extends Indexe
         public static final short CanNotSetPropertyValue_1 = 11;
 
         /**
+         * Circular reference.
+         */
+        public static final short CircularReference = 52;
+
+        /**
          * Class ‘{0}’ is not final.
          */
         public static final short ClassNotFinal_1 = 12;
@@ -256,6 +262,11 @@ public final class Errors extends Indexe
         public static final short IllegalMemberType_2 = 37;
 
         /**
+         * This operation can not be applied to values of class ‘{0}’.
+         */
+        public static final short IllegalOperationForValueClass_1 = 141;
+
+        /**
          * Option ‘{0}’ can not take the “{1}” value.
          */
         public static final short IllegalOptionValue_2 = 38;
@@ -266,7 +277,23 @@ public final class Errors extends Indexe
         public static final short IllegalOrdinateRange_3 = 39;
 
         /**
-         * Property ‘{0}’ does not accept instances of ‘{1}’.
+         * Parameter “{0}” can not be of type ‘{1}’.
+         */
+        public static final short IllegalParameterType_2 = 143;
+
+        /**
+         * Parameter “{0}” does not accept values of ‘{2}’ type. Expected an instance of ‘{1}’ or
+         * derived type.
+         */
+        public static final short IllegalParameterValueClass_3 = 138;
+
+        /**
+         * Parameter “{0}” can not take the “{1}” value.
+         */
+        public static final short IllegalParameterValue_2 = 144;
+
+        /**
+         * Property “{0}” does not accept instances of ‘{1}’.
          */
         public static final short IllegalPropertyClass_2 = 40;
 
@@ -296,6 +323,11 @@ public final class Errors extends Indexe
         public static final short IncompatiblePropertyValue_1 = 45;
 
         /**
+         * Unit “{0}” is incompatible with current value.
+         */
+        public static final short IncompatibleUnit_1 = 140;
+
+        /**
          * Units “{0}” and “{1}” are incompatible.
          */
         public static final short IncompatibleUnits_2 = 46;
@@ -326,11 +358,6 @@ public final class Errors extends Indexe
         public static final short InfiniteArgumentValue_1 = 51;
 
         /**
-         * Infinite recursivity.
-         */
-        public static final short InfiniteRecursivity = 52;
-
-        /**
          * Argument ‘{0}’ shall contain at least {1} elements. A number of {2} is insufficient.
          */
         public static final short InsufficientArgumentSize_3 = 53;
@@ -386,12 +413,17 @@ public final class Errors extends Indexe
         public static final short MissingSchemeInURI = 62;
 
         /**
-         * Missing value for option “{0}”.
+         * Missing value for “{0}” option.
          */
         public static final short MissingValueForOption_1 = 63;
 
         /**
-         * Missing value for property “{0}”.
+         * Missing value for “{0}” parameter.
+         */
+        public static final short MissingValueForParameter_1 = 142;
+
+        /**
+         * Missing value for “{0}” property.
          */
         public static final short MissingValueForProperty_1 = 64;
 
@@ -611,6 +643,11 @@ public final class Errors extends Indexe
         public static final short TooManyArguments_2 = 105;
 
         /**
+         * Tree depth exceeds the maximum.
+         */
+        public static final short TreeDepthExceedsMaximum = 145;
+
+        /**
          * Ordering between “{0}” and “{1}” elements is undefined.
          */
         public static final short UndefinedOrderingForElements_2 = 106;
@@ -641,6 +678,11 @@ public final class Errors extends Indexe
         public static final short UnexpectedFileFormat_2 = 111;
 
         /**
+         * Parameter “{0}” has no unit.
+         */
+        public static final short UnitlessParameter_1 = 139;
+
+        /**
          * Authority “{0}” is unknown.
          */
         public static final short UnknownAuthority_1 = 136;
@@ -786,6 +828,21 @@ public final class Errors extends Indexe
     }
 
     /**
+     * Returns resources in the locale specified in the given property map. This convenience method looks
+     * for the {@link #LOCALE_KEY} entry. If the given map is null, or contains no entry for the locale key,
+     * or the value is not an instance of {@link Locale}, then this method fallback on the default locale.
+     *
+     * @param  properties The map of properties, or {@code null} if none.
+     * @return Resources in the given locale.
+     * @throws MissingResourceException if resources can't be found.
+     *
+     * @since 0.4
+     */
+    public static Errors getResources(final Map<?,?> properties) throws MissingResourceException {
+        return getResources(getLocale(properties));
+    }
+
+    /**
      * Gets a string for the given key from this resource bundle or one of its parents.
      *
      * @param  key The key for the desired string.
@@ -793,7 +850,7 @@ public final class Errors extends Indexe
      * @throws MissingResourceException If no object for the given key can be found.
      */
     public static String format(final short key) throws MissingResourceException {
-        return getResources(null).getString(key);
+        return getResources((Locale) null).getString(key);
     }
 
     /**
@@ -808,7 +865,7 @@ public final class Errors extends Indexe
     public static String format(final short  key,
                                 final Object arg0) throws MissingResourceException
     {
-        return getResources(null).getString(key, arg0);
+        return getResources((Locale) null).getString(key, arg0);
     }
 
     /**
@@ -825,7 +882,7 @@ public final class Errors extends Indexe
                                 final Object arg0,
                                 final Object arg1) throws MissingResourceException
     {
-        return getResources(null).getString(key, arg0, arg1);
+        return getResources((Locale) null).getString(key, arg0, arg1);
     }
 
     /**
@@ -844,7 +901,7 @@ public final class Errors extends Indexe
                                 final Object arg1,
                                 final Object arg2) throws MissingResourceException
     {
-        return getResources(null).getString(key, arg0, arg1, arg2);
+        return getResources((Locale) null).getString(key, arg0, arg1, arg2);
     }
 
     /**
@@ -865,7 +922,7 @@ public final class Errors extends Indexe
                                 final Object arg2,
                                 final Object arg3) throws MissingResourceException
     {
-        return getResources(null).getString(key, arg0, arg1, arg2, arg3);
+        return getResources((Locale) null).getString(key, arg0, arg1, arg2, arg3);
     }
 
     /**

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties?rev=1569926&r1=1569925&r2=1569926&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties [ISO-8859-1] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties [ISO-8859-1] Wed Feb 19 21:31:56 2014
@@ -36,6 +36,7 @@ CanNotParseFile_2                 = Can 
 CanNotRead_1                      = Can not read \u201c{0}\u201d.
 CanNotRepresentInFormat_2         = Can not represent \u201c{1}\u201d in the {0} format.
 CanNotSetPropertyValue_1          = Can not set a value for property \u201c{0}\u201d.
+CircularReference                 = Circular reference.
 ClassNotFinal_1                   = Class \u2018{0}\u2019 is not final.
 CloneNotSupported_1               = Can not clone an object of type \u2018{0}\u2019.
 ColinearAxisDirections_2          = Axis directions {0} and {1} are colinear.
@@ -56,19 +57,24 @@ IllegalArgumentClass_3            = Argu
 IllegalArgumentField_4            = Argument \u2018{0}\u2019 can not take the \u201c{1}\u201d value, because the \u2018{2}\u2019 field can not take the \u201c{3}\u201d value.
 IllegalArgumentValue_2            = Argument \u2018{0}\u2019 can not take the \u201c{1}\u201d value.
 IllegalAxisDirection_2            = Coordinate system of class \u2018{0}\u2019 can not have axis in the {1} direction.
-IllegalOptionValue_2              = Option \u2018{0}\u2019 can not take the \u201c{1}\u201d value.
 IllegalBitsPattern_1              = Illegal bits pattern: {0}.
 IllegalClass_2                    = Class \u2018{1}\u2019 is illegal. It must be \u2018{0}\u2019 or a derived class.
 IllegalFormatPatternForClass_2    = The \u201c{1}\u201d pattern can not be applied to formating of objects of type \u2018{0}\u2019.
 IllegalLanguageCode_1             = The \u201c{0}\u201d language is not recognized.
 IllegalMemberType_2               = Member \u201c{0}\u201d can not be associated to type \u201c{1}\u201d.
+IllegalOperationForValueClass_1   = This operation can not be applied to values of class \u2018{0}\u2019.
+IllegalOptionValue_2              = Option \u2018{0}\u2019 can not take the \u201c{1}\u201d value.
 IllegalOrdinateRange_3            = The [{0} \u2026 {1}] range of ordinate values is not valid for the \u201c{2}\u201d axis.
-IllegalPropertyClass_2            = Property \u2018{0}\u2019 does not accept instances of \u2018{1}\u2019.
+IllegalParameterType_2            = Parameter \u201c{0}\u201d can not be of type \u2018{1}\u2019.
+IllegalParameterValue_2           = Parameter \u201c{0}\u201d can not take the \u201c{1}\u201d value.
+IllegalParameterValueClass_3      = Parameter \u201c{0}\u201d does not accept values of \u2018{2}\u2019 type. Expected an instance of \u2018{1}\u2019 or derived type.
+IllegalPropertyClass_2            = Property \u201c{0}\u201d does not accept instances of \u2018{1}\u2019.
 IllegalRange_2                    = Range [{0} \u2026 {1}] is not valid.
 IllegalUnicodeCodePoint_2         = Value {1} for \u201c{0}\u201d is not a valid Unicode code point.
 IllegalUnitFor_2                  = Unit of measurement \u201c{1}\u201d is not valid for \u201c{0}\u201d values.
 IncompatibleCoordinateSystemTypes = Incompatible coordinate system types.
 IncompatiblePropertyValue_1       = Property \u201c{0}\u201d has an incompatible value.
+IncompatibleUnit_1                = Unit \u201c{0}\u201d is incompatible with current value.
 IncompatibleUnits_2               = Units \u201c{0}\u201d and \u201c{1}\u201d are incompatible.
 InconsistentAttribute_2           = Value \u201c{1}\u201d of attribute \u2018{0}\u2019 is inconsistent with other attributes.
 InconsistentTableColumns          = Inconsistent table columns.
@@ -76,7 +82,6 @@ IdentifierAlreadyBound_1          = Iden
 IndexOutOfBounds_1                = Index {0} is out of bounds.
 IndicesOutOfBounds_2              = Indices ({0}, {1}) are out of bounds.
 InfiniteArgumentValue_1           = Argument \u2018{0}\u2019 can not take an infinite value.
-InfiniteRecursivity               = Infinite recursivity.
 InsufficientArgumentSize_3        = Argument \u2018{0}\u2019 shall contain at least {1} elements. A number of {2} is insufficient.
 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.
@@ -88,8 +93,9 @@ MismatchedMatrixSize_4            = Mism
 MissingAuthority_1                = No authority was specified for code \u201c{0}\u201d. The expected syntax is \u201cAUTHORITY:CODE\u201d.
 MissingRequiredModule_1           = This operation requires the \u201c{0}\u201d module.
 MissingSchemeInURI                = Missing scheme in URI.
-MissingValueForOption_1           = Missing value for option \u201c{0}\u201d.
-MissingValueForProperty_1         = Missing value for property \u201c{0}\u201d.
+MissingValueForOption_1           = Missing value for \u201c{0}\u201d option.
+MissingValueForParameter_1        = Missing value for \u201c{0}\u201d parameter.
+MissingValueForProperty_1         = Missing value for \u201c{0}\u201d property.
 MissingValueInColumn_1            = Missing value in the \u201c{0}\u201d column.
 MutuallyExclusiveOptions_2        = Options \u201c{0}\u201d and \u201c{1}\u201d are mutually exclusive.
 NegativeArgument_2                = Argument \u2018{0}\u2019 shall not be negative. The given value was {1}.
@@ -134,12 +140,14 @@ StalledThread_1                   = Thre
 StreamIsForwardOnly_1             = Can not move backward in the \u201c{0}\u201d stream.
 TooFewArguments_2                 = Expected at least {0} argument{0,choice,1#|2#s}, but got {1}.
 TooManyArguments_2                = Expected at most {0} argument{0,choice,1#|2#s}, but got {1}.
+TreeDepthExceedsMaximum           = Tree depth exceeds the maximum.
 UndefinedOrderingForElements_2    = Ordering between \u201c{0}\u201d and \u201c{1}\u201d elements is undefined.
 UnexpectedArrayLength_2           = Expected an array of length {0}, but got {1}.
 UnexpectedChange_1                = Unexpected change in \u2018{0}\u2019.
 UnexpectedEndOfFile_1             = Unexpected end of file while reading \u201c{0}\u201d.
 UnexpectedEndOfString_1           = More characters were expected at the end of \u201c{0}\u201d.
 UnexpectedFileFormat_2            = File \u201c{1}\u201d seems to be encoded in an other format than {0}.
+UnitlessParameter_1               = Parameter \u201c{0}\u201d has no unit.
 UnknownAuthority_1                = Authority \u201c{0}\u201d is unknown.
 UnknownAxisDirection_1            = Axis direction \u201c{0}\u201d is unknown.
 UnknownCommand_1                  = Command \u201c{0}\u201d is not recognized.

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties?rev=1569926&r1=1569925&r2=1569926&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties [ISO-8859-1] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties [ISO-8859-1] Wed Feb 19 21:31:56 2014
@@ -26,6 +26,7 @@ CanNotParseFile_2                 = Ne p
 CanNotRead_1                      = Ne peut pas lire \u00ab\u202f{0}\u202f\u00bb.
 CanNotRepresentInFormat_2         = Ne peut pas repr\u00e9senter \u00ab\u202f{1}\u202f\u00bb dans le format {0}.
 CanNotSetPropertyValue_1          = Ne peut pas d\u00e9finir une valeur pour la propri\u00e9t\u00e9 \u00ab\u202f{0}\u202f\u00bb.
+CircularReference                 = R\u00e9f\u00e9rence circulaire.
 ClassNotFinal_1                   = La classe \u2018{0}\u2019 n\u2019est pas finale.
 CloneNotSupported_1               = Un objet de type \u2018{0}\u2019 ne peut pas \u00eatre clon\u00e9.
 ColinearAxisDirections_2          = Les directions d\u2019axes {0} et {1} sont colin\u00e9aires.
@@ -46,19 +47,24 @@ IllegalArgumentClass_3            = L\u2
 IllegalArgumentField_4            = L\u2019argument \u2018{0}\u2019 n\u2019accepte pas la valeur \u00ab\u202f{1}\u202f\u00bb parce que le champs \u2018{2}\u2019 ne peut pas prendre la valeur \u00ab\u202f{3}\u202f\u00bb.
 IllegalArgumentValue_2            = L\u2019argument \u2018{0}\u2019 n\u2019accepte pas la valeur \u00ab\u202f{1}\u202f\u00bb.
 IllegalAxisDirection_2            = Les syst\u00e8mes de coordonn\u00e9es de classe \u2018{0}\u2019 ne peuvent pas avoir d\u2019axe dans la direction \u00ab\u202f{1}\u202f\u00bb.
-IllegalOptionValue_2              = L\u2019option \u2018{0}\u2019 n\u2019accepte pas la valeur \u00ab\u202f{1}\u202f\u00bb.
 IllegalBitsPattern_1              = Pattern de bits invalide: {0}.
 IllegalClass_2                    = La classe \u2018{1}\u2019 est ill\u00e9gale. Il doit s\u2019agir d\u2019une classe \u2018{0}\u2019 ou d\u00e9riv\u00e9e.
 IllegalFormatPatternForClass_2    = Le mod\u00e8le \u00ab\u202f{1}\u202f\u00bb ne peut pas \u00eatre appliqu\u00e9 au formatage d\u2019objets de type \u2018{0}\u2019.
 IllegalLanguageCode_1             = Le code de langue \u00ab\u202f{0}\u202f\u00bb n\u2019est pas reconnu.
 IllegalMemberType_2               = Le membre \u00ab\u202f{0}\u202f\u00bb ne peut pas \u00eatre associ\u00e9 au type \u00ab\u202f{1}\u202f\u00bb.
+IllegalOperationForValueClass_1   = Cette op\u00e9ration ne peut pas s\u2019appliquer aux valeurs de classe \u2018{0}\u2019.
+IllegalOptionValue_2              = L\u2019option \u2018{0}\u2019 n\u2019accepte pas la valeur \u00ab\u202f{1}\u202f\u00bb.
 IllegalOrdinateRange_3            = La plage de valeurs de coordonn\u00e9es [{0} \u2026 {1}] n\u2019est pas valide pour l\u2019axe \u00ab\u202f{2}\u202f\u00bb.
-IllegalPropertyClass_2            = La propri\u00e9t\u00e9 \u2018{0}\u2019 n\u2019accepte pas les valeurs de type \u2018{1}\u2019.
+IllegalParameterType_2            = Le param\u00e8tre \u00ab\u202f{0}\u202f\u00bb ne peut pas \u00eatre du type \u2018{1}\u2019.
+IllegalParameterValue_2           = Le param\u00e8tre \u00ab\u202f{0}\u202f\u00bb n\u2019accepte pas la valeur \u00ab\u202f{1}\u202f\u00bb.
+IllegalParameterValueClass_3      = Le param\u00e8tre \u00ab\u202f{0}\u202f\u00bb n\u2019accepte pas les valeurs de type \u2018{2}\u2019. Une instance de \u2018{1}\u2019 ou d\u2019un type d\u00e9riv\u00e9 \u00e9tait attendue.
+IllegalPropertyClass_2            = La propri\u00e9t\u00e9 \u00ab\u202f{0}\u202f\u00bb n\u2019accepte pas les valeurs de type \u2018{1}\u2019.
 IllegalRange_2                    = La plage [{0} \u2026 {1}] n\u2019est pas valide.
 IllegalUnicodeCodePoint_2         = La valeur {1} de \u00ab\u202f{0}\u202f\u00bb n\u2019est pas un code Unicode valide.
 IllegalUnitFor_2                  = L\u2019unit\u00e9 de mesure \u00ab\u202f{1}\u202f\u00bb n\u2019est pas valide pour les valeurs de \u00ab\u202f{0}\u202f\u00bb.
 IncompatibleCoordinateSystemTypes = Types de syst\u00e8mes de coordonn\u00e9es incompatibles.
 IncompatiblePropertyValue_1       = La valeur de la propri\u00e9t\u00e9 \u00ab\u202f{0}\u202f\u00bb n\u2019est pas compatible.
+IncompatibleUnit_1                = L\u2019unit\u00e9 \u00ab\u202f{0}\u202f\u00bb n\u2019est pas compatible avec la valeur actuelle.
 IncompatibleUnits_2               = Les unit\u00e9s \u00ab\u202f{0}\u202f\u00bb et \u00ab\u202f{1}\u202f\u00bb ne sont pas compatibles.
 InconsistentAttribute_2           = La valeur \u00ab\u202f{1}\u202f\u00bb 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.
@@ -66,7 +72,6 @@ IdentifierAlreadyBound_1          = L\u2
 IndexOutOfBounds_1                = L\u2019index {0} est en dehors des limites permises.
 IndicesOutOfBounds_2              = Les index ({0}, {1}) sont en dehors des limites permises.
 InfiniteArgumentValue_1           = L\u2019argument \u2018{0}\u2019 ne peut pas prendre une valeur infinie.
-InfiniteRecursivity               = R\u00e9cursivit\u00e9 infinie.
 InsufficientArgumentSize_3        = L\u2019argument \u2018{0}\u2019 doit contenir au moins {1} \u00e9l\u00e9ments. Un nombre de {2} est insuffisant.
 KeyCollision_1                    = Une valeur diff\u00e9rente est d\u00e9j\u00e0 associ\u00e9e \u00e0 la cl\u00e9 \u00ab\u202f{0}\u202f\u00bb.
 MandatoryAttribute_2              = L\u2019attribut \u00ab\u202f{0}\u202f\u00bb est obligatoire pour un objet de type \u2018{1}\u2019.
@@ -79,6 +84,7 @@ MissingAuthority_1                = Aucu
 MissingRequiredModule_1           = Cette op\u00e9ration requiert le module \u00ab\u202f{0}\u202f\u00bb.
 MissingSchemeInURI                = Il manque le sch\u00e9ma d\u2019URI.
 MissingValueForOption_1           = Aucune valeur n\u2019a \u00e9t\u00e9 d\u00e9finie pour l\u2019option \u00ab\u202f{0}\u202f\u00bb.
+MissingValueForParameter_1        = Aucune valeur n\u2019a \u00e9t\u00e9 d\u00e9finie pour le param\u00e8tre \u00ab\u202f{0}\u202f\u00bb.
 MissingValueForProperty_1         = Aucune valeur n\u2019a \u00e9t\u00e9 d\u00e9finie pour la propri\u00e9t\u00e9 \u00ab\u202f{0}\u202f\u00bb.
 MissingValueInColumn_1            = Il manque une valeur dans la colonne \u00ab\u202f{0}\u202f\u00bb.
 MutuallyExclusiveOptions_2        = Les options \u00ab\u202f{0}\u202f\u00bb et \u00ab\u202f{1}\u202f\u00bb sont mutuellement exclusives.
@@ -123,12 +129,14 @@ StalledThread_1                   = La t
 StreamIsForwardOnly_1             = Ne peut pas reculer dans le flux de donn\u00e9es \u00ab\u202f{0}\u202f\u00bb.
 TooFewArguments_2                 = Au moins {0} argument{0,choice,1# \u00e9tait attendu|2#s \u00e9taient attendus}, mais seulement {1} {1,choice,1#a \u00e9t\u00e9 sp\u00e9cifi\u00e9|2#ont \u00e9t\u00e9 sp\u00e9cifi\u00e9s}.
 TooManyArguments_2                = Au plus {0} argument{0,choice,1# \u00e9tait attendu|2#s \u00e9taient attendus}, mais {1} {1,choice,1#a \u00e9t\u00e9 sp\u00e9cifi\u00e9|2#ont \u00e9t\u00e9 sp\u00e9cifi\u00e9s}.
+TreeDepthExceedsMaximum           = La profondeur de l\u2019arbre exc\u00e8de le maximum.
 UndefinedOrderingForElements_2    = L\u2019ordre entre les \u00e9l\u00e9ments \u00ab\u202f{0}\u202f\u00bb et \u00ab\u202f{1}\u202f\u00bb n\u2019est pas d\u00e9fini.
 UnexpectedArrayLength_2           = Un tableau de longueur {0} \u00e9tait attendu, mais le tableau re\u00e7u est de longueur {1}.
 UnexpectedChange_1                = Changement inattendu dans \u2018{0}\u2019.
 UnexpectedEndOfFile_1             = Fin de fichier inattendue lors de la lecture de \u00ab\u202f{0}\u202f\u00bb.
 UnexpectedEndOfString_1           = D\u2019autres caract\u00e8res \u00e9taient attendus \u00e0 la fin du texte \u00ab\u202f{0}\u202f\u00bb.
 UnexpectedFileFormat_2            = Le fichier \u00ab\u202f{1}\u202f\u00bb semble \u00eatre encod\u00e9 dans un autre format que {0}.
+UnitlessParameter_1               = Le param\u00e8tre \u201c{0}\u201d n\u2019a pas d\u2019unit\u00e9.
 UnknownAuthority_1                = L\u2019autorit\u00e9 \u00ab\u202f{0}\u202f\u00bb n\u2019est pas reconnue.
 UnknownAxisDirection_1            = La direction d\u2019axe \u00ab\u202f{0}\u202f\u00bb n\u2019est pas reconnue.
 UnknownCommand_1                  = La commande \u00ab\u202f{0}\u202f\u00bb n\u2019est pas reconnue.

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java?rev=1569926&r1=1569925&r2=1569926&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java [UTF-8] Wed Feb 19 21:31:56 2014
@@ -21,6 +21,7 @@ import java.io.BufferedInputStream;
 import java.io.DataInputStream;
 import java.io.IOException;
 import java.text.MessageFormat;
+import java.util.Map;
 import java.util.Enumeration;
 import java.util.Locale;
 import java.util.MissingResourceException;
@@ -74,6 +75,14 @@ import org.apache.sis.internal.jdk7.JDK7
  */
 public class IndexedResourceBundle extends ResourceBundle implements Localized {
     /**
+     * Key used in properties map for localizing some aspects of the operation being executed.
+     * The {@code getResources(Map<?,?>)} methods defined in some sub-classes will look for this property.
+     *
+     * @see org.apache.sis.referencing.AbstractIdentifiedObject#LOCALE_KEY
+     */
+    public static final String LOCALE_KEY = "locale";
+
+    /**
      * Maximum string length for text inserted into another text. This parameter is used by
      * {@link #summarize}. Resource strings are never cut to this length. However, text replacing
      * {@code "{0}"} in a string like {@code "Parameter name is {0}"} will be cut to this length.
@@ -668,6 +677,25 @@ public class IndexedResourceBundle exten
     }
 
     /**
+     * Returns the locale specified in the given map, or {@code null} if none.
+     * Value of unexpected type are ignored.
+     *
+     * @param  properties The map of properties, or {@code null} if none.
+     * @return The locale found in the given map, or {@code null} if none.
+     *
+     * @since 0.4
+     */
+    static Locale getLocale(final Map<?,?> properties) {
+        if (properties != null) {
+            final Object candidate = properties.get(LOCALE_KEY);
+            if (candidate instanceof Locale) {
+                return (Locale) candidate;
+            }
+        }
+        return null;
+    }
+
+    /**
      * Returns a string representation of this object.
      * This method is for debugging purposes only.
      *

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/xml/NilInternationalString.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/xml/NilInternationalString.java?rev=1569926&r1=1569925&r2=1569926&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/xml/NilInternationalString.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/xml/NilInternationalString.java [UTF-8] Wed Feb 19 21:31:56 2014
@@ -18,7 +18,6 @@ package org.apache.sis.xml;
 
 import java.util.Locale;
 import java.io.Serializable;
-import java.io.ObjectStreamException;
 import org.opengis.util.InternationalString;
 import org.apache.sis.util.resources.Errors;
 
@@ -117,7 +116,7 @@ final class NilInternationalString imple
     /**
      * Invoked on deserialization for replacing the deserialized instance by the unique instance.
      */
-    private Object readResolve() throws ObjectStreamException {
+    private Object readResolve() {
         return reason.createNilObject(InternationalString.class);
     }
 }

Modified: sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/converter/ConverterRegistryTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/converter/ConverterRegistryTest.java?rev=1569926&r1=1569925&r2=1569926&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/converter/ConverterRegistryTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/converter/ConverterRegistryTest.java [UTF-8] Wed Feb 19 21:31:56 2014
@@ -58,7 +58,7 @@ public final strictfp class ConverterReg
      * All converters registered in a test case. Only the converter type and properties
      * will be verified; no conversion or serialization shall be attempted.
      */
-    private Deque<ObjectConverter<?,?>> converters = new ArrayDeque<ObjectConverter<?,?>>();
+    private final Deque<ObjectConverter<?,?>> converters = new ArrayDeque<ObjectConverter<?,?>>();
 
     /**
      * Registers a converter to test.

Modified: sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/simple/SimpleReferenceIdentifierTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/simple/SimpleReferenceIdentifierTest.java?rev=1569926&r1=1569925&r2=1569926&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/simple/SimpleReferenceIdentifierTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/simple/SimpleReferenceIdentifierTest.java [UTF-8] Wed Feb 19 21:31:56 2014
@@ -49,9 +49,9 @@ public final strictfp class SimpleRefere
     @Test
     public void testToWKT() {
         final SimpleCitation authority = new SimpleCitation("EPSG");
-        assertEquals("AUTHORITY[\"EPSG\",\"4326\"]", new SimpleReferenceIdentifier(authority, "4326").toWKT());
-        assertEquals("AUTHORITY[\"EPSG\",null]",     new SimpleReferenceIdentifier(authority,  null ).toWKT());
-        assertEquals("AUTHORITY[null,\"4326\"]",     new SimpleReferenceIdentifier(null,      "4326").toWKT());
-        assertEquals("AUTHORITY[null,null]",         new SimpleReferenceIdentifier(null,       null ).toWKT());
+        assertEquals("ID[\"EPSG\", \"4326\"]", new SimpleReferenceIdentifier(authority, "4326").toWKT());
+        assertEquals("ID[\"EPSG\", null]",     new SimpleReferenceIdentifier(authority,  null ).toWKT());
+        assertEquals("ID[null, \"4326\"]",     new SimpleReferenceIdentifier(null,      "4326").toWKT());
+        assertEquals("ID[null, null]",         new SimpleReferenceIdentifier(null,       null ).toWKT());
     }
 }

Modified: sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/test/AssertTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/test/AssertTest.java?rev=1569926&r1=1569925&r2=1569926&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/test/AssertTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/test/AssertTest.java [UTF-8] Wed Feb 19 21:31:56 2014
@@ -36,8 +36,22 @@ public final strictfp class AssertTest e
      */
     @Test
     public void testAssertEqualsMultilines() {
+        // Without trailing spaces.
         assertMultilinesEquals("Line 1\nLine 2\r\nLine 3\n\rLine 5",
                                "Line 1\rLine 2\nLine 3\n\nLine 5");
+
+        // With different trailing spaces.
+        assertMultilinesEquals("Line 1\nLine 2\r\nLine 3\n\rLine 5",
+                               "Line 1\rLine 2\nLine 3\n\nLine 5  ");
+
+        // With different leading spaces.
+        try {
+            assertMultilinesEquals("Line 1\nLine 2\r\nLine 3\n\rLine 5",
+                                   "Line 1\rLine 2\n  Line 3\n\nLine 5");
+            fail("Lines are not equal.");
+        } catch (AssertionError e) {
+            assertTrue(e.getMessage().startsWith("Line[2]"));
+        }
     }
 
     /**

Modified: sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/util/NumericsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/util/NumericsTest.java?rev=1569926&r1=1569925&r2=1569926&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/util/NumericsTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/util/NumericsTest.java [UTF-8] Wed Feb 19 21:31:56 2014
@@ -39,6 +39,34 @@ import static org.junit.Assert.*;
  */
 public final strictfp class NumericsTest extends TestCase {
     /**
+     * Tests the {@link Numerics#cached(Object)} method.
+     */
+    @Test
+    public void testCached() {
+        Double value;
+        assertEquals(value = Double.valueOf(   0), Numerics.cached(value));
+        assertEquals(value = Double.valueOf(   1), Numerics.cached(value));
+        assertEquals(value = Double.valueOf(  -1), Numerics.cached(value));
+        assertEquals(value = Double.valueOf(  10), Numerics.cached(value));
+        assertEquals(value = Double.valueOf(-150), Numerics.cached(value));
+        assertEquals(value = Double.valueOf( NaN), Numerics.cached(value));
+    }
+
+    /**
+     * Tests the {@link Numerics#valueOf(double)} method.
+     */
+    @Test
+    public void testValueOf() {
+        double value;
+        assertEquals(Double.valueOf(value =    0), Numerics.valueOf(value));
+        assertEquals(Double.valueOf(value =    1), Numerics.valueOf(value));
+        assertEquals(Double.valueOf(value =   -1), Numerics.valueOf(value));
+        assertEquals(Double.valueOf(value =   10), Numerics.valueOf(value));
+        assertEquals(Double.valueOf(value = -150), Numerics.valueOf(value));
+        assertEquals(Double.valueOf(value =  NaN), Numerics.valueOf(value));
+    }
+
+    /**
      * Tests the {@link Numerics#epsilonEqual(double, double)} method.
      */
     @Test

Modified: sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/io/AppenderTestCase.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/io/AppenderTestCase.java?rev=1569926&r1=1569925&r2=1569926&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/io/AppenderTestCase.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/io/AppenderTestCase.java [UTF-8] Wed Feb 19 21:31:56 2014
@@ -25,7 +25,7 @@ import static org.apache.sis.test.Assert
 
 
 /**
- * Base class for the testing {@code *Appender} implementation.
+ * Base class for the testing of {@code *Appender} implementation.
  * This is public because JUnit requires it, but should be considered as an implementation details.
  *
  * @author  Martin Desruisseaux (Geomatys)

Modified: sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/io/TableAppenderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/io/TableAppenderTest.java?rev=1569926&r1=1569925&r2=1569926&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/io/TableAppenderTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/io/TableAppenderTest.java [UTF-8] Wed Feb 19 21:31:56 2014
@@ -27,7 +27,7 @@ import org.apache.sis.internal.jdk7.JDK7
 
 
 /**
- * Tests the {@link TableAppender} implementations.
+ * Tests {@link TableAppender} implementation.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-3.00)

Modified: sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/math/StatisticsFormatTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/math/StatisticsFormatTest.java?rev=1569926&r1=1569925&r2=1569926&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/math/StatisticsFormatTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/math/StatisticsFormatTest.java [UTF-8] Wed Feb 19 21:31:56 2014
@@ -25,7 +25,7 @@ import static org.apache.sis.test.Assert
 
 
 /**
- * Tests {@link StatisticsFormat}.
+ * Tests the {@link StatisticsFormat} class.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-3.00)

Modified: sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/math/StatisticsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/math/StatisticsTest.java?rev=1569926&r1=1569925&r2=1569926&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/math/StatisticsTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/math/StatisticsTest.java [UTF-8] Wed Feb 19 21:31:56 2014
@@ -28,7 +28,7 @@ import static org.apache.sis.test.Assert
 
 
 /**
- * Tests {@link Statistics}.
+ * Tests the {@link Statistics} class.
  *
  * <p>This class uses {@link Random} numbers generator with hard-coded seeds. We do not allow
  * random seeds because the tests invoke the {@link Random#nextGaussian()} method, then check

Modified: sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/measure/SexagesimalConverterTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/measure/SexagesimalConverterTest.java?rev=1569926&r1=1569925&r2=1569926&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/measure/SexagesimalConverterTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/measure/SexagesimalConverterTest.java [UTF-8] Wed Feb 19 21:31:56 2014
@@ -28,7 +28,7 @@ import static org.apache.sis.test.Assert
 
 
 /**
- * Test {@link SexagesimalConverter}
+ * Test the {@link SexagesimalConverter} class.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-2.5)

Modified: sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java?rev=1569926&r1=1569925&r2=1569926&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/Assert.java [UTF-8] Wed Feb 19 21:31:56 2014
@@ -100,29 +100,45 @@ public strictfp class Assert extends org
 
     /**
      * Asserts that two strings are equal, ignoring the differences in EOL characters.
-     * The comparisons is performed one a line-by-line basis. For each line, leading
-     * and trailing spaces are ignored in order to make the comparison independent of
-     * indentation.
+     * The comparisons is performed one a line-by-line basis. For each line, trailing
+     * spaces (but not leading spaces) are ignored.
      *
      * @param expected The expected string.
      * @param actual   The actual string.
      */
     public static void assertMultilinesEquals(final CharSequence expected, final CharSequence actual) {
-        assertArrayEquals(CharSequences.split(expected, '\n'), CharSequences.split(actual, '\n'));
+        assertMultilinesEquals(null, expected, actual);
     }
 
     /**
      * Asserts that two strings are equal, ignoring the differences in EOL characters.
-     * The comparisons is performed one a line-by-line basis. For each line, leading
-     * and trailing spaces are ignored in order to make the comparison independent of
-     * indentation.
+     * The comparisons is performed one a line-by-line basis. For each line, trailing
+     * spaces (but not leading spaces) are ignored.
      *
      * @param message  The message to print in case of failure, or {@code null} if none.
      * @param expected The expected string.
      * @param actual   The actual string.
      */
     public static void assertMultilinesEquals(final String message, final CharSequence expected, final CharSequence actual) {
-        assertArrayEquals(message, CharSequences.split(expected, '\n'), CharSequences.split(actual, '\n'));
+        final CharSequence[] expectedLines = CharSequences.splitOnEOL(expected);
+        final CharSequence[] actualLines   = CharSequences.splitOnEOL(actual);
+        final int length = Math.min(expectedLines.length, actualLines.length);
+        final StringBuilder buffer = new StringBuilder(message != null ? message : "Line").append('[');
+        final int base = buffer.length();
+        for (int i=0; i<length; i++) {
+            CharSequence e = expectedLines[i];
+            CharSequence a = actualLines[i];
+            e = e.subSequence(0, CharSequences.skipTrailingWhitespaces(e, 0, e.length()));
+            a = a.subSequence(0, CharSequences.skipTrailingWhitespaces(a, 0, a.length()));
+            assertEquals(buffer.append(i).append(']').toString(), e, a);
+            buffer.setLength(base);
+        }
+        if (expectedLines.length > actualLines.length) {
+            fail(buffer.append(length).append("] missing line: ").append(expectedLines[length]).toString());
+        }
+        if (expectedLines.length < actualLines.length) {
+            fail(buffer.append(length).append("] extraneous line: ").append(actualLines[length]).toString());
+        }
     }
 
     /**

Modified: sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/TestStep.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/TestStep.java?rev=1569926&r1=1569925&r2=1569926&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/TestStep.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/TestStep.java [UTF-8] Wed Feb 19 21:31:56 2014
@@ -25,11 +25,12 @@ import java.lang.annotation.RetentionPol
 
 /**
  * A test method producing an object to be used by another test method.
- * Such methods are annotated with this {@code TestStep} annotation instead than the
- * JUnit {@link org.junit.Test} one. However in current implementation, those methods
- * must be explicitely invoked from another method. This is because JUnit 4 does not
- * support tests chaining, so this annotation is currently used only for documentation
- * purpose.
+ *
+ * <p>If this annotation was supported, we would annotate some methods with the {@code TestStep} annotation
+ * instead than the JUnit {@link org.junit.Test} one. However in current implementation, this functionality
+ * is not supported and the test step methods must be explicitely invoked from another method. Consequently
+ * this annotation is currently used only for documentation purpose, in case a future JUnit version would
+ * support tests chaining.</p>
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3

Modified: sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/CharSequencesTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/CharSequencesTest.java?rev=1569926&r1=1569925&r2=1569926&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/CharSequencesTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/CharSequencesTest.java [UTF-8] Wed Feb 19 21:31:56 2014
@@ -29,7 +29,7 @@ import static org.apache.sis.util.CharSe
 
 
 /**
- * Tests {@link CharSequences} methods.
+ * Tests the {@link CharSequences} methods.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Johann Sorel (Geomatys)

Modified: sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/StringBuildersTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/StringBuildersTest.java?rev=1569926&r1=1569925&r2=1569926&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/StringBuildersTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/StringBuildersTest.java [UTF-8] Wed Feb 19 21:31:56 2014
@@ -24,7 +24,7 @@ import static org.apache.sis.util.String
 
 
 /**
- * Tests {@link StringBuilders} methods.
+ * Tests the {@link StringBuilders} methods.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @author  Johann Sorel (Geomatys)



Mime
View raw message