sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1480602 [6/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/sis...
Date Thu, 09 May 2013 12:24:20 GMT
Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/GO_CharacterString.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/internal/jaxb/gco/GO_Decimal.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/internal/jaxb/gco/GO_GenericName.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/internal/jaxb/gco/GO_Integer.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/internal/jaxb/gco/GO_Real.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/internal/jaxb/gco/InternationalStringAdapter.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/internal/jaxb/gco/InternationalStringConverter.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/internal/jaxb/gco/LocalNameAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/LocalNameAdapter.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/LocalNameAdapter.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/LocalNameAdapter.java [UTF-8] Thu May  9 12:24:13 2013
@@ -16,6 +16,7 @@
  */
 package org.apache.sis.internal.jaxb.gco;
 
+import java.util.Locale;
 import javax.xml.bind.annotation.adapters.XmlAdapter;
 import org.opengis.util.LocalName;
 import org.opengis.util.NameFactory;
@@ -26,7 +27,7 @@ import org.apache.sis.util.CharSequences
  * JAXB adapter in order to map implementing class with the GeoAPI interface.
  * See package documentation for more information about JAXB and interface.
  *
- * @author  Cédric Briançon (Geomatys)
+ * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-2.5)
  * @version 0.3
@@ -70,7 +71,7 @@ public final class LocalNameAdapter exte
      */
     @Override
     public String marshal(final LocalName value) {
-        return (value == null) ? null : value.toInternationalString().toString(null);
+        return (value == null) ? null : value.toInternationalString().toString(Locale.ROOT);
     }
 
     /**

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/LocalNameAdapter.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/internal/jaxb/gco/ObjectIdentification.html
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ObjectIdentification.html?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ObjectIdentification.html (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ObjectIdentification.html Thu May  9 12:24:13 2013
@@ -21,7 +21,7 @@
        which defines the <code>xlink</code> and <code>uuidref</code> attributes to be supported by all metadata
        wrappers in the private <code>org.apache.sis.internal.jaxb.metadata</code> package and sub-packages.</p>
 
-    <h2>Difference between <code>gml:id</code> and <code>gmd:uuid</code></h2>
+    <h2>Difference between <code>gml:id</code> and <code>gco:uuid</code></h2>
     <p>The <a href="https://www.seegrid.csiro.au/wiki/bin/view/AppSchemas/GmlIdentifiers">GML identifiers</a> page said:</p>
     <ul>
       <li><code>id</code> is a standard <strong>GML</strong> attribute available on every object-with-identity.

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ScopedNameAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ScopedNameAdapter.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ScopedNameAdapter.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ScopedNameAdapter.java [UTF-8] Thu May  9 12:24:13 2013
@@ -17,6 +17,7 @@
 package org.apache.sis.internal.jaxb.gco;
 
 import java.util.List;
+import java.util.Locale;
 import java.util.ConcurrentModificationException;
 import javax.xml.bind.annotation.adapters.XmlAdapter;
 import org.opengis.util.LocalName;
@@ -64,7 +65,7 @@ public final class ScopedNameAdapter ext
         int i=0;
         for (final LocalName name : parsedNames) {
             // Asks for the unlocalized name, since we are going to marshal that.
-            names[i++] = name.toInternationalString().toString(null);
+            names[i++] = name.toInternationalString().toString(Locale.ROOT);
         }
         if (i != names.length) {
             throw new ConcurrentModificationException(Errors.format(Errors.Keys.UnexpectedChange_1, "parsedNames"));

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ScopedNameAdapter.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/internal/jaxb/gco/StringAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.java [UTF-8] Thu May  9 12:24:13 2013
@@ -16,9 +16,10 @@
  */
 package org.apache.sis.internal.jaxb.gco;
 
+import java.util.Locale;
 import javax.xml.bind.annotation.adapters.XmlAdapter;
 import org.opengis.util.InternationalString;
-import org.apache.sis.internal.jaxb.MarshalContext;
+import org.apache.sis.internal.jaxb.Context;
 
 
 /**
@@ -27,7 +28,7 @@ import org.apache.sis.internal.jaxb.Mars
  * method needs to localize {@link InternationalString} instances for the locale specified in the
  * current marshaller context.
  *
- * @author  Cédric Briançon (Geomatys)
+ * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-2.5)
  * @version 0.3
@@ -44,6 +45,8 @@ public final class StringAdapter extends
      * Returns a string representation of the given character sequence. If the given
      * sequence is an instance of {@link InternationalString}, then the locale from
      * the current unmashalling context is used in order to get a string.
+     * If the context is {@code null} or does not specify any locale, then the choice
+     * of locale is left to the {@link InternationalString#toString()} implementation.
      *
      * @param  value The wrapper for the value, or {@code null}.
      * @return The string representation of the given text, or {@code null}.
@@ -53,8 +56,15 @@ public final class StringAdapter extends
             final CharSequence text = value.toCharSequence();
             if (text != null) {
                 if (text instanceof InternationalString) {
-                    final MarshalContext context = MarshalContext.current();
-                    return ((InternationalString) text).toString(context != null ? context.getLocale() : null);
+                    final Context context = Context.current();
+                    if (context != null) {
+                        final Locale locale = context.getLocale();
+                        if (locale != null) {
+                            // While Apache SIS accepts null locale, foreigner
+                            // implementations are not guaranteed to support null.
+                            return ((InternationalString) text).toString(locale);
+                        }
+                    }
                 }
                 return text.toString();
             }

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.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/internal/jaxb/gco/URIAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/URIAdapter.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/URIAdapter.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/URIAdapter.java [UTF-8] Thu May  9 12:24:13 2013
@@ -19,14 +19,14 @@ package org.apache.sis.internal.jaxb.gco
 import java.net.URI;
 import java.net.URISyntaxException;
 import javax.xml.bind.annotation.adapters.XmlAdapter;
-import org.apache.sis.internal.jaxb.MarshalContext;
+import org.apache.sis.internal.jaxb.Context;
 
 
 /**
  * JAXB adapter wrapping a URI value with a {@code <gco:CharacterString>} element,
  * for ISO-19139 compliance.
  *
- * @author  Cédric Briançon (Geomatys)
+ * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-2.5)
  * @version 0.3
@@ -51,8 +51,8 @@ public final class URIAdapter extends Xm
     public URI unmarshal(final GO_CharacterString value) throws URISyntaxException {
         final String text = StringAdapter.toString(value);
         if (text != null) {
-            final MarshalContext context = MarshalContext.current();
-            return MarshalContext.converter(context).toURI(context, text);
+            final Context context = Context.current();
+            return Context.converter(context).toURI(context, text);
         }
         return null;
     }

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/URIAdapter.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/internal/jaxb/gco/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

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListAdapter.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListAdapter.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListAdapter.java [UTF-8] Thu May  9 12:24:13 2013
@@ -19,7 +19,7 @@ package org.apache.sis.internal.jaxb.gmd
 import javax.xml.bind.annotation.adapters.XmlAdapter;
 import org.opengis.util.CodeList;
 import org.apache.sis.util.iso.Types;
-import org.apache.sis.internal.jaxb.MarshalContext;
+import org.apache.sis.internal.jaxb.Context;
 
 
 /**
@@ -30,7 +30,7 @@ import org.apache.sis.internal.jaxb.Mars
  * {@preformat xml
  *   <dateType>
  *     <CI_DateTypeCode codeList="../Codelist/ML_gmxCodelists.xml#CI_DateTypeCode" codeListValue="revision" codeSpace="fra">
- *       révision
+ *       révision
  *     </CI_DateTypeCode>
  *   </dateType>
  * }
@@ -41,7 +41,7 @@ import org.apache.sis.internal.jaxb.Mars
  * @param <ValueType> The subclass implementing this adapter.
  * @param <BoundType> The code list being adapted.
  *
- * @author  Cédric Briançon (Geomatys)
+ * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-2.5)
  * @version 0.3
@@ -133,7 +133,7 @@ public abstract class CodeListAdapter<Va
             return null;
         }
         return wrap(isEnum() ? new CodeListProxy(Types.getCodeName(value))
-                             : new CodeListProxy(MarshalContext.current(), value));
+                             : new CodeListProxy(Context.current(), value));
     }
 
     /**

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListAdapter.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/internal/jaxb/gmd/CodeListProxy.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListProxy.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListProxy.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListProxy.java [UTF-8] Thu May  9 12:24:13 2013
@@ -23,9 +23,9 @@ import javax.xml.bind.annotation.XmlAttr
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlValue;
 import org.opengis.util.CodeList;
-import org.apache.sis.util.logging.Logging;
 import org.apache.sis.util.iso.Types;
-import org.apache.sis.internal.jaxb.MarshalContext;
+import org.apache.sis.util.logging.Logging;
+import org.apache.sis.internal.jaxb.Context;
 
 
 /**
@@ -34,7 +34,7 @@ import org.apache.sis.internal.jaxb.Mars
  * the spacial case of {@link Locale} type, by {@link CodeListLocaleAdapter}. It provides the
  * {@link #codeList} and {@link #codeListValue} attribute to be marshalled.
  *
- * @author  Cédric Briançon (Geomatys)
+ * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-2.5)
  * @version 0.3
@@ -53,8 +53,8 @@ public final class CodeListProxy {
      * @param  identifier The UML identifier of the code list.
      * @return The URL to the given code list in the given schema.
      */
