sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1480602 [13/15] - in /sis/branches/Android: ./ ide-project/ ide-project/NetBeans/ ide-project/NetBeans/nbproject/ ide-project/eclipse/ sis-app/src/main/java/org/apache/sis/cli/ sis-build-helper/ sis-build-helper/src/main/java/org/apache/si...
Date Thu, 09 May 2013 12:24:20 GMT
Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/NilObjectHandler.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/NilReason.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/NilReason.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/NilReason.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/NilReason.java [UTF-8] Thu May  9 12:24:13 2013
@@ -58,7 +58,7 @@ public final class NilReason implements 
     /**
      * For cross-version compatibility.
      */
-    private static final long serialVersionUID = -1302619137838086028L;
+    private static final long serialVersionUID = 5553785821187789895L;
 
     /**
      * There is no value.
@@ -114,7 +114,7 @@ public final class NilReason implements 
      *
      * {@section Providing an explanation}
      * Users are encouraged to use the {@link #valueOf(String)} method instead than this constant,
-     * in order to provide a brief explanation. The string representation for {@code valueOf(…)}
+     * in order to provide a brief explanation. The string representation for {@code valueOf(…)}
      * is <code>"other:<var>explanation</var>"</code> where <var>explanation</var> is a string of
      * two or more characters with no included spaces.
      *

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/NilReason.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java [UTF-8] Thu May  9 12:24:13 2013
@@ -31,9 +31,8 @@ import javax.xml.bind.annotation.adapter
 import org.apache.sis.util.Version;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.resources.Errors;
-import org.apache.sis.internal.jaxb.MarshalContext;
-
-import static org.apache.sis.util.collection.Collections.unmodifiableOrCopy;
+import org.apache.sis.internal.util.CollectionsExt;
+import org.apache.sis.internal.jaxb.Context;
 
 
 /**
@@ -62,7 +61,7 @@ abstract class Pooled {
      *
      * @see #convertPropertyKey(String)
      */
-    private static final String ENDORSED_PREFIX = "com.sun.xml.bind.";
+    static final String ENDORSED_PREFIX = "com.sun.xml.bind.";
 
     /**
      * {@code true} if the JAXB implementation is the one bundled in JDK 6, or {@code false}
@@ -132,6 +131,13 @@ abstract class Pooled {
     private int bitMasks;
 
     /**
+     * The {@link System#nanoTime()} value of the last call to {@link #reset()}.
+     * This is used for disposing (un)marshallers that have not been used for a while,
+     * since {@code reset()} is invoked just before to push a (un)marshaller in the pool.
+     */
+    volatile long resetTime;
+
+    /**
      * Default constructor.
      *
      * @param internal {@code true} if the JAXB implementation is the one bundled in JDK 6,
@@ -145,15 +151,17 @@ abstract class Pooled {
     }
 
     /**
-     * Returns the initial value of {@link MarshalContext#bitMasks}. Shall be 0 if this object is
-     * an unmarshaller, or {@link MarshalContext#MARSHALING} if it is an {@link Unmarshaller}.
+     * Returns the initial value of {@link Context#bitMasks}. Shall be 0 if this object is
+     * an unmarshaller, or {@link Context#MARSHALLING} if it is an {@link Unmarshaller}.
      */
     private int initialBitMasks() {
-        return (this instanceof Marshaller) ? MarshalContext.MARSHALING : 0;
+        return (this instanceof Marshaller) ? Context.MARSHALLING : 0;
     }
 
     /**
-     * Resets the (un)marshaller to its initial state.
+     * Releases resources and resets the (un)marshaller to its initial state.
+     * This method is invoked by {@link MarshallerPool} just before to push a
+     * (un)marshaller in the pool after its usage.
      *
      * @throws JAXBException If an error occurred while restoring a property.
      */
@@ -169,6 +177,7 @@ abstract class Pooled {
         locale     = null;
         timezone   = null;
         bitMasks   = initialBitMasks();
+        resetTime  = System.nanoTime();
     }
 
     /**
@@ -255,7 +264,7 @@ abstract class Pooled {
                                 copy.put(key, (String) schema);
                             }
                         }
-                        copy = unmodifiableOrCopy(copy);
+                        copy = CollectionsExt.unmodifiableOrCopy(copy);
                     }
                     schemas = copy;
                     return;
@@ -278,9 +287,9 @@ abstract class Pooled {
                     if (substitutes != null) {
                         for (final CharSequence substitute : substitutes) {
                             if (CharSequences.equalsIgnoreCase(substitute, "language")) {
-                                mask |= MarshalContext.SUBSTITUTE_LANGUAGE;
+                                mask |= Context.SUBSTITUTE_LANGUAGE;
                             } else if (CharSequences.equalsIgnoreCase(substitute, "country")) {
-                                mask |= MarshalContext.SUBSTITUTE_COUNTRY;
+                                mask |= Context.SUBSTITUTE_COUNTRY;
                             }
                         }
                     }
@@ -315,8 +324,8 @@ abstract class Pooled {
             if (name.equals(XML.TIMEZONE))    return timezone;
             if (name.equals(XML.STRING_SUBSTITUTES)) {
                 final StringBuilder buffer = new StringBuilder();
-                if ((bitMasks & MarshalContext.SUBSTITUTE_LANGUAGE) != 0) buffer.append("language,");
-                if ((bitMasks & MarshalContext.SUBSTITUTE_COUNTRY)  != 0) buffer.append("country,");
+                if ((bitMasks & Context.SUBSTITUTE_LANGUAGE) != 0) buffer.append("language,");
+                if ((bitMasks & Context.SUBSTITUTE_COUNTRY)  != 0) buffer.append("country,");
                 final int length = buffer.length();
                 if (length != 0) {
                     buffer.setLength(length - 1); // Remove the last coma.
@@ -333,14 +342,14 @@ abstract class Pooled {
     /**
      * Sets the given property to the wrapped (un)marshaller. This method is invoked
      * automatically when the property given to the {@link #setProperty(String, Object)}
-     * method was not one of the {@link XML} constants.
+     * method was not one of the {@link XML} constants.
      */
     abstract void setStandardProperty(String name, Object value) throws PropertyException;
 
     /**
      * Gets the given property from the wrapped (un)marshaller. This method is invoked
      * automatically when the property key given to the {@link #getProperty(String)}
-     * method was not one of the {@link XML} constants.
+     * method was not one of the {@link XML} constants.
      */
     abstract Object getStandardProperty(String name) throws PropertyException;
 
