You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2012/10/16 07:31:32 UTC
svn commit: r1398651 - in /sis/branches/JDK6: ./
ide-project/NetBeans/nbproject/
sis-utility/src/main/java/org/apache/sis/internal/jaxb/
sis-utility/src/main/java/org/apache/sis/internal/simple/
sis-utility/src/main/java/org/apache/sis/internal/util/ s...
Author: desruisseaux
Date: Tue Oct 16 05:31:31 2012
New Revision: 1398651
URL: http://svn.apache.org/viewvc?rev=1398651&view=rev
Log:
Merge from the JDK7 branch.
Added:
sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/
- copied from r1398647, sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/jaxb/
sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/simple/
- copied from r1398647, sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/simple/
sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/xml/
- copied from r1398647, sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/xml/
sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/xml/
- copied from r1398647, sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/xml/
Modified:
sis/branches/JDK6/ (props changed)
sis/branches/JDK6/ide-project/NetBeans/nbproject/genfiles.properties
sis/branches/JDK6/ide-project/NetBeans/nbproject/project.xml
sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/NonMarshalledAuthority.java
sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/util/Objects.java
sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/Cache.java
sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/CheckedArrayList.java
sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/CheckedHashMap.java
sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/CheckedHashSet.java
sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/type/package-info.java
sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/xml/IdentifierSpace.java
sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java
sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/xml/XLink.java
sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/test/XMLComparator.java
sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
Propchange: sis/branches/JDK6/
------------------------------------------------------------------------------
Merged /sis/branches/JDK7:r1398216-1398650
Modified: sis/branches/JDK6/ide-project/NetBeans/nbproject/genfiles.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/ide-project/NetBeans/nbproject/genfiles.properties?rev=1398651&r1=1398650&r2=1398651&view=diff
==============================================================================
--- sis/branches/JDK6/ide-project/NetBeans/nbproject/genfiles.properties (original)
+++ sis/branches/JDK6/ide-project/NetBeans/nbproject/genfiles.properties Tue Oct 16 05:31:31 2012
@@ -3,6 +3,6 @@
build.xml.data.CRC32=58e6b21c
build.xml.script.CRC32=462eaba0
build.xml.stylesheet.CRC32=28e38971@1.53.1.46
-nbproject/build-impl.xml.data.CRC32=885115bc
-nbproject/build-impl.xml.script.CRC32=5fe86ff5
+nbproject/build-impl.xml.data.CRC32=47249144
+nbproject/build-impl.xml.script.CRC32=61cb3eb8
nbproject/build-impl.xml.stylesheet.CRC32=6ddba6b6@1.53.1.46
Modified: sis/branches/JDK6/ide-project/NetBeans/nbproject/project.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/ide-project/NetBeans/nbproject/project.xml?rev=1398651&r1=1398650&r2=1398651&view=diff
==============================================================================
--- sis/branches/JDK6/ide-project/NetBeans/nbproject/project.xml (original)
+++ sis/branches/JDK6/ide-project/NetBeans/nbproject/project.xml Tue Oct 16 05:31:31 2012
@@ -19,6 +19,14 @@
</data>
<spellchecker-wordlist xmlns="http://www.netbeans.org/ns/spellchecker-wordlist/1">
<word>bitmask</word>
+ <word>deserialization</word>
+ <word>deserialized</word>
+ <word>initially</word>
+ <word>marshallable</word>
+ <word>marshalled</word>
+ <word>marshalling</word>
+ <word>namespace</word>
+ <word>namespaces</word>
<word>Unicode</word>
</spellchecker-wordlist>
</configuration>
Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/NonMarshalledAuthority.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/NonMarshalledAuthority.java?rev=1398651&r1=1398647&r2=1398651&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/NonMarshalledAuthority.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/NonMarshalledAuthority.java Tue Oct 16 05:31:31 2012
@@ -179,7 +179,7 @@ public final class NonMarshalledAuthorit
for (final T candidate : identifiers) {
if (candidate != null && candidate.getAuthority() instanceof NonMarshalledAuthority<?>) {
if (filtered == null) {
- filtered = new ArrayList<>(remaining);
+ filtered = new ArrayList<T>(remaining);
}
filtered.add(candidate);
}
@@ -219,7 +219,7 @@ public final class NonMarshalledAuthorit
final Field field = Class.forName("org.apache.sis.metadata.iso.citation.DefaultCitation").getDeclaredField(name);
field.setAccessible(true);
return (IdentifierSpace<?>) field.get(null);
- } catch (ReflectiveOperationException e) {
+ } catch (Exception e) {
Logging.unexpectedException(NonMarshalledAuthority.class, "readResolve", e);
}
return null;
Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/util/Objects.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/util/Objects.java?rev=1398651&r1=1398650&r2=1398651&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/util/Objects.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/util/Objects.java Tue Oct 16 05:31:31 2012
@@ -157,4 +157,14 @@ public final class Objects {
}
return object1.equals(object2);
}
+
+ /**
+ * Delegates to {@link Arrays#hashCode(Object[])}.
+ *
+ * @param values The object for which to compute hash code values.
+ * @return The hash code value for the given objects.
+ */
+ public static int hash(Object... values) {
+ return Arrays.hashCode(values);
+ }
}
Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/Cache.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/Cache.java?rev=1398651&r1=1398650&r2=1398651&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/Cache.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/Cache.java Tue Oct 16 05:31:31 2012
@@ -32,6 +32,7 @@ import net.jcip.annotations.GuardedBy;
import net.jcip.annotations.ThreadSafe;
import org.apache.sis.util.Disposable;
+import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.internal.util.ReferenceQueueConsumer;
@@ -204,14 +205,8 @@ public class Cache<K,V> extends Abstract
* @param soft If {@code true}, use {@link SoftReference} instead of {@link WeakReference}.
*/
public Cache(int initialCapacity, final long costLimit, final boolean soft) {
- if (initialCapacity < 1) {
- throw new IllegalArgumentException(Errors.format(
- Errors.Keys.IllegalArgumentValue_2, "initialCapacity", initialCapacity));
- }
- if (costLimit < 0) {
- throw new IllegalArgumentException(Errors.format(
- Errors.Keys.IllegalArgumentValue_2, "costLimit", costLimit));
- }
+ ArgumentChecks.ensureStrictlyPositive("initialCapacity", initialCapacity);
+ ArgumentChecks.ensurePositive("costLimit", costLimit);
initialCapacity = Collections.hashMapCapacity(initialCapacity);
this.map = new ConcurrentHashMap<K,Object>(initialCapacity);
this.costs = new LinkedHashMap<K,Integer>((int) Math.min(initialCapacity, costLimit), 0.75f, true);
Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/CheckedArrayList.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/CheckedArrayList.java?rev=1398651&r1=1398650&r2=1398651&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/CheckedArrayList.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/CheckedArrayList.java Tue Oct 16 05:31:31 2012
@@ -22,6 +22,7 @@ import java.util.ListIterator;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.NoSuchElementException;
import net.jcip.annotations.ThreadSafe;
import org.apache.sis.util.Decorator;
import org.apache.sis.util.resources.Errors;
@@ -169,29 +170,113 @@ public class CheckedArrayList<E> extends
/**
* A synchronized iterator with a check for write permission prior element removal.
+ * This class wraps the iterator provided by {@link ArrayList#iterator()}, and is
+ * also the base class for the wrapper around {@link ArrayList#listIterator()}.
+ *
+ * @see CheckedArrayList#iterator()
*/
@ThreadSafe
@Decorator(Iterator.class)
- private class Iter<E,I extends Iterator<E>> implements Iterator<E> {
- final I iterator;
- Iter(final I iterator) {this.iterator = iterator;}
- @Override public final boolean hasNext() {synchronized (getLock()) {return iterator.hasNext();}}
- @Override public final E next() {synchronized (getLock()) {return iterator.next();}}
- @Override public final void remove() {synchronized (getLock()) {checkWritePermission(); iterator.remove();}}
+ private class Iter<I extends Iterator<E>> implements Iterator<E> {
+ /** The {@link ArrayList} iterator. */
+ protected final I iterator;
+
+ /** Creates a new wrapper for the given {@link ArrayList} iterator. */
+ Iter(final I iterator) {
+ this.iterator = iterator;
+ }
+
+ /** Returns {@code true} if there is more elements in the iteration. */
+ @Override
+ public final boolean hasNext() {
+ synchronized (getLock()) {
+ return iterator.hasNext();
+ }
+ }
+
+ /** Returns the next element in the iteration. */
+ @Override
+ public final E next() throws NoSuchElementException {
+ synchronized (getLock()) {
+ return iterator.next();
+ }
+ }
+
+ /** Removes the previous element if the enclosing {@link CheckedArrayList} allows write operations. */
+ @Override
+ public final void remove() throws UnsupportedOperationException {
+ synchronized (getLock()) {
+ checkWritePermission();
+ iterator.remove();
+ }
+ }
}
/**
* A synchronized list iterator with a check for write permission prior element removal.
+ * This class wraps the iterator provided by {@link ArrayList#listIterator()}.
+ *
+ * @see CheckedArrayList#listIterator()
+ * @see CheckedArrayList#listIterator(int)
*/
@Decorator(ListIterator.class)
- private class ListIter<E> extends Iter<E,ListIterator<E>> implements ListIterator<E> {
- ListIter(final ListIterator<E> iterator) {super(iterator);}
- @Override public int nextIndex() {synchronized (getLock()) {return iterator.nextIndex();}}
- @Override public int previousIndex() {synchronized (getLock()) {return iterator.previousIndex();}}
- @Override public boolean hasPrevious() {synchronized (getLock()) {return iterator.hasPrevious();}}
- @Override public E previous() {synchronized (getLock()) {return iterator.previous();}}
- @Override public void set(final E e) {synchronized (getLock()) {checkWritePermission(); iterator.set(e);}}
- @Override public void add(final E e) {synchronized (getLock()) {checkWritePermission(); iterator.add(e);}}
+ private class ListIter extends Iter<ListIterator<E>> implements ListIterator<E> {
+ /** Creates a new wrapper for the given {@link ArrayList} list iterator. */
+ ListIter(final ListIterator<E> iterator) {
+ super(iterator);
+ }
+
+ /** Returns the index of the element to be returned by {@link #next()}. */
+ @Override
+ public int nextIndex() {
+ synchronized (getLock()) {
+ return iterator.nextIndex();
+ }
+ }
+
+ /** Returns the index of the element to be returned by {@link #previous()}. */
+ @Override
+ public int previousIndex() {
+ synchronized (getLock()) {
+ return iterator.previousIndex();
+ }
+ }
+
+ /** Returns {@code true} if there is elements before current position. */
+ @Override
+ public boolean hasPrevious() {
+ synchronized (getLock()) {
+ return iterator.hasPrevious();
+ }
+ }
+
+ /** Returns the previous element in the iteration. */
+ @Override
+ public E previous() throws NoSuchElementException {
+ synchronized (getLock()) {
+ return iterator.previous();
+ }
+ }
+
+ /** See the {@link CheckedArrayList#set(int, Object)} method contract. */
+ @Override
+ public void set(final E element) throws IllegalArgumentException, UnsupportedOperationException {
+ ensureValid(element);
+ synchronized (getLock()) {
+ checkWritePermission();
+ iterator.set(element);
+ }
+ }
+
+ /** See the {@link CheckedArrayList#add(Object)} method contract. */
+ @Override
+ public void add(final E element) throws IllegalArgumentException, UnsupportedOperationException {
+ ensureValid(element);
+ synchronized (getLock()) {
+ checkWritePermission();
+ iterator.add(element);
+ }
+ }
}
/**
@@ -202,7 +287,7 @@ public class CheckedArrayList<E> extends
@Override
public Iterator<E> iterator() {
synchronized (getLock()) {
- return new Iter<E,Iterator<E>>(super.iterator());
+ return new Iter<Iterator<E>>(super.iterator());
}
}
@@ -215,7 +300,7 @@ public class CheckedArrayList<E> extends
@Override
public ListIterator<E> listIterator() {
synchronized (getLock()) {
- return new ListIter<E>(super.listIterator());
+ return new ListIter(super.listIterator());
}
}
@@ -228,7 +313,7 @@ public class CheckedArrayList<E> extends
@Override
public ListIterator<E> listIterator(final int index) {
synchronized (getLock()) {
- return new ListIter<E>(super.listIterator(index));
+ return new ListIter(super.listIterator(index));
}
}
Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/CheckedHashMap.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/CheckedHashMap.java?rev=1398651&r1=1398650&r2=1398651&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/CheckedHashMap.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/CheckedHashMap.java Tue Oct 16 05:31:31 2012
@@ -22,6 +22,7 @@ import java.util.Iterator;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashMap;
+import java.util.NoSuchElementException;
import net.jcip.annotations.ThreadSafe;
import org.apache.sis.util.Decorator;
import org.apache.sis.util.resources.Errors;
@@ -344,15 +345,43 @@ public class CheckedHashMap<K,V> extends
/**
* A synchronized iterator with a check for write permission prior element removal.
+ * This class wraps the iterator provided by the {@link LinkedHashMap} views.
*/
@ThreadSafe
@Decorator(Iterator.class)
private final class Iter<E> implements Iterator<E> {
- final Iterator<E> iterator;
- Iter(final Iterator<E> iterator) {this.iterator = iterator;}
- @Override public boolean hasNext() {synchronized (getLock()) {return iterator.hasNext();}}
- @Override public E next() {synchronized (getLock()) {return iterator.next();}}
- @Override public void remove() {synchronized (getLock()) {checkWritePermission(); iterator.remove();}}
+ /** The {@link LinkedHashMap} iterator. */
+ private final Iterator<E> iterator;
+
+ /** Creates a new wrapper for the given {@link LinkedHashMap} iterator. */
+ Iter(final Iterator<E> iterator) {
+ this.iterator = iterator;
+ }
+
+ /** Returns {@code true} if there is more elements in the iteration. */
+ @Override
+ public boolean hasNext() {
+ synchronized (getLock()) {
+ return iterator.hasNext();
+ }
+ }
+
+ /** Returns the next element in the iteration. */
+ @Override
+ public E next() throws NoSuchElementException {
+ synchronized (getLock()) {
+ return iterator.next();
+ }
+ }
+
+ /** Removes the previous element if the enclosing {@link CheckedHashMap} allows write operations. */
+ @Override
+ public void remove() throws UnsupportedOperationException {
+ synchronized (getLock()) {
+ checkWritePermission();
+ iterator.remove();
+ }
+ }
}
/**
@@ -363,34 +392,141 @@ public class CheckedHashMap<K,V> extends
@ThreadSafe
@Decorator(Collection.class)
private class Sync<E> implements Collection<E> {
- /**
- * The {@link Map#keySet()}, {@link Map#values()} or {@link Map#entrySet()} view.
- */
+ /** The {@link Map#keySet()}, {@link Map#values()} or {@link Map#entrySet()} view. */
private final Collection<E> view;
- /**
- * Create a new synchronized wrapper for the given view.
- */
+ /** Create a new synchronized wrapper for the given view. */
Sync(final Collection<E> view) {
this.view = view;
}
- @Override public final void clear() {synchronized (getLock()) { view.clear ( );}}
- @Override public final int size() {synchronized (getLock()) { return view.size ( );}}
- @Override public final boolean isEmpty() {synchronized (getLock()) { return view.isEmpty ( );}}
- @Override public final boolean contains(Object o) {synchronized (getLock()) { return view.contains (o);}}
- @Override public final boolean containsAll(Collection<?> c) {synchronized (getLock()) { return view.containsAll(c);}}
- @Override public final boolean add(E e) {synchronized (getLock()) {checkWritePermission(); return view.add (e);}}
- @Override public final boolean addAll(Collection<? extends E> c) {synchronized (getLock()) {checkWritePermission(); return view.addAll (c);}}
- @Override public final boolean remove(Object o) {synchronized (getLock()) {checkWritePermission(); return view.remove (o);}}
- @Override public final boolean removeAll(Collection<?> c) {synchronized (getLock()) {checkWritePermission(); return view.removeAll (c);}}
- @Override public final boolean retainAll(Collection<?> c) {synchronized (getLock()) {checkWritePermission(); return view.retainAll (c);}}
- @Override public final Object[] toArray() {synchronized (getLock()) { return view.toArray ( );}}
- @Override public final <T> T[] toArray(T[] a) {synchronized (getLock()) { return view.toArray (a);}}
- @Override public final String toString() {synchronized (getLock()) { return view.toString ( );}}
- @Override public final boolean equals(Object o) {synchronized (getLock()) { return view.equals (o);}}
- @Override public final int hashCode() {synchronized (getLock()) { return view.hashCode ( );}}
- @Override public final Iterator<E> iterator() {synchronized (getLock()) {return new Iter<E>(view.iterator());}}
+ /** Returns a synchronized and checked iterator over the elements in this collection. */
+ @Override
+ public final Iterator<E> iterator() {
+ synchronized (getLock()) {
+ return new Iter<E>(view.iterator());
+ }
+ }
+
+ /** Returns the number of elements in the collection. */
+ @Override
+ public final int size() {
+ synchronized (getLock()) {
+ return view.size();
+ }
+ }
+
+ /** Returns {@code true} if the collection is empty. */
+ @Override
+ public final boolean isEmpty() {
+ synchronized (getLock()) {
+ return view.isEmpty();
+ }
+ }
+
+ /** Returns {@code true} if the collection contains the given element. */
+ @Override
+ public final boolean contains(final Object element) {
+ synchronized (getLock()) {
+ return view.contains(element);
+ }
+ }
+
+ /** Returns {@code true} if the collection contains all elements of the given collection. */
+ @Override
+ public final boolean containsAll(final Collection<?> collection) {
+ synchronized (getLock()) {
+ return view.containsAll(collection);
+ }
+ }
+
+ /** Always unsupported operation in hash map views. */
+ @Override
+ public final boolean add(final E element) throws UnsupportedOperationException {
+ throw new UnsupportedOperationException(Errors.format(Errors.Keys.UnsupportedOperation_1, "add"));
+ }
+
+ /** Always unsupported operation in hash map views. */
+ @Override
+ public final boolean addAll(final Collection<? extends E> collection) throws UnsupportedOperationException {
+ throw new UnsupportedOperationException(Errors.format(Errors.Keys.UnsupportedOperation_1, "addAll"));
+ }
+
+ /** Remove the given element if the enclosing {@link CheckedHashMap} supports write operations. */
+ @Override
+ public final boolean remove(final Object element) throws UnsupportedOperationException {
+ synchronized (getLock()) {
+ checkWritePermission();
+ return view.remove(element);
+ }
+ }
+
+ /** Remove the given elements if the enclosing {@link CheckedHashMap} supports write operations. */
+ @Override
+ public final boolean removeAll(final Collection<?> collection) throws UnsupportedOperationException {
+ synchronized (getLock()) {
+ checkWritePermission();
+ return view.removeAll(collection);
+ }
+ }
+
+ /** Retains only the given elements if the enclosing {@link CheckedHashMap} supports write operations. */
+ @Override
+ public final boolean retainAll(final Collection<?> collection) throws UnsupportedOperationException {
+ synchronized (getLock()) {
+ checkWritePermission();
+ return view.retainAll(collection);
+ }
+ }
+
+ /** Removes all elements from the collection. */
+ @Override
+ public final void clear() throws UnsupportedOperationException {
+ synchronized (getLock()) {
+ checkWritePermission();
+ view.clear();
+ }
+ }
+
+ /** Returns the elements in an array. */
+ @Override
+ public final Object[] toArray() {
+ synchronized (getLock()) {
+ return view.toArray();
+ }
+ }
+
+ /** Returns the elements in an array. */
+ @Override
+ public final <T> T[] toArray(final T[] array) {
+ synchronized (getLock()) {
+ return view.toArray(array);
+ }
+ }
+
+ /** Returns a string representation of the elements. */
+ @Override
+ public final String toString() {
+ synchronized (getLock()) {
+ return view.toString();
+ }
+ }
+
+ /** Compare this collection with the given object for equality. */
+ @Override
+ public final boolean equals(final Object other) {
+ synchronized (getLock()) {
+ return view.equals(other);
+ }
+ }
+
+ /** Returns a hash code value for this collection. */
+ @Override
+ public final int hashCode() {
+ synchronized (getLock()) {
+ return view.hashCode();
+ }
+ }
}
/**
@@ -399,9 +535,7 @@ public class CheckedHashMap<K,V> extends
*/
@Decorator(Set.class)
private final class SyncSet<E> extends Sync<E> implements Set<E> {
- /**
- * Create a new synchronized wrapper for the given view.
- */
+ /** Create a new synchronized wrapper for the given view. */
SyncSet(final Set<E> set) {
super(set);
}
Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/CheckedHashSet.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/CheckedHashSet.java?rev=1398651&r1=1398650&r2=1398651&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/CheckedHashSet.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/CheckedHashSet.java Tue Oct 16 05:31:31 2012
@@ -21,6 +21,7 @@ import java.util.Iterator;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashSet;
+import java.util.NoSuchElementException;
import net.jcip.annotations.ThreadSafe;
import org.apache.sis.util.Decorator;
import org.apache.sis.util.resources.Errors;
@@ -168,15 +169,45 @@ public class CheckedHashSet<E> extends L
/**
* A synchronized iterator with a check for write permission prior element removal.
+ * This class wraps the iterator provided by {@link LinkedHashSet#iterator()}.
+ *
+ * @see CheckedHashSet#iterator()
*/
@ThreadSafe
@Decorator(Iterator.class)
- private final class Iter<E> implements Iterator<E> {
- final Iterator<E> iterator;
- Iter(final Iterator<E> iterator) {this.iterator = iterator;}
- @Override public boolean hasNext() {synchronized (getLock()) {return iterator.hasNext();}}
- @Override public E next() {synchronized (getLock()) {return iterator.next();}}
- @Override public void remove() {synchronized (getLock()) {checkWritePermission(); iterator.remove();}}
+ private final class Iter implements Iterator<E> {
+ /** The {@link LinkedHashSet} iterator. */
+ private final Iterator<E> iterator;
+
+ /** Creates a new wrapper for the given {@link LinkedHashSet} iterator. */
+ Iter(final Iterator<E> iterator) {
+ this.iterator = iterator;
+ }
+
+ /** Returns {@code true} if there is more elements in the iteration. */
+ @Override
+ public boolean hasNext() {
+ synchronized (getLock()) {
+ return iterator.hasNext();
+ }
+ }
+
+ /** Returns the next element in the iteration. */
+ @Override
+ public E next() throws NoSuchElementException {
+ synchronized (getLock()) {
+ return iterator.next();
+ }
+ }
+
+ /** Removes the previous element if the enclosing {@link CheckedHashSet} allows write operations. */
+ @Override
+ public void remove() throws UnsupportedOperationException {
+ synchronized (getLock()) {
+ checkWritePermission();
+ iterator.remove();
+ }
+ }
}
/**
@@ -187,7 +218,7 @@ public class CheckedHashSet<E> extends L
@Override
public Iterator<E> iterator() {
synchronized (getLock()) {
- return new Iter<E>(super.iterator());
+ return new Iter(super.iterator());
}
}
Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java?rev=1398651&r1=1398650&r2=1398651&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java Tue Oct 16 05:31:31 2012
@@ -51,6 +51,11 @@ public final class Errors extends Indexe
public static final int EmptyArgument_1 = 1;
/**
+ * Attribute â{0}â is not allowed for an object of type â{1}â.
+ */
+ public static final int ForbiddenAttribute_2 = 21;
+
+ /**
* Argument â{0}â can not be an instance of â{1}â.
*/
public static final int IllegalArgumentClass_2 = 17;
@@ -92,6 +97,11 @@ public final class Errors extends Indexe
public static final int IllegalRange_2 = 11;
/**
+ * Value â{1}â of attribute â{0}â is inconsistent with other attributes.
+ */
+ public static final int InconsistentAttribute_2 = 27;
+
+ /**
* Index {0} is out of bounds.
*/
public static final int IndexOutOfBounds_1 = 4;
@@ -102,6 +112,11 @@ public final class Errors extends Indexe
public static final int KeyCollision_1 = 19;
/**
+ * Attribute â{0}â is mandatory for an object of type â{1}â.
+ */
+ public static final int MandatoryAttribute_2 = 22;
+
+ /**
* Argument â{0}â shall not be negative. The given value was {1}.
*/
public static final int NegativeArgument_2 = 8;
@@ -132,6 +147,31 @@ public final class Errors extends Indexe
public static final int UnexpectedArgumentDimension_3 = 5;
/**
+ * This affine transform is unmodifiable.
+ */
+ public static final int UnmodifiableAffineTransform = 23;
+
+ /**
+ * This geometry is unmodifiable.
+ */
+ public static final int UnmodifiableGeometry = 24;
+
+ /**
+ * This metadata is unmodifiable.
+ */
+ public static final int UnmodifiableMetadata = 25;
+
+ /**
+ * Object â{0}â is unmodifiable.
+ */
+ public static final int UnmodifiableObject_1 = 26;
+
+ /**
+ * The â{0}â operation is unsupported.
+ */
+ public static final int UnsupportedOperation_1 = 20;
+
+ /**
* A value is already defined for â{0}â.
*/
public static final int ValueAlreadyDefined_1 = 13;
Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties?rev=1398651&r1=1398650&r2=1398651&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties Tue Oct 16 05:31:31 2012
@@ -15,6 +15,7 @@
# limitations under the License.
#
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.
@@ -23,14 +24,21 @@ IllegalBitsPattern_1 = Illega
IllegalClass_2 = Class \u2018{0}\u2019 is illegal. It must be \u2018{1}\u2019 or a derived class.
IllegalLanguageCode_1 = The \u201c{0}\u201d language is not recognized.
IllegalRange_2 = Range [{0} \u2026 {1}] is not valid.
+InconsistentAttribute_2 = Value \u201c{1}\u201d of attribute \u2018{0}\u2019 is inconsistent with other attributes.
IndexOutOfBounds_1 = Index {0} is out of bounds.
KeyCollision_1 = A different value is already associated to the \u201c{0}\u201d key.
+MandatoryAttribute_2 = Attribute \u201c{0}\u201d is mandatory for an object of type \u2018{1}\u2019.
NegativeArgument_2 = Argument \u2018{0}\u2019 shall not be negative. The given value was {1}.
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.
RecursiveCreateCallForKey_1 = Recursive call while creating an object for the \u201c{0}\u201d key.
UnexpectedArgumentDimension_3 = Argument \u2018{0}\u2019 has {1} dimensions, while {2} was expected.
+UnmodifiableAffineTransform = This affine transform is unmodifiable.
+UnmodifiableGeometry = This geometry is unmodifiable.
+UnmodifiableMetadata = This metadata is unmodifiable.
+UnmodifiableObject_1 = Object \u2018{0}\u2019 is unmodifiable.
+UnsupportedOperation_1 = The \u2018{0}\u2019 operation is unsupported.
ValueAlreadyDefined_1 = A value is already defined for \u201c{0}\u201d.
ValueNotGreaterThanZero_2 = Value \u2018{0}\u2019={1} is invalid. Expected a number greater than 0.
ValueOutOfRange_4 = Value \u2018{0}\u2019={1} is invalid. Expected a value in the [{2} \u2026 {3}] range.
Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties?rev=1398651&r1=1398650&r2=1398651&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties Tue Oct 16 05:31:31 2012
@@ -15,6 +15,7 @@
# limitations under the License.
#
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.
@@ -23,14 +24,21 @@ IllegalBitsPattern_1 = Patter
IllegalClass_2 = La classe \u2018{0}\u2019 est ill\u00e9gale. Il doit s\u2019agir d\u2019une classe \u2018{1}\u2019 ou d\u00e9riv\u00e9e.
IllegalLanguageCode_1 = Le code de langue \u201c{0}\u201d n\u2019est pas reconnu.
IllegalRange_2 = La plage [{0} \u2026 {1}] n\u2019est pas valide.
+InconsistentAttribute_2 = La valeur \u201c{1}\u201d de l\u2019attribut \u2018{0}\u2019 n\u2019est pas coh\u00e9rente avec celles des autres attributs.
IndexOutOfBounds_1 = L\u2019index {0} est en dehors des limites permises.
KeyCollision_1 = Une valeur diff\u00e9rente est d\u00e9j\u00e0 associ\u00e9e \u00e0 la cl\u00e9 \u201c{0}\u201d.
+MandatoryAttribute_2 = L\u2019attribut \u201c{0}\u201d est obligatoire pour un objet de type \u2018{1}\u2019.
NegativeArgument_2 = L\u2019argument \u2018{0}\u2019 ne doit pas \u00eatre n\u00e9gatif. La valeur donn\u00e9e \u00e9tait {1}.
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.
RecursiveCreateCallForKey_1 = Appel r\u00e9cursif lors de la cr\u00e9ation d\u2019un objet pour la cl\u00e9 \u201c{0}\u201d.
UnexpectedArgumentDimension_3 = L\u2019argument \u2018{0}\u2019 a {1} dimensions, alors qu\u2019on en attendait {2}.
+UnmodifiableAffineTransform = Cette transformation affine n\u2019est pas modifiable.
+UnmodifiableGeometry = Cette g\u00e9om\u00e9trie n\u2019est pas modifiable.
+UnmodifiableMetadata = Cette m\u00e9ta-donn\u00e9e n\u2019est pas modifiable.
+UnmodifiableObject_1 = L\u2019objet \u2018{0}\u2019 n\u2019est pas modifiable.
+UnsupportedOperation_1 = L\u2019op\u00e9ration \u2018{0}\u2019 n\u2019est pas support\u00e9e.
ValueAlreadyDefined_1 = Une valeur est d\u00e9j\u00e0 d\u00e9finie pour \u201c{0}\u201d.
ValueNotGreaterThanZero_2 = La valeur \u2018{0}\u2019={1} n\u2019est pas valide. On attendait un nombre positif non-nul.
ValueOutOfRange_4 = La valeur \u2018{0}\u2019={1} est invalide. Une valeur dans la plage [{2} \u2026 {3}] \u00e9tait attendue.
Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/type/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/type/package-info.java?rev=1398651&r1=1398650&r2=1398651&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/type/package-info.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/type/package-info.java Tue Oct 16 05:31:31 2012
@@ -30,7 +30,7 @@
* </li>
* <li>Implementations of {@link org.opengis.util.GenericName}:
* <ul>
- * <li>{@link org.apache.sis.util.type.DefaultLocalName} for identifier within a name space.</li>
+ * <li>{@link org.apache.sis.util.type.DefaultLocalName} for identifier within a namespace.</li>
* <li>{@link org.apache.sis.util.type.DefaultScopedName} for a composite of a <cite>head</cite>
* name and a <cite>tail</cite> name.</li>
* </ul>
Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/xml/IdentifierSpace.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/xml/IdentifierSpace.java?rev=1398651&r1=1398647&r2=1398651&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/xml/IdentifierSpace.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/xml/IdentifierSpace.java Tue Oct 16 05:31:31 2012
@@ -63,7 +63,7 @@ public interface IdentifierSpace<T> exte
*
* @see javax.xml.bind.annotation.XmlID
*/
- IdentifierSpace<String> ID = new NonMarshalledAuthority<>("gml:id", NonMarshalledAuthority.ID);
+ IdentifierSpace<String> ID = new NonMarshalledAuthority<String>("gml:id", NonMarshalledAuthority.ID);
/**
* An optional attribute available on every object-with-identity provided in the GMD schemas
@@ -74,7 +74,7 @@ public interface IdentifierSpace<T> exte
*
* @see UUID
*/
- IdentifierSpace<UUID> UUID = new NonMarshalledAuthority<>("gco:uuid", NonMarshalledAuthority.UUID);
+ IdentifierSpace<UUID> UUID = new NonMarshalledAuthority<UUID>("gco:uuid", NonMarshalledAuthority.UUID);
/**
* An optional attribute for URN to an external resources, or to an other part of a XML
@@ -86,7 +86,7 @@ public interface IdentifierSpace<T> exte
*
* @see XLink#getHRef()
*/
- IdentifierSpace<URI> HREF = new NonMarshalledAuthority<>("xlink:href", NonMarshalledAuthority.HREF);
+ IdentifierSpace<URI> HREF = new NonMarshalledAuthority<URI>("xlink:href", NonMarshalledAuthority.HREF);
/**
* Any XML attributes defined by OGC in the
@@ -96,7 +96,7 @@ public interface IdentifierSpace<T> exte
*
* @see XLink
*/
- IdentifierSpace<XLink> XLINK = new NonMarshalledAuthority<>("xlink", NonMarshalledAuthority.XLINK);
+ IdentifierSpace<XLink> XLINK = new NonMarshalledAuthority<XLink>("xlink", NonMarshalledAuthority.XLINK);
/**
* Returns the name of this identifier space.
Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java?rev=1398651&r1=1398647&r2=1398651&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java Tue Oct 16 05:31:31 2012
@@ -129,7 +129,7 @@ public final class Namespaces extends St
*/
private static final Map<String,String> SPECIFIC_URLS;
static {
- final Map<String,String> p = new HashMap<>(40);
+ final Map<String,String> p = new HashMap<String,String>(40);
p.put(XMLConstants.W3C_XML_SCHEMA_NS_URI, "xsd");
p.put(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "xsi");
p.put("http://www.w3.org/2004/02/skos/core#", "skos");
Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/xml/XLink.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/xml/XLink.java?rev=1398651&r1=1398647&r2=1398651&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/xml/XLink.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/xml/XLink.java Tue Oct 16 05:31:31 2012
@@ -18,7 +18,6 @@ package org.apache.sis.xml;
import java.net.URI;
import java.util.Locale;
-import java.util.Objects;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
@@ -31,6 +30,9 @@ import org.apache.sis.util.Classes;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.resources.Errors;
+// Related to JDK7
+import org.apache.sis.internal.util.Objects;
+
/**
* The XML attributes defined by OGC in the
Modified: sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/test/XMLComparator.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/test/XMLComparator.java?rev=1398651&r1=1398650&r2=1398651&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/test/XMLComparator.java (original)
+++ sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/test/XMLComparator.java Tue Oct 16 05:31:31 2012
@@ -87,10 +87,10 @@ public strictfp class XMLComparator {
/**
* The fully-qualified name of attributes to ignore in comparisons. The name shall be in
- * the form {@code "namespace:name"}, or only {@code "name"} if there is no name space.
- * In order to ignore everything in a name space, use {@code "namespace:*"}.
+ * the form {@code "namespace:name"}, or only {@code "name"} if there is no namespace.
+ * In order to ignore everything in a namespace, use {@code "namespace:*"}.
* <p>
- * For example in order to ignore the name space, type and schema location declaration,
+ * For example in order to ignore the namespace, type and schema location declaration,
* the following strings can be added in this set:
*
* {@preformat text
@@ -105,8 +105,8 @@ public strictfp class XMLComparator {
/**
* The fully-qualified name of nodes to ignore in comparisons. The name shall be in the form
- * {@code "namespace:name"}, or only {@code "name"} if there is no name space. In order to
- * ignore everything in a name space, use {@code "namespace:*"}.
+ * {@code "namespace:name"}, or only {@code "name"} if there is no namespace. In order to
+ * ignore everything in a namespace, use {@code "namespace:*"}.
* <p>
* This set provides a way to ignore a node of the given name <em>and all its children</em>.
* In order to ignore a node but still compare its children, override the
@@ -364,10 +364,10 @@ public strictfp class XMLComparator {
}
/**
- * Compares the names and name spaces of the given node.
+ * Compares the names and namespaces of the given node.
* Subclasses can override this method if they need a different comparison.
*
- * @param expected The node having the expected name and name space.
+ * @param expected The node having the expected name and namespace.
* @param actual The node to compare.
*/
protected void compareNames(final Node expected, final Node actual) {
@@ -416,7 +416,7 @@ public strictfp class XMLComparator {
* Returns {@code true} if the given node or attribute shall be ignored.
*
* @param ignored The set of node or attribute fully qualified names to ignore.
- * @param ns The node or attribute name space, or {@code null}.
+ * @param ns The node or attribute namespace, or {@code null}.
* @param name The node or attribute name.
* @return {@coce true} if the node or attribute shall be ignored.
*/
@@ -493,7 +493,7 @@ public strictfp class XMLComparator {
* Verifies that the given property (text or number) are equal, ignoring spaces. If they are
* not equal, then an error message is formatted using the given property name and nodes.
*
- * @param propertyName The name of the property being compared (typically "name", "name space", etc.).
+ * @param propertyName The name of the property being compared (typically "name", "namespace", etc.).
* @param expected The property value from the expected node to compare.
* @param actual The property value to compare to the expected one.
* @param expectedNode The node from which the expected property has been fetched.
Modified: sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java?rev=1398651&r1=1398650&r2=1398651&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java (original)
+++ sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java Tue Oct 16 05:31:31 2012
@@ -48,7 +48,8 @@ import org.junit.runners.Suite;
org.apache.sis.internal.util.ReferenceQueueConsumerTest.class,
org.apache.sis.util.collection.WeakHashSetTest.class,
org.apache.sis.util.collection.WeakValueHashMapTest.class,
- org.apache.sis.util.collection.CacheTest.class
+ org.apache.sis.util.collection.CacheTest.class,
+ org.apache.sis.xml.XLinkTest.class
})
public final strictfp class UtilityTestSuite extends TestSuite {
}