-    private static String schema(final MarshalContext context, final String file, final String identifier) {
-        return schema(MarshalContext.schema(context, "gmd", "http://schemas.opengis.net/iso/19139/20070417/"),
+    private static String schema(final Context context, final String file, final String identifier) {
+        return schema(Context.schema(context, "gmd", "http://schemas.opengis.net/iso/19139/20070417/"),
                 "resources/Codelist", file, identifier);
     }
 
@@ -70,7 +70,7 @@ public final class CodeListProxy {
      * </ul>
      *
      * @param  schema     The schema, typically as a result of a call to
-     *                    {@link MarshalContext#schema(MarshalContext, String, String)}.
+     *                    {@link Context#schema(Context, String, String)}.
      * @param  directory  The directory to concatenate, for example {@code "resources/uom"}
      *                    or {@code "resources/Codelist"} (<strong>no trailing {@code '/'}</strong>).
      * @param  file       The XML file, for example {@code "gmxUom.xml"}, {@code "gmxCodelists.xml"}
@@ -149,7 +149,7 @@ public final class CodeListProxy {
      * @param codeSpace     The 3-letters language code of the {@code value} attribute, or {@code null} if none.
      * @param value         The value in the language specified by the {@code codeSpace} attribute, or {@code null} if none.
      */
-    CodeListProxy(final MarshalContext context, final String catalog,
+    CodeListProxy(final Context context, final String catalog,
             final String codeList, final String codeListValue, final String codeSpace, final String value)
     {
         this.codeList      = schema(context, catalog, codeList);
@@ -165,16 +165,16 @@ public final class CodeListProxy {
      * @param context The current (un)marshalling context, or {@code null} if none.
      * @param code    The code list to wrap.
      */
-    CodeListProxy(final MarshalContext context, final CodeList<?> code) {
+    CodeListProxy(final Context context, final CodeList<?> code) {
         final String classID = Types.getListName(code);
         final String fieldID = Types.getCodeName(code);
         codeList = schema(context, "gmxCodelists.xml", classID);
         /*
          * Get the localized name of the field identifier, if possible.
-         * This code partially duplicates Types.getCodeTitle(CodeList, Locale).
+         * This code partially duplicates Types.getCodeTitle(CodeList).
          * This duplication exists because this constructor stores more information in
          * an opportunist way. If this constructor is updated, please consider updating
-         * the Types.getCodeTitle(CodeList, Locale) method accordingly.
+         * the Types.getCodeTitle(CodeList) method accordingly.
          */
         final Locale locale = context.getLocale();
         if (locale != null) {
@@ -187,12 +187,12 @@ public final class CodeListProxy {
             }
         }
         if (value != null) {
-            codeSpace = MarshalContext.converter(context).toLanguageCode(context, locale);
+            codeSpace = Context.converter(context).toLanguageCode(context, locale);
         } else {
             // Fallback when no value is defined for the code list. Build a value from the
             // most descriptive name (excluding the field name), which is usually the UML
             // name except for CharacterSet in which case it is a string like "UTF-8".
-            value = Types.getCodeTitle(code);
+            value = Types.getCodeLabel(code);
         }
         codeListValue = fieldID;
     }

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListProxy.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/internal/jaxb/gmd/Country.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java [UTF-8] Thu May  9 12:24:13 2013
@@ -22,7 +22,7 @@ import javax.xml.bind.annotation.XmlElem
 
 import org.apache.sis.util.Locales;
 import org.apache.sis.util.CharSequences;
-import org.apache.sis.internal.jaxb.MarshalContext;
+import org.apache.sis.internal.jaxb.Context;
 import org.apache.sis.internal.jaxb.gco.GO_CharacterString;
 import org.apache.sis.internal.jaxb.gco.CharSequenceAdapter;
 
@@ -42,7 +42,7 @@ import org.apache.sis.internal.jaxb.gco.
  *
  * Note that {@code <gco:CharacterString>} can be substituted to the country code.
  *
- * @author  Cédric Briançon (Geomatys)
+ * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-2.5)
  * @version 0.3
@@ -64,7 +64,7 @@ public final class Country extends GO_Ch
 
     /**
      * Builds a {@code <gco:CharacterString>} element.
-     * For private use by {@link #create(MarshalContext, Locale)} only.
+     * For private use by {@link #create(Context, Locale)} only.
      */
     private Country(final GO_CharacterString code) {
         super(code);
@@ -72,14 +72,14 @@ public final class Country extends GO_Ch
 
     /**
      * Builds a {@code <Country>} element.
-     * For private use by {@link #create(MarshalContext, Locale, CharSequenceAdapter)} only.
+     * For private use by {@link #create(Context, Locale, CharSequenceAdapter)} only.
      *
      * @param context       The current (un)marshalling context, or {@code null} if none.
      * @param codeListValue The {@code codeListValue} attribute in the XML element.
      * @param codeSpace     The 3-letters language code of the {@code value} attribute, or {@code null} if none.
      * @param value         The value in the language specified by the {@code codeSpace} attribute, or {@code null} if none.
      */
-    private Country(final MarshalContext context, final String codeListValue, final String codeSpace, final String value) {
+    private Country(final Context context, final String codeListValue, final String codeSpace, final String value) {
         proxy = new CodeListProxy(context, "ML_gmxCodelists.xml", "Country", codeListValue, codeSpace, value);
     }
 
@@ -91,10 +91,10 @@ public final class Country extends GO_Ch
      * @return The country to marshal, or {@code null} if the given locale was null
      *         or if its {@link Locale#getCountry()} attribute is the empty string.
      */
-    static Country create(final MarshalContext context, final Locale locale) {
+    static Country create(final Context context, final Locale locale) {
         if (locale != null) {
-            final String codeListValue = MarshalContext.converter(context).toCountryCode(context, locale);
-            if (!codeListValue.isEmpty() && MarshalContext.isFlagSet(context, MarshalContext.SUBSTITUTE_COUNTRY)) {
+            final String codeListValue = Context.converter(context).toCountryCode(context, locale);
+            if (!codeListValue.isEmpty() && Context.isFlagSet(context, Context.SUBSTITUTE_COUNTRY)) {
                 /*
                  * Marshal the locale as a <gco:CharacterString> instead than <Country>,
                  * using the user-supplied anchors if any.
@@ -109,7 +109,7 @@ public final class Country extends GO_Ch
             if (context != null) {
                 final Locale marshalLocale = context.getLocale();
                 if (marshalLocale != null) {
-                    codeSpace = MarshalContext.converter(context).toLanguageCode(context, locale);
+                    codeSpace = Context.converter(context).toLanguageCode(context, locale);
                     value = locale.getDisplayCountry(marshalLocale);
                     if (value.isEmpty()) {
                         value = null;
@@ -129,7 +129,7 @@ public final class Country extends GO_Ch
      * @param value The wrapper for this metadata value.
      * @return A locale which represents the metadata value.
      *
-     * @see LanguageCode#getLocale(MarshalContext, LanguageCode, boolean)
+     * @see LanguageCode#getLocale(Context, LanguageCode, boolean)
      */
     static Locale getLocale(final Country value) {
         if (value != null) {

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.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/internal/jaxb/gmd/LanguageCode.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LanguageCode.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LanguageCode.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LanguageCode.java [UTF-8] Thu May  9 12:24:13 2013
@@ -20,7 +20,7 @@ import java.util.Locale;
 import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlElement;
 
-import org.apache.sis.internal.jaxb.MarshalContext;
+import org.apache.sis.internal.jaxb.Context;
 import org.apache.sis.internal.jaxb.gco.GO_CharacterString;
 import org.apache.sis.internal.jaxb.gco.CharSequenceAdapter;
 
@@ -40,7 +40,7 @@ import org.apache.sis.internal.jaxb.gco.
  *
  * Note that {@code <gco:CharacterString>} can be substituted to the language code.
  *
- * @author  Cédric Briançon (Geomatys)
+ * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-2.5)
  * @version 0.3
@@ -62,7 +62,7 @@ public final class LanguageCode extends 
 
     /**
      * Builds a {@code <gco:CharacterString>} element.
-     * For private use by {@link #create(MarshalContext, Locale)} only.
+     * For private use by {@link #create(Context, Locale)} only.
      */
     private LanguageCode(final GO_CharacterString code) {
         super(code);
@@ -70,14 +70,14 @@ public final class LanguageCode extends 
 
     /**
      * Builds a {@code <LanguageCode>} element.
-     * For private use by {@link #create(MarshalContext, Locale)} only.
+     * For private use by {@link #create(Context, Locale)} only.
      *
      * @param context       The current (un)marshalling context, or {@code null} if none.
      * @param codeListValue The {@code codeListValue} attribute in the XML element.
      * @param codeSpace     The 3-letters language code of the {@code value} attribute, or {@code null} if none.
      * @param value         The value in the language specified by the {@code codeSpace} attribute, or {@code null} if none.
      */
-    private LanguageCode(final MarshalContext context, final String codeListValue, final String codeSpace, final String value) {
+    private LanguageCode(final Context context, final String codeListValue, final String codeSpace, final String value) {
         proxy = new CodeListProxy(context, "ML_gmxCodelists.xml", "LanguageCode", codeListValue, codeSpace, value);
     }
 
@@ -89,10 +89,10 @@ public final class LanguageCode extends 
      * @return The language to marshal, or {@code null} if the given locale was null
      *         or if its {@link Locale#getLanguage()} attribute is the empty string.
      */
-    static LanguageCode create(final MarshalContext context, final Locale locale) {
+    static LanguageCode create(final Context context, final Locale locale) {
         if (locale != null) {
-            final String codeListValue = MarshalContext.converter(context).toLanguageCode(context, locale);
-            if (!codeListValue.isEmpty() && MarshalContext.isFlagSet(context, MarshalContext.SUBSTITUTE_LANGUAGE)) {
+            final String codeListValue = Context.converter(context).toLanguageCode(context, locale);
+            if (!codeListValue.isEmpty() && Context.isFlagSet(context, Context.SUBSTITUTE_LANGUAGE)) {
                 /*
                  * Marshal the locale as a <gco:CharacterString> instead than <LanguageCode>,
                  * using the user-supplied anchors if any.
@@ -107,7 +107,7 @@ public final class LanguageCode extends 
             if (context != null) {
                 final Locale marshalLocale = context.getLocale();
                 if (marshalLocale != null) {
-                    codeSpace = MarshalContext.converter(context).toLanguageCode(context, locale);
+                    codeSpace = Context.converter(context).toLanguageCode(context, locale);
                     value = locale.getDisplayLanguage(marshalLocale);
                     if (value.isEmpty()) {
                         value = null;
@@ -132,17 +132,17 @@ public final class LanguageCode extends 
      *
      * @see Country#getLocale(Country)
      */
-    static Locale getLocale(final MarshalContext context, final LanguageCode value, final boolean useCharSequence) {
+    static Locale getLocale(final Context context, final LanguageCode value, final boolean useCharSequence) {
         if (value != null) {
             final CodeListProxy proxy = value.proxy;
             if (proxy != null) {
-                final Locale locale = MarshalContext.converter(context).toLocale(context, proxy.codeListValue);
+                final Locale locale = Context.converter(context).toLocale(context, proxy.codeListValue);
                 if (locale != null) {
                     return locale;
                 }
             }
             if (useCharSequence) {
-                return MarshalContext.converter(context).toLocale(context, value.toString());
+                return Context.converter(context).toLocale(context, value.toString());
             }
         }
         return null;

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LanguageCode.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/internal/jaxb/gmd/LocaleAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LocaleAdapter.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LocaleAdapter.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LocaleAdapter.java [UTF-8] Thu May  9 12:24:13 2013
@@ -18,8 +18,8 @@ package org.apache.sis.internal.jaxb.gmd
 
 import java.util.Locale;
 import javax.xml.bind.annotation.adapters.XmlAdapter;
-import org.apache.sis.internal.jaxb.MarshalContext;
 import org.apache.sis.internal.jaxb.gco.StringAdapter;
+import org.apache.sis.internal.jaxb.Context;
 
 
 /**
@@ -32,7 +32,7 @@ import org.apache.sis.internal.jaxb.gco.
  *   </gmd:language>
  * }
  *
- * @author  Cédric Briançon (Geomatys)
+ * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-2.5)
  * @version 0.3
@@ -57,13 +57,13 @@ public final class LocaleAdapter extends
      */
     @Override
     public Locale unmarshal(final LanguageCode value) {
-        final MarshalContext context = MarshalContext.current();
+        final Context context = Context.current();
         final Locale candidate = LanguageCode.getLocale(context, value, false);
         if (candidate != null) {
             return candidate;
         }
         final String text = StringAdapter.toString(value);
-        return (text != null) ? MarshalContext.converter(context).toLocale(context, text) : null;
+        return (text != null) ? Context.converter(context).toLocale(context, text) : null;
     }
 
     /**
@@ -75,6 +75,6 @@ public final class LocaleAdapter extends
      */
     @Override
     public LanguageCode marshal(final Locale value) {
-        return LanguageCode.create(MarshalContext.current(), value);
+        return LanguageCode.create(Context.current(), value);
     }
 }

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LocaleAdapter.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/internal/jaxb/gmd/LocalisedCharacterString.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LocalisedCharacterString.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LocalisedCharacterString.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LocalisedCharacterString.java [UTF-8] Thu May  9 12:24:13 2013
@@ -19,17 +19,17 @@ package org.apache.sis.internal.jaxb.gmd
 import java.util.Locale;
 import javax.xml.bind.annotation.XmlValue;
 import javax.xml.bind.annotation.XmlAttribute;
-import org.apache.sis.internal.jaxb.MarshalContext;
+import org.apache.sis.internal.jaxb.Context;
 
 // Related to JDK7
-import org.apache.sis.internal.util.Objects;
+import org.apache.sis.internal.jdk7.Objects;
 
 
 /**
  * The {@code <LocalisedCharacterString>} elements nested in a {@code <textGroup>} one.
  * This element contains a string for a given {@linkplain Locale locale}.
  *
- * @author  Cédric Briançon (Geomatys)
+ * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-2.5)
  * @version 0.3
@@ -59,7 +59,7 @@ final class LocalisedCharacterString {
     /**
      * Empty constructor only used by JAXB.
      */
-    public LocalisedCharacterString() {
+    LocalisedCharacterString() {
     }
 
     /**
@@ -84,8 +84,8 @@ final class LocalisedCharacterString {
         if (locale == null) {
             return null;
         }
-        final MarshalContext context = MarshalContext.current();
-        return LOCALE.concat(MarshalContext.converter(context).toLanguageCode(context, locale));
+        final Context context = Context.current();
+        return LOCALE.concat(Context.converter(context).toLanguageCode(context, locale));
     }
 
     /**
@@ -96,8 +96,8 @@ final class LocalisedCharacterString {
      */
     public void setLocale(final String localeId) {
         if (localeId != null) {
-            final MarshalContext context = MarshalContext.current();
-            locale = MarshalContext.converter(context).toLocale(context, localeId.substring(localeId.indexOf('-') + 1));
+            final Context context = Context.current();
+            locale = Context.converter(context).toLocale(context, localeId.substring(localeId.indexOf('-') + 1));
         } else {
             locale = null;
         }
@@ -128,7 +128,7 @@ final class LocalisedCharacterString {
      * Example:
      *
      * {@preformat
-     *   LocalisedCharacterString[#locale-fra, “Un texte”]
+     *   LocalisedCharacterString[#locale-fra, “Un texte”]
      * }
      *
      * @see TextGroup#toString()
@@ -138,7 +138,7 @@ final class LocalisedCharacterString {
         final StringBuilder buffer = new StringBuilder(80)
                 .append(getClass().getSimpleName()).append('[').append(getLocale());
         if (text != null) {
-            buffer.append(", “").append(text).append('”');
+            buffer.append(", “").append(text).append('”');
         }
         return buffer.append(']').toString();
     }

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LocalisedCharacterString.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/internal/jaxb/gmd/PT_FreeText.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/PT_FreeText.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/PT_FreeText.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/PT_FreeText.java [UTF-8] Thu May  9 12:24:13 2013
@@ -23,10 +23,11 @@ import javax.xml.bind.annotation.XmlElem
 import javax.xml.bind.annotation.XmlElementWrapper;
 
 import org.opengis.util.InternationalString;
-import org.apache.sis.internal.jaxb.MarshalContext;
+import org.apache.sis.internal.jaxb.Context;
 import org.apache.sis.internal.jaxb.gco.GO_CharacterString;
 import org.apache.sis.util.iso.DefaultInternationalString;
 import org.apache.sis.util.iso.SimpleInternationalString;
+import org.apache.sis.util.ArraysExt;
 
 
 /**
@@ -39,7 +40,7 @@ import org.apache.sis.util.iso.SimpleInt
  *     <gco:CharacterString>Some title in english is present in this node</gco:CharacterString>
  *     <gmd:PT_FreeText>
  *       <gmd:textGroup>
- *         <gmd:LocalisedCharacterString locale="#locale-fra">Un titre en français</gmd:LocalisedCharacterString>
+ *         <gmd:LocalisedCharacterString locale="#locale-fra">Un titre en français</gmd:LocalisedCharacterString>
  *       </gmd:textGroup>
  *     </gmd:PT_FreeText>
  *   </gmd:title>
@@ -53,7 +54,7 @@ import org.apache.sis.util.iso.SimpleInt
  * <p>The {@code <gco:CharacterString>} element is inherited from the {@link GO_CharacterString}
  * parent class.</p>
  *
- * @author  Cédric Briançon (Geomatys)
+ * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-2.5)
  * @version 0.3
@@ -80,42 +81,29 @@ public final class PT_FreeText extends G
     }
 
     /**
-     * Constructs a {@linkplain TextGroup text group} from a {@link DefaultInternationalString}
-     * which could contains several localized strings.
+     * Constructs a {@code PT_FreeText} containing the given text groups.
      *
-     * <p>The {@code <gco:CharacterString> element will typically be set for the {@code null} locale,
+     * <p>The {@code <gco:CharacterString>} element will typically be set for the {@link Locale#ROOT},
      * which is the "unlocalized" string (not the same thing than the string in the default locale).
      * Note that the {@link TextGroup} constructor works better if the {@code <gco:CharacterString>}
-     * have been set for the {@code null} locale (the default behavior). If a different locale were
+     * have been set for the {@code ROOT} locale (the default behavior). If a different locale were
      * set, the list of localized strings in {@code TextGroup} may contains an element which
      * duplicate the {@code <gco:CharacterString>} element, or the unlocalized string normally
      * written in {@code <gco:CharacterString>} may be missing.</p>
      *
-     * @param context The current (un)marshalling context, or {@code null} if none.
-     * @param text    An international string which could have several translations
-     *                embedded for the same text.
+     * @param text The text to write in the {@code <gco:CharacterString>} element.
+     * @param textGroup The text group elements.
      *
      * @see org.apache.sis.xml.XML#LOCALE
      */
-    private PT_FreeText(final MarshalContext context, final DefaultInternationalString text) {
-        super(text.toString(context != null ? context.getLocale() : null));
-        final Set<Locale> locales = text.getLocales();
-        int n = locales.size();
-        if (locales.contains(null)) {
-            n--;
-        }
-        textGroup = new TextGroup[n];
-        int i = 0;
-        for (final Locale locale : locales) {
-            if (locale != null) {
-                textGroup[i++] = new TextGroup(locale, text.toString(locale));
-            }
-        }
+    private PT_FreeText(final String text, final TextGroup[] textGroup) {
+        super(text);
+        this.textGroup = textGroup;
     }
 
     /**
      * Constructs a {@linkplain TextGroup text group} from the given {@link InternationalString}
-     * if it contains at least one non-null locale. Otherwise returns {@code null}, meaning that
+     * if it contains at least one non-root locale. Otherwise returns {@code null}, meaning that
      * the simpler {@link GO_CharacterString} construct should be used instead.
      *
      * @param context The current (un)marshalling context, or {@code null} if none.
@@ -125,14 +113,26 @@ public final class PT_FreeText extends G
      *         or {@code null} otherwise.
      */
     @SuppressWarnings("fallthrough")
-    public static PT_FreeText create(final MarshalContext context, final InternationalString text) {
+    public static PT_FreeText create(final Context context, final InternationalString text) {
         if (text instanceof DefaultInternationalString) {
             final DefaultInternationalString df = (DefaultInternationalString) text;
             final Set<Locale> locales = df.getLocales();
-            switch (locales.size()) {
-                case 0:  break;
-                case 1:  if (locales.contains(null)) break; // Otherwise fallthrough
-                default: return new PT_FreeText(context, df);
+            final TextGroup[] textGroup = new TextGroup[locales.size()];
+            int n = 0;
+            for (final Locale locale : locales) {
+                if (locale != null && !locale.equals(Locale.ROOT)) {
+                    textGroup[n++] = new TextGroup(locale, text.toString(locale));
+                }
+            }
+            if (n != 0) {
+                /*
+                 * Invoke toString(Locale) instead than toString() even if the locale is null,
+                 * since the desired fallback is typically Locale.ROOT instead than the system
+                 * default. It is usually safer to avoid null value, but in this particular case
+                 * the implementation (DefaultInternationalString) is known to support null.
+                 */
+                return new PT_FreeText(df.toString(context != null ? context.getLocale() : null),
+                        ArraysExt.resize(textGroup, n));
             }
         }
         return null;

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/PT_FreeText.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/internal/jaxb/gmd/TextGroup.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/TextGroup.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/TextGroup.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/TextGroup.java [UTF-8] Thu May  9 12:24:13 2013
@@ -20,7 +20,7 @@ import java.util.Locale;
 import javax.xml.bind.annotation.XmlElement;
 
 // Related to JDK7
-import org.apache.sis.internal.util.JDK7;
+import org.apache.sis.internal.jdk7.JDK7;
 
 
 /**
@@ -68,7 +68,7 @@ import org.apache.sis.internal.util.JDK7
  *   </gmd:PT_FreeText>
  * }
  *
- * @author  Cédric Briançon (Geomatys)
+ * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-2.5)
  * @version 0.3
@@ -117,8 +117,8 @@ final class TextGroup {
      *
      * {@preformat
      *   TextGroup
-     *   ├─ LocalisedCharacterString[#locale-eng, “A text”]
-     *   └─ LocalisedCharacterString[#locale-fra, “Un texte”]
+     *   ├─ LocalisedCharacterString[#locale-eng, “A text”]
+     *   └─ LocalisedCharacterString[#locale-fra, “Un texte”]
      * }
      *
      * @see LocalisedCharacterString#toString()
@@ -131,10 +131,10 @@ final class TextGroup {
             int corner = 0;
             for (LocalisedCharacterString string : localized) {
                 corner = buffer.length();
-                buffer.append("├─ ").append(string).append(lineSeparator);
+                buffer.append("├─ ").append(string).append(lineSeparator);
             }
             if (corner != 0) {
-                buffer.setCharAt(corner, '└');
+                buffer.setCharAt(corner, '└');
             }
         }
         return buffer.toString();

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/TextGroup.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/internal/jaxb/gmd/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

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/Anchor.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/Anchor.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/Anchor.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/Anchor.java [UTF-8] Thu May  9 12:24:13 2013
@@ -24,7 +24,7 @@ import org.opengis.util.InternationalStr
 import org.apache.sis.xml.XLink;
 
 // Related to JDK7
-import org.apache.sis.internal.util.Objects;
+import org.apache.sis.internal.jdk7.Objects;
 
 
 /**
@@ -47,7 +47,7 @@ public final class Anchor extends XLink 
     /**
      * Defined as a matter of principle (this class is not expected to be serialized).
      */
-    private static final long serialVersionUID = -6101324942683322597L;
+    private static final long serialVersionUID = -7896134857052775101L;
 
     /**
      * Often a short textual description of the URI target.

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmx/Anchor.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/internal/jaxb/gmx/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/java/org/apache/sis/internal/jaxb/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

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleCharacterIterator.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleCharacterIterator.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleCharacterIterator.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleCharacterIterator.java [UTF-8] Thu May  9 12:24:13 2013
@@ -36,7 +36,7 @@ public class SimpleCharacterIterator imp
     /**
      * For cross-version compatibility.
      */
-    private static final long serialVersionUID = -7041748809395493953L;
+    private static final long serialVersionUID = 4211374670559434445L;
 
     /**
      * The wrapped character sequence.

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleCharacterIterator.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/internal/simple/SimpleCitation.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleCitation.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleCitation.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleCitation.java [UTF-8] Thu May  9 12:24:13 2013
@@ -28,9 +28,11 @@ import org.opengis.metadata.citation.Pre
 import org.opengis.metadata.citation.ResponsibleParty;
 import org.opengis.metadata.citation.Series;
 import org.opengis.util.InternationalString;
-
 import org.apache.sis.util.iso.SimpleInternationalString;
 
+// Related to JDK7
+import org.apache.sis.internal.jdk7.Objects;
+
 
 /**
  * A trivial implementation of {@link Citation}.
@@ -44,7 +46,7 @@ public class SimpleCitation implements C
     /**
      * For cross-version compatibility.
      */
-    private static final long serialVersionUID = -1490465918703910949L;
+    private static final long serialVersionUID = 4818846034764528263L;
 
     /**
      * The title to be returned by {@link #getTitle()}.
@@ -87,6 +89,28 @@ public class SimpleCitation implements C
     @Override public String                           getISSN()                    {return null;}
 
     /**
+     * Compares the given object with this citation for equality.
+     *
+     * @param  obj The object to compare with this citation.
+     * @return {@code true} if both objects are equal.
+     */
+    @Override
+    public boolean equals(final Object obj) {
+        if (obj != null && obj.getClass() == getClass()) {
+            return Objects.equals(title, ((SimpleCitation) obj).title);
+        }
+        return false;
+    }
+
+    /**
+     * Returns a hash code value for this citation.
+     */
+    @Override
+    public int hashCode() {
+        return Objects.hashCode(title) ^ (int) serialVersionUID;
+    }
+
+    /**
      * Returns a string representation of this citation.
      */
     @Override

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleCitation.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/internal/simple/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

Modified: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java [UTF-8] Thu May  9 12:24:13 2013
@@ -16,8 +16,10 @@
  */
 package org.apache.sis.internal.util;
 
+import org.apache.sis.internal.jdk7.Objects;
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.Locale;
 import org.opengis.metadata.Identifier;
 import org.opengis.metadata.citation.Citation;
 import org.opengis.util.InternationalString;
@@ -83,8 +85,7 @@ public final class Citations extends Sta
             Iterator<? extends InternationalString> iterator = null;
             do {
                 if (candidate != null) {
-                    // The "null" locale argument is required for getting the unlocalized version.
-                    final String unlocalized = candidate.toString(null);
+                    final String unlocalized = candidate.toString(Locale.ROOT);
                     if (titleMatches(c1, unlocalized)) {
                         return true;
                     }
@@ -123,8 +124,7 @@ public final class Citations extends Sta
             Iterator<? extends InternationalString> iterator = null;
             do {
                 if (candidate != null) {
-                    // The "null" locale argument is required for getting the unlocalized version.
-                    final String unlocalized = candidate.toString(null);
+                    final String unlocalized = candidate.toString(Locale.ROOT);
                     if (equalsFiltered(unlocalized, title, LETTERS_AND_DIGITS, true)) {
                         return true;
                     }

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.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/internal/util/Cloner.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/Cloner.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/Cloner.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/Cloner.java [UTF-8] Thu May  9 12:24:13 2013
@@ -18,6 +18,7 @@ package org.apache.sis.internal.util;
 
 import java.lang.reflect.Method;
 import java.lang.reflect.InvocationTargetException;
+import net.jcip.annotations.NotThreadSafe;
 import org.apache.sis.util.Workaround;
 import org.apache.sis.util.resources.Errors;
 
@@ -31,15 +32,18 @@ import org.apache.sis.util.resources.Err
  * @version 0.3
  * @module
  */
+@NotThreadSafe
 @Workaround(library="JDK", version="1.7")
-public final class Cloner {
+public class Cloner {
     /**
      * The type of the object to clone, or {@code null} if not yet specified.
+     * Used for checking if the cached {@linkplain #method} is still valid.
      */
     private Class<?> type;
 
     /**
      * The {@code clone()} method, or {@code null} if not yet determined.
+     * This is cached for better performance if many instances of the same type are cloned.
      */
     private Method method;
 
@@ -50,7 +54,30 @@ public final class Cloner {
     }
 
     /**
-     * Clones the given object.
+     * Invoked when the given object can not be cloned because no public {@code clone()} method
+     * has been found. If this method returns {@code true}, then the {@link #clone(Object)}
+     * method in this class will throw a {@link CloneNotSupportedException}. Otherwise the
+     * {@code clone(Object)} method will return the original object.
+     *
+     * <p>The default implementation returns {@code true} in every cases.
+     * Subclasses can override this method if they need a different behavior.</p>
+     *
+     * @param  object The object that can not be cloned.
+     * @return {@code true} if the problem shall be considered a clone failure.
+     */
+    protected boolean isCloneRequired(final Object object) {
+        return true;
+    }
+
+    /**
+     * Clones the given object. If the given object does not provide a public {@code clone()}
+     * method, then there is a choice:
+     *
+     * <ul>
+     *   <li>If {@code isCloneRequired(object)} returns {@code true} (the default),
+     *       then a {@link CloneNotSupportedException} is thrown.</li>
+     *   <li>Otherwise the given object is returned.</li>
+     * </ul>
      *
      * @param  object The object to clone, or {@code null}.
      * @return A clone of the given object, or {@code null} if {@code object} was null.
@@ -66,7 +93,9 @@ public final class Cloner {
                 method = valueType.getMethod("clone", (Class<?>[]) null);
                 type = valueType; // Set only if the above line succeed.
             }
-            return method.invoke(object, (Object[]) null);
+            if (method != null) { // May be null if previous call threw NoSuchMethodException.
+                return method.invoke(object, (Object[]) null);
+            }
         } catch (InvocationTargetException e) {
             final Throwable cause = e.getCause();
             if (cause instanceof CloneNotSupportedException) {
@@ -79,9 +108,16 @@ public final class Cloner {
                 throw (Error) cause;
             }
             throw fail(e);
+        } catch (NoSuchMethodException e) {
+            if (isCloneRequired(object)) {
+                throw fail(e);
+            }
+            method = null;
+            type = valueType;
         } catch (Exception e) { // (ReflectiveOperationException) on JDK7
             throw fail(e);
         }
+        return object;
     }
 
     /**
@@ -91,7 +127,7 @@ public final class Cloner {
      * @param  cause The cause for the failure to clone an object.
      * @return An exception with an error message and the given cause.
      */
-    public CloneNotSupportedException fail(final Throwable cause) {
+    private CloneNotSupportedException fail(final Throwable cause) {
         CloneNotSupportedException e = new CloneNotSupportedException(
                 Errors.format(Errors.Keys.CloneNotSupported_1, type));
         e.initCause(cause);

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/Cloner.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/internal/util/DaemonThread.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/DaemonThread.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/DaemonThread.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/DaemonThread.java [UTF-8] Thu May  9 12:24:13 2013
@@ -99,6 +99,18 @@ abstract class DaemonThread extends Thre
     public abstract void run();
 
     /**
+     * Returns {@code true} if this thread seems to be blocked for a time long enough for suspecting
+     * a problem. The default implementation always returns {@code false}. Subclasses are encouraged
+     * to provide some problem detection mechanism here if they can. For example if the head of a
+     * queue seems to be never removed, then maybe the process consuming that queue is blocked.
+     *
+     * @return {@code true} if this thread seems to be stalled.
+     */
+    protected boolean isStalled() {
+        return false;
+    }
+
+    /**
      * Returns {@code true} if this daemon thread shall terminate.
      * This happen at shutdown time.
      *
@@ -137,26 +149,24 @@ abstract class DaemonThread extends Thre
     }
 
     /**
-     * Returns the names of dead threads, or {@code null} if none. The returned list should
-     * always be null. A non-empty list would be a symptom for a severe problem, probably
+     * Returns the list of stalled or dead threads, or {@code null} if none. The returned list
+     * should always be null. A non-empty list would be a symptom for a severe problem, probably
      * requiring an application reboot.
      *
      * <p><strong>This method is for internal use by Apache SIS only.</strong>
      * Users should never invoke this method explicitely.</p>
      *
      * @param  thread The first thread in the chain of threads to verify.
-     * @return The name of dead threads, or {@code null} if none.
-     *
-     * @see Threads#listDeadThreads()
+     * @return The list of stalled or dead threads, or {@code null} if none.
      */
-    static List<String> listDeadThreads(DaemonThread thread) {
-        List<String> list = null;
+    static List<Thread> listStalledThreads(DaemonThread thread) {
+        List<Thread> list = null;
         while (thread != null) {
-            if (!thread.isAlive()) {
+            if (!thread.isAlive() || thread.isStalled()) {
                 if (list == null) {
-                    list = new ArrayList<String>();
+                    list = new ArrayList<Thread>();
                 }
-                list.add(thread.getName());
+                list.add(thread);
             }
             thread = thread.previous;
         }

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/DaemonThread.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/internal/util/DefaultFactories.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/internal/util/DelayedExecutor.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/DelayedExecutor.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/DelayedExecutor.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/DelayedExecutor.java [UTF-8] Thu May  9 12:24:13 2013
@@ -16,6 +16,7 @@
  */
 package org.apache.sis.internal.util;
 
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.DelayQueue;
 import java.util.concurrent.BlockingQueue;
 import org.apache.sis.util.logging.Logging;
@@ -182,4 +183,28 @@ public final class DelayedExecutor exten
         }
         // Do not log anything at this point, since the loggers may be shutdown now.
     }
+
+    /**
+     * Returns {@code true} if this thread seems to be stalled. This method checks the head
+     * of the queue. If the delay for that head has expired and the head is not removed in
+     * the next 5 seconds, then we will presume that the thread is stalled or dead.
+     */
+    @Override
+    protected boolean isStalled() {
+        final DelayedRunnable waiting = QUEUE.peek();
+        if (waiting != null && waiting.getDelay(TimeUnit.NANOSECONDS) <= 0) try {
+            for (int i=0; i<50; i++) {
+                if (!isAlive()) break;
+                Thread.sleep(100);
+                if (QUEUE.peek() != waiting) {
+                    return false;
+                }
+            }
+            return true;
+        } catch (InterruptedException e) {
+            // Someone doesn't want to let us wait. Since we didn't had the time to
+            // determine if the thread is stalled, conservatively return 'false'.
+        }
+        return false;
+    }
 }

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/DelayedExecutor.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/internal/util/DelayedRunnable.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/internal/util/LocalizedException.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/internal/util/LocalizedParseException.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/LocalizedParseException.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/LocalizedParseException.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/LocalizedParseException.java [UTF-8] Thu May  9 12:24:13 2013
@@ -46,7 +46,7 @@ public final class LocalizedParseExcepti
     /**
      * For cross-version compatibility.
      */
-    private static final long serialVersionUID = 8240939095802384277L;
+    private static final long serialVersionUID = -1467571540435486742L;
 
     /**
      * The locale to use for formatting the localized error message.

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/LocalizedParseException.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/internal/util/OSGiActivator.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/OSGiActivator.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/OSGiActivator.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/OSGiActivator.java [UTF-8] Thu May  9 12:24:13 2013
@@ -19,18 +19,23 @@ package org.apache.sis.internal.util;
 import javax.management.JMException;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.BundleListener;
 
 
 /**
  * Bundle activator for OSGi environment.
- * This class should not be used directly.
+ * This class is declared in the {@code maven-bundle-plugin} configuration in the
+ * {@code sis-utility/pom.xml} file. This class should not be used directly.
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
  * @version 0.3
  * @module
+ *
+ * @see ServletListener
  */
-public final class OSGiActivator implements BundleActivator {
+public final class OSGiActivator implements BundleActivator, BundleListener {
     /**
      * Creates a new bundle activator.
      */
@@ -44,6 +49,7 @@ public final class OSGiActivator impleme
      */
     @Override
     public void start(final BundleContext context) {
+        context.addBundleListener(this);
     }
 
     /**
@@ -51,15 +57,27 @@ public final class OSGiActivator impleme
      * This method shutdowns the {@code sis-utility} threads.
      *
      * @param  context The execution context of the bundle being stopped.
-     * @throws InterruptedException If an other thread invoked {@link #interrupt()} while
-     *         we were waiting for the {@code sis-utility} threads to die.
      * @throws JMException If an error occurred during unregistration of the supervisor MBean.
      */
     @Override
-    public void stop(final BundleContext context) throws InterruptedException, JMException {
-        Threads.shutdown(4000);
-        if (Supervisor.ENABLED) {
-            Supervisor.unregister();
+    public void stop(final BundleContext context) throws JMException {
+        context.removeBundleListener(this);
+        Shutdown.stop(getClass());
+    }
+
+    /**
+     * Invoked when an other module has been installed or un-installed.
+     * This method notifies the Apache SIS library that the classpath may have changed.
+     *
+     * @param event The event that describe the life-cycle change.
+     */
+    @Override
+    public void bundleChanged(final BundleEvent event) {
+        switch (event.getType()) {
+            case BundleEvent.STARTED:
+            case BundleEvent.STOPPED: {
+                SystemListener.fireClasspathChanged();
+            }
         }
     }
 }

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/OSGiActivator.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/internal/util/ReferenceQueueConsumer.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/internal/util/Supervisor.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/Supervisor.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/Supervisor.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/Supervisor.java [UTF-8] Thu May  9 12:24:13 2013
@@ -34,6 +34,7 @@ import java.lang.management.ManagementFa
 
 import org.apache.sis.util.About;
 import org.apache.sis.util.Localized;
+import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.logging.Logging;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.collection.TreeTable;
@@ -116,6 +117,7 @@ public final class Supervisor extends St
      */
     public Supervisor(final Locale locale) throws NotCompliantMBeanException {
         super(SupervisorMBean.class);
+        ArgumentChecks.ensureNonNull("locale", locale);
         this.locale = locale;
     }
 
@@ -199,13 +201,21 @@ public final class Supervisor extends St
      * {@inheritDoc}
      */
     @Override
-    public List<String> warnings() {
-        final List<String> warnings = Threads.listDeadThreads();
-        if (warnings != null) {
-            final Errors resources = Errors.getResources(locale);
-            for (int i=warnings.size(); --i>=0;) {
-                warnings.set(i, resources.getString(Errors.Keys.DeadThread_1, warnings.get(i)));
-            }
+    public String[] warnings() {
+        final DaemonThread lastCreatedDaemon;
+        synchronized (Threads.class) {
+            lastCreatedDaemon = Threads.lastCreatedDaemon;
+        }
+        final List<Thread> threads = DaemonThread.listStalledThreads(lastCreatedDaemon);
+        if (threads == null) {
+            return null;
+        }
+        final String[] warnings = new String[threads.size()];
+        final Errors resources = Errors.getResources(locale);
+        for (int i=0; i<warnings.length; i++) {
+            final Thread thread = threads.get(i);
+            warnings[i] = resources.getString(thread.isAlive() ?
+                    Errors.Keys.StalledThread_1 : Errors.Keys.DeadThread_1, thread.getName());
         }
         return warnings;
     }

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/Supervisor.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/internal/util/SupervisorMBean.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/SupervisorMBean.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/SupervisorMBean.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/SupervisorMBean.java [UTF-8] Thu May  9 12:24:13 2013
@@ -16,7 +16,6 @@
  */
 package org.apache.sis.internal.util;
 
-import java.util.List;
 import org.apache.sis.util.collection.TreeTable;
 
 
@@ -46,5 +45,5 @@ public interface SupervisorMBean {
      *
      * @return A description of a problems in the library, or {@code null} if none.
      */
-    List<String> warnings();
+    String[] warnings();
 }

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/SupervisorMBean.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/internal/util/Threads.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/Threads.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/Threads.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/Threads.java [UTF-8] Thu May  9 12:24:13 2013
@@ -16,7 +16,6 @@
  */
 package org.apache.sis.internal.util;
 
-import java.util.List;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.ExecutorService;
 import org.apache.sis.util.Static;
@@ -131,15 +130,4 @@ final class Threads extends Static {
         }
         DaemonThread.killAll(lastCreatedDaemon, stopWaitingAt);
     }
-
-    /**
-     * Returns the names of dead threads, or {@code null} if none. The returned list should
-     * always be null. A non-empty list would be a symptom for a severe problem, probably
-     * requiring an application reboot.
-     *
-     * @return The name of dead threads, or {@code null} if none.
-     */
-    static synchronized List<String> listDeadThreads() {
-        return DaemonThread.listDeadThreads(lastCreatedDaemon);
-    }
 }

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/Threads.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/internal/util/Utilities.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java [UTF-8] Thu May  9 12:24:13 2013
@@ -21,6 +21,9 @@ import java.util.FormattableFlags;
 import org.apache.sis.util.Static;
 import org.apache.sis.util.CharSequences;
 
+import static java.lang.Math.abs;
+import static java.lang.Math.max;
+
 
 /**
  * Miscellaneous utilities which should not be put in public API.
@@ -32,6 +35,31 @@ import org.apache.sis.util.CharSequences
  */
 public final class Utilities extends Static {
     /**
+     * Relative difference tolerated when comparing floating point numbers using
+     * {@link org.apache.sis.util.ComparisonMode#APPROXIMATIVE}.
+     *
+     * <p>Historically, this was the relative tolerance threshold for considering two
+     * matrixes as equal. This value has been determined empirically in order to allow
+     * {@link org.apache.sis.referencing.operation.transform.ConcatenatedTransform} to
+     * detect the cases where two {@link org.apache.sis.referencing.operation.transform.LinearTransform}
+     * are equal for practical purpose. This threshold can be used as below:</p>
+     *
+     * {@preformat java
+     *     Matrix m1 = ...;
+     *     Matrix m2 = ...;
+     *     if (Matrices.epsilonEqual(m1, m2, EQUIVALENT_THRESHOLD, true)) {
+     *         // Consider that matrixes are equal.
+     *     }
+     * }
+     *
+     * By extension, the same threshold value is used for comparing other floating point values.
+     *
+     * @see org.apache.sis.internal.referencing.Utilities#LINEAR_TOLERANCE
+     * @see org.apache.sis.internal.referencing.Utilities#ANGULAR_TOLERANCE
+     */
+    public static final double COMPARISON_THRESHOLD = 1E-14;
+
+    /**
      * Bit mask to isolate the sign bit of non-{@linkplain Double#isNaN(double) NaN} values in a
      * {@code double}. For any real value, the following code evaluate to 0 if the given value is
      * positive:
@@ -57,24 +85,76 @@ public final class Utilities extends Sta
     }
 
     /**
+     * Returns {@code true} if the given values are approximatively equal,
+     * up to the {@linkplain #COMPARISON_THRESHOLD comparison threshold}.
+     *
+     * @param  v1 The first value to compare.
+     * @param  v2 The second value to compare.
+     * @return {@code true} If both values are approximatively equal.
+     */
+    public static boolean epsilonEqual(final double v1, final double v2) {
+        final double threshold = COMPARISON_THRESHOLD * max(abs(v1), abs(v2));
+        if (threshold == Double.POSITIVE_INFINITY || Double.isNaN(threshold)) {
+            return Double.doubleToLongBits(v1) == Double.doubleToLongBits(v2);
+        }
+        return abs(v1 - v2) <= threshold;
+    }
+
+    /**
+     * Returns {@code true} if the following objects are floating point numbers ({@link Float} or
+     * {@link Double} types) and approximatively equal. If the given object are not floating point
+     * numbers, then this method returns {@code false} unconditionally on the assumption that
+     * strict equality has already been checked before this method call.
+     *
+     * @param  v1 The first value to compare.
+     * @param  v2 The second value to compare.
+     * @return {@code true} If both values are real number and approximatively equal.
+     */
+    public static boolean floatEpsilonEqual(final Object v1, final Object v2) {
+        return (v1 instanceof Float || v1 instanceof Double) &&
+               (v2 instanceof Float || v2 instanceof Double) &&
+               epsilonEqual(((Number) v1).doubleValue(), ((Number) v2).doubleValue());
+    }
+
+    /**
      * Formats the given character sequence to the given formatter. This method takes in account
      * the {@link FormattableFlags#UPPERCASE} and {@link FormattableFlags#LEFT_JUSTIFY} flags.
      *
      * @param formatter The formatter in which to format the value.
      * @param flags     The formatting flags.
      * @param width     Minimal number of characters to write, padding with {@code ' '} if necessary.
+     * @param precision Number of characters to keep before truncation, or -1 if no limit.
      * @param value     The text to format.
      */
-    public static void formatTo(final Formatter formatter, final int flags, int width, String value) {
+    public static void formatTo(final Formatter formatter, final int flags,
+            int width, int precision, String value)
+    {
         final String format;
         final Object[] args;
         boolean isUpperCase = (flags & FormattableFlags.UPPERCASE) != 0;
         if (isUpperCase && width > 0) {
             // May change the string length in some locales.
             value = value.toUpperCase(formatter.locale());
-            isUpperCase = false;
+            isUpperCase = false; // Because conversion has already been done.
+        }
+        int length = value.length();
+        if (precision >= 0) {
+            for (int i=0,n=0; i<length; i += n) {
+                if (--precision < 0) {
+                    // Found the amount of characters to keep. The 'n' variable can be
+                    // zero only if precision == 0, in which case the string is empty.
+                    if (n == 0) {
+                        value = "";
+                    } else {
+                        length = (i -= n) + 1;
+                        final StringBuilder buffer = new StringBuilder(length);
+                        value = buffer.append(value, 0, i).append('…').toString();
+                    }
+                    break;
+                }
+                n = Character.charCount(value.codePointAt(i));
+            }
         }
-        final int length = value.length();
         // Double check since length() is faster than codePointCount(...).
         if (width > length && (width -= value.codePointCount(0, length)) > 0) {
             format = "%s%s";

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.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/internal/util/X364.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/internal/util/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/java/org/apache/sis/io/AppendableWriter.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/io/Appender.java
URL: http://svn.apache.org/viewvc/sis/branches/Android/sis-utility/src/main/java/org/apache/sis/io/Appender.java?rev=1480602&r1=1480601&r2=1480602&view=diff
==============================================================================
--- sis/branches/Android/sis-utility/src/main/java/org/apache/sis/io/Appender.java [iso-8859-1] (original)
+++ sis/branches/Android/sis-utility/src/main/java/org/apache/sis/io/Appender.java [UTF-8] Thu May  9 12:24:13 2013
@@ -24,7 +24,7 @@ import org.apache.sis.util.ArgumentCheck
 import static org.apache.sis.util.Characters.isLineOrParagraphSeparator;
 
 // Related to JDK7
-import org.apache.sis.internal.util.JDK7;
+import org.apache.sis.internal.jdk7.JDK7;
 
 
 /**
@@ -38,7 +38,7 @@ import org.apache.sis.internal.util.JDK7
  *   <li>No synchronization is performed.</li>
  * </ul>
  *
- * If needed, this {@code Appender} can be viewed as a synchronized
+ * If needed, this {@code Appender} can be viewed as a synchronized
  * {@link java.io.Writer} by invoking the {@link IO#asWriter(Appendable)} method.
  *
  * {@section Flushing and closing the stream}

Propchange: sis/branches/Android/sis-utility/src/main/java/org/apache/sis/io/Appender.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