Author: desruisseaux
Date: Sun Dec 2 08:11:16 2012
New Revision: 1416136
URL: http://svn.apache.org/viewvc?rev=1416136&view=rev
Log:
Merge from the JDK6 branch, except the change from "geoapi" to
"geoapi-pending": the trunk stay on the GeoAPI 3.0.0 official release.
Added:
sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/jaxb/UUIDs.java
- copied unchanged from r1416135,
sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/UUIDs.java
sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/
- copied from r1416135,
sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/
sis/trunk/sis-utility/src/main/java/org/apache/sis/measure/SexagesimalConverter.java
- copied unchanged from r1416135,
sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/SexagesimalConverter.java
sis/trunk/sis-utility/src/main/java/org/apache/sis/measure/Units.java
- copied unchanged from r1416135,
sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/Units.java
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Version.java
- copied unchanged from r1416135,
sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/Version.java
sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/MarshalContext.java
- copied unchanged from r1416135,
sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/xml/MarshalContext.java
sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/ObjectConverters.java
- copied unchanged from r1416135,
sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/xml/ObjectConverters.java
sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/ObjectResolver.java
- copied unchanged from r1416135,
sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/xml/ObjectResolver.java
sis/trunk/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java
- copied unchanged from r1416135,
sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/measure/UnitsTest.java
sis/trunk/sis-utility/src/test/java/org/apache/sis/util/VersionTest.java
- copied unchanged from r1416135,
sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/util/VersionTest.java
Modified:
sis/trunk/ (props changed)
sis/trunk/ide-project/NetBeans/nbproject/project.properties
sis/trunk/pom.xml
sis/trunk/sis-build-helper/src/main/java/org/apache/sis/internal/taglet/Preformat.java
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.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/IdentifierMapWithSpecialCases.java
sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/util/ReferenceQueueConsumer.java
sis/trunk/sis-utility/src/main/java/org/apache/sis/io/TableFormatter.java
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/ArgumentChecks.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/Workaround.java
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/CheckedArrayList.java
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/CheckedHashSet.java
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/WeakValueHashMap.java
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/NilObjectHandler.java
sis/trunk/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
sis/trunk/sis-utility/src/test/java/org/apache/sis/util/UtilitiesTest.java
Propchange: sis/trunk/
------------------------------------------------------------------------------
Merged /sis/branches/JDK7:r1415740-1416132
Merged /sis/branches/JDK6:r1415755-1416135
Modified: sis/trunk/ide-project/NetBeans/nbproject/project.properties
URL:
http://svn.apache.org/viewvc/sis/trunk/ide-project/NetBeans/nbproject/project.properties?rev=1416136&r1=1416135&r2=1416136&view=diff
==============================================================================
--- sis/trunk/ide-project/NetBeans/nbproject/project.properties (original)
+++ sis/trunk/ide-project/NetBeans/nbproject/project.properties Sun Dec 2
08:11:16 2012
@@ -126,7 +126,7 @@ build.generated.dir
build.generated.sources.dir = ${build.dir}/generated-sources
build.test.classes.dir = ${build.dir}/test/classes
build.test.results.dir = ${build.dir}/test/results
-build.classes.excludes = **/*.java,**/*.form
+build.classes.excludes =
**/*.java,**/*.form,**/*.bak,**/resources/*.properties
build.sysclasspath = ignore
dist.dir = dist
dist.jar = ${dist.dir}/SIS.jar
Modified: sis/trunk/pom.xml
URL:
http://svn.apache.org/viewvc/sis/trunk/pom.xml?rev=1416136&r1=1416135&r2=1416136&view=diff
==============================================================================
--- sis/trunk/pom.xml (original)
+++ sis/trunk/pom.xml Sun Dec 2 08:11:16 2012
@@ -28,7 +28,7 @@
<parent>
<groupId>org.apache</groupId>
<artifactId>apache</artifactId>
- <version>11</version>
+ <version>12</version>
</parent>
@@ -375,7 +375,7 @@ Apache SIS is a toolkit for describing l
<dependency> <!-- Syntax highlighting -->
<groupId>net.sf.xslthl</groupId>
<artifactId>xslthl</artifactId>
- <version>2.0.2</version>
+ <version>2.1.0</version>
<scope>runtime</scope>
</dependency>
</dependencies>
@@ -438,13 +438,13 @@ Apache SIS is a toolkit for describing l
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
- <version>2.5.1</version>
+ <version>2.6</version>
</plugin>
<!-- Produce JavaDoc -->
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
- <version>2.8.1</version>
+ <version>2.9</version>
<configuration>
<source>${maven.compile.source}</source> <!-- Enables
javadoc to handle language constructs present in target JDK. -->
<encoding>${project.build.sourceEncoding}</encoding> <!-- Encoding
of Java source file. -->
@@ -517,7 +517,7 @@ Apache SIS is a toolkit for describing l
<!-- Unit tests report -->
<plugin>
<artifactId>maven-surefire-report-plugin</artifactId>
- <version>2.12.3</version>
+ <version>2.12.4</version>
</plugin>
<!-- "Release Audit" report (checks license headers etc.) -->
Modified:
sis/trunk/sis-build-helper/src/main/java/org/apache/sis/internal/taglet/Preformat.java
URL:
http://svn.apache.org/viewvc/sis/trunk/sis-build-helper/src/main/java/org/apache/sis/internal/taglet/Preformat.java?rev=1416136&r1=1416135&r2=1416136&view=diff
==============================================================================
---
sis/trunk/sis-build-helper/src/main/java/org/apache/sis/internal/taglet/Preformat.java
(original)
+++
sis/trunk/sis-build-helper/src/main/java/org/apache/sis/internal/taglet/Preformat.java
Sun Dec 2 08:11:16 2012
@@ -27,6 +27,10 @@ import com.sun.tools.doclets.formats.htm
* The first word after the tag must be the format name ("java", "math", "wkt"
or "text").
* The remaining is the text to format.
*
+ * <p>This taglet will automatically replace {@code &}, {@code <} and {@code
>} by their HTML entities.
+ * The only exception is {@code @}, which is converted to the original
{@code @} character because
+ * we can't use that character directly inside this taglet.</p>
+ *
* @author Martin Desruisseaux (Geomatys)
* @since 0.3 (derived from geotk-3.00)
* @version 0.3
@@ -37,10 +41,10 @@ public final class Preformat extends Inl
* Special characters to replace by HTML entities.
*/
private static final String[] SPECIAL_CHARS = new String[] {
- "&", "&",
- "<", "<",
- ">", ">",
- "â", "↑"
+ "@", "@", // Because we can't use @ directly in {@preformat}.
+ "&", "&",
+ "<", "<",
+ ">", ">"
};
/**
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=1416136&r1=1416135&r2=1416136&view=diff
==============================================================================
---
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java
(original)
+++
sis/trunk/sis-metadata/src/main/java/org/apache/sis/metadata/ModifiableMetadata.java
Sun Dec 2 08:11:16 2012
@@ -26,6 +26,7 @@ import org.opengis.util.CodeList;
import org.apache.sis.util.collection.CheckedHashSet;
import org.apache.sis.util.collection.CheckedArrayList;
+import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
import static org.apache.sis.util.collection.Collections.isNullOrEmpty;
import static org.apache.sis.util.collection.Collections.hashMapCapacity;
@@ -373,6 +374,12 @@ public abstract class ModifiableMetadata
protected void checkWritePermission() throws
UnsupportedOperationException {
ModifiableMetadata.this.checkWritePermission();
}
+
+ @Override
+ protected void ensureValid(final E element) throws
IllegalArgumentException {
+ ensureNonNull("element", element);
+ super.ensureValid(element);
+ }
}
/**
@@ -399,6 +406,12 @@ public abstract class ModifiableMetadata
protected void checkWritePermission() throws
UnsupportedOperationException {
ModifiableMetadata.this.checkWritePermission();
}
+
+ @Override
+ protected void ensureValid(final E element) throws
IllegalArgumentException {
+ ensureNonNull("element", element);
+ super.ensureValid(element);
+ }
}
/**
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=1416136&r1=1416135&r2=1416136&view=diff
==============================================================================
---
sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapAdapter.java
(original)
+++
sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapAdapter.java
Sun Dec 2 08:11:16 2012
@@ -47,9 +47,10 @@ import static org.apache.sis.util.collec
* two identifiers, this is considered acceptable.</p>
*
* {@section Handling of duplicated authorities}
- * The collection shall not contains more than one identifier for the same
- * {@linkplain Identifier#getAuthority() authority}. Nevertheless if such
duplication
- * is found, then this map implementation applies the following rules:
+ * The collection shall not contain more than one identifier for the same
+ * {@linkplain Identifier#getAuthority() authority}. However duplications may
happen if the user
+ * has direct access to the list, for example through {@link
Citation#getIdentifiers()}. If such
+ * duplication is found, then this map implementation applies the following
rules:
*
* <ul>
* <li>All getter methods (including the iterators and the values returned
by the {@code put}
@@ -57,16 +58,21 @@ import static org.apache.sis.util.collec
* occurrence of each authority. Any subsequent occurrences of the same
authorities are
* silently ignored.</li>
* <li>All setter methods <em>may</em> affect <em>all</em> identifiers
previously associated to
- * the given authority, not just the first occurrence. We do that in
order to ensure that
- * the effect of setter methods are visible to subsequent calls to
getter methods. Whatever
- * all occurrences or only the first one will be affected is
implementation dependent.</li>
+ * the given authority, not just the first occurrence. The only
guarantee is that the list
+ * is update in such a way that the effect of setter methods are visible
to subsequent calls
+ * to getter methods.</li>
* </ul>
*
* {@section Handling of null identifiers}
- * The collection of identifiers shall not contains any null element. However,
in order to
- * make the code more robust, any null element are skipped. Note however that
it may cause some
- * inconsistency, for example {@link #isEmpty()} could returns {@code false}
while the more
- * accurate {@link #size()} method returns 0.
+ * The collection of identifiers shall not contains any null element. This is
normally ensured by
+ * the {@link org.apache.sis.metadata.ModifiableMetadata} internal collection
implementations.
+ * This class performs opportunist null checks as an additional safety.
However because we perform
+ * those checks only in opportunist ways, the following inconsistencies remain:
+ *
+ * <ul>
+ * <li>{@link #isEmpty()} may return {@code false} when the more accurate
{@link #size()}
+ * method returns 0.</li>
+ * </ul>
*
* {@section Thread safety}
* This class is thread safe if the underlying identifier collection is thread
safe.
@@ -345,7 +351,7 @@ public class IdentifierMapAdapter extend
}
/**
- * Same implementation than {@link IdentifierMap#clear()}.
+ * Same implementation than {@link IdentifierMapAdapter#clear()}.
*/
@Override
public void clear() throws UnsupportedOperationException {
@@ -353,7 +359,7 @@ public class IdentifierMapAdapter extend
}
/**
- * Same implementation than {@link IdentifierMap#isEmpty()}.
+ * Same implementation than {@link IdentifierMapAdapter#isEmpty()}.
*/
@Override
public boolean isEmpty() {
Modified:
sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapWithSpecialCases.java
URL:
http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapWithSpecialCases.java?rev=1416136&r1=1416135&r2=1416136&view=diff
==============================================================================
---
sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapWithSpecialCases.java
(original)
+++
sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/jaxb/IdentifierMapWithSpecialCases.java
Sun Dec 2 08:11:16 2012
@@ -31,7 +31,7 @@ import org.apache.sis.internal.util.Obje
/**
* A map of identifiers which handles some identifiers in a special way.
* The identifiers for the following authorities are handled in a special way.
- * See usages of {@link #isSpecialCase(Citation)} for spotting the code where
+ * See usages of {@link #specialCase(Object)} for spotting the code where
* a special handling is applied.
*
* <ul>
Modified:
sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/util/ReferenceQueueConsumer.java
URL:
http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/util/ReferenceQueueConsumer.java?rev=1416136&r1=1416135&r2=1416136&view=diff
==============================================================================
---
sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/util/ReferenceQueueConsumer.java
(original)
+++
sis/trunk/sis-utility/src/main/java/org/apache/sis/internal/util/ReferenceQueueConsumer.java
Sun Dec 2 08:11:16 2012
@@ -39,7 +39,7 @@ import org.apache.sis.util.logging.Loggi
* assert ReferenceQueueConsumer.DEFAULT.isAlive();
* }
*
- * @Override
+ * @Override
* public void dispose() {
* // Perform here some cleaning work that must be done when the
referent has
* // been garbage-collected. Remember that get() returns null
from this point.
Modified:
sis/trunk/sis-utility/src/main/java/org/apache/sis/io/TableFormatter.java
URL:
http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/io/TableFormatter.java?rev=1416136&r1=1416135&r2=1416136&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/io/TableFormatter.java
(original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/io/TableFormatter.java
Sun Dec 2 08:11:16 2012
@@ -383,7 +383,7 @@ public class TableFormatter extends Filt
public void setCellAlignment(final byte alignment) {
if (alignment < ALIGN_LEFT || alignment > ALIGN_RIGHT) {
throw new IllegalArgumentException(Errors.format(
- Errors.Keys.IllegalArgument_1, "alignment"));
+ Errors.Keys.IllegalArgumentValue_2, "alignment",
alignment));
}
this.alignment = alignment;
}
Modified:
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/ArgumentChecks.java
URL:
http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/ArgumentChecks.java?rev=1416136&r1=1416135&r2=1416136&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/util/ArgumentChecks.java
(original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/util/ArgumentChecks.java
Sun Dec 2 08:11:16 2012
@@ -27,25 +27,46 @@ import org.apache.sis.util.resources.Err
* Every methods in this class can throw one of the following exceptions:
*
* <table class="sis">
- * <tr><th>Exception</th><th class="sep">Thrown by</th></tr>
- * <tr><td>{@link NullArgumentException}</td>
- * <td class="sep">{@link #ensureNonNull(String, Object) ensureNonNull},
- * {@link #ensureNonEmpty(String, CharSequence) ensureNonEmpty}</td></tr>
- *
- * <tr><td>{@link IllegalArgumentException}</td>
- * <td class="sep">{@link #ensureNonEmpty(String, CharSequence)
ensureNonEmpty},
- * {@link #ensurePositive(String, int) ensurePositive},
- * {@link #ensureStrictlyPositive(String, int) ensureStrictlyPositive},
- * {@link #ensureBetween(String, int, int, int) ensureBetween},
- * {@link #ensureCanCast(String, Class, Object) ensureCanCast}</td></tr>
- *
- * <tr><td>{@link IndexOutOfBoundsException}</td>
- * <td class="sep">{@link #ensureValidIndex(int, int)
ensureValidIndex}</td></tr>
- *
- * <tr><td>{@link MismatchedDimensionException}</td>
- * <td class="sep">{@link #ensureDimensionMatches(String, int, DirectPosition)
ensureDimensionMatches}</td></tr>
+ * <tr>
+ * <th>Exception</th>
+ * <th class="sep">Thrown by</th>
+ * </tr><tr>
+ * <td>{@link NullArgumentException}</td>
+ * <td class="sep">
+ * {@link #ensureNonNull(String, Object) ensureNonNull},
+ * {@link #ensureNonEmpty(String, CharSequence) ensureNonEmpty}.
+ * </td>
+ * </tr><tr>
+ * <td>{@link IllegalArgumentException}</td>
+ * <td class="sep">
+ * {@link #ensureNonEmpty(String, CharSequence) ensureNonEmpty},
+ * {@link #ensurePositive(String, int) ensurePositive},
+ * {@link #ensureStrictlyPositive(String, int) ensureStrictlyPositive},
+ * {@link #ensureBetween(String, int, int, int) ensureBetween},
+ * {@link #ensureCanCast(String, Class, Object) ensureCanCast}.
+ * </td>
+ * </tr><tr>
+ * <td>{@link IndexOutOfBoundsException}</td>
+ * <td class="sep">
+ * {@link #ensureValidIndex(int, int) ensureValidIndex}.
+ * </td>
+ * </tr><tr>
+ * <td>{@link MismatchedDimensionException}</td>
+ * <td class="sep">
+ * {@link #ensureDimensionMatches(String, int, DirectPosition)
ensureDimensionMatches}.
+ * </td>
+ * </tr>
* </table>
*
+ * More specialized {@code ensureXXX(â¦)} methods are provided in the
following classes:
+ * <ul>
+ * <li>{@link org.apache.sis.measure.Units}:
+ * {@link org.apache.sis.measure.Units#ensureAngular ensureAngular},
+ * {@link org.apache.sis.measure.Units#ensureLinear ensureLinear},
+ * {@link org.apache.sis.measure.Units#ensureTemporal ensureTemporal},
+ * {@link org.apache.sis.measure.Units#ensureScale ensureScale}.</li>
+ * </ul>
+ *
* {@section Method Arguments}
* By convention, the value to check is always the last parameter given to
every methods
* in this class. The other parameters may include the programmatic name of
the argument
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=1416136&r1=1416135&r2=1416136&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Static.java
(original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Static.java Sun Dec
2 08:11:16 2012
@@ -34,6 +34,13 @@ package org.apache.sis.util;
* <tr><td>{@link Classes}</td>
* <td>Methods working on {@link Class} instances.</td></tr>
*
+ * <tr><th colspan="2" class="hsep">Mathematics and units of
measurement</th></tr>
+ * <tr><td>{@link org.apache.sis.math.MathFunctions}</td>
+ * <td>Additions to the {@link java.lang.Math} methods.</td></tr>
+ * <tr><td>{@link org.apache.sis.measure.Units}</td>
+ * <td>Get a {@linkplain javax.measure.unit.Unit unit} from a symbol or
EPSG code,
+ * 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.Collections}</td>
* <td>Additions to the JDK {@link java.util.Collections}
methods.</td></tr>
Modified:
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Workaround.java
URL:
http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Workaround.java?rev=1416136&r1=1416135&r2=1416136&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Workaround.java
(original)
+++ sis/trunk/sis-utility/src/main/java/org/apache/sis/util/Workaround.java Sun
Dec 2 08:11:16 2012
@@ -16,6 +16,7 @@
*/
package org.apache.sis.util;
+import java.lang.annotation.Documented;
import java.lang.annotation.Target;
import java.lang.annotation.Retention;
import java.lang.annotation.ElementType;
@@ -36,6 +37,7 @@ import java.lang.annotation.RetentionPol
* @version 0.3
* @module
*/
+@Documented
@Target({ElementType.TYPE, ElementType.CONSTRUCTOR, ElementType.METHOD,
ElementType.FIELD, ElementType.LOCAL_VARIABLE})
@Retention(RetentionPolicy.SOURCE)
Modified:
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/CheckedArrayList.java
URL:
http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/CheckedArrayList.java?rev=1416136&r1=1416135&r2=1416136&view=diff
==============================================================================
---
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/CheckedArrayList.java
(original)
+++
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/CheckedArrayList.java
Sun Dec 2 08:11:16 2012
@@ -109,15 +109,20 @@ public class CheckedArrayList<E> extends
/**
* Ensures that the given element can be added to this list.
- * The default implementation ensures that the object is assignable to the
type specified
- * at construction time. Subclasses can override this method if they need
to perform
- * additional checks.
+ * The default implementation ensures that the object is {@code null} or
assignable
+ * to the type specified at construction time. Subclasses can override
this method
+ * if they need to perform additional checks.
+ *
+ * {@section Synchronization}
+ * This method is invoked <em>before</em> to get the synchronization
{@linkplain #getLock() lock}.
+ * This is different than the {@link #checkWritePermission()} method,
which is invoked inside the
+ * synchronized block.
*
* @param element the object to check, or {@code null}.
* @throws IllegalArgumentException if the specified element can not be
added to this list.
*/
protected void ensureValid(final E element) throws
IllegalArgumentException {
- if (element!=null && !type.isInstance(element)) {
+ if (element != null && !type.isInstance(element)) {
throw new IllegalArgumentException(Errors.format(
Errors.Keys.IllegalArgumentClass_3, "element",
element.getClass(), type));
}
Modified:
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/CheckedHashSet.java
URL:
http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/CheckedHashSet.java?rev=1416136&r1=1416135&r2=1416136&view=diff
==============================================================================
---
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/CheckedHashSet.java
(original)
+++
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/CheckedHashSet.java
Sun Dec 2 08:11:16 2012
@@ -108,15 +108,20 @@ public class CheckedHashSet<E> extends L
/**
* Ensures that the given element can be added to this set.
- * The default implementation ensures that the object is assignable to the
type specified
- * at construction time. Subclasses can override this method if they need
to perform
- * additional checks.
+ * The default implementation ensures that the object is {@code null} or
assignable
+ * to the type specified at construction time. Subclasses can override
this method
+ * if they need to perform additional checks.
+ *
+ * {@section Synchronization}
+ * This method is invoked <em>before</em> to get the synchronization
{@linkplain #getLock() lock}.
+ * This is different than the {@link #checkWritePermission()} method,
which is invoked inside the
+ * synchronized block.
*
* @param element the object to check, or {@code null}.
* @throws IllegalArgumentException if the specified element can not be
added to this set.
*/
protected void ensureValid(final E element) throws
IllegalArgumentException {
- if (element!=null && !type.isInstance(element)) {
+ if (element != null && !type.isInstance(element)) {
throw new IllegalArgumentException(Errors.format(
Errors.Keys.IllegalArgumentClass_3, "element",
element.getClass(), type));
}
Modified:
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/WeakValueHashMap.java
URL:
http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/WeakValueHashMap.java?rev=1416136&r1=1416135&r2=1416136&view=diff
==============================================================================
---
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/WeakValueHashMap.java
(original)
+++
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/collection/WeakValueHashMap.java
Sun Dec 2 08:11:16 2012
@@ -339,13 +339,16 @@ public class WeakValueHashMap<K,V> exten
}
/**
- * Implementation of {@link #put(Object, Object)} and {@link
#remove(Object)} operations.
+ * Implementation of {@link #put(Object, Object)} and {@link
#remove(Object)} operations
+ *
+ * @param putIfAbsent If {@code true} and a value is found for the given
key,
+ * returns the old value without modifying the map.
*/
@SuppressWarnings("unchecked")
- private synchronized V intern(final Object key, final V value) {
+ private synchronized V intern(final Object key, final V value, final
boolean putIfAbsent) {
assert isValid();
/*
- * If 'obj' is already contained in this WeakValueHashMap, we need to
clear it.
+ * If 'value' is already contained in this WeakValueHashMap, we need
to clear it.
*/
V oldValue = null;
Entry[] table = this.table;
@@ -354,6 +357,9 @@ public class WeakValueHashMap<K,V> exten
for (Entry e = table[index]; e != null; e = (Entry) e.next) {
if (keyEquals(key, e.key)) {
oldValue = e.get();
+ if (putIfAbsent) {
+ return oldValue;
+ }
e.dispose();
table = this.table; // May have changed.
index = hash % table.length;
@@ -379,7 +385,7 @@ public class WeakValueHashMap<K,V> exten
*
* @param key key with which the specified value is to be associated.
* @param value value to be associated with the specified key.
- * @return previous value associated with specified key, or {@code null}
+ * @return The previous value associated with specified key, or {@code
null}
* if there was no mapping for key.
*
* @throws NullArgumentException if the key or the value is {@code null}.
@@ -388,7 +394,25 @@ public class WeakValueHashMap<K,V> exten
public V put(final K key, final V value) throws NullArgumentException {
ArgumentChecks.ensureNonNull("key", key);
ArgumentChecks.ensureNonNull("value", value);
- return intern(key, value);
+ return intern(key, value, false);
+ }
+
+ /**
+ * Associates the specified value with the specified key only if no value
is currently
+ * associated to that key. If a value already exists for the given key,
then this method
+ * returns the current value without changing the map.
+ *
+ * @param key key with which the specified value is to be associated.
+ * @param value value to be associated with the specified key.
+ * @return {@code null} if the given value has been associated to the
given key,
+ * or the current (unchanged) value if a mapping already exists
for that key.
+ *
+ * @throws NullArgumentException if the key or the value is {@code null}.
+ */
+ public V putIfAbsent(final K key, final V value) throws
NullArgumentException {
+ ArgumentChecks.ensureNonNull("key", key);
+ ArgumentChecks.ensureNonNull("value", value);
+ return intern(key, value, true);
}
/**
@@ -400,7 +424,7 @@ public class WeakValueHashMap<K,V> exten
*/
@Override
public V remove(final Object key) {
- return intern(key, null);
+ return intern(key, null, false);
}
/**
Modified:
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
URL:
http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java?rev=1416136&r1=1416135&r2=1416136&view=diff
==============================================================================
---
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
(original)
+++
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
Sun Dec 2 08:11:16 2012
@@ -100,14 +100,15 @@ public final class Errors extends Indexe
public static final int IllegalArgumentClass_3 = 2;
/**
- * Argument â{0}â can not take the â{1}â value.
+ * Argument â{0}â can not take the â{1}â value, because the
â{2}â field can not take the â{3}â
+ * value.
*/
- public static final int IllegalArgumentValue_2 = 14;
+ public static final int IllegalArgumentField_4 = 15;
/**
- * Illegal value for argument â{0}â.
+ * Argument â{0}â can not take the â{1}â value.
*/
- public static final int IllegalArgument_1 = 15;
+ public static final int IllegalArgumentValue_2 = 14;
/**
* Illegal bits pattern: {0}.
@@ -190,6 +191,26 @@ public final class Errors extends Indexe
public static final int NodeNotFound_1 = 39;
/**
+ * â{0}â is not an angular unit.
+ */
+ public static final int NonAngularUnit_1 = 46;
+
+ /**
+ * â{0}â is not a linear unit.
+ */
+ public static final int NonLinearUnit_1 = 47;
+
+ /**
+ * â{0}â is not a scale unit.
+ */
+ public static final int NonScaleUnit_1 = 48;
+
+ /**
+ * â{0}â is not a time unit.
+ */
+ public static final int NonTemporalUnit_1 = 49;
+
+ /**
* Argument â{0}â shall not be NaN (Not-a-Number).
*/
public static final int NotANumber_1 = 9;
Modified:
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
URL:
http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties?rev=1416136&r1=1416135&r2=1416136&view=diff
==============================================================================
---
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
(original)
+++
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
Sun Dec 2 08:11:16 2012
@@ -21,9 +21,9 @@ DuplicatedValue_1 = Value
ElementAlreadyPresent_1 = Element \u201c{0}\u201d is already present.
EmptyArgument_1 = Argument \u2018{0}\u2019 shall not be empty.
ForbiddenAttribute_2 = Attribute \u201c{0}\u201d is not allowed for
an object of type \u2018{1}\u2019.
-IllegalArgument_1 = Illegal value for argument \u2018{0}\u2019.
IllegalArgumentClass_2 = Argument \u2018{0}\u2019 can not be an
instance of \u2018{1}\u2019.
IllegalArgumentClass_3 = Argument \u2018{0}\u2019 can not be an
instance of \u2018{1}\u2019. Expected an instance of \u2018{2}\u2019 or derived
type.
+IllegalArgumentField_4 = Argument \u2018{0}\u2019 can not take the
\u201c{1}\u201d value, because the \u2018{2}\u2019 field can not take the
\u201c{3}\u201d value.
IllegalArgumentValue_2 = Argument \u2018{0}\u2019 can not take the
\u201c{1}\u201d value.
IllegalBitsPattern_1 = Illegal bits pattern: {0}.
IllegalClass_2 = Class \u2018{0}\u2019 is illegal. It must be
\u2018{1}\u2019 or a derived class.
@@ -41,6 +41,10 @@ NodeChildOfItself_1 = Node \
NodeHasAnotherParent_1 = Node \u201c{0}\u201d already has another
parent.
NodeHasNoParent_1 = Node \u201c{0}\u201d has no parent.
NodeNotFound_1 = No \u201c{0}\u201d node found.
+NonAngularUnit_1 = \u201c{0}\u201d is not an angular unit.
+NonLinearUnit_1 = \u201c{0}\u201d is not a linear unit.
+NonScaleUnit_1 = \u201c{0}\u201d is not a scale unit.
+NonTemporalUnit_1 = \u201c{0}\u201d is not a time unit.
NotANumber_1 = Argument \u2018{0}\u2019 shall not be NaN
(Not-a-Number).
NotAPrimitiveWrapper_1 = Class \u2018{0}\u2019 is not a primitive
type wrapper.
NullArgument_1 = Argument \u2018{0}\u2019 shall not be null.
Modified:
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
URL:
http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties?rev=1416136&r1=1416135&r2=1416136&view=diff
==============================================================================
---
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
(original)
+++
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
Sun Dec 2 08:11:16 2012
@@ -21,9 +21,9 @@ DuplicatedValue_1 = La val
ElementAlreadyPresent_1 = L\u2019\u00e9lement \u201c{0}\u201d est
d\u00e9j\u00e0 pr\u00e9sent.
EmptyArgument_1 = L\u2019argument \u2018{0}\u2019 ne doit pas
\u00eatre vide.
ForbiddenAttribute_2 = L\u2019attribut \u201c{0}\u201d n\u2019est
pas autoris\u00e9 pour un objet de type \u2018{1}\u2019.
-IllegalArgument_1 = Valeur ill\u00e9gale pour l\u2019argument
\u2018{0}\u2019.
IllegalArgumentClass_2 = L\u2019argument \u2018{0}\u2019 ne peut pas
\u00eatre de type \u2018{1}\u2019.
IllegalArgumentClass_3 = L\u2019argument \u2018{0}\u2019 ne peut pas
\u00eatre de type \u2018{1}\u2019. Une instance de \u2018{2}\u2019 ou d\u2019un
type d\u00e9riv\u00e9 \u00e9tait attendue.
+IllegalArgumentField_4 = L\u2019argument \u2018{0}\u2019
n\u2019accepte pas la valeur \u201c{1}\u201d parce que le champs
\u2018{2}\u2019 ne peut pas prendre la valeur \u201c{3}\u201d.
IllegalArgumentValue_2 = L\u2019argument \u2018{0}\u2019
n\u2019accepte pas la valeur \u201c{1}\u201d.
IllegalBitsPattern_1 = Pattern de bits invalide: {0}.
IllegalClass_2 = La classe \u2018{0}\u2019 est ill\u00e9gale.
Il doit s\u2019agir d\u2019une classe \u2018{1}\u2019 ou d\u00e9riv\u00e9e.
@@ -41,6 +41,10 @@ NodeChildOfItself_1 = Le n\u
NodeHasAnotherParent_1 = Le n\u0153ud \u201c{0}\u201d a
d\u00e9j\u00e0 un autre parent.
NodeHasNoParent_1 = Le n\u0153ud \u201c{0}\u201d n\u2019a pas de
parent.
NodeNotFound_1 = Aucun n\u0153ud \u201c{0}\u201d n\u2019a
\u00e9t\u00e9 trouv\u00e9.
+NonAngularUnit_1 = \u201c{0}\u201d n\u2019est pas une
unit\u00e9 d\u2019angles.
+NonLinearUnit_1 = \u201c{0}\u201d n\u2019est pas une
unit\u00e9 de longueurs.
+NonScaleUnit_1 = \u201c{0}\u201d n\u2019est pas une
unit\u00e9 d\u2019\u00e9chelles.
+NonTemporalUnit_1 = \u201c{0}\u201d n\u2019est pas une
unit\u00e9 de temps.
NotANumber_1 = L\u2019argument \u2018{0}\u2019 ne doit pas
\u00eatre NaN (Not-a-Number).
NotAPrimitiveWrapper_1 = La classe \u2018{0}\u2019 n\u2019est pas un
adaptateur d\u2019un type primitif.
NullArgument_1 = L\u2019argument \u2018{0}\u2019 ne doit pas
\u00eatre nul.
Modified:
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
URL:
http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java?rev=1416136&r1=1416135&r2=1416136&view=diff
==============================================================================
---
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
(original)
+++
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
Sun Dec 2 08:11:16 2012
@@ -54,6 +54,16 @@ public final class Vocabulary extends In
}
/**
+ * Angle
+ */
+ public static final int Angle = 9;
+
+ /**
+ * Degrees
+ */
+ public static final int Degrees = 10;
+
+ /**
* Maximum value
*/
public static final int MaximumValue = 5;
@@ -69,6 +79,11 @@ public final class Vocabulary extends In
public static final int MinimumValue = 4;
/**
+ * Minutes
+ */
+ public static final int Minutes = 11;
+
+ /**
* Name
*/
public static final int Name = 0;
@@ -89,6 +104,11 @@ public final class Vocabulary extends In
public static final int RootMeanSquare = 7;
/**
+ * Seconds
+ */
+ public static final int Seconds = 12;
+
+ /**
* Standard deviation
*/
public static final int StandardDeviation = 8;
Modified:
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
URL:
http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties?rev=1416136&r1=1416135&r2=1416136&view=diff
==============================================================================
---
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
(original)
+++
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
Sun Dec 2 08:11:16 2012
@@ -14,12 +14,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+Angle = Angle
+Degrees = Degrees
MaximumValue = Maximum value
MeanValue = Mean value
MinimumValue = Minimum value
+Minutes = Minutes
Name = Name
NumberOfValues = Number of values
NumberOfNaN = Number of \u2018NaN\u2019
RootMeanSquare = Root Mean Square
StandardDeviation = Standard deviation
+Seconds = Seconds
Type = Type
Modified:
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
URL:
http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties?rev=1416136&r1=1416135&r2=1416136&view=diff
==============================================================================
---
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
(original)
+++
sis/trunk/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
Sun Dec 2 08:11:16 2012
@@ -14,12 +14,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
+Angle = Angle
+Degrees = Degr\u00e9s
MaximumValue = Valeur maximale
MeanValue = Valeur moyenne
MinimumValue = Valeur minimale
+Minutes = Minutes
Name = Nom
NumberOfValues = Nombre de valeurs
NumberOfNaN = Nombre de \u2018NaN\u2019
RootMeanSquare = Moyenne quadratique
+Seconds = Secondes
StandardDeviation = \u00c9cart type
Type = Type
Modified:
sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/NilObjectHandler.java
URL:
http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/NilObjectHandler.java?rev=1416136&r1=1416135&r2=1416136&view=diff
==============================================================================
---
sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/NilObjectHandler.java
(original)
+++
sis/trunk/sis-utility/src/main/java/org/apache/sis/xml/NilObjectHandler.java
Sun Dec 2 08:11:16 2012
@@ -17,16 +17,14 @@
package org.apache.sis.xml;
import java.util.Map;
-import java.util.Arrays;
+import java.util.List;
import java.util.ArrayList;
import java.util.Collection;
import java.lang.reflect.Proxy;
import java.lang.reflect.Method;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
-
import org.opengis.metadata.Identifier;
-
import org.apache.sis.util.Classes;
import org.apache.sis.util.Numbers;
import org.apache.sis.util.ComparisonMode;
@@ -67,7 +65,13 @@ final class NilObjectHandler implements
* or modify identifiers.
*/
NilObjectHandler(final Identifier[] identifiers) {
- attribute = IdentifierMapAdapter.create(new
ArrayList<Identifier>(Arrays.asList(identifiers)));
+ final List<Identifier> asList = new
ArrayList<Identifier>(identifiers.length);
+ for (final Identifier identifier : identifiers) {
+ if (identifier != null) {
+ asList.add(identifier);
+ }
+ }
+ attribute = IdentifierMapAdapter.create(asList);
}
/**
Modified:
sis/trunk/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
URL:
http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java?rev=1416136&r1=1416135&r2=1416136&view=diff
==============================================================================
---
sis/trunk/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
(original)
+++
sis/trunk/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
Sun Dec 2 08:11:16 2012
@@ -39,6 +39,7 @@ import org.junit.runners.Suite;
org.apache.sis.util.CharSequencesTest.class,
org.apache.sis.util.StringBuildersTest.class,
org.apache.sis.util.UtilitiesTest.class,
+ org.apache.sis.util.VersionTest.class,
org.apache.sis.util.LocalesTest.class,
org.apache.sis.util.resources.IndexedResourceBundleTest.class,
org.apache.sis.util.logging.PerformanceLevelTest.class,
@@ -59,9 +60,10 @@ import org.junit.runners.Suite;
org.apache.sis.util.type.TypesTest.class,
org.apache.sis.util.type.SimpleInternationalStringTest.class,
org.apache.sis.util.type.DefaultInternationalStringTest.class,
-
- // Formatting
org.apache.sis.internal.util.LocalizedParseExceptionTest.class,
+
+ // Measurements and formatting.
+ org.apache.sis.measure.UnitsTest.class,
org.apache.sis.measure.FormattedCharacterIteratorTest.class,
org.apache.sis.measure.AngleFormatTest.class,
org.apache.sis.measure.AngleTest.class,
Modified:
sis/trunk/sis-utility/src/test/java/org/apache/sis/util/UtilitiesTest.java
URL:
http://svn.apache.org/viewvc/sis/trunk/sis-utility/src/test/java/org/apache/sis/util/UtilitiesTest.java?rev=1416136&r1=1416135&r2=1416136&view=diff
==============================================================================
--- sis/trunk/sis-utility/src/test/java/org/apache/sis/util/UtilitiesTest.java
(original)
+++ sis/trunk/sis-utility/src/test/java/org/apache/sis/util/UtilitiesTest.java
Sun Dec 2 08:11:16 2012
@@ -19,6 +19,7 @@ package org.apache.sis.util;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashSet;
+import org.apache.sis.test.TestCase;
import org.junit.*;
import static org.junit.Assert.*;
@@ -32,7 +33,7 @@ import static org.junit.Assert.*;
* @version 0.3
* @module
*/
-public final strictfp class UtilitiesTest {
+public final strictfp class UtilitiesTest extends TestCase {
/**
* Tests {@link Utilities#deepEquals(Object, Object, ComparisonMode)}.
*/