sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1467488 - in /sis/trunk: ./ sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gmi/ sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/ sis-metadata/src/main/java/org/apache/sis/metadata/ sis-metadata/src/main/java/org/a...
Date Fri, 12 Apr 2013 21:53:15 GMT
Author: desruisseaux
Date: Fri Apr 12 21:53:14 2013
New Revision: 1467488

URL: http://svn.apache.org/r1467488
Log:
Merge from the JDK6 branch.

Added:
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
      - copied, changed from r1467483, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java
      - copied unchanged from r1467483, sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/util/EmptyQueue.java
      - copied unchanged from r1467483, sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/util/EmptyQueue.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/util/EmptySortedSet.java
      - copied unchanged from r1467483, sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/util/EmptySortedSet.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/util/UnmodifiableArrayList.java
      - copied unchanged from r1467483, sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/util/UnmodifiableArrayList.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/Containers.java
      - copied unchanged from r1467483, sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/Containers.java
Removed:
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/UnmodifiableIdentifier.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/CollectionsExt.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/EmptyQueue.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/EmptySortedSet.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/UnmodifiableArrayList.java
Modified:
    sis/trunk/   (props changed)
    sis/trunk/CHANGES
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gmi/LE_ProcessStep.java
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gmi/MI_CoverageDescription.java
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gmi/MI_Georectified.java
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gmi/MI_Georeferenceable.java
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gmi/MI_ImageDescription.java
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gmi/MI_Metadata.java
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_Identifier.java
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_Identifier.java
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/Cloner.java
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/Pruner.java
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultIdentifier.java
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java
    sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescription.java
    sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/ImmutableEnvelope.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapAdapter.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/jaxb/NonMarshalledAuthority.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/jdk7/Objects.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/measure/Angle.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/measure/FormattedCharacterIterator.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/measure/Range.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/measure/RangeFormat.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Classes.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Deprecable.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Locales.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Numbers.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/util/ObjectConverters.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Static.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/Cache.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/DefaultTreeTable.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/package-info.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractInternationalString.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultInternationalString.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultScopedName.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/MarshallerPool.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java
    sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/XML.java
    sis/trunk/sis-utility/src/test/java/org/apache/sis/measure/RangeFormatTest.java
    sis/trunk/sis-utility/src/test/java/org/apache/sis/measure/RangeTest.java
    sis/trunk/sis-utility/src/test/java/org/apache/sis/test/TestRunner.java
    sis/trunk/sis-utility/src/test/java/org/apache/sis/util/iso/DefaultInternationalStringTest.java
    sis/trunk/sis-utility/src/test/java/org/apache/sis/util/iso/SimpleInternationalStringTest.java
    sis/trunk/sis-utility/src/test/java/org/apache/sis/xml/MarshallerPoolTest.java

Propchange: sis/trunk/
------------------------------------------------------------------------------
  Merged /sis/branches/JDK7:r1467089-1467466
  Merged /sis/branches/JDK6:r1467102-1467483

Modified: sis/trunk/CHANGES
URL: http://svn.apache.org/viewvc/sis/trunk/CHANGES?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/CHANGES (original)
+++ sis/trunk/CHANGES Fri Apr 12 21:53:14 2013
@@ -4,9 +4,9 @@ Apache SIS Change Log
 Release 0.3-incubating - Current Development
 
 * SIS-31 Website needs a facelift (aestrada, Ross Laidlaw,
-  (Suresh Marru, mattmann)
+  Suresh Marru, mattmann)
 
-* SIS-95: Explicitly specify Typed extends Object parameters 
+* SIS-95: Explicitly specify Typed extends Object parameters
   in FallbackConverterTest (mattmann, desruisseaux)
 
 * SIS-77: Provide an IDE build for Eclipse (mattmann)

Modified: sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gmi/LE_ProcessStep.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gmi/LE_ProcessStep.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gmi/LE_ProcessStep.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gmi/LE_ProcessStep.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -21,7 +21,7 @@ import javax.xml.bind.annotation.XmlRoot
 import org.opengis.metadata.lineage.ProcessStep;
 import org.apache.sis.metadata.iso.lineage.DefaultProcessStep;
 
-import static org.apache.sis.util.collection.CollectionsExt.isNullOrEmpty;
+import static org.apache.sis.util.collection.Containers.isNullOrEmpty;
 
 
 /**

Modified: sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gmi/MI_CoverageDescription.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gmi/MI_CoverageDescription.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gmi/MI_CoverageDescription.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gmi/MI_CoverageDescription.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -21,7 +21,7 @@ import javax.xml.bind.annotation.XmlRoot
 import org.opengis.metadata.content.CoverageDescription;
 import org.apache.sis.metadata.iso.content.DefaultCoverageDescription;
 
-import static org.apache.sis.util.collection.CollectionsExt.isNullOrEmpty;
+import static org.apache.sis.util.collection.Containers.isNullOrEmpty;
 
 
 /**

Modified: sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gmi/MI_Georectified.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gmi/MI_Georectified.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gmi/MI_Georectified.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gmi/MI_Georectified.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -21,7 +21,7 @@ import javax.xml.bind.annotation.XmlRoot
 import org.opengis.metadata.spatial.Georectified;
 import org.apache.sis.metadata.iso.spatial.DefaultGeorectified;
 
-import static org.apache.sis.util.collection.CollectionsExt.isNullOrEmpty;
+import static org.apache.sis.util.collection.Containers.isNullOrEmpty;
 
 
 /**

Modified: sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gmi/MI_Georeferenceable.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gmi/MI_Georeferenceable.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gmi/MI_Georeferenceable.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gmi/MI_Georeferenceable.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -21,7 +21,7 @@ import javax.xml.bind.annotation.XmlRoot
 import org.opengis.metadata.spatial.Georeferenceable;
 import org.apache.sis.metadata.iso.spatial.DefaultGeoreferenceable;
 
-import static org.apache.sis.util.collection.CollectionsExt.isNullOrEmpty;
+import static org.apache.sis.util.collection.Containers.isNullOrEmpty;
 
 
 /**

Modified: sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gmi/MI_ImageDescription.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gmi/MI_ImageDescription.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gmi/MI_ImageDescription.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gmi/MI_ImageDescription.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -21,7 +21,7 @@ import javax.xml.bind.annotation.XmlRoot
 import org.opengis.metadata.content.ImageDescription;
 import org.apache.sis.metadata.iso.content.DefaultImageDescription;
 
-import static org.apache.sis.util.collection.CollectionsExt.isNullOrEmpty;
+import static org.apache.sis.util.collection.Containers.isNullOrEmpty;
 
 
 /**

Modified: sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gmi/MI_Metadata.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gmi/MI_Metadata.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gmi/MI_Metadata.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/gmi/MI_Metadata.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -21,7 +21,7 @@ import javax.xml.bind.annotation.XmlRoot
 import org.opengis.metadata.Metadata;
 import org.apache.sis.metadata.iso.DefaultMetadata;
 
-import static org.apache.sis.util.collection.CollectionsExt.isNullOrEmpty;
+import static org.apache.sis.util.collection.Containers.isNullOrEmpty;
 
 
 /**

Modified: sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_Identifier.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_Identifier.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_Identifier.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/MD_Identifier.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -23,7 +23,7 @@ import org.opengis.metadata.Identifier;
 import org.opengis.referencing.ReferenceIdentifier;
 
 import org.apache.sis.metadata.iso.DefaultIdentifier;
-import org.apache.sis.metadata.iso.UnmodifiableIdentifier;
+import org.apache.sis.metadata.iso.ImmutableIdentifier;
 import org.apache.sis.internal.jaxb.gco.PropertyType;
 
 
@@ -107,11 +107,11 @@ public final class MD_Identifier extends
      * @return The metadata to be marshalled.
      */
     @XmlElement(name = "RS_Identifier")