@@ -408,7 +417,7 @@ abstract class Pooled {
      * operation. Must be followed by a call to {@code finish()} in a {@code finally} block.
      *
      * {@preformat java
-     *     MarshalContext context = begin();
+     *     Context context = begin();
      *     try {
      *         ...
      *     } finally {
@@ -416,9 +425,9 @@ abstract class Pooled {
      *     }
      * }
      *
-     * @see MarshalContext#finish();
+     * @see Context#finish();
      */
-    final MarshalContext begin() {
-        return new MarshalContext(converter, resolver, gmlVersion, schemas, locale, timezone, bitMasks);
+    final Context begin() {
+        return new Context(converter, resolver, gmlVersion, schemas, locale, timezone, bitMasks);
     }
 }

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/PooledMarshaller.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/PooledMarshaller.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/PooledMarshaller.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/PooledMarshaller.java [UTF-8] Thu May  9 12:24:13 2013
@@ -32,7 +32,7 @@ import javax.xml.validation.Schema;
 import org.xml.sax.ContentHandler;
 import org.w3c.dom.Node;
 import org.apache.sis.util.Decorator;
-import org.apache.sis.internal.jaxb.MarshalContext;
+import org.apache.sis.internal.jaxb.Context;
 
 
 /**
@@ -42,7 +42,7 @@ import org.apache.sis.internal.jaxb.Mars
  * <ul>
  *   <li>Save properties before modification, in order to restore them to their original values
  *       when the marshaller is recycled.</li>
- *   <li>Constructs a SIS {@link MarshalContext} object on marshalling, in order to give
+ *   <li>Constructs a SIS {@link Context} object on marshalling, in order to give
  *       additional information to the SIS object being marshalled.</li>
  * </ul>
  *
@@ -106,7 +106,7 @@ final class PooledMarshaller extends Poo
      */
     @Override
     public void marshal(final Object object, final Result output) throws JAXBException {
-        final MarshalContext context = begin();
+        final Context context = begin();
         try {
             marshaller.marshal(object, output);
         } finally {
@@ -119,7 +119,7 @@ final class PooledMarshaller extends Poo
      */
     @Override
     public void marshal(final Object object, final OutputStream output) throws JAXBException {
-        final MarshalContext context = begin();
+        final Context context = begin();
         try {
             marshaller.marshal(object, output);
         } finally {
@@ -132,7 +132,7 @@ final class PooledMarshaller extends Poo
      */
     @Override
     public void marshal(final Object object, final File output) throws JAXBException {
-        final MarshalContext context = begin();
+        final Context context = begin();
         try {
             marshaller.marshal(object, output);
         } finally {
@@ -145,7 +145,7 @@ final class PooledMarshaller extends Poo
      */
     @Override
     public void marshal(final Object object, final Writer output) throws JAXBException {
-        final MarshalContext context = begin();
+        final Context context = begin();
         try {
             marshaller.marshal(object, output);
         } finally {
@@ -158,7 +158,7 @@ final class PooledMarshaller extends Poo
      */
     @Override
     public void marshal(final Object object, final ContentHandler output) throws JAXBException {
-        final MarshalContext context = begin();
+        final Context context = begin();
         try {
             marshaller.marshal(object, output);
         } finally {
@@ -171,7 +171,7 @@ final class PooledMarshaller extends Poo
      */
     @Override
     public void marshal(final Object object, final Node output) throws JAXBException {
-        final MarshalContext context = begin();
+        final Context context = begin();
         try {
             marshaller.marshal(object, output);
         } finally {
@@ -184,7 +184,7 @@ final class PooledMarshaller extends Poo
      */
     @Override
     public void marshal(final Object object, final XMLStreamWriter output) throws JAXBException {
-        final MarshalContext context = begin();
+        final Context context = begin();
         try {
             marshaller.marshal(object, output);
         } finally {
@@ -197,7 +197,7 @@ final class PooledMarshaller extends Poo
      */
     @Override
     public void marshal(final Object object, final XMLEventWriter output) throws JAXBException {
-        final MarshalContext context = begin();
+        final Context context = begin();
         try {
             marshaller.marshal(object, output);
         } finally {
@@ -210,7 +210,7 @@ final class PooledMarshaller extends Poo
      */
     @Override
     public Node getNode(final Object object) throws JAXBException {
-        final MarshalContext context = begin();
+        final Context context = begin();
         try {
             return marshaller.getNode(object);
         } finally {

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/PooledMarshaller.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/PooledUnmarshaller.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/PooledUnmarshaller.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/PooledUnmarshaller.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/PooledUnmarshaller.java [UTF-8] Thu May  9 12:24:13 2013
@@ -35,7 +35,7 @@ import javax.xml.validation.Schema;
 import org.w3c.dom.Node;
 import org.xml.sax.InputSource;
 import org.apache.sis.util.Decorator;
-import org.apache.sis.internal.jaxb.MarshalContext;
+import org.apache.sis.internal.jaxb.Context;
 
 
 /**
@@ -45,7 +45,7 @@ import org.apache.sis.internal.jaxb.Mars
  * <ul>
  *   <li>Save properties before modification, in order to restore them to their original values
  *       when the unmarshaller is recycled.</li>
- *   <li>Constructs a SIS {@link MarshalContext} object on unmarshalling, in order to give
+ *   <li>Constructs a SIS {@link Context} object on unmarshalling, in order to give
  *       additional information to the SIS object being unmarshalled.</li>
  * </ul>
  *
@@ -107,7 +107,7 @@ final class PooledUnmarshaller extends P
      */
     @Override
     public Object unmarshal(final InputStream input) throws JAXBException {
-        final MarshalContext context = begin();
+        final Context context = begin();
         try {
             return unmarshaller.unmarshal(input);
         } finally {
@@ -120,7 +120,7 @@ final class PooledUnmarshaller extends P
      */
     @Override
     public Object unmarshal(final URL input) throws JAXBException {
-        final MarshalContext context = begin();
+        final Context context = begin();
         try {
             return unmarshaller.unmarshal(input);
         } finally {
@@ -133,7 +133,7 @@ final class PooledUnmarshaller extends P
      */
     @Override
     public Object unmarshal(final File input) throws JAXBException {
-        final MarshalContext context = begin();
+        final Context context = begin();
         try {
             return unmarshaller.unmarshal(input);
         } finally {
@@ -146,7 +146,7 @@ final class PooledUnmarshaller extends P
      */
     @Override
     public Object unmarshal(final Reader input) throws JAXBException {
-        final MarshalContext context = begin();
+        final Context context = begin();
         try {
             return unmarshaller.unmarshal(input);
         } finally {
@@ -159,7 +159,7 @@ final class PooledUnmarshaller extends P
      */
     @Override
     public Object unmarshal(final InputSource input) throws JAXBException {
-        final MarshalContext context = begin();
+        final Context context = begin();
         try {
             return unmarshaller.unmarshal(input);
         } finally {
@@ -172,7 +172,7 @@ final class PooledUnmarshaller extends P
      */
     @Override
     public Object unmarshal(final Node input) throws JAXBException {
-        final MarshalContext context = begin();
+        final Context context = begin();
         try {
             return unmarshaller.unmarshal(input);
         } finally {
@@ -185,7 +185,7 @@ final class PooledUnmarshaller extends P
      */
     @Override
     public <T> JAXBElement<T> unmarshal(final Node input, final Class<T> declaredType) throws JAXBException {
-        final MarshalContext context = begin();
+        final Context context = begin();
         try {
             return unmarshaller.unmarshal(input, declaredType);
         } finally {
@@ -198,7 +198,7 @@ final class PooledUnmarshaller extends P
      */
     @Override
     public Object unmarshal(final Source input) throws JAXBException {
-        final MarshalContext context = begin();
+        final Context context = begin();
         try {
             return unmarshaller.unmarshal(input);
         } finally {
@@ -211,7 +211,7 @@ final class PooledUnmarshaller extends P
      */
     @Override
     public <T> JAXBElement<T> unmarshal(final Source input, final Class<T> declaredType) throws JAXBException {
-        final MarshalContext context = begin();
+        final Context context = begin();
         try {
             return unmarshaller.unmarshal(input, declaredType);
         } finally {
@@ -224,7 +224,7 @@ final class PooledUnmarshaller extends P
      */
     @Override
     public Object unmarshal(final XMLStreamReader input) throws JAXBException {
-        final MarshalContext context = begin();
+        final Context context = begin();
         try {
             return unmarshaller.unmarshal(input);
         } finally {
@@ -237,7 +237,7 @@ final class PooledUnmarshaller extends P
      */
     @Override
     public <T> JAXBElement<T> unmarshal(final XMLStreamReader input, final Class<T> declaredType) throws JAXBException {
-        final MarshalContext context = begin();
+        final Context context = begin();
         try {
             return unmarshaller.unmarshal(input, declaredType);
         } finally {
@@ -250,7 +250,7 @@ final class PooledUnmarshaller extends P
      */
     @Override
     public Object unmarshal(final XMLEventReader input) throws JAXBException {
-        final MarshalContext context = begin();
+        final Context context = begin();
         try {
             return unmarshaller.unmarshal(input);
         } finally {
@@ -263,7 +263,7 @@ final class PooledUnmarshaller extends P
      */
     @Override
     public <T> JAXBElement<T> unmarshal(final XMLEventReader input, final Class<T> declaredType) throws JAXBException {
-        final MarshalContext context = begin();
+        final Context context = begin();
         try {
             return unmarshaller.unmarshal(input, declaredType);
         } finally {

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/PooledUnmarshaller.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/ReferenceResolver.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/ReferenceResolver.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/ReferenceResolver.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/ReferenceResolver.java [UTF-8] Thu May  9 12:24:13 2013
@@ -21,7 +21,6 @@ import java.lang.reflect.Proxy;
 import org.opengis.metadata.Identifier;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.LenientComparable;
-import org.apache.sis.internal.jaxb.UUIDs;
 import org.apache.sis.internal.jaxb.gmx.Anchor;
 
 import static org.apache.sis.util.ArgumentChecks.*;
@@ -91,9 +90,7 @@ public class ReferenceResolver {
 
     /**
      * Returns an object of the given type for the given {@code uuid} attribute, or {@code null}
-     * if none. The default implementation looks in an internal map for previously unmarshalled
-     * object having the given UUID. If no existing instance is found, then this method returns
-     * {@code null}.
+     * if none. The default implementation returns {@code null} in all cases.
      *
      * @param  <T>     The compile-time type of the {@code type} argument.
      * @param  context Context (GML version, locale, <i>etc.</i>) of the (un)marshalling process.
@@ -106,8 +103,7 @@ public class ReferenceResolver {
     public <T> T resolve(final MarshalContext context, final Class<T> type, final UUID uuid) {
         ensureNonNull("type", type);
         ensureNonNull("uuid", uuid);
-        final Object object = UUIDs.lookup(uuid);
-        return type.isInstance(object) ? (T) object : null;
+        return null;
     }
 
     /**

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/ReferenceResolver.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/ValueConverter.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/ValueConverter.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/ValueConverter.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/ValueConverter.java [UTF-8] Thu May  9 12:24:13 2013
@@ -82,14 +82,14 @@ public class ValueConverter {
     }
 
     /**
-     * Invoked when an exception occurred in any {@code toXXX(…)} method. The default implementation
+     * Invoked when an exception occurred in any {@code toXXX(…)} method. The default implementation
      * does nothing and return {@code false}, which will cause the (un)marshalling process of the
      * whole XML document to fail.
      *
      * <p>This method provides a single hook that subclasses can override in order to provide their
      * own error handling for every methods defined in this class, like the example documented in
      * the {@link XML#CONVERTER} javadoc. Subclasses also have the possibility to override individual
-     * {@code toXXX(…)} methods, like the example provided in this <a href="#skip-navbar_top">class
+     * {@code toXXX(…)} methods, like the example provided in this <a href="#skip-navbar_top">class
      * javadoc</a>.</p>
      *
      * @param  <T> The compile-time type of the {@code sourceType} argument.
@@ -97,7 +97,7 @@ public class ValueConverter {
      * @param  value The value that can't be converted.
      * @param  sourceType The base type of the value to convert. This is determined by the argument
      *         type of the method that caught the exception. For example the source type is always
-     *         {@code URI.class} if the exception has been caught by the {@link #toURL(URI)} method.
+     *         {@code URI.class} if the exception has been caught by the {@link #toURL(MarshalContext, URI)} method.
      * @param  targetType The expected type of the converted object.
      * @param  exception The exception that occurred during the conversion attempt.
      * @return {@code true} if the (un)marshalling process should continue despite this error,
@@ -120,9 +120,9 @@ public class ValueConverter {
      *   <li>Try {@code value.getISO3Language()}:<ul>
      *     <li>On success, return that value if non-empty, or {@code null} otherwise.</li>
      *     <li>If an exception has been thrown, then:<ul>
-     *       <li>If {@link #exceptionOccured exceptionOccured(…)} return {@code true}, then
+     *       <li>If {@link #exceptionOccured exceptionOccured(…)} return {@code true}, then
      *           returns {@code value.getLanguage()} if non-empty or {@code null} otherwise.</li>
-     *       <li>If {@code exceptionOccured(…)} returned {@code false} (which is the default
+     *       <li>If {@code exceptionOccured(…)} returned {@code false} (which is the default
      *           behavior), then let the exception propagate.</li>
      *     </ul></li>
      *   </ul></li>
@@ -165,9 +165,9 @@ public class ValueConverter {
      *   <li>Try {@code value.getISO3Country()}:<ul>
      *     <li>On success, return that value if non-empty, or {@code null} otherwise.</li>
      *     <li>If an exception has been thrown, then:<ul>
-     *       <li>If {@link #exceptionOccured exceptionOccured(…)} return {@code true}, then
+     *       <li>If {@link #exceptionOccured exceptionOccured(…)} return {@code true}, then
      *           returns {@code value.getCountry()} if non-empty or {@code null} otherwise.</li>
-     *       <li>If {@code exceptionOccured(…)} returned {@code false} (which is the default
+     *       <li>If {@code exceptionOccured(…)} returned {@code false} (which is the default
      *           behavior), then let the exception propagate.</li>
      *     </ul></li>
      *   </ul></li>
@@ -209,7 +209,7 @@ public class ValueConverter {
      * @param  context Context (GML version, locale, <i>etc.</i>) of the (un)marshalling process.
      * @param  value The string to convert to a locale, or {@code null}.
      * @return The converted locale, or {@code null} if the given value was null or empty, or
-     *         if an exception was thrown and {@code exceptionOccured(…)} returned {@code true}.
+     *         if an exception was thrown and {@code exceptionOccured(…)} returned {@code true}.
      * @throws IllegalArgumentException If the given string can not be converted to a locale.
      */
     public Locale toLocale(final MarshalContext context, String value) throws IllegalArgumentException {
@@ -226,7 +226,7 @@ public class ValueConverter {
 
     /**
      * Converts the given string to a unit. The default implementation is as below, omitting
-     * the check for null value and the call to {@link #exceptionOccured exceptionOccured(…)}
+     * the check for null value and the call to {@link #exceptionOccured exceptionOccured(…)}
      * in case of error:
      *
      * {@preformat java
@@ -236,7 +236,7 @@ public class ValueConverter {
      * @param  context Context (GML version, locale, <i>etc.</i>) of the (un)marshalling process.
      * @param  value The string to convert to a unit, or {@code null}.
      * @return The converted unit, or {@code null} if the given value was null or empty, or
-     *         if an exception was thrown and {@code exceptionOccured(…)} returned {@code true}.
+     *         if an exception was thrown and {@code exceptionOccured(…)} returned {@code true}.
      * @throws IllegalArgumentException If the given string can not be converted to a unit.
      *
      * @see Units#valueOf(String)
@@ -256,7 +256,7 @@ public class ValueConverter {
     /**
      * Converts the given string to a Universal Unique Identifier. The default implementation
      * is as below, omitting the check for null value and the call to {@link #exceptionOccured
-     * exceptionOccured(…)} in case of error:
+     * exceptionOccured(…)} in case of error:
      *
      * {@preformat java
      *     return UUID.fromString(value);
@@ -265,7 +265,7 @@ public class ValueConverter {
      * @param  context Context (GML version, locale, <i>etc.</i>) of the (un)marshalling process.
      * @param  value The string to convert to a UUID, or {@code null}.
      * @return The converted UUID, or {@code null} if the given value was null or empty, or
-     *         if an exception was thrown and {@code exceptionOccured(…)} returned {@code true}.
+     *         if an exception was thrown and {@code exceptionOccured(…)} returned {@code true}.
      * @throws IllegalArgumentException If the given string can not be converted to a UUID.
      *
      * @see UUID#fromString(String)
@@ -285,7 +285,7 @@ public class ValueConverter {
     /**
      * Converts the given string to a URI. The default performs the following work
      * (omitting the check for null value and the call to {@link #exceptionOccured
-     * exceptionOccured(…)} in case of error):
+     * exceptionOccured(…)} in case of error):
      *
      * {@preformat java
      *     return new URI(value);
@@ -294,7 +294,7 @@ public class ValueConverter {
      * @param  context Context (GML version, locale, <i>etc.</i>) of the (un)marshalling process.
      * @param  value The string to convert to a URI, or {@code null}.
      * @return The converted URI, or {@code null} if the given value was null or empty, or if
-     *         an exception was thrown and {@code exceptionOccured(…)} returned {@code true}.
+     *         an exception was thrown and {@code exceptionOccured(…)} returned {@code true}.
      * @throws URISyntaxException If the given string can not be converted to a URI.
      *
      * @see URI#URI(String)
@@ -313,7 +313,7 @@ public class ValueConverter {
 
     /**
      * Converts the given URL to a URI. The default implementation is as below, omitting
-     * the check for null value and the call to {@link #exceptionOccured exceptionOccured(…)}
+     * the check for null value and the call to {@link #exceptionOccured exceptionOccured(…)}
      * in case of error:
      *
      * {@preformat java
@@ -323,7 +323,7 @@ public class ValueConverter {
      * @param  context Context (GML version, locale, <i>etc.</i>) of the (un)marshalling process.
      * @param  value The URL to convert to a URI, or {@code null}.
      * @return The converted URI, or {@code null} if the given value was null or if an
-     *         exception was thrown and {@code exceptionOccured(…)} returned {@code true}.
+     *         exception was thrown and {@code exceptionOccured(…)} returned {@code true}.
      * @throws URISyntaxException If the given URL can not be converted to a URI.
      *
      * @see URL#toURI()
@@ -341,7 +341,7 @@ public class ValueConverter {
 
     /**
      * Converts the given URI to a URL. The default implementation is as below, omitting
-     * the check for null value and the call to {@link #exceptionOccured exceptionOccured(…)}
+     * the check for null value and the call to {@link #exceptionOccured exceptionOccured(…)}
      * in case of error:
      *
      * {@preformat java
@@ -351,7 +351,7 @@ public class ValueConverter {
      * @param  context Context (GML version, locale, <i>etc.</i>) of the (un)marshalling process.
      * @param  value The URI to convert to a URL, or {@code null}.
      * @return The converted URL, or {@code null} if the given value was null or if an
-     *         exception was thrown and {@code exceptionOccured(…)} returned {@code true}.
+     *         exception was thrown and {@code exceptionOccured(…)} returned {@code true}.
      * @throws MalformedURLException If the given URI can not be converted to a URL.
      *
      * @see URI#toURL()
@@ -372,7 +372,7 @@ public class ValueConverter {
 
     /**
      * Converts the given string to a {@code NilReason}. The default implementation is as below,
-     * omitting the check for null value and the call to {@link #exceptionOccured exceptionOccured(…)}
+     * omitting the check for null value and the call to {@link #exceptionOccured exceptionOccured(…)}
      * in case of error:
      *
      * {@preformat java
@@ -382,7 +382,7 @@ public class ValueConverter {
      * @param  context Context (GML version, locale, <i>etc.</i>) of the (un)marshalling process.
      * @param  value The string to convert to a nil reason, or {@code null}.
      * @return The converted nil reason, or {@code null} if the given value was null or empty, or
-     *         if an exception was thrown and {@code exceptionOccured(…)} returned {@code true}.
+     *         if an exception was thrown and {@code exceptionOccured(…)} returned {@code true}.
      * @throws URISyntaxException If the given string can not be converted to a nil reason.
      *
      * @see NilReason#valueOf(String)

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/ValueConverter.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/XLink.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/XLink.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/XLink.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/XLink.java [UTF-8] Thu May  9 12:24:13 2013
@@ -31,7 +31,7 @@ import org.apache.sis.util.logging.Loggi
 import org.apache.sis.util.resources.Errors;
 
 // Related to JDK7
-import org.apache.sis.internal.util.Objects;
+import org.apache.sis.internal.jdk7.Objects;
 
 
 /**
@@ -46,7 +46,7 @@ import org.apache.sis.internal.util.Obje
  *
  * <table class="sis">
  * <tr>
- *   <th> </th>
+ *   <th> </th>
  *   <th width="14%">{@link XLink.Type#SIMPLE simple}</th>
  *   <th width="14%">{@link XLink.Type#EXTENDED extended}</th>
  *   <th width="14%">{@link XLink.Type#LOCATOR locator}</th>
@@ -55,15 +55,15 @@ import org.apache.sis.internal.util.Obje
  *   <th width="14%">{@link XLink.Type#TITLE title}</th>
  * </tr>
  *   <tr align="center"><td><b>{@link #getType() type}</b></td>       <td>R</td><td>R</td><td>R</td><td>R</td><td>R</td><td>R</td></tr>
- *   <tr align="center"><td><b>{@link #getHRef() href}</b></td>       <td>O</td><td> </td><td>R</td><td> </td><td> </td><td> </td></tr>
- *   <tr align="center"><td><b>{@link #getRole() role}</b></td>       <td>O</td><td>O</td><td>O</td><td> </td><td>O</td><td> </td></tr>
- *   <tr align="center"><td><b>{@link #getArcRole() arcrole}</b></td> <td>O</td><td> </td><td> </td><td>O</td><td> </td><td> </td></tr>
- *   <tr align="center"><td><b>{@link #getTitle() title}</b></td>     <td>O</td><td>O</td><td>O</td><td>O</td><td>O</td><td> </td></tr>
- *   <tr align="center"><td><b>{@link #getShow() show}</b></td>       <td>O</td><td> </td><td> </td><td>O</td><td> </td><td> </td></tr>
- *   <tr align="center"><td><b>{@link #getActuate() actuate}</b></td> <td>O</td><td> </td><td> </td><td>O</td><td> </td><td> </td></tr>
- *   <tr align="center"><td><b>{@link #getLabel() label}</b></td>     <td> </td><td> </td><td>O</td><td> </td><td>O</td><td> </td></tr>
- *   <tr align="center"><td><b>{@link #getFrom() from}</b></td>       <td> </td><td> </td><td> </td><td>O</td><td> </td><td> </td></tr>
- *   <tr align="center"><td><b>{@link #getTo() to}</b></td>           <td> </td><td> </td><td> </td><td>O</td><td> </td><td> </td></tr>
+ *   <tr align="center"><td><b>{@link #getHRef() href}</b></td>       <td>O</td><td> </td><td>R</td><td> </td><td> </td><td> </td></tr>
+ *   <tr align="center"><td><b>{@link #getRole() role}</b></td>       <td>O</td><td>O</td><td>O</td><td> </td><td>O</td><td> </td></tr>
+ *   <tr align="center"><td><b>{@link #getArcRole() arcrole}</b></td> <td>O</td><td> </td><td> </td><td>O</td><td> </td><td> </td></tr>
+ *   <tr align="center"><td><b>{@link #getTitle() title}</b></td>     <td>O</td><td>O</td><td>O</td><td>O</td><td>O</td><td> </td></tr>
+ *   <tr align="center"><td><b>{@link #getShow() show}</b></td>       <td>O</td><td> </td><td> </td><td>O</td><td> </td><td> </td></tr>
+ *   <tr align="center"><td><b>{@link #getActuate() actuate}</b></td> <td>O</td><td> </td><td> </td><td>O</td><td> </td><td> </td></tr>
+ *   <tr align="center"><td><b>{@link #getLabel() label}</b></td>     <td> </td><td> </td><td>O</td><td> </td><td>O</td><td> </td></tr>
+ *   <tr align="center"><td><b>{@link #getFrom() from}</b></td>       <td> </td><td> </td><td> </td><td>O</td><td> </td><td> </td></tr>
+ *   <tr align="center"><td><b>{@link #getTo() to}</b></td>           <td> </td><td> </td><td> </td><td>O</td><td> </td><td> </td></tr>
  * </table>
  *
  * When {@code xlink} attributes are found at unmarshalling time instead of an object definition,
@@ -86,7 +86,7 @@ public class XLink implements Serializab
     /**
      * For cross-version compatibility.
      */
-    private static final long serialVersionUID = -4349950135677857725L;
+    private static final long serialVersionUID = 4046720871882443681L;
 
     /**
      * The type of link. If {@code null}, then the type will be inferred by {@link #getType()}.
@@ -235,7 +235,7 @@ public class XLink implements Serializab
         /**
          * A pointer to an external resource. Allows the {@link XLink#getHRef() href},
          * {@link XLink#getRole() role}, {@link #getTitle() title} and {@link XLink#getLabel()
-         * label} attributes, where {@code href} is mandatory and all other are optional.
+         * label} attributes, where {@code href} is mandatory and all other are optional.
          */
         @XmlEnumValue("locator")
         LOCATOR(0x1 | 0x2 | 0x4 | 0x10 | 0x80, 0x1 | 0x2),
@@ -301,7 +301,7 @@ public class XLink implements Serializab
          * Returns the attribute name for this type.
          */
         final String identifier() {
-            return name().toLowerCase(Locale.US);
+            return name().toLowerCase(Locale.ROOT);
         }
     }
 
@@ -377,9 +377,9 @@ public class XLink implements Serializab
     /**
      * Sets the type of link. Any value different than {@link org.apache.sis.xml.XLink.Type#AUTO
      * Type.AUTO} (including {@code null}) will overwrite the value inferred automatically by
-     * {@link #getType()}. A {@code AUTO} value will enable automatic type detection.
+     * {@link #getType()}. A {@code AUTO} value will enable automatic type detection.
      *
-     * @param type The new type of link, or {@code null} if none.
+     * @param type The new type of link, or {@code null} if none.
      */
     public synchronized void setType(final Type type) {
         canWrite(0x1, "type", "type"); // We want a non-null value in all cases.
@@ -424,7 +424,7 @@ public class XLink implements Serializab
      *        attribute allows an XML element to refer to another XML element that has
      *        a corresponding <code>id</code> attribute.}
      *
-     * @return A URN to a resources, or {@code null} if none.
+     * @return A URN to a resources, or {@code null} if none.
      *
      * @category locator
      */
@@ -436,7 +436,7 @@ public class XLink implements Serializab
     /**
      * Sets the URN to a resources.
      *
-     * @param  href A URN to a resources, or {@code null} if none.
+     * @param  href A URN to a resources, or {@code null} if none.
      * @throws UnsupportedOperationException If this {@code xlink} is unmodifiable.
      * @throws IllegalStateException If the link type {@linkplain #setType has been explicitely set}.
      *         and that type does not allow the {@code "href"} attribute.
@@ -451,7 +451,7 @@ public class XLink implements Serializab
     /**
      * Returns a URI reference for some description of the arc role.
      *
-     * @return A URI reference for some description of the arc role, or {@code null} if none.
+     * @return A URI reference for some description of the arc role, or {@code null} if none.
      *
      * @category semantic
      */
@@ -463,7 +463,7 @@ public class XLink implements Serializab
     /**
      * Sets the URI reference for some description of the arc role.
      *
-     * @param  role A URI reference for some description of the arc role, or {@code null} if none.
+     * @param  role A URI reference for some description of the arc role, or {@code null} if none.
      * @throws UnsupportedOperationException If this {@code xlink} is unmodifiable.
      * @throws IllegalStateException If the link type {@linkplain #setType has been explicitely set}.
      *         and that type does not allow the {@code "role"} attribute.
@@ -478,7 +478,7 @@ public class XLink implements Serializab
     /**
      * Returns a URI reference for some description of the arc role.
      *
-     * @return A URI reference for some description of the arc role, or {@code null} if none.
+     * @return A URI reference for some description of the arc role, or {@code null} if none.
      *
      * @category semantic
      */
@@ -490,7 +490,7 @@ public class XLink implements Serializab
     /**
      * Sets a URI reference for some description of the arc role.
      *
-     * @param  arcrole A URI reference for some description of the arc role, or {@code null} if none.
+     * @param  arcrole A URI reference for some description of the arc role, or {@code null} if none.
      * @throws UnsupportedOperationException If this {@code xlink} is unmodifiable.
      * @throws IllegalStateException If the link type {@linkplain #setType has been explicitely set}.
      *         and that type does not allow the {@code "arcrole"} attribute.
@@ -505,7 +505,7 @@ public class XLink implements Serializab
     /**
      * Returns a human-readable string with a short description for the arc.
      *
-     * @return A human-readable string with a short description for the arc, or {@code null} if none.
+     * @return A human-readable string with a short description for the arc, or {@code null} if none.
      *
      * @category semantic
      */
@@ -518,7 +518,7 @@ public class XLink implements Serializab
      * Sets a human-readable string with a short description for the arc.
      *
      * @param  title A human-readable string with a short description for the arc,
-     *         or {@code null} if none.
+     *         or {@code null} if none.
      * @throws UnsupportedOperationException If this {@code xlink} is unmodifiable.
      * @throws IllegalStateException If the link type {@linkplain #setType has been explicitely set}.
      *         and that type does not allow the {@code "title"} attribute.

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/XLink.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/XML.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/XML.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/XML.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/XML.java [UTF-8] Thu May  9 12:24:13 2013
@@ -17,9 +17,17 @@
 package org.apache.sis.xml;
 
 import java.util.Locale;
+import java.io.File;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.StringReader;
+import java.io.StringWriter;
 import javax.xml.bind.Marshaller;
 import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.JAXBException;
 import org.apache.sis.util.Static;
+import org.apache.sis.internal.util.SystemListener;
+import org.apache.sis.internal.jaxb.TypeRegistration;
 
 
 /**
@@ -36,7 +44,7 @@ import org.apache.sis.util.Static;
  *   <li>{@link #STRING_SUBSTITUTES} for specifying which code lists to replace by simpler {@code <gco:CharacterString>} elements.</li>
  * </ul>
  *
- * @author  Cédric Briançon (Geomatys)
+ * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-3.00)
  * @version 0.3
@@ -139,7 +147,7 @@ public final class XML extends Static {
      *     Unmarshaller um = marshallerPool.acquireUnmarshaller();
      *     um.setProperty(XML.RESOLVER, myResolver);
      *     Object obj = um.unmarshal(xml);
-     *     marshallerPool.release(um);
+     *     marshallerPool.recycle(um);
      * }
      *
      * @see Unmarshaller#setProperty(String, Object)
@@ -156,7 +164,7 @@ public final class XML extends Static {
      * string is not valid), the default behavior is to throw an exception which cause the
      * (un)marshalling of the entire document to fail. This default behavior can be customized by
      * invoking {@link Marshaller#setProperty(String, Object)} with this {@code CONVERTER} property
-     * key and a custom {@link ValueConverter} instance. {@code ValueConverter} can also be used
+     * key and a custom {@link ValueConverter} instance. {@code ValueConverter} can also be used
      * for replacing an erroneous URL by a fixed URL. See the {@link ValueConverter} javadoc for
      * more details.</p>
      *
@@ -187,7 +195,7 @@ public final class XML extends Static {
      *     Unmarshaller um = marshallerPool.acquireUnmarshaller();
      *     um.setProperty(XML.CONVERTER, myWarningList);
      *     Object obj = um.unmarshal(xml);
-     *     marshallerPool.release(um);
+     *     marshallerPool.recycle(um);
      *     if (!myWarningList.isEmpty()) {
      *         // Report here the warnings to the user.
      *     }
@@ -227,8 +235,144 @@ public final class XML extends Static {
     public static final String STRING_SUBSTITUTES = "org.apache.sis.xml.stringSubstitutes";
 
     /**
+     * The pool of marshallers and unmarshallers used by this class.
+     * The field name uses the uppercase convention because this field is almost constant:
+     * this field is initially null, then created by {@link #getPool()} when first needed.
+     * Once created the field value usually doesn't change. However the field may be reset
+     * to {@code null} in an OSGi context when modules are loaded or unloaded, because the
+     * set of classes returned by {@link TypeRegistration#defaultClassesToBeBound()} may
+     * have changed.
+     *
+     * @see #getPool()
+     */
+    private static volatile MarshallerPool POOL;
+
+    /**
+     * Registers a listener for classpath changes. In such case, a new pool will need to
+     * be created because the {@code JAXBContext} may be different.
+     */
+    static {
+        SystemListener.add(new SystemListener() {
+            @Override protected void classpathChanged() {
+                POOL = null;
+            }
+        });
+    }
+
+    /**
      * Do not allow instantiation on this class.
      */
     private XML() {
     }
+
+    /**
+     * Returns the default (un)marshaller pool used by all methods in this class.
+     *
+     * {@note Current implementation uses the double-check idiom. This is usually a deprecated
+     * practice (the recommended alterative is to use static class initialization), but in this
+     * particular case the field may be reset to <code>null</code> if OSGi modules are loaded
+     * or unloaded, so static class initialization would be a little bit too rigid.}
+     */
+    private static MarshallerPool getPool() throws JAXBException {
+        MarshallerPool pool = POOL;
+        if (pool == null) {
+            synchronized (XML.class) {
+                pool = POOL; // Double-check idiom: see javadoc.
+                if (pool == null) {
+                    POOL = pool = new MarshallerPool(TypeRegistration.defaultClassesToBeBound());
+                }
+            }
+        }
+        return pool;
+    }
+
+    /**
+     * Marshall the given object into a string.
+     *
+     * @param  object The root of content tree to be marshalled.
+     * @return The XML representation of the given object.
+     * @throws JAXBException If an error occurred during the marshalling.
+     */
+    public static String marshal(final Object object) throws JAXBException {
+        final StringWriter output = new StringWriter();
+        final MarshallerPool pool = getPool();
+        final Marshaller marshaller = pool.acquireMarshaller();
+        marshaller.marshal(object, output);
+        pool.recycle(marshaller);
+        return output.toString();
+    }
+
+    /**
+     * Marshall the given object into a stream.
+     *
+     * @param  object The root of content tree to be marshalled.
+     * @param  output The stream where to write.
+     * @throws JAXBException If an error occurred during the marshalling.
+     */
+    public static void marshal(final Object object, final OutputStream output) throws JAXBException {
+        final MarshallerPool pool = getPool();
+        final Marshaller marshaller = pool.acquireMarshaller();
+        marshaller.marshal(object, output);
+        pool.recycle(marshaller);
+    }
+
+    /**
+     * Marshall the given object into a file.
+     *
+     * @param  object The root of content tree to be marshalled.
+     * @param  output The file to be written.
+     * @throws JAXBException If an error occurred during the marshalling.
+     */
+    public static void marshal(final Object object, final File output) throws JAXBException {
+        final MarshallerPool pool = getPool();
+        final Marshaller marshaller = pool.acquireMarshaller();
+        marshaller.marshal(object, output);
+        pool.recycle(marshaller);
+    }
+
+    /**
+     * Unmarshall an object from the given string.
+     *
+     * @param  input The XML representation of an object.
+     * @return The object unmarshalled from the given input.
+     * @throws JAXBException If an error occurred during the unmarshalling.
+     */
+    public static Object unmarshal(final String input) throws JAXBException {
+        final StringReader in = new StringReader(input);
+        final MarshallerPool pool = getPool();
+        final Unmarshaller unmarshaller = pool.acquireUnmarshaller();
+        final Object object = unmarshaller.unmarshal(in);
+        pool.recycle(unmarshaller);
+        return object;
+    }
+
+    /**
+     * Unmarshall an object from the given stream.
+     *
+     * @param  input The stream from which to read a XML representation.
+     * @return The object unmarshalled from the given input.
+     * @throws JAXBException If an error occurred during the unmarshalling.
+     */
+    public static Object unmarshal(final InputStream input) throws JAXBException {
+        final MarshallerPool pool = getPool();
+        final Unmarshaller unmarshaller = pool.acquireUnmarshaller();
+        final Object object = unmarshaller.unmarshal(input);
+        pool.recycle(unmarshaller);
+        return object;
+    }
+
+    /**
+     * Unmarshall an object from the given file.
+     *
+     * @param  input The file from which to read a XML representation.
+     * @return The object unmarshalled from the given input.
+     * @throws JAXBException If an error occurred during the unmarshalling.
+     */
+    public static Object unmarshal(final File input) throws JAXBException {
+        final MarshallerPool pool = getPool();
+        final Unmarshaller unmarshaller = pool.acquireUnmarshaller();
+        final Object object = unmarshaller.unmarshal(input);
+        pool.recycle(unmarshaller);
+        return object;
+    }
 }

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/XML.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/xml/package-info.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Propchange: sis/branches/Android/sis-utility/src/main/resources/org/apache/sis/internal/util/Descriptions.properties
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=ISO-8859-1

Propchange: sis/branches/Android/sis-utility/src/main/resources/org/apache/sis/internal/util/Descriptions_fr.properties
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=ISO-8859-1

Propchange: sis/branches/Android/sis-utility/src/site/apt/index.apt
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Propchange: sis/branches/Android/sis-utility/src/test/java/org/apache/sis/internal/jaxb/IdentifierMapAdapterTest.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/test/java/org/apache/sis/internal/jaxb/IdentifierMapWithSpecialCasesTest.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/test/java/org/apache/sis/internal/jaxb/IdentifierMapWithSpecialCasesTest.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/test/java/org/apache/sis/internal/jaxb/IdentifierMapWithSpecialCasesTest.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/test/java/org/apache/sis/internal/jaxb/IdentifierMapWithSpecialCasesTest.java [UTF-8] Thu May  9 12:24:13 2013
@@ -42,12 +42,12 @@ import static org.apache.sis.test.TestUt
  * @version 0.3
  * @module
  */
-@DependsOn(IdentifierMapAdapter.class)
+@DependsOn(IdentifierMapAdapterTest.class)
 public final strictfp class IdentifierMapWithSpecialCasesTest extends IdentifierMapAdapterTest {
     /**
      * The HREF string to replace by {@link XLink#toString()}.
      */
-    private static final String TO_REPLACE = "xlink:href=“";
+    private static final String TO_REPLACE = "xlink:href=“";
 
     /**
      * Creates the {@link IdentifierMapWithSpecialCases} instance to test for the given identifiers.
@@ -57,7 +57,7 @@ public final strictfp class IdentifierMa
      */
     @Override
     IdentifierMapAdapter create(final Collection<Identifier> identifiers) {
-        return new IdentifierMapWithSpecialCases(identifiers, null);
+        return new IdentifierMapWithSpecialCases(identifiers);
     }
 
     /**
@@ -70,7 +70,7 @@ public final strictfp class IdentifierMa
         final int start = expected.indexOf(TO_REPLACE);
         if (start >= 0) {
             final int end = start + TO_REPLACE.length();
-            final int close = expected.indexOf('”', end);
+            final int close = expected.indexOf('”', end);
             final StringBuilder buffer = new StringBuilder(expected);
             buffer.replace(close, close+1, "\"]");
             buffer.replace(start, end, "xlink=XLink[href=\"");
@@ -110,25 +110,19 @@ public final strictfp class IdentifierMa
     }
 
     /**
-     * Tests the binding of UUID.
+     * Tests with UUIDs.
      */
     @Test
     public void testUUIDs() {
-        final String object = "IdentifiedObject";
         final List<Identifier> identifiers = new ArrayList<Identifier>();
-        final IdentifierMap map = new IdentifierMapWithSpecialCases(identifiers, object);
+        final IdentifierMap map = new IdentifierMapWithSpecialCases(identifiers);
         final UUID id1 = UUID.fromString("434f3107-c6d2-4c8c-bb25-553f68641c5c");
         final UUID id2 = UUID.fromString("42924124-032a-4dfe-b06e-113e3cb81cf0");
 
         // Add first UUID.
-        assertNull("Shall not contain UUID before put.", UUIDs.lookup(id1));
         assertNull(map.putSpecialized(IdentifierSpace.UUID, id1));
-        assertSame("Object sholl be associated to UUID.", object, UUIDs.lookup(id1));
 
         // Replace UUID by a new one.
-        assertNull("Shall not contain UUID before put.", UUIDs.lookup(id2));
         assertSame(id1, map.putSpecialized(IdentifierSpace.UUID, id2));
-        assertNull("Shall not contain the removed UUID.", UUIDs.lookup(id1));
-        assertSame("Object sholl be associated to UUID.", object, UUIDs.lookup(id2));
     }
 }

Propchange: sis/branches/Android/sis-utility/src/test/java/org/apache/sis/internal/jaxb/IdentifierMapWithSpecialCasesTest.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/test/java/org/apache/sis/internal/test/AssertTest.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/test/java/org/apache/sis/internal/test/AssertTest.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/test/java/org/apache/sis/internal/test/AssertTest.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/test/java/org/apache/sis/internal/test/AssertTest.java [UTF-8] Thu May  9 12:24:13 2013
@@ -17,6 +17,7 @@
 package org.apache.sis.internal.test;
 
 import org.junit.Test;
+import org.apache.sis.test.TestCase;
 
 import static org.apache.sis.test.Assert.*;
 
@@ -29,7 +30,7 @@ import static org.apache.sis.test.Assert
  * @version 0.3
  * @module
  */
-public final strictfp class AssertTest {
+public final strictfp class AssertTest extends TestCase {
     /**
      * Tests the {@link Assert#assertMultilinesEquals(String, String)} method.
      */
@@ -44,7 +45,7 @@ public final strictfp class AssertTest {
      */
     @Test
     public void testSerialize() {
-        final String local = "Le silence éternel de ces espaces infinis m'effraie";
+        final String local = "Le silence éternel de ces espaces infinis m'effraie";
         assertNotSame(local, assertSerializedEquals(local));
     }
 }

Propchange: sis/branches/Android/sis-utility/src/test/java/org/apache/sis/internal/test/AssertTest.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/test/java/org/apache/sis/internal/test/XMLComparatorTest.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/test/java/org/apache/sis/internal/test/XMLComparatorTest.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/test/java/org/apache/sis/internal/test/XMLComparatorTest.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/test/java/org/apache/sis/internal/test/XMLComparatorTest.java [UTF-8] Thu May  9 12:24:13 2013
@@ -16,6 +16,7 @@
  */
 package org.apache.sis.internal.test;
 
+import org.apache.sis.test.TestCase;
 import org.apache.sis.test.XMLComparator;
 import org.junit.Test;
 
@@ -30,7 +31,7 @@ import static org.junit.Assert.*;
  * @version 0.3
  * @module
  */
-public final strictfp class XMLComparatorTest {
+public final strictfp class XMLComparatorTest extends TestCase {
     /**
      * Tests the {@link XMLComparator#ignoredAttributes} and {@link XMLComparator#ignoredNodes}
      * sets.

Propchange: sis/branches/Android/sis-utility/src/test/java/org/apache/sis/internal/test/XMLComparatorTest.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Propchange: sis/branches/Android/sis-utility/src/test/java/org/apache/sis/internal/test/package-info.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Propchange: sis/branches/Android/sis-utility/src/test/java/org/apache/sis/internal/util/LocalizedParseExceptionTest.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Propchange: sis/branches/Android/sis-utility/src/test/java/org/apache/sis/internal/util/ReferenceQueueConsumerTest.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Propchange: sis/branches/Android/sis-utility/src/test/java/org/apache/sis/internal/util/X364Test.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Propchange: sis/branches/Android/sis-utility/src/test/java/org/apache/sis/io/AppenderTestCase.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Propchange: sis/branches/Android/sis-utility/src/test/java/org/apache/sis/io/EchoAppendable.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Propchange: sis/branches/Android/sis-utility/src/test/java/org/apache/sis/io/LeftMarginTest.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Propchange: sis/branches/Android/sis-utility/src/test/java/org/apache/sis/io/LineAppenderTest.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Propchange: sis/branches/Android/sis-utility/src/test/java/org/apache/sis/io/SingleCharAppendable.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/test/java/org/apache/sis/io/TableAppenderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/test/java/org/apache/sis/io/TableAppenderTest.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/test/java/org/apache/sis/io/TableAppenderTest.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/test/java/org/apache/sis/io/TableAppenderTest.java [UTF-8] Thu May  9 12:24:13 2013
@@ -23,7 +23,7 @@ import org.junit.Test;
 import static org.junit.Assert.*;
 
 // Related to JK7
-import org.apache.sis.internal.util.JDK7;
+import org.apache.sis.internal.jdk7.JDK7;
 
 
 /**
@@ -59,14 +59,14 @@ public final strictfp class TableAppende
     @Override
     void run(String lineSeparator) throws IOException {
         final Appendable out = appender;
-        table.nextLine('═');
+        table.nextLine('═');
 
         // r.e.d. = Equatorial diameter Measured relative to the Earth.
         // Source: "Planet" on wikipedia on July 25, 2008.
         assertSame(out, out.append("English\tFrench\tr.e.d." + lineSeparator));
         table.writeHorizontalSeparator();
         assertSame(out, out.append("Mercury\tMercure\t0.382" + lineSeparator));
-        assertSame(out, out.append("Venus\tVénus\t0.949"     + lineSeparator));
+        assertSame(out, out.append("Venus\tVénus\t0.949"     + lineSeparator));
         assertSame(out, out.append("Earth\tTerre"));
         assertSame(out, out.append("\t1.00"                  + lineSeparator));
         assertSame(out, out.append("Mars\tMa"));
@@ -78,7 +78,7 @@ public final strictfp class TableAppende
         assertSame(out, out.append("9.449"                   + lineSeparator));
         assertSame(out, out.append("Uranus\tUranus\t4.007"   + lineSeparator
                                  + "Neptune\tNeptune\t3.883" + lineSeparator));
-        table.nextLine('═');
+        table.nextLine('═');
         /*
          * If our test case is using the wrapper which will send the data once character at time,
          * our TableAppender implementation will not be able to detect the line separator and
@@ -90,18 +90,18 @@ public final strictfp class TableAppende
             lineSeparator = JDK7.lineSeparator();
         }
         assertOutputEquals(
-                  "╔═════════╤═════════╤════════╗" + lineSeparator
-                + "║ English │ French  │ r.e.d. ║" + lineSeparator
-                + "╟─────────┼─────────┼────────╢" + lineSeparator
-                + "║ Mercury │ Mercure │ 0.382  ║" + lineSeparator
-                + "║ Venus   │ Vénus   │ 0.949  ║" + lineSeparator
-                + "║ Earth   │ Terre   │ 1.00   ║" + lineSeparator
-                + "║ Mars    │ Mars    │ 0.532  ║" + lineSeparator
-                + "║ Jupiter │ Jupiter │ 11.209 ║" + lineSeparator
-                + "║ Saturn  │ Saturne │ 9.449  ║" + lineSeparator
-                + "║ Uranus  │ Uranus  │ 4.007  ║" + lineSeparator
-                + "║ Neptune │ Neptune │ 3.883  ║" + lineSeparator
-                + "╚═════════╧═════════╧════════╝" + lineSeparator);
+                  "╔═════════╤═════════╤════════╗" + lineSeparator
+                + "║ English │ French  │ r.e.d. ║" + lineSeparator
+                + "╟─────────┼─────────┼────────╢" + lineSeparator
+                + "║ Mercury │ Mercure │ 0.382  ║" + lineSeparator
+                + "║ Venus   │ Vénus   │ 0.949  ║" + lineSeparator
+                + "║ Earth   │ Terre   │ 1.00   ║" + lineSeparator
+                + "║ Mars    │ Mars    │ 0.532  ║" + lineSeparator
+                + "║ Jupiter │ Jupiter │ 11.209 ║" + lineSeparator
+                + "║ Saturn  │ Saturne │ 9.449  ║" + lineSeparator
+                + "║ Uranus  │ Uranus  │ 4.007  ║" + lineSeparator
+                + "║ Neptune │ Neptune │ 3.883  ║" + lineSeparator
+                + "╚═════════╧═════════╧════════╝" + lineSeparator);
     }
 
     /**
@@ -121,13 +121,13 @@ public final strictfp class TableAppende
          * then TableAppender.toString() is allowed to format the table.
          */
         testToString(new TableAppender(),
-                "╔═════════╤═════════╤════════╗\n"
-              + "║ English │ French  │ r.e.d. ║\n"
-              + "╟─────────┼─────────┼────────╢\n"
-              + "║ Mercury │ Mercure │ 0.382  ║\n"
-              + "║ Venus   │ Vénus   │ 0.949  ║\n"
-              + "║ Earth   │ Terre   │ 1.00   ║\n"
-              + "╚═════════╧═════════╧════════╝\n");
+                "╔═════════╤═════════╤════════╗\n"
+              + "║ English │ French  │ r.e.d. ║\n"
+              + "╟─────────┼─────────┼────────╢\n"
+              + "║ Mercury │ Mercure │ 0.382  ║\n"
+              + "║ Venus   │ Vénus   │ 0.949  ║\n"
+              + "║ Earth   │ Terre   │ 1.00   ║\n"
+              + "╚═════════╧═════════╧════════╝\n");
     }
 
     /**
@@ -137,12 +137,12 @@ public final strictfp class TableAppende
      * @param expected The expected string representation of the formatted table.
      */
     private static void testToString(final TableAppender table, final String expected) {
-        table.nextLine('═');
+        table.nextLine('═');
         table.append("English\tFrench\tr.e.d.\n").writeHorizontalSeparator();
         table.append("Mercury\tMercure\t0.382\n")
-             .append("Venus\tVénus\t0.949\n")
+             .append("Venus\tVénus\t0.949\n")
              .append("Earth\tTerre\t1.00\n")
-             .nextLine('═');
+             .nextLine('═');
         assertEquals(expected, table.toString());
     }
 }

Propchange: sis/branches/Android/sis-utility/src/test/java/org/apache/sis/io/TableAppenderTest.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Propchange: sis/branches/Android/sis-utility/src/test/java/org/apache/sis/io/TabulationExpansionTest.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/test/java/org/apache/sis/io/WordWrapTest.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/test/java/org/apache/sis/io/WordWrapTest.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/test/java/org/apache/sis/io/WordWrapTest.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/test/java/org/apache/sis/io/WordWrapTest.java [UTF-8] Thu May  9 12:24:13 2013
@@ -25,7 +25,7 @@ import static org.junit.Assert.*;
 import static org.apache.sis.util.Characters.SOFT_HYPHEN;
 
 // Related to JK7
-import org.apache.sis.internal.util.JDK7;
+import org.apache.sis.internal.jdk7.JDK7;
 
 
 /**
@@ -59,7 +59,7 @@ public strictfp class WordWrapTest exten
     }
 
     /**
-     * Runs the test using an extract from Émile Nelligan (1879-1941)
+     * Runs the test using an extract from Émile Nelligan (1879-1941)
      * with soft hyphen and X3.64 sequences added.
      *
      * @param  lineSeparator The line separator to use in the test strings.
@@ -73,7 +73,7 @@ public strictfp class WordWrapTest exten
         }
         final String BLUE    = X364.FOREGROUND_BLUE   .sequence();
         final String DEFAULT = X364.FOREGROUND_DEFAULT.sequence();
-        assertSame(f, f.append("Ah! comme la " + BLUE + "neige" + DEFAULT + " a neigé!" + lineSeparator));
+        assertSame(f, f.append("Ah! comme la " + BLUE + "neige" + DEFAULT + " a neigé!" + lineSeparator));
         assertSame(f, f.append("Ma vitre est un jar" + SOFT_HYPHEN + "din de givre."    + lineSeparator));
         /*
          * If our test case is using the wrapper which will send the data once character at time,
@@ -90,7 +90,7 @@ public strictfp class WordWrapTest exten
         final String expectedLineSeparator = expectedLineSeparator(lineSeparator);
         assertOutputEquals("Ah! comme"                             + insertedLineSeparator
                          + "la " + BLUE + "neige" + DEFAULT + " a" + insertedLineSeparator
-                         + "neigé!"                                + expectedLineSeparator
+                         + "neigé!"                                + expectedLineSeparator
                          + "Ma vitre"                              + insertedLineSeparator
                          + "est un jar" + SOFT_HYPHEN              + insertedLineSeparator
                          + "din de"                                + insertedLineSeparator

Propchange: sis/branches/Android/sis-utility/src/test/java/org/apache/sis/io/WordWrapTest.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Propchange: sis/branches/Android/sis-utility/src/test/java/org/apache/sis/io/WordWrapWithLineSeparatorTest.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/test/java/org/apache/sis/math/MathFunctionsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/test/java/org/apache/sis/math/MathFunctionsTest.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/test/java/org/apache/sis/math/MathFunctionsTest.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/test/java/org/apache/sis/math/MathFunctionsTest.java [UTF-8] Thu May  9 12:24:13 2013
@@ -23,7 +23,7 @@ import org.apache.sis.test.DependsOnMeth
 
 import static org.junit.Assert.*;
 import static org.apache.sis.math.MathFunctions.*;
-import static org.apache.sis.util.Arrays.isSorted;
+import static org.apache.sis.util.ArraysExt.isSorted;
 
 
 /**
@@ -34,7 +34,7 @@ import static org.apache.sis.util.Arrays
  * @version 0.3
  * @module
  */
-@DependsOn(org.apache.sis.util.ArraysTest.class)
+@DependsOn(org.apache.sis.util.ArraysExtTest.class)
 public final strictfp class MathFunctionsTest extends TestCase {
     /**
      * Small number for floating point comparisons.
@@ -144,7 +144,7 @@ public final strictfp class MathFunction
     }
 
     /**
-     * Tests the {@link MathFunctions#atanh(double)} method in the [-1 … +1] range.
+     * Tests the {@link MathFunctions#atanh(double)} method in the [-1 … +1] range.
      */
     @Test
     public void testAtanh() {

Propchange: sis/branches/Android/sis-utility/src/test/java/org/apache/sis/math/MathFunctionsTest.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/test/java/org/apache/sis/math/StatisticsFormatTest.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/test/java/org/apache/sis/math/StatisticsFormatTest.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/test/java/org/apache/sis/math/StatisticsFormatTest.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/test/java/org/apache/sis/math/StatisticsFormatTest.java [UTF-8] Thu May  9 12:24:13 2013
@@ -35,19 +35,19 @@ import static org.apache.sis.test.Assert
 public final strictfp class StatisticsFormatTest extends TestCase {
     /**
      * Tests the formatting of {@code Statistics} without column headers.
-     * We instantiate the {@link StatisticsFormat} directly in order to fix the locale
+     * We instantiate the {@link StatisticsFormat} directly in order to fix the locale
      * to a hard-coded value. But except for the localization, the result should be
      * nearly identical to a call to the {@link Statistics#toString()} method.
      */
     @Test
     public void testFormattingWithoutHeader() {
         final Statistics statistics = Statistics.forSeries(null, null, null);
-        statistics.add(10);
-        statistics.add(15);
-        statistics.add(22);
-        statistics.add(17);
-        statistics.add(12);
-        statistics.add( 3);
+        statistics.accept(10);
+        statistics.accept(15);
+        statistics.accept(22);
+        statistics.accept(17);
+        statistics.accept(12);
+        statistics.accept( 3);
 
         final StatisticsFormat format = StatisticsFormat.getInstance(Locale.US);
         final String text = format.format(statistics);
@@ -67,27 +67,27 @@ public final strictfp class StatisticsFo
     @Test
     @DependsOnMethod("testFormattingWithoutHeader")
     public void testFormattingWithBorder() {
-        final Statistics statistics = Statistics.forSeries("Temperature", "∂T/∂t", "∂²T/∂t²");
-        statistics.add(10);
-        statistics.add(15);
-        statistics.add(22);
-        statistics.add(17);
-        statistics.add(12);
-        statistics.add( 3);
+        final Statistics statistics = Statistics.forSeries("Temperature", "∂T/∂t", "∂²T/∂t²");
+        statistics.accept(10);
+        statistics.accept(15);
+        statistics.accept(22);
+        statistics.accept(17);
+        statistics.accept(12);
+        statistics.accept( 3);
 
         final StatisticsFormat format = StatisticsFormat.getInstance(Locale.US);
         format.setBorderWidth(1);
         final String text = format.format(statistics);
         assertMultilinesEquals(
-                "┌─────────────────────┬─────────────┬───────┬─────────┐\n" +
-                "│                     │ Temperature │ ∂T/∂t │ ∂²T/∂t² │\n" +
-                "├─────────────────────┼─────────────┼───────┼─────────┤\n" +
-                "│ Number of values:   │           6 │     5 │       4 │\n" +
-                "│ Minimum value:      │        3.00 │ -9.00 │  -12.00 │\n" +
-                "│ Maximum value:      │       22.00 │  7.00 │    2.00 │\n" +
-                "│ Mean value:         │       13.17 │ -1.40 │   -3.50 │\n" +
-                "│ Root Mean Square:   │       14.44 │  6.40 │    6.40 │\n" +
-                "│ Standard deviation: │        6.49 │  6.99 │    6.19 │\n" +
-                "└─────────────────────┴─────────────┴───────┴─────────┘\n", text);
+                "┌─────────────────────┬─────────────┬───────┬─────────┐\n" +
+                "│                     │ Temperature │ ∂T/∂t │ ∂²T/∂t² │\n" +
+                "├─────────────────────┼─────────────┼───────┼─────────┤\n" +
+                "│ Number of values:   │           6 │     5 │       4 │\n" +
+                "│ Minimum value:      │        3.00 │ -9.00 │  -12.00 │\n" +
+                "│ Maximum value:      │       22.00 │  7.00 │    2.00 │\n" +
+                "│ Mean value:         │       13.17 │ -1.40 │   -3.50 │\n" +
+                "│ Root Mean Square:   │       14.44 │  6.40 │    6.40 │\n" +
+                "│ Standard deviation: │        6.49 │  6.99 │    6.19 │\n" +
+                "└─────────────────────┴─────────────┴───────┴─────────┘\n", text);
     }
 }

Propchange: sis/branches/Android/sis-utility/src/test/java/org/apache/sis/math/StatisticsFormatTest.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Modified: sis/branches/Android/sis-utility/src/test/java/org/apache/sis/math/StatisticsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/test/java/org/apache/sis/math/StatisticsTest.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/test/java/org/apache/sis/math/StatisticsTest.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/test/java/org/apache/sis/math/StatisticsTest.java [UTF-8] Thu May  9 12:24:13 2013
@@ -30,6 +30,16 @@ import static org.apache.sis.test.Assert
 /**
  * Tests {@link Statistics}.
  *
+ * <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
+ * if the statistical values are within some range. Because Gaussian distributions have non-null
+ * probability to contain arbitrary large values (infinity is the only limit), testing with random
+ * seeds could produce statistical values out of the expected range no matter how large is this range.
+ * We could only reduce the probability, but never make it null. This is not a flaw in the code,
+ * but a consequence of the probabilistic nature of those statistical distributions.
+ * Consequently, in order to keep the build stable, the random seeds are fixed to values
+ * that are known to produce results inside the range expected by this test class.</p>
+ *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-3.00)
  * @version 0.3
@@ -63,10 +73,10 @@ public final strictfp class StatisticsTe
      */
     @Test
     public void testGaussian() {
-        final Random random = new Random(317780561);
+        final Random random = new Random(317780561); // See class javadoc.
         final Statistics statistics = new Statistics(null);
         for (int i=0; i<10000; i++) {
-            statistics.add(random.nextGaussian());
+            statistics.accept(random.nextGaussian());
         }
         assertEquals(0, statistics.countNaN());
         assertEquals(10000, statistics.count());
@@ -91,7 +101,7 @@ public final strictfp class StatisticsTe
         final Random random = new Random(309080660);
         final Statistics statistics = new Statistics(null);
         for (int i=0; i<10000; i++) {
-            statistics.add(random.nextDouble()*range + lower);
+            statistics.accept(random.nextDouble()*range + lower);
         }
         assertEquals(0,      statistics.countNaN());
         assertEquals(10000,  statistics.count());
@@ -104,7 +114,7 @@ public final strictfp class StatisticsTe
 
     /**
      * Same than {@link #testUniform()}, but on integer values.
-     * Used for testing {@link Statistics#add(long)}.
+     * Used for testing {@link Statistics#accept(long)}.
      */
     @Test
     public void testUniformUsingIntegers() {
@@ -118,7 +128,7 @@ public final strictfp class StatisticsTe
         final Random random = new Random(309080660);
         final Statistics statistics = new Statistics(null);
         for (int i=0; i<10000; i++) {
-            statistics.add(random.nextInt(range) + lower);
+            statistics.accept(random.nextInt(range) + lower);
         }
         assertEquals(0,      statistics.countNaN());
         assertEquals(10000,  statistics.count());
@@ -164,15 +174,15 @@ public final strictfp class StatisticsTe
             assertTrue("Possible misorder in offsetAndTolerancePairs", offset > 10);
             assertTrue("Possible misorder in offsetAndTolerancePairs", tolerance < 0.2);
             statistics.reset();
-            statistics.add(offset);
+            statistics.accept(offset);
             for (int i=0; i<10000; i++) {
-                statistics.add(random.nextDouble());
+                statistics.accept(random.nextDouble());
             }
             final double r = statistics.mean() - offset / statistics.count();
             final double expected = (tolerance != 0) ? 0.5 : 0;
             assertEquals(expected, r, tolerance);
 
-            statistics.add(-offset); // Accuracy will be better than in previous test.
+            statistics.accept(-offset); // Accuracy will be better than in previous test.
             assertEquals(expected, statistics.mean(), min(tolerance, 0.1));
         }
     }
@@ -182,7 +192,7 @@ public final strictfp class StatisticsTe
      */
     @Test
     public void testConcatenation() {
-        final Random random = new Random(429323868);
+        final Random random = new Random(429323868); // See class javadoc.
         final Statistics global = new Statistics(null);
         final Statistics byBlock = new Statistics(null);
         for (int i=0; i<10; i++) {
@@ -194,10 +204,10 @@ public final strictfp class StatisticsTe
                 } else {
                     value = random.nextGaussian() + 10*random.nextDouble();
                 }
-                global.add(value);
-                block.add(value);
+                global.accept(value);
+                block.accept(value);
             }
-            byBlock.add(block);
+            byBlock.combine(block);
             if (i == 0) {
                 assertEquals("Adding for the first time; should have the same amount of data.",   block,  byBlock);
                 assertEquals("Adding for the first time; should have got exactly the same data.", global, byBlock);
@@ -222,10 +232,10 @@ public final strictfp class StatisticsTe
     @Test
     public void testSerialization() throws IOException {
         final Statistics statistics = new Statistics(null);
-        statistics.add(40);
-        statistics.add(10);
-        statistics.add(NaN);
-        statistics.add(20);
+        statistics.accept(40);
+        statistics.accept(10);
+        statistics.accept(NaN);
+        statistics.accept(20);
         final Statistics after = assertSerializedEquals(statistics);
         assertNotSame(statistics, after);
         assertEquals( 3,                 after.count());

Propchange: sis/branches/Android/sis-utility/src/test/java/org/apache/sis/math/StatisticsTest.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8

Propchange: sis/branches/Android/sis-utility/src/test/java/org/apache/sis/measure/AngleFormatTest.java
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May  9 12:24:13 2013
@@ -1 +1 @@
-text/plain
+text/plain;charset=UTF-8



Mime
View raw message