Author: desruisseaux
Date: Mon Feb 23 20:38:45 2015
New Revision: 1661771
URL: http://svn.apache.org/r1661771
Log:
Merge bug fix from the JDK8 branch.
Added:
sis/branches/JDK7/application/sis-console/src/main/artifact/conf/
- copied from r1661768,
sis/branches/JDK8/application/sis-console/src/main/artifact/conf/
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySet.java
- copied, changed from r1661768,
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySet.java
sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/util/LazySetTest.java
- copied unchanged from r1661768,
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/util/LazySetTest.java
Modified:
sis/branches/JDK7/ (props changed)
sis/branches/JDK7/application/sis-console/src/main/artifact/bin/sis
sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/Command.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Affine.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorParameters.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/OperationMethodSet.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AffineTest.java
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/TensorValuesTest.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Constants.java
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages_fr.properties
sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
Propchange: sis/branches/JDK7/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Feb 23 20:38:45 2015
@@ -1,4 +1,4 @@
/sis/branches/Android:1430670-1480699
/sis/branches/JDK6:1394913-1508480
-/sis/branches/JDK8:1584960-1661572
+/sis/branches/JDK8:1584960-1661768
/sis/trunk:1394364-1508466,1519089-1519674
Modified: sis/branches/JDK7/application/sis-console/src/main/artifact/bin/sis
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/application/sis-console/src/main/artifact/bin/sis?rev=1661771&r1=1661770&r2=1661771&view=diff
==============================================================================
--- sis/branches/JDK7/application/sis-console/src/main/artifact/bin/sis [UTF-8]
(original)
+++ sis/branches/JDK7/application/sis-console/src/main/artifact/bin/sis [UTF-8]
Mon Feb 23 20:38:45 2015
@@ -29,4 +29,6 @@ then
fi
# Execute SIS with any optional JAR that the user may put in the 'lib'
directory.
-java -classpath "$BASE_DIR/lib/*" org.apache.sis.console.Command $SIS_OPTS "$@"
+java -classpath "$BASE_DIR/lib/*" \
+ -Djava.util.logging.config.file="$BASE_DIR/conf/logging.properties" \
+ org.apache.sis.console.Command $SIS_OPTS "$@"
Modified:
sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/Command.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/Command.java?rev=1661771&r1=1661770&r2=1661771&view=diff
==============================================================================
---
sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/Command.java
[UTF-8] (original)
+++
sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/Command.java
[UTF-8] Mon Feb 23 20:38:45 2015
@@ -17,6 +17,8 @@
package org.apache.sis.console;
import java.util.Locale;
+import java.util.logging.LogManager;
+import java.util.logging.ConsoleHandler;
import java.io.Console;
import java.io.PrintStream;
import java.io.PrintWriter;
@@ -62,7 +64,7 @@ import org.apache.sis.util.logging.Monol
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3
- * @version 0.4
+ * @version 0.6
* @module
*/
public final class Command {
@@ -229,7 +231,24 @@ public final class Command {
* @param args Command-line options.
*/
public static void main(final String[] args) {
- MonolineFormatter.install();
+ /*
+ * The logging configuration is given by the "conf/logging.properties"
file in the Apache SIS
+ * installation directory. By default, that configuration file
contains the following line:
+ *
+ * java.util.logging.ConsoleHandler.formatter =
org.apache.sis.util.logging.MonolineFormatter
+ *
+ * However this configuration is silently ignored by LogManager at JVM
startup time, probably
+ * because the Apache SIS class is not on the system classpath. So we
check again for this
+ * configuration line here, and manually install our log formatter
only if the above-cited
+ * line is present.
+ */
+ final LogManager manager = LogManager.getLogManager();
+ if
(MonolineFormatter.class.getName().equals(manager.getProperty(ConsoleHandler.class.getName()
+ ".formatter"))) {
+ MonolineFormatter.install();
+ }
+ /*
+ * Now run the command.
+ */
final Command c;
try {
c = new Command(args);
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Affine.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Affine.java?rev=1661771&r1=1661770&r2=1661771&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Affine.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Affine.java
[UTF-8] Mon Feb 23 20:38:45 2015
@@ -36,7 +36,7 @@ import org.apache.sis.referencing.operat
/**
- * The provider for "<cite>Affine general parametric transformation</cite>"
(EPSG:9624).
+ * The provider for "<cite>Affine parametric transformation</cite>"
(EPSG:9624).
* The set of available parameters depends on the matrix size, which is 3×3 by
default.
*
* <table class="sis">
@@ -74,7 +74,7 @@ public final class Affine extends Abstra
*
* @see org.apache.sis.internal.util.Constants#AFFINE
*/
- public static final String NAME = "Affine general parametric
transformation";
+ public static final String NAME = "Affine parametric transformation";
/**
* The EPSG:9624 compliant instance, created when first needed.
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorParameters.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorParameters.java?rev=1661771&r1=1661770&r2=1661771&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorParameters.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorParameters.java
[UTF-8] Mon Feb 23 20:38:45 2015
@@ -30,7 +30,6 @@ import org.opengis.parameter.ParameterVa
import org.opengis.parameter.ParameterDescriptor;
import org.opengis.parameter.ParameterDescriptorGroup;
import org.opengis.parameter.GeneralParameterValue;
-import org.opengis.parameter.GeneralParameterDescriptor;
import org.opengis.parameter.ParameterNotFoundException;
import org.opengis.parameter.InvalidParameterNameException;
import org.opengis.metadata.Identifier;
@@ -186,7 +185,7 @@ public class TensorParameters<E> impleme
*
* {@section Relationship with EPSG}
* The above-cited group of parameters are close, but not identical, to
the definitions provided
- * by the <cite>"Affine general parametric transformation"</cite>
(EPSG:9624) operation method.
+ * by the <cite>"Affine parametric transformation"</cite> (EPSG:9624)
operation method.
* The differences are:
*
* <ul>
@@ -377,7 +376,7 @@ public class TensorParameters<E> impleme
* <tr><th>Rank</th> <th>Type</th> <th>Used with</th></tr>
* <tr><td>0</td> <td>scalar</td> <td></td></tr>
* <tr><td>1</td> <td>vector</td> <td></td></tr>
- * <tr><td>2</td> <td>matrix</td> <td>Affine general parametric
transformation</td></tr>
+ * <tr><td>2</td> <td>matrix</td> <td>Affine parametric
transformation</td></tr>
* <tr><td><var>k</var></td><td>rank <var>k</var> tensor</td></tr>
* </table>
*
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java?rev=1661771&r1=1661770&r2=1661771&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java
[UTF-8] Mon Feb 23 20:38:45 2015
@@ -44,6 +44,7 @@ import org.opengis.referencing.operation
import org.opengis.util.FactoryException;
import org.opengis.util.NoSuchIdentifierException;
+import org.apache.sis.internal.util.LazySet;
import org.apache.sis.internal.util.Constants;
import org.apache.sis.internal.referencing.Formulas;
import org.apache.sis.internal.referencing.ReferencingUtilities;
@@ -229,7 +230,25 @@ public class DefaultMathTransformFactory
* @see #reload()
*/
public DefaultMathTransformFactory() {
- this(ServiceLoader.load(OperationMethod.class));
+ /*
+ * WORKAROUND for a JDK bug: ServiceLoader does not support usage of
two Iterator instances
+ * before the first iteration is finished. Steps to reproduce:
+ *
+ * ServiceLoader<?> loader =
ServiceLoader.load(OperationMethod.class);
+ *
+ * Iterator<?> it1 = loader.iterator();
+ * assertTrue ( it1.hasNext() );
+ * assertNotNull( it1.next()) );
+ *
+ * Iterator<?> it2 = loader.iterator();
+ * assertTrue ( it1.hasNext()) );
+ * assertTrue ( it2.hasNext()) );
+ * assertNotNull( it1.next()) );
+ * assertNotNull( it2.next()) ); //
ConcurrentModificationException here !!!
+ *
+ * Wrapping the ServiceLoader in a LazySet avoid this issue.
+ */
+ this(new
LazySet<>(ServiceLoader.load(OperationMethod.class).iterator()));
}
/**
@@ -297,6 +316,7 @@ public class DefaultMathTransformFactory
*/
@Override
public Set<OperationMethod> getAvailableMethods(final Class<? extends
SingleOperation> type) {
+ ArgumentChecks.ensureNonNull("type", type);
OperationMethodSet set;
synchronized (methodsByType) {
set = methodsByType.get(type);
@@ -458,6 +478,7 @@ public class DefaultMathTransformFactory
}
if (Double.isNaN(actual)) {
parameter.setValue(expected, unit);
+ return false;
}
return true;
}
@@ -879,8 +900,13 @@ public class DefaultMathTransformFactory
public void reload() {
synchronized (methods) {
methodsByName.clear();
- if (methods instanceof ServiceLoader<?>) {
- ((ServiceLoader<?>) methods).reload();
+ Iterable<? extends OperationMethod> m = methods;
+ if (m instanceof LazySet<?>) { // Workaround for JDK bug. See
DefaultMathTransformFactory() constructor.
+ ((LazySet<?>) m).reload();
+ m = ((LazySet<? extends OperationMethod>) m).source;
+ }
+ if (m instanceof ServiceLoader<?>) {
+ ((ServiceLoader<?>) m).reload();
}
synchronized (methodsByType) {
for (final OperationMethodSet c : methodsByType.values()) {
Modified:
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/OperationMethodSet.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/OperationMethodSet.java?rev=1661771&r1=1661770&r2=1661771&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/OperationMethodSet.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/OperationMethodSet.java
[UTF-8] Mon Feb 23 20:38:45 2015
@@ -116,7 +116,8 @@ final class OperationMethodSet extends A
}
// Maintenance note: following check shall be consistent with the one
in 'contains(Object)'.
if (method instanceof DefaultOperationMethod) {
- if (!type.isAssignableFrom(((DefaultOperationMethod)
method).getOperationType())) {
+ final Class<? extends SingleOperation> c =
((DefaultOperationMethod) method).getOperationType();
+ if (c != null && !type.isAssignableFrom(c)) {
return false;
}
}
@@ -222,7 +223,8 @@ final class OperationMethodSet extends A
public boolean contains(final Object object) {
// Maintenance note: following check shall be consistent with the one
in 'transfer()'.
if (object instanceof DefaultOperationMethod) {
- if (!type.isAssignableFrom(((DefaultOperationMethod)
object).getOperationType())) {
+ final Class<? extends SingleOperation> c =
((DefaultOperationMethod) object).getOperationType();
+ if (c != null && !type.isAssignableFrom(c)) {
return false;
}
} else if (!(object instanceof OperationMethod)) {
Modified:
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AffineTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AffineTest.java?rev=1661771&r1=1661770&r2=1661771&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AffineTest.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/AffineTest.java
[UTF-8] Mon Feb 23 20:38:45 2015
@@ -82,7 +82,7 @@ public final strictfp class AffineTest e
public void testWKT() {
final Matrix matrix = Matrices.createDiagonal(3, 3);
assertWktEquals(
- "ParameterGroup[“Affine general parametric transformation”," +
+ "ParameterGroup[“Affine parametric transformation”," +
" Id[“EPSG”, 9624, Citation[“OGP”]]]",
Affine.parameters(matrix));
/*
* Try arbitrary values.
@@ -91,7 +91,7 @@ public final strictfp class AffineTest e
matrix.setElement(1, 1, 0); // B1
matrix.setElement(1, 2, -1); // B2
assertWktEquals(
- "ParameterGroup[“Affine general parametric transformation”,\n"
+
+ "ParameterGroup[“Affine parametric transformation”,\n" +
" Parameter[“A1”, 2.0, Id[“EPSG”, 8624]],\n" +
" Parameter[“B1”, 0.0, Id[“EPSG”, 8640]],\n" +
" Parameter[“B2”, -1.0, Id[“EPSG”, 8641]],\n" +
Modified:
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/TensorValuesTest.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/TensorValuesTest.java?rev=1661771&r1=1661770&r2=1661771&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/TensorValuesTest.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/parameter/TensorValuesTest.java
[UTF-8] Mon Feb 23 20:38:45 2015
@@ -332,7 +332,7 @@ public final strictfp class TensorValues
/**
* Tests {@link TensorParameters#ALPHANUM} formatting.
* <ul>
- * <li>Group name shall be {@code "Affine general parametric
transformation"}.</li>
+ * <li>Group name shall be {@code "Affine parametric
transformation"}.</li>
* <li>No {@code "num_row"} or {@code "num_col"} parameters if their
value is equals to 3.</li>
* <li>Parameter names shall be of the form {@code "A0"}.</li>
* <li>Identifiers present, but only for A0-A2 and B0-B2.</li>
@@ -348,7 +348,7 @@ public final strictfp class TensorValues
singletonMap(TensorValues.NAME_KEY, Affine.NAME), matrix);
validate(group);
assertWktEquals(
- "ParameterGroup[“Affine general parametric transformation”,\n"
+
+ "ParameterGroup[“Affine parametric transformation”,\n" +
" Parameter[“A2”, 4.0, Id[“EPSG”, 8625]],\n" +
" Parameter[“B0”, -2.0, Id[“EPSG”, 8639]],\n" +
" Parameter[“C2”, 7.0]]", group);
Modified:
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Constants.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Constants.java?rev=1661771&r1=1661770&r2=1661771&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Constants.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/Constants.java
[UTF-8] Mon Feb 23 20:38:45 2015
@@ -82,7 +82,7 @@ public final class Constants extends Sta
public static final String NUM_ROW = "num_row", NUM_COL = "num_col";
/**
- * The OGC name for <cite>Affine general parametric transformation"</cite>.
+ * The OGC name for <cite>"Affine parametric transformation"</cite>.
*
* @see org.apache.sis.internal.referencing.provider.Affine#NAME
*/
Copied:
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySet.java
(from r1661768,
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySet.java)
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySet.java?p2=sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySet.java&p1=sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySet.java&r1=1661768&r2=1661771&rev=1661771&view=diff
==============================================================================
---
sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySet.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/util/LazySet.java
[UTF-8] Mon Feb 23 20:38:45 2015
@@ -217,6 +217,11 @@ public final class LazySet<E> extends Ab
public E next() {
return get(cursor++);
}
+
+ @Override
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
};
}
}
Modified:
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages_fr.properties
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages_fr.properties?rev=1661771&r1=1661770&r2=1661771&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages_fr.properties
[ISO-8859-1] (original)
+++
sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages_fr.properties
[ISO-8859-1] Mon Feb 23 20:38:45 2015
@@ -22,5 +22,5 @@ IgnoredPropertiesAfterFirst_1 = Des pr
IgnoredPropertyAssociatedTo_1 = Une propri\u00e9t\u00e9 associ\u00e9e \u00e0
\u2018{0}\u2019 a \u00e9t\u00e9 ignor\u00e9e.
PropertyHiddenBy_2 = La propri\u00e9t\u00e9
\u00ab\u202f{0}\u202f\u00bb est masqu\u00e9e par \u00ab\u202f{1}\u202f\u00bb.
LocalesDiscarded = Des textes ont \u00e9t\u00e9 ignor\u00e9s
pour certaines langues.
-MismatchedEllipsoidAxisLength_3 = Le param\u00e8tre
\u00ab\u202f{1}\u202f\u00bb aurait pu \u00eatre omis. Mais il lui a
\u00e9t\u00e9 donn\u00e9 la {2} qui ne correspond pas \u00e0 la d\u00e9finition
de l'ellipso\u00efde \u00ab\u202f{0}\u202f\u00bb.
+MismatchedEllipsoidAxisLength_3 = Le param\u00e8tre
\u00ab\u202f{1}\u202f\u00bb aurait pu \u00eatre omis. Mais il lui a
\u00e9t\u00e9 donn\u00e9 la valeur {2} qui ne correspond pas \u00e0 la
d\u00e9finition de l'ellipso\u00efde \u00ab\u202f{0}\u202f\u00bb.
UnparsableValueStoredAsText_2 = La valeur \u00ab\u202f{1}\u202f\u00bb ne
peut pas \u00eatre interpr\u00e9t\u00e9e comme une instance de \u2018{0}\u2019.
Elle est donc m\u00e9moris\u00e9e sous sa forme textuelle, mais sera
ignor\u00e9e par certains traitements.
Modified:
sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
URL:
http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java?rev=1661771&r1=1661770&r2=1661771&view=diff
==============================================================================
---
sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
[UTF-8] (original)
+++
sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
[UTF-8] Mon Feb 23 20:38:45 2015
@@ -26,7 +26,7 @@ import org.junit.BeforeClass;
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.3
- * @version 0.5
+ * @version 0.6
* @module
*/
@Suite.SuiteClasses({
@@ -78,6 +78,7 @@ import org.junit.BeforeClass;
org.apache.sis.util.collection.CodeListSetTest.class,
org.apache.sis.internal.util.CollectionsExtTest.class,
org.apache.sis.internal.util.AbstractMapTest.class,
+ org.apache.sis.internal.util.LazySetTest.class,
// GeoAPI most basic types.
org.apache.sis.internal.util.DefinitionURITest.class,