-    public UnmodifiableIdentifier getReferenceIdentifier() {
+    public ImmutableIdentifier getReferenceIdentifier() {
         if (!skip()) {
             final Identifier metadata = this.metadata;
             if (metadata instanceof ReferenceIdentifier) {
-                return UnmodifiableIdentifier.castOrCopy((ReferenceIdentifier) metadata);
+                return ImmutableIdentifier.castOrCopy((ReferenceIdentifier) metadata);
             }
         }
         return null;
@@ -122,7 +122,7 @@ public final class MD_Identifier extends
      *
      * @param metadata The unmarshalled metadata.
      */
-    public void setReferenceIdentifier(final UnmodifiableIdentifier metadata) {
+    public void setReferenceIdentifier(final ImmutableIdentifier metadata) {
         this.metadata = metadata;
     }
 }

Modified: sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_Identifier.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_Identifier.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_Identifier.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/RS_Identifier.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -18,7 +18,7 @@ package org.apache.sis.internal.jaxb.met
 
 import javax.xml.bind.annotation.XmlElementRef;
 import org.opengis.referencing.ReferenceIdentifier;
-import org.apache.sis.metadata.iso.UnmodifiableIdentifier;
+import org.apache.sis.metadata.iso.ImmutableIdentifier;
 import org.apache.sis.internal.jaxb.gco.PropertyType;
 
 
@@ -81,13 +81,13 @@ public final class RS_Identifier extends
      * @return The metadata to be marshalled.
      */
     @XmlElementRef
-    public UnmodifiableIdentifier getElement() {
+    public ImmutableIdentifier getElement() {
         if (skip()) return null;
         final ReferenceIdentifier metadata = this.metadata;
-        if (metadata instanceof UnmodifiableIdentifier) {
-            return (UnmodifiableIdentifier) metadata;
+        if (metadata instanceof ImmutableIdentifier) {
+            return (ImmutableIdentifier) metadata;
         } else {
-            return new UnmodifiableIdentifier(metadata);
+            return new ImmutableIdentifier(metadata);
         }
     }
 
@@ -96,7 +96,7 @@ public final class RS_Identifier extends
      *
      * @param metadata The unmarshalled metadata.
      */
-    public void setElement(final UnmodifiableIdentifier metadata) {
+    public void setElement(final ImmutableIdentifier metadata) {
         this.metadata = metadata;
     }
 }

Modified: sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/Cloner.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/Cloner.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/Cloner.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/Cloner.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -22,8 +22,8 @@ import java.util.Iterator;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.LinkedHashMap;
-import org.apache.sis.util.collection.CollectionsExt;
-import org.apache.sis.util.collection.UnmodifiableArrayList;
+import org.apache.sis.util.collection.Containers;
+import org.apache.sis.internal.util.CollectionsExt;
 
 
 /**
@@ -105,7 +105,7 @@ final class Cloner extends org.apache.si
                 } else {
                     // Conservatively assumes a List if we are not sure to have a Set,
                     // since the list is less destructive (no removal of duplicated).
-                    collection = UnmodifiableArrayList.wrap(array);
+                    collection = Containers.unmodifiableList(array);
                 }
             }
             return collection;

Modified: sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -29,8 +29,8 @@ import org.apache.sis.internal.util.Chec
 import org.apache.sis.internal.util.CheckedArrayList;
 
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
-import static org.apache.sis.util.collection.CollectionsExt.isNullOrEmpty;
-import static org.apache.sis.util.collection.CollectionsExt.hashMapCapacity;
+import static org.apache.sis.util.collection.Containers.isNullOrEmpty;
+import static org.apache.sis.util.collection.Containers.hashMapCapacity;
 import static org.apache.sis.internal.jaxb.MarshalContext.isMarshalling;
 
 

Modified: sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyAccessor.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -46,10 +46,10 @@ import org.apache.sis.util.collection.Ba
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.xml.IdentifiedObject;
 
-import static org.apache.sis.util.collection.CollectionsExt.modifiableCopy;
-import static org.apache.sis.util.collection.CollectionsExt.hashMapCapacity;
-import static org.apache.sis.internal.util.Utilities.floatEpsilonEqual;
 import static org.apache.sis.metadata.PropertyComparator.*;
+import static org.apache.sis.internal.util.Utilities.floatEpsilonEqual;
+import static org.apache.sis.internal.util.CollectionsExt.modifiableCopy;
+import static org.apache.sis.util.collection.Containers.hashMapCapacity;
 
 
 /**

Modified: sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/Pruner.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/Pruner.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/Pruner.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/Pruner.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -21,7 +21,7 @@ import java.util.Iterator;
 import java.util.Collection;
 import java.util.IdentityHashMap;
 import org.opengis.util.CodeList;
-import org.apache.sis.util.collection.CollectionsExt;
+import org.apache.sis.internal.util.CollectionsExt;
 
 
 /**

Modified: sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultIdentifier.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultIdentifier.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultIdentifier.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/DefaultIdentifier.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -32,6 +32,8 @@ import org.opengis.metadata.citation.Cit
  * @since   0.3 (derived from geotk-2.1)
  * @version 0.3
  * @module
+ *
+ * @see ImmutableIdentifier
  */
 @XmlType(name = "MD_Identifier_Type", propOrder = {
     "code",

Copied: sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java (from r1467483, sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java)
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java?p2=sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java&p1=sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java&r1=1467483&r2=1467488&rev=1467488&view=diff
==============================================================================
--- sis/branches/JDK6/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/ImmutableIdentifier.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -350,8 +350,10 @@ public class ImmutableIdentifier impleme
             key= AUTHORITY_KEY; this.authority = (Citation)            (value = authority);
             key=   REMARKS_KEY; this.remarks   = (InternationalString) (value = remarks);
         } catch (ClassCastException exception) {
-            throw new InvalidParameterValueException(
-                    Errors.format(Errors.Keys.IllegalArgumentValue_2, key, value), exception, key, value);
+            final InvalidParameterValueException e = new InvalidParameterValueException(
+                    Errors.format(Errors.Keys.IllegalArgumentValue_2, key, value), key, value);
+            e.initCause(exception);
+            throw e;
         }
         ensureNonNull(CODE_KEY, code);
     }

Modified: sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/DefaultCitation.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -34,7 +34,7 @@ import org.apache.sis.internal.jaxb.NonM
 import org.apache.sis.metadata.iso.ISOMetadata;
 import org.apache.sis.xml.IdentifierSpace;
 
-import static org.apache.sis.util.collection.CollectionsExt.isNullOrEmpty;
+import static org.apache.sis.util.collection.Containers.isNullOrEmpty;
 import static org.apache.sis.internal.metadata.MetadataUtilities.toDate;
 import static org.apache.sis.internal.metadata.MetadataUtilities.toMilliseconds;
 

Modified: sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescription.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescription.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescription.java [UTF-8] (original)
+++ sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescription.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -28,7 +28,7 @@ import org.apache.sis.internal.metadata.
 import org.apache.sis.util.collection.CheckedContainer;
 
 import static org.apache.sis.internal.jaxb.MarshalContext.isMarshalling;
-import static org.apache.sis.util.collection.CollectionsExt.isNullOrEmpty;
+import static org.apache.sis.util.collection.Containers.isNullOrEmpty;
 
 
 /**

Modified: sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/ImmutableEnvelope.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/ImmutableEnvelope.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/ImmutableEnvelope.java [UTF-8] (original)
+++ sis/trunk/sis-referencing/src/main/java/org/apache/sis/geometry/ImmutableEnvelope.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -37,6 +37,11 @@ import static org.apache.sis.util.Argume
  * This class is final in order to ensure that the immutability contract can not be broken
  * (assuming not using <cite>Java Native Interface</cite> or reflections).
  *
+ * {@note While <code>ImmutableEnvelope</code> objects are immutable, they contain references to
+ *        <code>CoordinateReferenceSystem</code> objects which are not guaranteed to be immutable.
+ *        For better safety, factory codes are encouraged to pass only immutable instances of
+ *        coordinate reference systems to the constructors.}
+ *
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.3 (derived from geotk-3.00)

Modified: sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapAdapter.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapAdapter.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapAdapter.java [UTF-8] (original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapAdapter.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -31,7 +31,7 @@ import org.apache.sis.util.ArgumentCheck
 import org.apache.sis.xml.IdentifierMap;
 import org.apache.sis.xml.IdentifierSpace;
 
-import static org.apache.sis.util.collection.CollectionsExt.hashMapCapacity;
+import static org.apache.sis.util.collection.Containers.hashMapCapacity;
 
 // Related to JDK7
 import org.apache.sis.internal.jdk7.Objects;

Modified: sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/jaxb/NonMarshalledAuthority.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/jaxb/NonMarshalledAuthority.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/jaxb/NonMarshalledAuthority.java [UTF-8] (original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/jaxb/NonMarshalledAuthority.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -27,7 +27,7 @@ import java.lang.reflect.Field;
 import org.opengis.metadata.Identifier;
 import org.opengis.metadata.citation.Citation;
 import org.apache.sis.internal.simple.SimpleCitation;
-import org.apache.sis.util.collection.UnmodifiableArrayList;
+import org.apache.sis.internal.util.UnmodifiableArrayList;
 import org.apache.sis.util.logging.Logging;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.xml.IdentifierSpace;

Modified: sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/jdk7/Objects.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/jdk7/Objects.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/jdk7/Objects.java (original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/jdk7/Objects.java Fri Apr 12 21:53:14 2013
@@ -38,13 +38,30 @@ public final class Objects {
     /**
      * See JDK7 javadoc.
      *
-     * @param value Reference to check against null value.
-     * @param message Exception message.
+     * @param  <T> The type of the value to check.
+     * @param  value Reference to check against null value.
+     * @return The given {@code value}, guaranteed to be non null.
      */
-    public static void requireNonNull(final Object value, final String message) {
+    public static <T> T requireNonNull(final T value) {
+        if (value == null) {
+            throw new NullPointerException();
+        }
+        return value;
+    }
+
+    /**
+     * See JDK7 javadoc.
+     *
+     * @param  <T> The type of the value to check.
+     * @param  value Reference to check against null value.
+     * @param  message Exception message.
+     * @return The given {@code value}, guaranteed to be non null.
+     */
+    public static <T> T requireNonNull(final T value, final String message) {
         if (value == null) {
             throw new NullPointerException(message);
         }
+        return value;
     }
 
     /**

Modified: sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java [UTF-8] (original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/util/Utilities.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -123,18 +123,38 @@ public final class Utilities extends Sta
      * @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";

Modified: sis/trunk/sis-utility/src/main/java/org/apache/sis/measure/Angle.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/measure/Angle.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/measure/Angle.java [UTF-8] (original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/measure/Angle.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -24,9 +24,10 @@ import java.text.Format;
 import java.text.ParseException;
 import java.io.Serializable;
 import net.jcip.annotations.Immutable;
-import org.apache.sis.math.MathFunctions;
+import org.apache.sis.internal.util.Utilities;
 
 import static java.lang.Double.doubleToLongBits;
+import static org.apache.sis.math.MathFunctions.isNegative;
 
 
 /**
@@ -204,7 +205,7 @@ public class Angle implements Comparable
         double m = Math.abs(θ);
         final boolean isSmall = m <= (1 / 3600E+3); // 1E-3 arc-second.
         if (isSmall || m > maximum()) {
-            final char h = hemisphere(MathFunctions.isNegative(θ));
+            final char h = hemisphere(isNegative(θ));
             if (h == 0) {
                 m = θ;  // Restore the sign.
             }
@@ -255,9 +256,7 @@ public class Angle implements Comparable
      *   <li>If the precision is 0, then this method formats an empty string.</li>
      *   <li>If the precision is 1 and this angle is a {@link Latitude} or {@link Longitude},
      *       then this method formats only the hemisphere symbol.</li>
-     *   <li>Otherwise the precision, if positive, is given to {@link AngleFormat#setMaximumWidth(int)}.
-     *       That formatter will try to respect the precision limit, but the formatted angle may
-     *       still be wider if the precision is too small or the angle magnitude too large.</li>
+     *   <li>Otherwise the precision, if positive, is given to {@link AngleFormat#setMaximumWidth(int)}.</li>
      * </ul>
      *
      * @param formatter The formatter in which to format this angle.
@@ -266,24 +265,23 @@ public class Angle implements Comparable
      * @param precision Maximal number of characters to write, or -1 if no limit.
      */
     @Override
-    public void formatTo(final Formatter formatter, final int flags, final int width, int precision) {
+    public void formatTo(final Formatter formatter, final int flags, final int width, final int precision) {
         final String value;
         if (precision == 0) {
             value = "";
         } else {
-            if (precision > 0) {
-                final char h = hemisphere(MathFunctions.isNegative(θ));
-                if (h != 0 && --precision == 0) {
-                    formatter.format("%c", h);
-                    return;
+            final char h;
+            int w = precision; // To be decremented only if we may truncate and an hemisphere symbol exist.
+            if (w > 0 && (h = hemisphere(isNegative(θ))) != 0 && --w == 0) {
+                value = Character.toString(h);
+            } else {
+                final AngleFormat format = new AngleFormat(formatter.locale());
+                if (w > 0) {
+                    format.setMaximumWidth(w);
                 }
+                value = format.format(this, new StringBuffer(), null).toString();
             }
-            final AngleFormat format = new AngleFormat(formatter.locale());
-            if (precision > 0) {
-                format.setMaximumWidth(precision);
-            }
-            value = format.format(this, new StringBuffer(), null).toString();
         }
-        org.apache.sis.internal.util.Utilities.formatTo(formatter, flags, width, value);
+        Utilities.formatTo(formatter, flags, width, precision, value);
     }
 }

Modified: sis/trunk/sis-utility/src/main/java/org/apache/sis/measure/FormattedCharacterIterator.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/measure/FormattedCharacterIterator.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/measure/FormattedCharacterIterator.java [UTF-8] (original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/measure/FormattedCharacterIterator.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -26,7 +26,7 @@ import java.util.Set;
 import java.text.Format;
 import java.text.AttributedCharacterIterator;
 import org.apache.sis.util.ArgumentChecks;
-import org.apache.sis.util.collection.CollectionsExt;
+import org.apache.sis.util.collection.Containers;
 import org.apache.sis.internal.converter.SurjectiveConverter;
 import org.apache.sis.internal.simple.SimpleCharacterIterator;
 
@@ -396,7 +396,7 @@ final class FormattedCharacterIterator e
     @Override
     public Map<Attribute, Object> getAttributes() {
         final int index = getIndex();
-        return CollectionsExt.derivedMap(attributes, new Filter(attributes, index), new Selector(index));
+        return Containers.derivedMap(attributes, new Filter(attributes, index), new Selector(index));
     }
 
     /**

Modified: sis/trunk/sis-utility/src/main/java/org/apache/sis/measure/Range.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/measure/Range.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/measure/Range.java [UTF-8] (original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/measure/Range.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -16,9 +16,13 @@
  */
 package org.apache.sis.measure;
 
+import java.util.Formatter;
+import java.util.Formattable;
+import java.util.FormattableFlags;
 import java.io.Serializable;
 import javax.measure.unit.Unit;
 import net.jcip.annotations.Immutable;
+import org.apache.sis.internal.util.Utilities;
 import org.apache.sis.util.collection.CheckedContainer;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.Numbers;
@@ -83,7 +87,7 @@ import org.apache.sis.internal.jdk7.Obje
  * @see org.apache.sis.util.collection.RangeSet
  */
 @Immutable
-public class Range<E extends Comparable<? super E>> implements CheckedContainer<E>, Serializable {
+public class Range<E extends Comparable<? super E>> implements CheckedContainer<E>, Formattable, Serializable {
     /**
      * For cross-version compatibility.
      */
@@ -653,4 +657,31 @@ public class Range<E extends Comparable<
         }
         return buffer.toString();
     }
+
+    /**
+     * Formats this range using the provider formatter. This method is invoked when an
+     * {@code Range} object is formatted using the {@code "%s"} conversion specifier of
+     * {@link Formatter}. Users don't need to invoke this method explicitely.
+     *
+     * <p>If the alternate flags is present (as in {@code "%#s"}), then the range will
+     * be formatted using the {@linkplain RangeFormat#isAlternateForm() alternate form}
+     * for exclusive bounds.</p>
+     *
+     * @param formatter The formatter in which to format this angle.
+     * @param flags     {@link FormattableFlags#LEFT_JUSTIFY} for left alignment, or 0 for right alignment.
+     * @param width     Minimal number of characters to write, padding with {@code ' '} if necessary.
+     * @param precision Maximal number of characters to write, or -1 if no limit.
+     */
+    @Override
+    public void formatTo(final Formatter formatter, final int flags, final int width, int precision) {
+        final String value;
+        if (precision == 0) {
+            value = "";
+        } else {
+            final RangeFormat format = new RangeFormat(formatter.locale(), elementType);
+            format.setAlternateForm((flags & FormattableFlags.ALTERNATE) != 0);
+            value = format.format(this, new StringBuffer(), null).toString();
+        }
+        Utilities.formatTo(formatter, flags, width, precision, value);
+    }
 }

Modified: sis/trunk/sis-utility/src/main/java/org/apache/sis/measure/RangeFormat.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/measure/RangeFormat.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/measure/RangeFormat.java [UTF-8] (original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/measure/RangeFormat.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -249,6 +249,14 @@ public class RangeFormat extends Format 
     private final String infinity;
 
     /**
+     * {@code true} if {@code RangeFormat} shall use the alternate form at formatting time.
+     * This flag as no effect on parsing, since both forms are accepted.
+     *
+     * @see #isAlternateForm()
+     */
+    private boolean alternateForm;
+
+    /**
      * The type of the range components. Valid types are {@link Number}, {@link Angle},
      * {@link Date} or a subclass of those types. This value determines the kind of range
      * to be created by the parse method:
@@ -430,6 +438,29 @@ public class RangeFormat extends Format 
     }
 
     /**
+     * Returns {@code true} if this {@code RangeFormat} shall use the alternate form at
+     * formatting time. The alternate form expresses open intervals like {@code ]a…b[}
+     * instead of {@code (a…b)}.
+     *
+     * <p>This flag as no effect on parsing, since the parser accepts both forms.</p>
+     *
+     * @return {@code true} for using the alternate format instead of the default format.
+     */
+    public boolean isAlternateForm() {
+        return alternateForm;
+    }
+
+    /**
+     * Sets whether this {@code RangeFormat} shall use the alternate form at formatting time.
+     *
+     * @param alternateForm {@code true} for using the alternate format, or {@code false} for
+     *        using the default format.
+     */
+    public void setAlternateForm(final boolean alternateForm) {
+        this.alternateForm = alternateForm;
+    }
+
+    /**
      * Returns the {@code *_FIELD} constant for the given field position, or -1 if none.
      */
     private static int getField(final FieldPosition position) {
@@ -521,8 +552,11 @@ public class RangeFormat extends Format 
             }
             field = MAX_VALUE_FIELD;
         }
-        toAppendTo.appendCodePoint(isSingleton ? openSet :
-                range.isMinIncluded() ? openInclusive : openExclusive);
+        toAppendTo.appendCodePoint( // Select the char for the first condition to be true below:
+                isSingleton           ? openSet :
+                range.isMinIncluded() ? openInclusive :
+                alternateForm         ? openExclusiveAlt :
+                /* otherwise */         openExclusive);
         for (; field <= UNIT_FIELD; field++) {
             final Object value;
             switch (field) {
@@ -569,9 +603,12 @@ public class RangeFormat extends Format 
                     toAppendTo.append(' ').append(separator).append(' ');
                     break;
                 }
-                case MAX_VALUE_FIELD: {
-                    toAppendTo.appendCodePoint(isSingleton ? closeSet :
-                            range.isMaxIncluded() ? closeInclusive : closeExclusive);
+                case MAX_VALUE_FIELD: { // Select the char for the first condition to be true below:
+                    toAppendTo.appendCodePoint(
+                            isSingleton           ? closeSet :
+                            range.isMaxIncluded() ? closeInclusive :
+                            alternateForm         ? closeExclusiveAlt :
+                            /* otherwise */         closeExclusive);
                     break;
                 }
             }

Modified: sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Classes.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Classes.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Classes.java [UTF-8] (original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Classes.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -29,7 +29,7 @@ import java.lang.reflect.WildcardType;
 import java.lang.reflect.GenericArrayType;
 import java.lang.reflect.ParameterizedType;
 
-import static org.apache.sis.util.collection.CollectionsExt.hashMapCapacity;
+import static org.apache.sis.util.collection.Containers.hashMapCapacity;
 
 
 /**

Modified: sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Deprecable.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Deprecable.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Deprecable.java [UTF-8] (original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Deprecable.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -16,6 +16,8 @@
  */
 package org.apache.sis.util;
 
+import org.opengis.util.InternationalString;
+
 
 /**
  * Interface of classes for which deprecated instances may exist. Deprecated instances exist in some
@@ -41,4 +43,14 @@ public interface Deprecable {
      * @return {@code true} if this instance is deprecated.
      */
     boolean isDeprecated();
+
+    /**
+     * If this instance is deprecated, the reason or the alternative to use.
+     * Otherwise, an optional free text.
+     *
+     * @return Comments about this instance, or {@code null} if none. Shall be the
+     *         reason for deprecation or the alternative to use if this instance
+     *         {@linkplain #isDeprecated() is deprecated}.
+     */
+    InternationalString getRemarks();
 }

Modified: sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Locales.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Locales.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Locales.java [UTF-8] (original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Locales.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -29,7 +29,7 @@ import org.apache.sis.util.logging.Loggi
 import org.apache.sis.util.resources.Errors;
 
 import static org.apache.sis.util.CharSequences.trimWhitespaces;
-import static org.apache.sis.util.collection.CollectionsExt.hashMapCapacity;
+import static org.apache.sis.util.collection.Containers.hashMapCapacity;
 
 
 /**

Modified: sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Numbers.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Numbers.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Numbers.java [UTF-8] (original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Numbers.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -27,7 +27,7 @@ import java.lang.reflect.Array;
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import org.apache.sis.util.resources.Errors;
-import org.apache.sis.util.collection.CollectionsExt;
+import org.apache.sis.internal.util.CollectionsExt;
 
 import static java.lang.Double.doubleToLongBits;
 

Modified: sis/trunk/sis-utility/src/main/java/org/apache/sis/util/ObjectConverters.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/ObjectConverters.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/util/ObjectConverters.java [UTF-8] (original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/util/ObjectConverters.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -18,7 +18,7 @@ package org.apache.sis.util;
 
 import java.util.Map;
 import java.util.Set;
-import org.apache.sis.util.collection.CollectionsExt;
+import org.apache.sis.util.collection.Containers;
 import org.apache.sis.internal.converter.IdentityConverter;
 import org.apache.sis.internal.converter.SystemRegistry;
 
@@ -103,7 +103,7 @@ public final class ObjectConverters exte
      * by invoking the {@link ObjectConverter#convert(Object)} method on the given converter.
      *
      * <p>This convenience method delegates to
-     * {@link CollectionsExt#derivedSet CollectionsExt.derivedSet(…)}.
+     * {@link Containers#derivedSet Containers.derivedSet(…)}.
      * See the javadoc of the above method for more information.
      *
      * @param  <S>       The type of elements in the storage (original) set.
@@ -114,10 +114,10 @@ public final class ObjectConverters exte
      * @return A view over the {@code storage} set containing all elements converted by the given
      *         converter, or {@code null} if {@code storage} was null.
      *
-     * @see CollectionsExt#derivedSet(Set, ObjectConverter)
+     * @see Containers#derivedSet(Set, ObjectConverter)
      */
     public static <S,E> Set<E> derivedSet(final Set<S> storage, final ObjectConverter<S,E> converter) {
-        return CollectionsExt.derivedSet(storage, converter);
+        return Containers.derivedSet(storage, converter);
     }
 
     /**
@@ -126,7 +126,7 @@ public final class ObjectConverters exte
      * by invoking the {@link ObjectConverter#convert(Object)} method on the given converters.
      *
      * <p>This convenience method delegates to
-     * {@link CollectionsExt#derivedMap CollectionsExt.derivedMap(…)}.
+     * {@link Containers#derivedMap Containers.derivedMap(…)}.
      * See the javadoc of the above method for more information.
      *
      * @param <SK>         The type of keys   in the storage map.
@@ -139,13 +139,13 @@ public final class ObjectConverters exte
      * @return A view over the {@code storage} map containing all entries converted by the given
      *         converters, or {@code null} if {@code storage} was null.
      *
-     * @see CollectionsExt#derivedMap(Map, ObjectConverter, ObjectConverter)
+     * @see Containers#derivedMap(Map, ObjectConverter, ObjectConverter)
      */
     public static <SK,SV,K,V> Map<K,V> derivedMap(final Map<SK,SV> storage,
                                                   final ObjectConverter<SK,K> keyConverter,
                                                   final ObjectConverter<SV,V> valueConverter)
     {
-        return CollectionsExt.derivedMap(storage, keyConverter, valueConverter);
+        return Containers.derivedMap(storage, keyConverter, valueConverter);
     }
 
     /**
@@ -154,7 +154,7 @@ public final class ObjectConverters exte
      * invoking the {@link ObjectConverter#convert(Object)} method on the given converter.
      *
      * <p>This convenience method delegates to
-     * {@link CollectionsExt#derivedMap CollectionsExt.derivedMap(…)}.
+     * {@link Containers#derivedMap Containers.derivedMap(…)}.
      * See the javadoc of the above method for more information.
      *
      * @param <SK>         The type of keys   in the storage map.
@@ -166,14 +166,14 @@ public final class ObjectConverters exte
      * @return A view over the {@code storage} map containing all entries with the keys converted
      *         by the given converter, or {@code null} if {@code storage} was null.
      *
-     * @see CollectionsExt#derivedMap(Map, ObjectConverter, ObjectConverter)
+     * @see Containers#derivedMap(Map, ObjectConverter, ObjectConverter)
      */
     public static <SK,K,V> Map<K,V> derivedKeys(final Map<SK,V> storage,
                                                 final ObjectConverter<SK,K> keyConverter,
                                                 final Class<V> valueType)
     {
         ArgumentChecks.ensureNonNull("valueType", valueType);
-        return CollectionsExt.derivedMap(storage, keyConverter, identity(valueType));
+        return Containers.derivedMap(storage, keyConverter, identity(valueType));
     }
 
     /**
@@ -182,7 +182,7 @@ public final class ObjectConverters exte
      * invoking the {@link ObjectConverter#convert(Object)} method on the given converter.
      *
      * <p>This convenience method delegates to
-     * {@link CollectionsExt#derivedMap CollectionsExt.derivedMap(…)}.
+     * {@link Containers#derivedMap Containers.derivedMap(…)}.
      * See the javadoc of the above method for more information.
      *
      * @param <K>          The type of keys in the storage and derived map.
@@ -194,13 +194,13 @@ public final class ObjectConverters exte
      * @return A view over the {@code storage} map containing all entries with the values converted
      *         by the given converter, or {@code null} if {@code storage} was null.
      *
-     * @see CollectionsExt#derivedMap(Map, ObjectConverter, ObjectConverter)
+     * @see Containers#derivedMap(Map, ObjectConverter, ObjectConverter)
      */
     public static <K,SV,V> Map<K,V> derivedValues(final Map<K,SV> storage,
                                                   final Class<K> keyType,
                                                   final ObjectConverter<SV,V> valueConverter)
     {
         ArgumentChecks.ensureNonNull("keyType", keyType);
-        return CollectionsExt.derivedMap(storage, identity(keyType), valueConverter);
+        return Containers.derivedMap(storage, identity(keyType), valueConverter);
     }
 }

Modified: sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Static.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Static.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Static.java [UTF-8] (original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Static.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -42,8 +42,9 @@ package org.apache.sis.util;
  *         and test if a unit is angular, linear or temporal.</td></tr>
  *
  * <tr><th colspan="2" class="hsep">Structures (trees, collections, arrays, parameters)</th></tr>
- * <tr><td>{@link org.apache.sis.util.collection.CollectionsExt}</td>
- *     <td>Additions to the JDK {@link java.util.Collections} methods.</td></tr>
+ * <tr><td>{@link org.apache.sis.util.collection.Containers}</td>
+ *     <td>Additions to the JDK {@link java.util.Collections} methods, also related to the
+ *         {@link org.apache.sis.util.collection.CheckedContainer} interface.</td></tr>
  * <tr><td>{@link ArraysExt}</td>
  *     <td>Insert or remove elements in the middle of arrays.</td></tr>
  *

Modified: sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/Cache.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/Cache.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/Cache.java [UTF-8] (original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/Cache.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -216,7 +216,7 @@ public class Cache<K,V> extends Abstract
     public Cache(int initialCapacity, final long costLimit, final boolean soft) {
         ArgumentChecks.ensureStrictlyPositive("initialCapacity", initialCapacity);
         ArgumentChecks.ensurePositive("costLimit", costLimit);
-        initialCapacity = CollectionsExt.hashMapCapacity(initialCapacity);
+        initialCapacity = Containers.hashMapCapacity(initialCapacity);
         this.map        = new ConcurrentHashMap<K,Object>(initialCapacity);
         this.costs      = new LinkedHashMap<K,Integer>((int) Math.min(initialCapacity, costLimit), 0.75f, true);
         this.costLimit  = costLimit;

Modified: sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/DefaultTreeTable.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/DefaultTreeTable.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/DefaultTreeTable.java [UTF-8] (original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/DefaultTreeTable.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -16,6 +16,7 @@
  */
 package org.apache.sis.util.collection;
 
+import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 import java.util.LinkedHashMap;
@@ -25,10 +26,11 @@ import net.jcip.annotations.NotThreadSaf
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.internal.util.Cloner;
+import org.apache.sis.internal.util.UnmodifiableArrayList;
 
 import static org.apache.sis.util.CharSequences.trimWhitespaces;
-import static org.apache.sis.util.collection.CollectionsExt.isNullOrEmpty;
-import static org.apache.sis.util.collection.CollectionsExt.hashMapCapacity;
+import static org.apache.sis.util.collection.Containers.isNullOrEmpty;
+import static org.apache.sis.util.collection.Containers.hashMapCapacity;
 
 // Related to JDK7
 import org.apache.sis.internal.jdk7.Objects;
@@ -124,7 +126,9 @@ public class DefaultTreeTable implements
         if (columns.length == 0) {
             throw new IllegalArgumentException(Errors.format(Errors.Keys.EmptyArgument_1, "columns"));
         }
-        columns = columns.clone();
+        // Copy the array for safety against user changes, and also for forcing the element type
+        // to TableColumn, not a subclass, because of the UnmodifiableArrayList.wrap(E[]) contract.
+        columns = Arrays.copyOf(columns, columns.length, TableColumn[].class);
         this.columnIndices = createColumnIndices(columns);
         this.columns = UnmodifiableArrayList.wrap(columns);
     }
@@ -171,6 +175,10 @@ public class DefaultTreeTable implements
     /**
      * Returns all columns in the given map, sorted by increasing index value.
      * This method relies on {@link LinkedHashSet} preserving insertion order.
+     *
+     * @return The columns in an array of elements of type {@code TableColumn},
+     *         <strong>not a subtype</strong> for allowing usage in
+     *         {@link UnmodifiableArrayList#wrap(E[])}.
      */
     static TableColumn<?>[] getColumns(final Map<TableColumn<?>,Integer> columnIndices) {
         return columnIndices.keySet().toArray(new TableColumn<?>[columnIndices.size()]);

Modified: sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/package-info.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/package-info.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/package-info.java [UTF-8] (original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/package-info.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -34,8 +34,8 @@
  *     and supports concurrency, while the other implementations are more lightweight, sometime
  *     thread-safe but without concurrency support.
  *   </li><li>
- *     {@linkplain org.apache.sis.util.collection.CollectionsExt#derivedMap Derived Map} and
- *     {@linkplain org.apache.sis.util.collection.CollectionsExt#derivedSet derived Set} are wrapper collections
+ *     {@linkplain org.apache.sis.util.collection.Containers#derivedMap Derived Map} and
+ *     {@linkplain org.apache.sis.util.collection.Containers#derivedSet derived Set} are wrapper collections
  *     in which the keys or the values are derived on-the-fly from the content of an other collection.
  *     The can also be used for creating filtered views.
  *   </li><li>

Modified: sis/trunk/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractInternationalString.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractInternationalString.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractInternationalString.java [UTF-8] (original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractInternationalString.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -177,28 +177,8 @@ public abstract class AbstractInternatio
      *                  or -1 for no restriction.
      */
     @Override
-    public void formatTo(final Formatter formatter, int flags, final int width, int precision) {
-        final Locale locale = formatter.locale();
-        String value = toString(locale);
-        if (precision >= 0) {
-            if ((flags & FormattableFlags.UPPERCASE) != 0) {
-                value = value.toUpperCase(locale); // May change the length in some locales.
-                flags &= ~FormattableFlags.UPPERCASE;
-            }
-            final int length = value.length();
-            if (precision < length) {
-                try {
-                    precision = value.offsetByCodePoints(0, precision);
-                } catch (IndexOutOfBoundsException e) {
-                    precision = length;
-                    // Happen if the string has fewer code-points than 'precision'. We could
-                    // avoid the try-catch block by checking value.codePointCount(…), but it
-                    // would result in scanning the string twice.
-                }
-                value = value.substring(0, precision);
-            }
-        }
-        Utilities.formatTo(formatter, flags, width, value);
+    public void formatTo(final Formatter formatter, final int flags, final int width, final int precision) {
+        Utilities.formatTo(formatter, flags, width, precision, toString(formatter.locale()));
     }
 
     /**

Modified: sis/trunk/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultInternationalString.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultInternationalString.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultInternationalString.java [UTF-8] (original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultInternationalString.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -32,7 +32,7 @@ import org.apache.sis.util.Locales;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.resources.Errors;
 
-import static org.apache.sis.util.collection.CollectionsExt.isNullOrEmpty;
+import static org.apache.sis.util.collection.Containers.isNullOrEmpty;
 
 // Related to JDK7
 import org.apache.sis.internal.jdk7.Objects;

Modified: sis/trunk/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java [UTF-8] (original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -29,7 +29,7 @@ import org.opengis.util.ScopedName;
 import org.opengis.util.GenericName;
 import org.opengis.util.InternationalString;
 import org.apache.sis.util.collection.WeakValueHashMap;
-import org.apache.sis.util.collection.UnmodifiableArrayList;
+import org.apache.sis.internal.util.UnmodifiableArrayList;
 
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
 

Modified: sis/trunk/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultScopedName.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultScopedName.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultScopedName.java [UTF-8] (original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultScopedName.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -29,7 +29,7 @@ import org.opengis.util.GenericName;
 import org.opengis.util.InternationalString;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.resources.Errors;
-import org.apache.sis.util.collection.UnmodifiableArrayList;
+import org.apache.sis.internal.util.UnmodifiableArrayList;
 
 
 
@@ -146,6 +146,7 @@ public class DefaultScopedName extends A
         if (i != size) { // Paranoiac check.
             throw new ConcurrentModificationException(Errors.format(Errors.Keys.UnexpectedChange_1, "names"));
         }
+        // Following line is safe because 'parsedNames' type is <? extends LocalName>.
         parsedNames = UnmodifiableArrayList.wrap(locals);
     }
 
@@ -210,6 +211,7 @@ public class DefaultScopedName extends A
         if (index != locals.length) { // Paranoiac check.
             throw new ConcurrentModificationException(Errors.format(Errors.Keys.UnexpectedChange_1, "tail"));
         }
+        // Following line is safe because 'parsedNames' type is <? extends LocalName>.
         parsedNames = UnmodifiableArrayList.wrap(locals);
         if (tail instanceof LocalName) {
             this.path = path;

Modified: sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/MarshallerPool.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/MarshallerPool.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/MarshallerPool.java [UTF-8] (original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/MarshallerPool.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -41,7 +41,7 @@ import org.apache.sis.internal.jaxb.Adap
  * {@preformat java
  *     Marshaller marshaller = pool.acquireMarshaller();
  *     marshaller.marchall(...);
- *     pool.release(marshaller);
+ *     pool.recycle(marshaller);
  * }
  *
  * {@section Configuring (un)marshallers}
@@ -101,7 +101,7 @@ public class MarshallerPool {
      * synchronized block.</p>
      *
      * @see #acquireMarshaller()
-     * @see #release(Marshaller)
+     * @see #recycle(Marshaller)
      */
     private final Deque<Marshaller> marshallers;
 
@@ -114,7 +114,7 @@ public class MarshallerPool {
      * synchronized block.</p>
      *
      * @see #acquireUnmarshaller()
-     * @see #release(Unmarshaller)
+     * @see #recycle(Unmarshaller)
      */
     private final Deque<Unmarshaller> unmarshallers;
 
@@ -237,13 +237,13 @@ public class MarshallerPool {
      *   <li>Registers a delayed task for disposing expired (un)marshallers after the timeout.</li>
      * </ul>
      */
-    private <T> void release(final Deque<T> queue, final T marshaller) {
+    private <T> void recycle(final Deque<T> queue, final T marshaller) {
         try {
             ((Pooled) marshaller).reset();
         } catch (JAXBException exception) {
             // Not expected to happen because we are supposed
             // to reset the properties to their initial values.
-            Logging.unexpectedException(MarshallerPool.class, "release", exception);
+            Logging.unexpectedException(MarshallerPool.class, "recycle", exception);
             return;
         }
         queue.push(marshaller);
@@ -325,12 +325,11 @@ public class MarshallerPool {
      * {@preformat java
      *     Marshaller marshaller = pool.acquireMarshaller();
      *     marshaller.marchall(...);
-     *     pool.release(marshaller);
+     *     pool.recycle(marshaller);
      * }
      *
-     * Note that this is not strictly required to release the marshaller in a {@code finally}
-     * block. Actually it is safer to let the garbage collector disposes the marshaller if an
-     * error occurred while marshalling the object.
+     * Note that {@link #recycle(Marshaller)} shall not be invoked in case of exception,
+     * since the marshaller may be in an invalid state.
      *
      * @return A marshaller configured for formatting OGC/ISO XML.
      * @throws JAXBException If an error occurred while creating and configuring a marshaller.
@@ -352,12 +351,11 @@ public class MarshallerPool {
      * {@preformat java
      *     Unmarshaller unmarshaller = pool.acquireUnmarshaller();
      *     Unmarshaller.unmarchall(...);
-     *     pool.release(unmarshaller);
+     *     pool.recycle(unmarshaller);
      * }
      *
-     * Note that this is not strictly required to release the unmarshaller in a {@code finally}
-     * block. Actually it is safer to let the garbage collector disposes the unmarshaller if an
-     * error occurred while unmarshalling the object.
+     * Note that {@link #recycle(Unmarshaller)} shall not be invoked in case of exception,
+     * since the unmarshaller may be in an invalid state.
      *
      * @return A unmarshaller configured for parsing OGC/ISO XML.
      * @throws JAXBException If an error occurred while creating and configuring the unmarshaller.
@@ -371,23 +369,31 @@ public class MarshallerPool {
     }
 
     /**
-     * Declares a marshaller as available for reuse. The caller should not use
-     * anymore the marshaller after this method call.
+     * Declares a marshaller as available for reuse.
+     * The caller should not use anymore the given marshaller after this method call.
+     *
+     * <p>Do not invoke this method if the marshaller threw an exception, since the
+     * marshaller may be in an invalid state. In particular, this method should not
+     * be invoked in a {@code finally} block.</p>
      *
      * @param marshaller The marshaller to return to the pool.
      */
-    public void release(final Marshaller marshaller) {
-        release(marshallers, marshaller);
+    public void recycle(final Marshaller marshaller) {
+        recycle(marshallers, marshaller);
     }
 
     /**
-     * Declares a unmarshaller as available for reuse. The caller should not use
-     * anymore the unmarshaller after this method call.
+     * Declares a unmarshaller as available for reuse.
+     * The caller should not use anymore the given unmarshaller after this method call.
+     *
+     * <p>Do not invoke this method if the marshaller threw an exception, since the
+     * marshaller may be in an invalid state. In particular, this method should not
+     * be invoked in a {@code finally} block.</p>
      *
      * @param unmarshaller The unmarshaller to return to the pool.
      */
-    public void release(final Unmarshaller unmarshaller) {
-        release(unmarshallers, unmarshaller);
+    public void recycle(final Unmarshaller unmarshaller) {
+        recycle(unmarshallers, unmarshaller);
     }
 
     /**

Modified: sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java [UTF-8] (original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -31,7 +31,7 @@ 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.util.collection.CollectionsExt;
+import org.apache.sis.internal.util.CollectionsExt;
 import org.apache.sis.internal.jaxb.MarshalContext;
 
 

Modified: sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/XML.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/XML.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/XML.java [UTF-8] (original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/XML.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -147,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)
@@ -195,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.
      *     }
@@ -298,7 +298,7 @@ public final class XML extends Static {
         final MarshallerPool pool = getPool();
         final Marshaller marshaller = pool.acquireMarshaller();
         marshaller.marshal(object, output);
-        pool.release(marshaller);
+        pool.recycle(marshaller);
         return output.toString();
     }
 
@@ -313,7 +313,7 @@ public final class XML extends Static {
         final MarshallerPool pool = getPool();
         final Marshaller marshaller = pool.acquireMarshaller();
         marshaller.marshal(object, output);
-        pool.release(marshaller);
+        pool.recycle(marshaller);
     }
 
     /**
@@ -327,7 +327,7 @@ public final class XML extends Static {
         final MarshallerPool pool = getPool();
         final Marshaller marshaller = pool.acquireMarshaller();
         marshaller.marshal(object, output);
-        pool.release(marshaller);
+        pool.recycle(marshaller);
     }
 
     /**
@@ -342,7 +342,7 @@ public final class XML extends Static {
         final MarshallerPool pool = getPool();
         final Unmarshaller unmarshaller = pool.acquireUnmarshaller();
         final Object object = unmarshaller.unmarshal(in);
-        pool.release(unmarshaller);
+        pool.recycle(unmarshaller);
         return object;
     }
 
@@ -357,7 +357,7 @@ public final class XML extends Static {
         final MarshallerPool pool = getPool();
         final Unmarshaller unmarshaller = pool.acquireUnmarshaller();
         final Object object = unmarshaller.unmarshal(input);
-        pool.release(unmarshaller);
+        pool.recycle(unmarshaller);
         return object;
     }
 
@@ -372,7 +372,7 @@ public final class XML extends Static {
         final MarshallerPool pool = getPool();
         final Unmarshaller unmarshaller = pool.acquireUnmarshaller();
         final Object object = unmarshaller.unmarshal(input);
-        pool.release(unmarshaller);
+        pool.recycle(unmarshaller);
         return object;
     }
 }

Modified: sis/trunk/sis-utility/src/test/java/org/apache/sis/measure/RangeFormatTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/test/java/org/apache/sis/measure/RangeFormatTest.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/test/java/org/apache/sis/measure/RangeFormatTest.java [UTF-8] (original)
+++ sis/trunk/sis-utility/src/test/java/org/apache/sis/measure/RangeFormatTest.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -192,6 +192,22 @@ public final strictfp class RangeFormatT
     }
 
     /**
+     * Tests the {@link RangeFormat#format(Object, StringBuffer, FieldPosition)} method
+     * using the alternate format.
+     */
+    @Test
+    public void testAlternateFormat() {
+        format = new RangeFormat(Locale.CANADA);
+        minPos = new FieldPosition(RangeFormat.Field.MIN_VALUE);
+        maxPos = new FieldPosition(RangeFormat.Field.MAX_VALUE);
+        format.setAlternateForm(true);
+
+        assertEquals("[-10 … 20]", format(NumberRange.create(-10, true, 20, true)));
+        assertEquals("]-3 … 4[",   format(NumberRange.create( -3, false, 4, false)));
+        assertEquals("[2 … 8[",    format(NumberRange.create(  2, true,  8, false)));
+    }
+
+    /**
      * Tests the parsing method on ranges of numbers. This test fixes the type to
      * {@code Integer.class}.  A different test will let the parser determine the
      * type itself.

Modified: sis/trunk/sis-utility/src/test/java/org/apache/sis/measure/RangeTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/test/java/org/apache/sis/measure/RangeTest.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/test/java/org/apache/sis/measure/RangeTest.java [UTF-8] (original)
+++ sis/trunk/sis-utility/src/test/java/org/apache/sis/measure/RangeTest.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -16,6 +16,7 @@
  */
 package org.apache.sis.measure;
 
+import java.util.Locale;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
@@ -306,6 +307,19 @@ public final strictfp class RangeTest ex
     }
 
     /**
+     * Tests the {@link Range#formatTo(Formatter, int, int, int)} method.
+     */
+    @Test
+    public void testFormatTo() {
+        final Range<Integer> range = new Range<Integer>(Integer.class, 10, true,  20, false);
+        assertEquals("[10 … 20)",    String.format(Locale.CANADA, "%s", range));
+        assertEquals("[10 … 20)",    String.format(Locale.CANADA, "%4s", range));
+        assertEquals("[10 … 20)   ", String.format(Locale.CANADA, "%-12s", range));
+        assertEquals("   [10 … 20)", String.format(Locale.CANADA, "%12s", range));
+        assertEquals("[10 … 20[   ", String.format(Locale.CANADA, "%#-12s", range));
+    }
+
+    /**
      * Tests the {@link Range#equals(Object)} method.
      */
     @Test

Modified: sis/trunk/sis-utility/src/test/java/org/apache/sis/test/TestRunner.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/test/java/org/apache/sis/test/TestRunner.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/test/java/org/apache/sis/test/TestRunner.java [UTF-8] (original)
+++ sis/trunk/sis-utility/src/test/java/org/apache/sis/test/TestRunner.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -39,8 +39,8 @@ import org.junit.runners.model.TestClass
 
 import org.apache.sis.util.ArraysExt;
 
-import static org.apache.sis.util.collection.CollectionsExt.isNullOrEmpty;
-import static org.apache.sis.util.collection.CollectionsExt.hashMapCapacity;
+import static org.apache.sis.util.collection.Containers.isNullOrEmpty;
+import static org.apache.sis.util.collection.Containers.hashMapCapacity;
 
 
 /**

Modified: sis/trunk/sis-utility/src/test/java/org/apache/sis/util/iso/DefaultInternationalStringTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/test/java/org/apache/sis/util/iso/DefaultInternationalStringTest.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/test/java/org/apache/sis/util/iso/DefaultInternationalStringTest.java [UTF-8] (original)
+++ sis/trunk/sis-utility/src/test/java/org/apache/sis/util/iso/DefaultInternationalStringTest.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -108,11 +108,11 @@ public final strictfp class DefaultInter
         assertEquals("English message:",     MESSAGE_en, String.format(Locale.ENGLISH, "%s", toTest));
         assertEquals("French message:",      MESSAGE_fr, String.format(Locale.FRENCH,  "%s", toTest));
 
-        assertEquals("  This", String.format(Locale.ROOT,    "%6.4s",  toTest));
-        assertEquals("  This", String.format(Locale.ENGLISH, "%6.4s",  toTest));
-        assertEquals(" Voici", String.format(Locale.FRENCH,  "%6.5s",  toTest));
-        assertEquals("THIS  ", String.format(Locale.ROOT,    "%-6.5S", toTest));
-        assertEquals("THIS  ", String.format(Locale.ENGLISH, "%-6.5S", toTest));
-        assertEquals("VOICI ", String.format(Locale.FRENCH,  "%-6.5S", toTest));
+        assertEquals("  Thi…", String.format(Locale.ROOT,    "%6.4s",  toTest));
+        assertEquals("  Thi…", String.format(Locale.ENGLISH, "%6.4s",  toTest));
+        assertEquals(" Voic…", String.format(Locale.FRENCH,  "%6.5s",  toTest));
+        assertEquals("THIS… ", String.format(Locale.ROOT,    "%-6.5S", toTest));
+        assertEquals("THIS… ", String.format(Locale.ENGLISH, "%-6.5S", toTest));
+        assertEquals("VOIC… ", String.format(Locale.FRENCH,  "%-6.5S", toTest));
     }
 }

Modified: sis/trunk/sis-utility/src/test/java/org/apache/sis/util/iso/SimpleInternationalStringTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/test/java/org/apache/sis/util/iso/SimpleInternationalStringTest.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/test/java/org/apache/sis/util/iso/SimpleInternationalStringTest.java [UTF-8] (original)
+++ sis/trunk/sis-utility/src/test/java/org/apache/sis/util/iso/SimpleInternationalStringTest.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -60,4 +60,17 @@ public final strictfp class SimpleIntern
         assertEquals(MESSAGE, after.toString(Locale.JAPANESE));
         validate(after);
     }
+
+    /**
+     * Tests the formatting in a {@code printf} statement.
+     */
+    @Test
+    public void testPrintf() {
+        final SimpleInternationalString toTest = new SimpleInternationalString(MESSAGE);
+        assertEquals(MESSAGE,                               String.format("%s", toTest));
+        assertEquals("    This is an unlocalized message.", String.format("%35s", toTest));
+        assertEquals("This is an unlocalized message.    ", String.format("%-35s", toTest));
+        assertEquals("This is a…",                          String.format("%1.10s", toTest));
+        assertEquals("This is a…  ",                        String.format("%-12.10s", toTest));
+    }
 }

Modified: sis/trunk/sis-utility/src/test/java/org/apache/sis/xml/MarshallerPoolTest.java
URL: http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/test/java/org/apache/sis/xml/MarshallerPoolTest.java?rev=1467488&r1=1467487&r2=1467488&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/test/java/org/apache/sis/xml/MarshallerPoolTest.java [UTF-8] (original)
+++ sis/trunk/sis-utility/src/test/java/org/apache/sis/xml/MarshallerPoolTest.java [UTF-8] Fri Apr 12 21:53:14 2013
@@ -57,13 +57,13 @@ public final strictfp class MarshallerPo
         /*
          * MarshallerPool should reset the properties to their initial state.
          */
-        pool.release(marshaller);
+        pool.recycle(marshaller);
         assertSame(marshaller, pool.acquireMarshaller());
         /*
          * Following should be null, but has been replaced by "" under the hood
          * for avoiding a NullPointerException in current JAXB implementation.
          */
         assertEquals("", marshaller.getProperty("com.sun.xml.bind.xmlHeaders"));
-        pool.release(marshaller);
+        pool.recycle(marshaller);
     }
 }



Mime
View raw message