Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -3185,7 +3185,7 @@ next: while (r.next()) { ? " ORDER BY ABS(DEPRECATED), " : " AND DEPRECATED=0 ORDER BY "); // Do not put spaces around "=" - SQLTranslator searches for this exact match. if (isFloat) { - buffer.append("ABS(").append(select).append("-?), "); + buffer.append("ABS(").append(where).append("-?), "); } buffer.append(select); // Only for making order determinist. /*
Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGFactory.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGFactory.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGFactory.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGFactory.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -45,6 +45,7 @@ import org.apache.sis.internal.system.De import org.apache.sis.internal.util.Constants; import org.apache.sis.referencing.factory.ConcurrentAuthorityFactory; import org.apache.sis.referencing.factory.UnavailableFactoryException; +import org.apache.sis.util.resources.Messages; import org.apache.sis.util.logging.Logging; import org.apache.sis.util.ArgumentChecks; import org.apache.sis.util.Classes; @@ -270,7 +271,7 @@ public class EPSGFactory extends Concurr throw new UnavailableFactoryException(Initializer.unspecified(locale)); } } catch (Exception e) { - throw new UnavailableFactoryException(message(e), e); + throw new UnavailableFactoryException(canNotUse(e), e); } dataSource = ds; nameFactory = factory(NameFactory.class, "nameFactory", properties); @@ -293,12 +294,19 @@ public class EPSGFactory extends Concurr /** * Returns the message to put in an {@link UnavailableFactoryException} having the given exception as its cause. */ - private String message(final Exception e) { + private String canNotUse(final Exception e) { String message = Exceptions.getLocalizedMessage(e, locale); if (message == null) { message = Classes.getShortClassName(e); } - return Resources.forLocale(locale).getString(Resources.Keys.CanNotUseGeodeticParameters_2, Constants.EPSG, message); + return canNotUse(message); + } + + /** + * Returns the message to put in an {@link UnavailableFactoryException} having the given cause. + */ + private String canNotUse(final String cause) { + return Resources.forLocale(locale).getString(Resources.Keys.CanNotUseGeodeticParameters_2, Constants.EPSG, cause); } /** @@ -367,15 +375,18 @@ public class EPSGFactory extends Concurr * See <a href="https://issues.apache.org/jira/browse/LEGAL-183">LEGAL-183</a> for more information.</p> * * @param connection connection to the database where to create the EPSG schema. - * @throws FileNotFoundException if a SQL script has not been found, - * typically because a required resource is not on the classpath. - * @throws IOException if an I/O error occurred while reading a SQL script. - * @throws SQLException if an error occurred while writing to the database. + * @throws UnavailableFactoryException if installation failed. The exception will have a + * {@link FileNotFoundException} cause if a SQL script has not been found + * (typically because a required resource is not on the classpath), an + * {@link IOException} if an I/O error occurred while reading a SQL script, or a + * {@link SQLException} if an error occurred while writing to the database. * * @see InstallationScriptProvider */ - public synchronized void install(final Connection connection) throws IOException, SQLException { + public synchronized void install(final Connection connection) throws UnavailableFactoryException { ArgumentChecks.ensureNonNull("connection", connection); + String message = null; + Exception failure = null; try (EPSGInstaller installer = new EPSGInstaller(connection)) { final boolean ac = connection.getAutoCommit(); if (ac) { @@ -403,9 +414,21 @@ public class EPSGFactory extends Concurr } } } catch (IOException | SQLException e) { - installer.logFailure(locale, e); - throw e; + message = installer.failure(locale, e); + failure = e; } + } catch (SQLException e) { + message = Messages.getResources(locale).getString(Messages.Keys.CanNotCreateSchema_1, Constants.EPSG); + failure = e; + } + if (failure != null) { + /* + * Derby sometime wraps SQLException into another SQLException. For making the stack strace a + * little bit simpler, keep only the root cause provided that the exception type is compatible. + */ + UnavailableFactoryException exception = new UnavailableFactoryException(message, Exceptions.unwrap(failure)); + exception.setUnavailableFactory(this); + throw exception; } } @@ -455,7 +478,7 @@ public class EPSGFactory extends Concurr return newDataAccess(connection, tr); } else { connection.close(); - exception = new UnavailableFactoryException(SQLTranslator.tableNotFound(locale)); + exception = new UnavailableFactoryException(canNotUse(SQLTranslator.tableNotFound(locale))); } } catch (Exception e) { // Really want to catch all exceptions here. if (connection != null) try { @@ -463,11 +486,14 @@ public class EPSGFactory extends Concurr } catch (SQLException e2) { e.addSuppressed(e2); } + if (e instanceof FactoryException) { + throw (FactoryException) e; + } /* * Derby sometime wraps SQLException into another SQLException. For making the stack strace a * little bit simpler, keep only the root cause provided that the exception type is compatible. */ - exception = new UnavailableFactoryException(message(e), Exceptions.unwrap(e)); + exception = new UnavailableFactoryException(canNotUse(e), Exceptions.unwrap(e)); } exception.setUnavailableFactory(this); throw exception; Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGInstaller.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGInstaller.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGInstaller.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGInstaller.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -25,7 +25,6 @@ import java.sql.SQLException; import java.util.StringTokenizer; import java.util.concurrent.TimeUnit; import java.util.logging.Level; -import java.util.logging.LogRecord; import java.io.BufferedReader; import org.apache.sis.util.StringBuilders; import org.apache.sis.internal.metadata.sql.ScriptRunner; @@ -187,7 +186,7 @@ final class EPSGInstaller extends Script /** * Invoked for each text found in a SQL statement. This method replaces {@code ''} by {@code Null}. - * The intend is to consistently use the null value for meaning "no information", which is not the + * The intent is to consistently use the null value for meaning "no information", which is not the * same than "information is an empty string". This replacement is okay in this particular case * since there is no field in the EPSG database for which we really want an empty string. * @@ -275,18 +274,16 @@ final class EPSGInstaller extends Script } /** - * Logs a message reporting the failure to create EPSG database. This method is invoked when {@link EPSGFactory} - * caught an exception. This log completes rather than replaces the exception message since {@code EPSGFactory} - * lets the exception propagate. Another code (for example {@link org.apache.sis.referencing.CRS#forCode(String)}) - * may catch that exception and log another record with the exception message. + * Creates a message reporting the failure to create EPSG database. This method is invoked when {@link EPSGFactory} + * caught an exception. This method completes the exception message with the file name and line number where the + * error occurred, if such information is available. */ - final void logFailure(final Locale locale, final Exception cause) { + final String failure(final Locale locale, final Exception cause) { String message = Messages.getResources(locale).getString(Messages.Keys.CanNotCreateSchema_1, EPSG); String status = status(locale); if (status != null) { message = message + ' ' + status; } - message = Exceptions.formatChainedMessages(locale, message, cause); - InstallationScriptProvider.log(new LogRecord(Level.WARNING, message)); + return Exceptions.formatChainedMessages(locale, message, cause); } } Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/SQLTranslator.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/SQLTranslator.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/SQLTranslator.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/SQLTranslator.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -19,6 +19,7 @@ package org.apache.sis.referencing.facto import java.util.Map; import java.util.HashMap; import java.util.Locale; +import java.util.function.Function; import java.sql.DatabaseMetaData; import java.sql.ResultSet; import java.sql.SQLException; @@ -28,9 +29,6 @@ import org.apache.sis.util.ArgumentCheck import org.apache.sis.util.resources.Errors; import org.apache.sis.internal.util.Constants; -// Branch-dependent imports -import java.util.function.Function; - /** * Converts the SQL statements from MS-Access dialect to standard SQL. The {@link #apply(String)} method Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -53,6 +53,7 @@ import org.apache.sis.util.collection.Co import org.apache.sis.util.UnsupportedImplementationException; import org.apache.sis.util.logging.Logging; import org.apache.sis.parameter.Parameterized; +import org.apache.sis.metadata.iso.citation.Citations; import org.apache.sis.referencing.cs.CoordinateSystems; import org.apache.sis.referencing.AbstractIdentifiedObject; import org.apache.sis.referencing.operation.transform.MathTransforms; @@ -64,6 +65,7 @@ import org.apache.sis.internal.referenci import org.apache.sis.internal.referencing.WKTUtilities; import org.apache.sis.internal.metadata.WKTKeywords; import org.apache.sis.internal.metadata.MetadataUtilities; +import org.apache.sis.internal.util.Constants; import org.apache.sis.internal.util.CollectionsExt; import org.apache.sis.internal.util.UnmodifiableArrayList; import org.apache.sis.internal.system.Semaphores; @@ -963,10 +965,27 @@ check: for (int isTarget=0; ; isTar parameters = null; } if (parameters != null) { + /* + * Format the parameter values. Apache SIS uses the EPSG geodetic dataset as the main source of + * parameter definitions. When a parameter is defined by both OGC and EPSG with different names, + * the Formatter class is responsible for choosing an appropriate name. But when the difference + * is more fundamental, we may have duplication. For example in the "Molodensky" operation, OGC + * uses source and target axis lengths while EPSG uses only difference between those lengths. + * In this case, OGC and EPSG parameters are defined separately and are redundant. To simplify + * the CoordinateOperation WKT, we omit non-EPSG parameters when we have determined that we are + * about to describe an EPSG operation. We could generalize this filtering to any authority, but + * we don't because few authorities are as complete as EPSG, so other authorities are more likely + * to mix EPSG or someone else components with their own. Note also that we don't apply filtering + * on MathTransform WKT neither for more reliable debugging. + */ + final boolean filter = WKTUtilities.isEPSG(parameters.getDescriptor(), false) && // NOT method.getName() + Constants.EPSG.equalsIgnoreCase(Citations.getCodeSpace(formatter.getNameAuthority())); formatter.newLine(); formatter.indent(+1); for (final GeneralParameterValue param : parameters.values()) { - WKTUtilities.append(param, formatter); + if (!filter || WKTUtilities.isEPSG(param.getDescriptor(), true)) { + WKTUtilities.append(param, formatter); + } } formatter.indent(-1); } Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractSingleOperation.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -173,7 +173,7 @@ class AbstractSingleOperation extends Ab * In the particular case of a {@linkplain PassThroughTransform pass through transform} with more dimensions * than what we would expect from the given method, the check will rather be performed against the * {@linkplain PassThroughTransform#getSubTransform() sub transform}. - * The intend is to allow creation of a three-dimensional {@code ProjectedCRS} with a two-dimensional + * The intent is to allow creation of a three-dimensional {@code ProjectedCRS} with a two-dimensional * {@code OperationMethod}, where the third-dimension just pass through. * * <p>This method tries to locates what seems to be the "core" of the given math transform. The definition Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationContext.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationContext.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationContext.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationContext.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -17,6 +17,7 @@ package org.apache.sis.referencing.operation; import java.io.Serializable; +import java.util.function.Predicate; import org.opengis.metadata.extent.Extent; import org.opengis.metadata.extent.GeographicBoundingBox; import org.opengis.referencing.operation.CoordinateOperation; @@ -25,9 +26,6 @@ import org.apache.sis.metadata.iso.exten import org.apache.sis.internal.util.CollectionsExt; import org.apache.sis.util.ArgumentChecks; -// Branch-dependent imports -import java.util.function.Predicate; - /** * Optional information about the context in which a requested coordinate operation will be used. Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationFinder.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationFinder.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationFinder.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationFinder.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -542,7 +542,7 @@ public class CoordinateOperationFinder e /* * TODO: instead than creating parameters for an identity operation, we should create the * CoordinateOperation directly from the MathTransform created by mtFactory below. - * The intend if to get the correct OperationMethod, which should not be "Affine" + * The intent if to get the correct OperationMethod, which should not be "Affine" * if there is a CS type change. */ parameters = Affine.identity(targetDim); @@ -957,7 +957,7 @@ public class CoordinateOperationFinder e /* * If one of the transform performs nothing more than a change of axis order or units, do * not expose that conversion in a ConcatenatedTransform. Instead, merge that conversion - * with the "main" operation. The intend is to simplify the operation chain by hidding + * with the "main" operation. The intent is to simplify the operation chain by hidding * trivial operations. */ CoordinateOperation main = null; Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -26,6 +26,7 @@ import java.util.Iterator; import java.util.Objects; import java.util.logging.Level; import java.util.logging.LogRecord; +import java.util.function.Predicate; import javax.measure.IncommensurableException; import org.opengis.util.FactoryException; @@ -78,9 +79,6 @@ import org.apache.sis.util.collection.Co import org.apache.sis.util.collection.BackingStoreException; import org.apache.sis.util.resources.Vocabulary; -// Branch-dependent imports -import java.util.function.Predicate; - /** * Base class of code that search for coordinate operation, either by looking in a registry maintained by an authority Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactory.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -548,7 +548,7 @@ next: for (int i=components.size(); -- transform = getMathTransformFactory().createBaseToDerived(sourceCRS, parameters, targetCRS.getCoordinateSystem()); } /* - * The "operationType" property is currently undocumented. The intend is to help this factory method in + * The "operationType" property is currently undocumented. The intent is to help this factory method in * situations where the given operation method is not an Apache SIS implementation or does not override * getOperationType(), or the method is ambiguous (e.g. "Affine" can be used for both a transformation * or a conversion). Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/builder/LinearTransformBuilder.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/builder/LinearTransformBuilder.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/builder/LinearTransformBuilder.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/builder/LinearTransformBuilder.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -110,7 +110,7 @@ public class LinearTransformBuilder exte private int numPoints; /** - * The transform created by the last call to {@link #create()}. + * The transform created by the last call to {@link #create(MathTransformFactory)}. * This is reset to {@code null} when coordinates are modified. */ private transient LinearTransform transform; @@ -373,8 +373,6 @@ search: for (int j=0; j<numPoints; j++) throws MismatchedDimensionException { ArgumentChecks.ensureNonNull("sourceToTarget", sourceToTarget); - pendingSources = null; - pendingTargets = null; transform = null; correlation = null; sources = null; @@ -513,7 +511,6 @@ search: for (int j=0; j<numPoints; j++) * @since 0.8 */ public double[] getControlPoint(final int[] source) { - processPendings(); ArgumentChecks.ensureNonNull("source", source); verifySourceDimension(source.length); if (targets == null) { @@ -551,97 +548,6 @@ search: for (int j=0; j<numPoints; j++) } /** - * Sets the source points, overwriting any previous setting. The number of source points will need to be the same - * than the number of {@linkplain #setTargetPoints target points} when the {@link #create()} method will be invoked. - * In current Apache SIS implementation, the source points must be one or two-dimensional. - * - * <p>If this builder has been created with the {@link #LinearTransformBuilder(int...)} constructor, - * then all given points must be two-dimensional and all ordinate values must be integers in the - * [0 … <var>width</var>-1] or [0 … <var>height</var>-1] range for the first and second dimension - * respectively. This constraint does not apply if this builder has been created with the - * {@link #LinearTransformBuilder()} constructor.</p> - * - * <p>It is caller's responsibility to ensure that no source point is duplicated. - * If the same source point is repeated twice, then {@code LinearTransformBuilder} behavior is undefined.</p> - * - * @param points the source points, assumed precise. - * @throws MismatchedDimensionException if at least one point does not have the expected number of dimensions. - * - * @deprecated Replaced by {@link #setControlPoints(Map)}. - */ - @Deprecated - public void setSourcePoints(final DirectPosition... points) throws MismatchedDimensionException { - ArgumentChecks.ensureNonNull("points", points); - transform = null; - correlation = null; - sources = null; - targets = null; - numPoints = 0; - pendingSources = points.clone(); - } - - /** - * Sets the target points, overwriting any previous setting. The number of target points will need to be the same - * than the number of {@linkplain #setSourcePoints source points} when the {@link #create()} method will be invoked. - * Target points can have any number of dimensions (not necessarily 2), but all points shall have - * the same number of dimensions. - * - * @param points the target points, assumed uncertain. - * @throws MismatchedDimensionException if not all points have the same number of dimensions. - * - * @deprecated Replaced by {@link #setControlPoints(Map)}. - */ - @Deprecated - public void setTargetPoints(final DirectPosition... points) throws MismatchedDimensionException { - ArgumentChecks.ensureNonNull("points", points); - transform = null; - correlation = null; - sources = null; - targets = null; - numPoints = 0; - pendingTargets = points.clone(); - } - - @Deprecated - private transient DirectPosition[] pendingSources, pendingTargets; - - @Deprecated - private void processPendings() { - if (pendingSources != null || pendingTargets != null) { - if (pendingSources == null || pendingTargets == null) { - throw new IllegalStateException(Errors.format( - Errors.Keys.MissingValueForProperty_1, (pendingSources == null) ? "sources" : "targets")); - } - final int length = pendingSources.length; - if (pendingTargets.length != length) { - throw new IllegalStateException(Errors.format(Errors.Keys.MismatchedArrayLengths)); - } - final Map<DirectPosition,DirectPosition> sourceToTarget = new java.util.HashMap<>(length); - for (int i=0; i<length; i++) { - sourceToTarget.put(pendingSources[i], pendingTargets[i]); - } - setControlPoints(sourceToTarget); - } - } - - /** - * Creates a linear transform approximation from the source positions to the target positions. - * This method assumes that source positions are precise and that all uncertainty is in the target positions. - * - * @return the fitted linear transform. - * - * @deprecated Replaced by {@link #create(MathTransformFactory)}. - */ - @Deprecated - public LinearTransform create() { - try { - return create(null); - } catch (FactoryException e) { - throw new RuntimeException(e); - } - } - - /** * Creates a linear transform approximation from the source positions to the target positions. * This method assumes that source positions are precise and that all uncertainty is in the target positions. * @@ -658,7 +564,6 @@ search: for (int j=0; j<numPoints; j++) @SuppressWarnings("serial") public LinearTransform create(final MathTransformFactory factory) throws FactoryException { if (transform == null) { - processPendings(); final double[][] sources = this.sources; // Protect from changes. final double[][] targets = this.targets; if (targets == null) { @@ -731,7 +636,7 @@ search: for (int j=0; j<numPoints; j++) } /** - * Returns the correlation coefficients of the last transform created by {@link #create()}, + * Returns the correlation coefficients of the last transform created by {@link #create create(…)}, * or {@code null} if none. If non-null, the array length is equals to the number of target * dimensions. * Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/GeneralMatrix.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/GeneralMatrix.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/GeneralMatrix.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/matrix/GeneralMatrix.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -175,7 +175,7 @@ class GeneralMatrix extends MatrixSIS im /** * Infers all {@link DoubleDouble#error} with a default values inferred from {@link DoubleDouble#value}. * For example if a matrix element is exactly 3.141592653589793, there is good chances that the user's - * intend was to specify the {@link Math#PI} value, in which case this method will infer that we would + * intent was to specify the {@link Math#PI} value, in which case this method will infer that we would * need to add 1.2246467991473532E-16 in order to get a value closer to π. */ static void inferErrors(final double[] elements) { Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/AlbersEqualArea.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/AlbersEqualArea.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/AlbersEqualArea.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/AlbersEqualArea.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -138,7 +138,7 @@ public class AlbersEqualArea extends Equ /* * Compute rn = (1-ℯ²)/nm, which is the reciprocal of the "real" n used in Snyder and EPSG guidance note. * We opportunistically use double-double arithmetic since the MatrixSIS operations use them anyway, but - * we do not really have that accuracy because of the limited precision of 'nm'. The intend is rather to + * we do not really have that accuracy because of the limited precision of 'nm'. The intent is rather to * increase the chances term cancellations happen during concatenation of coordinate operations. */ final DoubleDouble rn = DoubleDouble.verbatim(1); Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -37,7 +37,7 @@ import static org.apache.sis.internal.ut /** * Helper class for map projection constructions, providing formulas normally needed only at construction time. * Since map projection constructions should not happen very often, we afford using some double-double arithmetic. - * The main intend is not to provide more accurate coordinate conversions (while it may be a nice side-effect), + * The main intent is not to provide more accurate coordinate conversions (while it may be a nice side-effect), * but to improve the result of matrix multiplications when the map projection is part of a more complex chain * of transformations. More specifically we want to be able: * Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Mercator.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Mercator.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Mercator.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Mercator.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -251,7 +251,7 @@ public class Mercator extends ConformalP if (λ0 != 0) { /* * Use double-double arithmetic here for consistency with the work done in the normalization matrix. - * The intend is to have exact value at 'double' precision when computing Matrix.invert(). Note that + * The intent is to have exact value at 'double' precision when computing Matrix.invert(). Note that * there is no such goal for other parameters computed from sine or consine functions. */ final DoubleDouble offset = DoubleDouble.createDegreesToRadians(); Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -106,7 +106,7 @@ import static java.lang.Math.*; * higher level}.</div> * * {@code NormalizedProjection} does not store the above cited parameters (central meridian, scale factor, <i>etc.</i>) - * on intend (except indirectly), in order to make clear that those parameters are not used by subclasses. + * on intent (except indirectly), in order to make clear that those parameters are not used by subclasses. * The ability to recognize two {@code NormalizedProjection}s as {@linkplain #equals(Object, ComparisonMode) equivalent} * without consideration for the scale factor (among other) allow more efficient concatenation in some cases * (typically some combinations of inverse projection followed by a direct projection). Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractLinearTransform.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractLinearTransform.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractLinearTransform.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractLinearTransform.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -294,7 +294,7 @@ abstract class AbstractLinearTransform e /* * If the 'inverse' matrix was not computed in any of the transforms being compared * (i.e. if 'this.inverse' and 'object.inverse' are both null), then assume that the - * two transforms will compute their inverse in the same way. The intend is to avoid + * two transforms will compute their inverse in the same way. The intent is to avoid * to trig the inverse transform computation. * * Note that this code requires the 'inverse' fields to be volatile Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameter.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameter.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameter.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameter.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -26,7 +26,7 @@ import org.apache.sis.parameter.DefaultP * This temporary {@code ParameterValue} bypasses the validity check normally performed by {@link DefaultParameterValue}. * * <div class="note"><b>Rational:</b> - * The intend is to skip the parameter value verification done by {@link DefaultParameterValue#setValue(Object, Unit)} + * The intent is to skip the parameter value verification done by {@link DefaultParameterValue#setValue(Object, Unit)} * on the assumption that the value has already been verified when the user created his {@code ParameterValueGroup}. * Even if the user's {@code ParameterValue} implementation did not performed any verification, there is chances that * {@link DefaultMathTransformFactory} {@linkplain org.apache.sis.parameter.Parameters#copy copied} the parameters in Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/CoordinateSystemTransform.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/CoordinateSystemTransform.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/CoordinateSystemTransform.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/CoordinateSystemTransform.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -157,9 +157,9 @@ abstract class CoordinateSystemTransform } /** - * Implementation of {@link DefaultMathTransformFactory#createCoordinateSystemChange(CoordinateSystem, CoordinateSystem)}, - * defined here for reducing the {@code DefaultMathTransformFactory} weight in the common case where the conversions - * handled by this class are not needed. + * Implementation of {@link DefaultMathTransformFactory#createCoordinateSystemChange(CoordinateSystem, + * CoordinateSystem, Ellipsoid)}, defined here for reducing the {@code DefaultMathTransformFactory} + * weight in the common case where the conversions handled by this class are not needed. */ static MathTransform create(final MathTransformFactory factory, final CoordinateSystem source, final CoordinateSystem target) throws FactoryException Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -686,7 +686,7 @@ public class DefaultMathTransformFactory /** * If the parameters given by the user were not created by {@code getDefaultParameters(String)} * or something equivalent, copies those parameters into the structure expected by the provider. - * The intend is to make sure that we have room for the parameters that {@code setEllipsoids(…)} + * The intent is to make sure that we have room for the parameters that {@code setEllipsoids(…)} * may write. * * <p>A side effect of this method is that the copy operation may perform a check of @@ -1203,25 +1203,6 @@ public class DefaultMathTransformFactory } /** - * Creates a math transform that represent a change of coordinate system. - * - * @param source the source coordinate system. - * @param target the target coordinate system. - * @return a conversion from the given source to the given target coordinate system. - * @throws FactoryException if the conversion can not be created. - * - * @deprecated Replaced by {@link #createCoordinateSystemChange(CoordinateSystem, CoordinateSystem, Ellipsoid)} - * - * @since 0.7 - */ - @Deprecated - public MathTransform createCoordinateSystemChange(final CoordinateSystem source, final CoordinateSystem target) - throws FactoryException - { - return createCoordinateSystemChange(source, target, null); - } - - /** * Creates a math transform that represent a change of coordinate system. If exactly one argument is * an {@linkplain org.apache.sis.referencing.cs.DefaultEllipsoidalCS ellipsoidal coordinate systems}, * then the {@code ellipsoid} argument is mandatory. In all other cases (including the case where both Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/EllipsoidToCentricTransform.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/EllipsoidToCentricTransform.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/EllipsoidToCentricTransform.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/EllipsoidToCentricTransform.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -898,7 +898,7 @@ next: while (--numPts >= 0) { /** * If this transform returns three-dimensional outputs, and if the transform just after this one * just drops the height values, then replaces this transform by a two-dimensional one. - * The intend is to handle the following sequence of operations defined in the EPSG database: + * The intent is to handle the following sequence of operations defined in the EPSG database: * * <ol> * <li>Inverse of <cite>Geographic/geocentric conversions</cite> (EPSG:9602)</li> @@ -978,7 +978,7 @@ next: while (--numPts >= 0) { /** * If this transform expects three-dimensional inputs, and if the transform just before this one * unconditionally sets the height to zero, then replaces this transform by a two-dimensional one. - * The intend is to handle the following sequence of operations defined in the EPSG database: + * The intent is to handle the following sequence of operations defined in the EPSG database: * * <ol> * <li>Inverse of <cite>Geographic 3D to 2D conversion</cite> (EPSG:9659)</li> Modified: sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearInterpolator1D.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearInterpolator1D.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearInterpolator1D.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/LinearInterpolator1D.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -39,11 +39,26 @@ import org.apache.sis.util.resources.Err * <p>If desired values in decreasing order can be supported by inverting the sign of all values, * then concatenating this transform with a transform that multiply all output values by -1.</p> * + * <div class="section">Extrapolation</div> + * If an input value is outside the expected range of values, this class extrapolates using the + * slope defined by the two first points if the requested value is before, or the slope defined + * by the two last points if the requested value is after. In other words, extrapolations are + * computed using only values at the extremum where extrapolation happen. This rule causes less + * surprising behavior when computing a data cube envelope, which may need extrapolation by 0.5 + * pixel before the first value or after the last value. + * + * <div class="note"><b>Example:</b> + * if a vertical dimension is made of slices at y₀=5, y₁=10, y₂=100 and y₃=250 meters, then linear + * interpolation at 0.5 is 7.5 meters and extrapolation at -0.5 is expected to give 2.5 meters.</div> + * * @author Johann Sorel (Geomatys) * @author Rémi Maréchal (Geomatys) * @author Martin Desruisseaux (Geomatys) - * @version 0.7 - * @since 0.7 + * @version 1.0 + * + * @see MathTransforms#interpolate(double[], double[]) + * + * @since 0.7 * @module */ final class LinearInterpolator1D extends AbstractMathTransform1D implements Serializable { @@ -54,15 +69,11 @@ final class LinearInterpolator1D extends /** * The sequence values specified at construction time. + * Must contain at least 2 values. */ private final double[] values; /** - * The average function slope. Used only for extrapolations. - */ - private final double slope; - - /** * If the transform is invertible, the inverse. Otherwise {@code null}. * The transform is invertible only if values are in increasing order. */ @@ -72,15 +83,13 @@ final class LinearInterpolator1D extends * Creates a new transform which will interpolate in the given table of values. * The inputs are {0, 1, … , <var>N</var>} where <var>N</var> is length of output values. * - * <p>This constructor assumes that the {@code values} array have already be clones, - * so it will not clone it again.</p> + * <p>This constructor assumes that the {@code values} array has already been cloned, + * so it will not clone it again. That array shall contain at least two values.</p> * * @param values the <var>y</var> values in <var>y=f(x)</var> where <var>x</var> = {0, 1, … , {@code values.length-1}}. - * @param slope the value to use for extrapolation. */ - private LinearInterpolator1D(final double[] values, final double slope) { + private LinearInterpolator1D(final double[] values) { this.values = values; // Cloning this array is caller's responsibility. - this.slope = slope; double last = values[0]; for (int i=1; i<values.length; i++) { if (!(last <= (last = values[i]))) { // Use '!' for catching NaN values. @@ -93,14 +102,15 @@ final class LinearInterpolator1D extends /** * Creates a transform for the given values. This method returns an affine transform instead than an - * interpolator if the given values form a series with a constant increment. + * interpolator if the given values form a series with a constant increment. The given array shall + * contain at least two values. * * @param values a <strong>copy</strong> of the user-provided values. This array may be modified. */ private static MathTransform1D create(final double[] values) { final int n = values.length - 1; final double offset = values[0]; - double slope = (values[n] - offset) / n; + final double slope = (values[n] - offset) / n; final double as = Math.abs(slope); /* * If the increment between values is constant (with a small tolerance factor), @@ -122,12 +132,11 @@ final class LinearInterpolator1D extends */ final boolean isReverted = (slope < 0); if (isReverted) { - slope = -slope; for (i=0; i <= n; i++) { values[i] = -values[i]; } } - MathTransform1D tr = new LinearInterpolator1D(values, slope); + MathTransform1D tr = new LinearInterpolator1D(values); if (isReverted) { tr = new ConcatenatedTransformDirect1D(tr, LinearTransform1D.NEGATE); } @@ -223,17 +232,21 @@ final class LinearInterpolator1D extends final int n = values.length - 1; if (i < n) { x -= i; - y = values[i] * (1-x) + values[i+1] * x; - d = values[i+1] - values[i]; + final double y0 = values[i ]; + final double y1 = values[i+1]; + y = y0 * (1-x) + y1 * x; + d = y1 - y0; } else { // x is after the last available value. - y = (x - n) * slope + values[n]; - d = slope; + final double y1 = values[n]; + d = y1 - values[n-1]; + y = (x - n) * d + y1; } } else { // x is before the first available value. - y = x * slope + values[0]; - d = slope; + final double y0 = values[0]; + d = values[1] - y0; + y = x * d + y0; } if (dstPts != null) { dstPts[dstOff] = y; @@ -256,11 +269,13 @@ final class LinearInterpolator1D extends return values[i] * (1-x) + values[i+1] * x; } else { // x is after the last available value. - return (x - n) * slope + values[n]; + final double y1 = values[n]; + return (x - n) * (y1 - values[n-1]) + y1; } } else { // x is before the first available value. - return x * slope + values[0]; + final double y0 = values[0]; + return x * (values[1] - y0) + y0; } } @@ -271,13 +286,8 @@ final class LinearInterpolator1D extends */ @Override public double derivative(final double x) { - if (x >= 0) { - final int i = (int) x; - if (i < values.length - 1) { - return values[i+1] - values[i]; - } - } - return slope; + final int i = Math.max(0, Math.min(values.length - 2, (int) x)); + return values[i+1] - values[i]; } /** @@ -307,7 +317,7 @@ final class LinearInterpolator1D extends /** * Combines {@link #transform(double)}, {@link #derivative(double)} in a single method call. - * The intend is to avoid to call {@link Arrays#binarySearch(double[], double)} twice for the + * The intent is to avoid to call {@link Arrays#binarySearch(double[], double)} twice for the * same value. */ @Override @@ -320,7 +330,8 @@ final class LinearInterpolator1D extends int i = Arrays.binarySearch(values, y); if (i >= 0) { x = i; - d = (i >= 1 && i < values.length) ? (values[i] - values[i-1]) : slope; + i = Math.max(1, Math.min(values.length - 1, i)); + d = values[i] - values[i-1]; } else { i = ~i; if (i >= 1) { @@ -330,11 +341,13 @@ final class LinearInterpolator1D extends } else { // y is after the last available value. final int n = values.length - 1; - x = (y - values[n]) / (d = slope) + n; + final double y1 = values[n]; + x = (y - y1) / (d = y1 - values[n-1]) + n; } } else { // y is before the first available value. - x = (y - values[0]) / (d = slope); + final double y0 = values[0]; + x = (y - y0) / (d = values[1] - y0); } } if (dstPts != null) { @@ -361,11 +374,13 @@ final class LinearInterpolator1D extends } else { // y is after the last available value. final int n = values.length - 1; - return (y - values[n]) / slope + n; + final double y1 = values[n]; + return (y - y1) / (y1 - values[n-1]) + n; } } else { // y is before the first available value. - return (y - values[0]) / slope; + final double y0 = values[0]; + return (y - y0) / (values[1] - y0); } } } @@ -380,13 +395,8 @@ final class LinearInterpolator1D extends if (i < 0) { i = ~i; } - final double d; - if (i >= 1 && i < values.length) { - d = (values[i] - values[i-1]); - } else { - d = slope; - } - return 1 / d; + i = Math.max(1, Math.min(values.length - 1, i)); + return 1 / (values[i] - values[i-1]); } } Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/geometry/EnvelopesTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/geometry/EnvelopesTest.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/geometry/EnvelopesTest.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/geometry/EnvelopesTest.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -67,7 +67,7 @@ public final strictfp class EnvelopesTes * This transformation can not handle poles. * * <p>This method wraps the math transform into an opaque object for hiding the fact that the given - * transform implement the {@link MathTransform2D} interface. The intend is to disable optimization + * transform implement the {@link MathTransform2D} interface. The intent is to disable optimization * paths (if any), in order to test the generic path.</p> */ @Override Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/GeographicOffsetsTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/GeographicOffsetsTest.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/GeographicOffsetsTest.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/GeographicOffsetsTest.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -113,7 +113,7 @@ public final strictfp class GeographicOf /** * Tests {@code VerticalOffset.createMathTransform(…)} indirectly, through a call to the math transform factory - * with the source and target coordinate systems specified. The intend of this test is to verify that the change + * with the source and target coordinate systems specified. The intent of this test is to verify that the change * of axis direction is properly handled, given source CRS axis direction up and target CRS axis direction down. * * @throws FactoryException if an error occurred while creating the transform. Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterMarshallingTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterMarshallingTest.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterMarshallingTest.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/parameter/ParameterMarshallingTest.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -384,7 +384,7 @@ public final strictfp class ParameterMar /** * Tests unmarshalling of a parameter value group. The XML file does not use {@code xlink:href} attributes; - * descriptor definitions are repeated. The intend of this test is to test Apache SIS capability to replace + * descriptor definitions are repeated. The intent of this test is to test Apache SIS capability to replace * duplicates instances by unique instances. * * @throws JAXBException if an error occurred during unmarshalling. Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeocentricCRSTest.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -107,7 +107,7 @@ public final strictfp class DefaultGeoce } /** - * Tests WKT 1 formatting using axes in kilometres. The intend of this test is to verify that + * Tests WKT 1 formatting using axes in kilometres. The intent of this test is to verify that * the coordinate system replacement documented in {@link #testWKT1()} preserves the axis units. * * @since 0.6 Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultGeographicCRSTest.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -87,7 +87,7 @@ public final strictfp class DefaultGeogr /** * Verifies the {@link CommonCRS#WGS84} identifiers in both normalized and unnormalized CRS. - * The intend is actually to test the replacement of {@code "EPSG:4326"} by {@code "CRS:84"}. + * The intent is actually to test the replacement of {@code "EPSG:4326"} by {@code "CRS:84"}. */ @Test public void testIdentifiers() { Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GeodeticObjectFactoryTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GeodeticObjectFactoryTest.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GeodeticObjectFactoryTest.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GeodeticObjectFactoryTest.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -111,7 +111,7 @@ public final strictfp class GeodeticObje /** * Tests {@link GeodeticObjectFactory#createFromWKT(String)} with an erroneous projection parameter name. - * The intend is to verify that the expected exception is thrown. + * The intent is to verify that the expected exception is thrown. * * @throws FactoryException if the parsing failed for another reason than the expected one. */ Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/IdentifiedObjectFinderTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/IdentifiedObjectFinderTest.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/IdentifiedObjectFinderTest.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/IdentifiedObjectFinderTest.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -77,7 +77,7 @@ public final strictfp class IdentifiedOb CRS84, finder.findSingleton(CRS84)); /* * Same test than above, using a CRS without identifier. - * The intend is to force a full scan. + * The intent is to force a full scan. */ final CoordinateReferenceSystem search = new DefaultGeographicCRS( Collections.singletonMap(DefaultGeographicCRS.NAME_KEY, CRS84.getName()), Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGInstallerTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGInstallerTest.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGInstallerTest.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGInstallerTest.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -221,7 +221,7 @@ public final strictfp class EPSGInstalle /* * Following forces the authority factory to iterate over all codes. * Since the iterator returns only non-deprecated codes, EPSG:4329 - * should not be included. The intend is to verify that the fields + * should not be included. The intent is to verify that the fields * of type BOOLEAN have been properly handled. */ codes = new HashSet<>(codes); Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationFinderTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationFinderTest.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationFinderTest.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/CoordinateOperationFinderTest.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -281,7 +281,7 @@ public final strictfp class CoordinateOp λDimension = new int[] {1}; zDimension = new int[] {2}; double[] source = { - 39.00, -85.00, -10000.00, // The intend of those large height values is to cause a shift in (φ,λ) + 39.00, -85.00, -10000.00, // The intent of those large height values is to cause a shift in (φ,λ) 38.26, -80.58, +10000.00 // large enough for being detected if we fail to use h in calculations. }; double[] target; Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperationTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperationTest.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperationTest.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultConcatenatedOperationTest.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -43,7 +43,7 @@ import static org.apache.sis.test.TestUt * Tests the {@link DefaultConcatenatedOperation} class. * * @author Martin Desruisseaux (Geomatys) - * @version 0.7 + * @version 0.8 * @since 0.7 * @module */ @@ -114,9 +114,7 @@ public final strictfp class DefaultConca " Axis[“Latitude (B)”, north, Unit[“degree”, 0.017453292519943295]],\n" + " Axis[“Ellipsoidal height (h)”, up, Unit[“metre”, 1]]]],\n" + " CoordinateOperationStep[“Geographic to geocentric”,\n" + - " Method[“Geographic/geocentric conversions”],\n" + - " Parameter[“semi_major”, 6377397.155, Unit[“metre”, 1]],\n" + - " Parameter[“semi_minor”, 6356078.962818189, Unit[“metre”, 1]]],\n" + + " Method[“Geographic/geocentric conversions”]],\n" + // Omit non-EPSG parameters for EPSG method. " CoordinateOperationStep[“Tokyo to JGD2000 (GSI)”,\n" + " Method[“Geocentric translations”],\n" + " Parameter[“X-axis translation”, -146.414],\n" + Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactoryTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactoryTest.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactoryTest.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/DefaultCoordinateOperationFactoryTest.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -169,16 +169,18 @@ public final strictfp class DefaultCoord assertSame ("targetCRS", targetCRS, operation.getTargetCRS()); assertInstanceOf("operation", ConcatenatedOperation.class, operation); /* - * The accuracy of the coordinate operation depends on whether a path as been found with the help + * The accuracy of the coordinate operation depends on whether a path has been found with the help * of the EPSG database (in which case the reported accuracy is 2 metres) or if we had to find an - * operation by ourselves (in which case we conservatively report an accuracy of 3000 metres, bu - * in practice observe an error of about 80 metres for this test). + * operation by ourselves (in which case we conservatively report an accuracy of 3000 metres, but + * in practice observe an error between 80 and 515 metres for this test depending on the operation + * method used). By comparison, the translation declared in EPSG database is about 370 metres in + * geocentric coordinates. */ final boolean isUsingEpsgFactory = verifyParametersNTF(((ConcatenatedOperation) operation).getOperations(), 1); assertEquals("linearAccuracy", isUsingEpsgFactory ? 2 : PositionalAccuracyConstant.UNKNOWN_ACCURACY, CRS.getLinearAccuracy(operation), STRICT); - tolerance = isUsingEpsgFactory ? Formulas.LINEAR_TOLERANCE : 100; + tolerance = isUsingEpsgFactory ? Formulas.LINEAR_TOLERANCE : 600; transform = operation.getMathTransform(); /* * Test using the location of Paris (48.856578°N, 2.351828°E) first, @@ -236,7 +238,7 @@ public final strictfp class DefaultCoord assertEquals("linearAccuracy", isUsingEpsgFactory ? 2 : PositionalAccuracyConstant.UNKNOWN_ACCURACY, CRS.getLinearAccuracy(operation), STRICT); - tolerance = isUsingEpsgFactory ? Formulas.LINEAR_TOLERANCE : 100; + tolerance = isUsingEpsgFactory ? Formulas.LINEAR_TOLERANCE : 600; transform = operation.getMathTransform(); isInverseTransformSupported = false; /* Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/builder/LinearTransformBuilderTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/builder/LinearTransformBuilderTest.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/builder/LinearTransformBuilderTest.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/builder/LinearTransformBuilderTest.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -74,15 +74,12 @@ public final strictfp class LinearTransf */ @Test public void testMinimalist2D() throws FactoryException { + final Map<DirectPosition2D,DirectPosition2D> pos = new HashMap<>(8); + assertNull(pos.put(new DirectPosition2D(1, 1), new DirectPosition2D(3, 2))); + assertNull(pos.put(new DirectPosition2D(1, 2), new DirectPosition2D(3, 5))); + assertNull(pos.put(new DirectPosition2D(2, 2), new DirectPosition2D(5, 5))); final LinearTransformBuilder builder = new LinearTransformBuilder(); - builder.setSourcePoints( - new DirectPosition2D(1, 1), - new DirectPosition2D(1, 2), - new DirectPosition2D(2, 2)); - builder.setTargetPoints( - new DirectPosition2D(3, 2), - new DirectPosition2D(3, 5), - new DirectPosition2D(5, 5)); + builder.setControlPoints(pos); assertArrayEquals(new double[] {3, 2}, builder.getControlPoint(new int[] {1, 1}), STRICT); assertArrayEquals(new double[] {3, 5}, builder.getControlPoint(new int[] {1, 2}), STRICT); Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorMethodComparison.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorMethodComparison.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorMethodComparison.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorMethodComparison.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -260,7 +260,7 @@ public final class MercatorMethodCompari /** * Prints the error of the two methods for various eccentricity values. - * The intend of this method is to find an eccentricity threshold value where we consider the errors too high. + * The intent of this method is to find an eccentricity threshold value where we consider the errors too high. * * <p>This method is used for determining empirically a value for {@link ConformalProjection#ECCENTRICITY_THRESHOLD}. * The current threshold value is shown by inserting a horizontal line separator in the table when that threshold Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/AbridgedMolodenskyTransformTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/AbridgedMolodenskyTransformTest.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/AbridgedMolodenskyTransformTest.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/AbridgedMolodenskyTransformTest.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -127,7 +127,7 @@ public final strictfp class AbridgedMolo } /** - * Tests a deserialized instance. The intend is to verify that the transient fields + * Tests a deserialized instance. The intent is to verify that the transient fields * are correctly recomputed. * * @throws FactoryException if an error occurred while creating a transform step. Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateDomainTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateDomainTest.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateDomainTest.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateDomainTest.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -27,7 +27,7 @@ import static org.junit.Assert.*; /** * Tests {@link CoordinateDomain}. - * The main intend of this class is to allow visual inspection (by looking in source code) of sampled data. + * The main intent of this class is to allow visual inspection (by looking in source code) of sampled data. * * @author Martin Desruisseaux (Geomatys) * @version 0.6 Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateSystemTransformTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateSystemTransformTest.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateSystemTransformTest.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/CoordinateSystemTransformTest.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -37,7 +37,6 @@ import org.junit.AfterClass; import org.junit.Test; - /** * Tests the {@link CoordinateSystemTransform} static factory method. * Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactoryTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactoryTest.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactoryTest.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactoryTest.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -229,7 +229,7 @@ public final strictfp class DefaultMathT assertEquals(classification, 6356256.909237285, param.parameter("semi_minor").doubleValue(), 1E-4); /* * Creates a ProjectedCRS from the map projection. This part is more an integration test than - * a DefaultMathTransformFactory test. Again, the intend is to verify that the properties are + * a DefaultMathTransformFactory test. Again, the intent is to verify that the properties are * the one that we specified. */ final DefaultProjectedCRS crs = new DefaultProjectedCRS(dummyName, Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/LinearInterpolator1DTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/LinearInterpolator1DTest.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/LinearInterpolator1DTest.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/LinearInterpolator1DTest.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -21,6 +21,7 @@ import org.opengis.referencing.operation import org.opengis.referencing.operation.NoninvertibleTransformException; import org.opengis.referencing.operation.TransformException; import org.opengis.test.referencing.TransformTestCase; +import org.apache.sis.test.DependsOnMethod; import org.junit.Test; import static org.opengis.test.Assert.*; @@ -31,7 +32,7 @@ import static org.opengis.test.Assert.*; * * @author Rémi Maréchal (Geomatys) * @author Martin Desruisseaux (Geomatys). - * @version 0.7 + * @version 1.0 * @since 0.7 * @module */ @@ -238,4 +239,25 @@ public final strictfp class LinearInterp */ verifyInDomain(new double[] {min}, new double[] {max}, new int[] {100}, new Random(randomSeed)); } + + /** + * Tests input values outside the expected range. + * A few values inside ranges are also tested as a safety. + * + * @throws TransformException if an error occurred while testing a value. + */ + @Test + @DependsOnMethod("testIndicesToIncreasingValues") + public void testExtrapolations() throws TransformException { + values = new double[] {5, 10, 100, 250}; + transform = LinearInterpolator1D.create(preimage, values); + derivativeDeltas = new double[] {0.1}; + verifyTransform(new double[] {0, 1, 0.5, -0.5, -1, -2, 3, 3.5, 4, 5}, // Values to transform. + new double[] {5, 10, 7.5, 2.5, 0, -5, 250, 325, 400, 550}); // Expected results. + + verifyConsistency(0f, 1f, 0.5f, -0.5f, -1f, -2f, 3f, 3.5f, 4f, 5f); + verifyDerivative(0.25); // Interpolation (verified by safety) + verifyDerivative(-8); // Extrapolation + verifyDerivative( 8); + } } Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -415,7 +415,7 @@ public final strictfp class CoordinateRe /** * The keywords before which to cut the CRS names when sorting by alphabetical order. - * The main intend here is to preserve the "far west", "west", "central west", "central", + * The main intent here is to preserve the "far west", "west", "central west", "central", * "central east", "east", "far east" order. */ private static final String[] CUT_BEFORE = { Modified: sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ConsistencyTest.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ConsistencyTest.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ConsistencyTest.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ConsistencyTest.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -25,6 +25,7 @@ import org.opengis.util.FactoryException import org.opengis.util.NoSuchIdentifierException; import org.opengis.referencing.crs.CoordinateReferenceSystem; import org.apache.sis.referencing.factory.FactoryDataException; +import org.apache.sis.referencing.factory.UnavailableFactoryException; import org.apache.sis.referencing.IdentifiedObjects; import org.apache.sis.referencing.CRS; import org.apache.sis.io.wkt.Convention; @@ -67,11 +68,22 @@ public final strictfp class ConsistencyT * Codes to exclude for now. */ private static final Set<String> EXCLUDES = new HashSet<>(Arrays.asList( - "CRS:1", // Computer display - "EPSG:5819" // EPSG topocentric example A + "CRS:1", // Computer display: WKT parser alters the (i,j) axis names. + "EPSG:5819", // EPSG topocentric example A: error while parsing WKT. + "AUTO2:42001", // This projection requires parameters, but we provide none. + "AUTO2:42002", // This projection requires parameters, but we provide none. + "AUTO2:42003", // This projection requires parameters, but we provide none. + "AUTO2:42004", // This projection requires parameters, but we provide none. + "AUTO2:42005" // This projection requires parameters, but we provide none. )); /** + * Width of the code columns in the warnings formatted by {@link #print(String, String, Object)}. + * We begin with an arbitrary width and will expand if necessary. + */ + private int codeWidth = 15; + + /** * Verifies the WKT consistency of all CRS instances. * * @throws FactoryException if an error other than "unsupported operation method" occurred. @@ -92,7 +104,7 @@ public final strictfp class ConsistencyT final CoordinateReferenceSystem crs; try { crs = CRS.forCode(code); - } catch (NoSuchIdentifierException | FactoryDataException e) { + } catch (UnavailableFactoryException | NoSuchIdentifierException | FactoryDataException e) { print(code, "WARNING", e.getLocalizedMessage()); continue; } @@ -118,9 +130,13 @@ public final strictfp class ConsistencyT * Prints the given code followed by spaces and the given {@code "ERROR"} or {@code "WARNING"} word, * then the given message. */ - private static void print(final String code, final String word, final Object message) { + private void print(final String code, final String word, final Object message) { + final int currentWidth = code.length(); + if (currentWidth >= codeWidth) { + codeWidth = currentWidth + 1; + } out.print(code); - out.print(CharSequences.spaces(15 - code.length())); + out.print(CharSequences.spaces(codeWidth - currentWidth)); out.print(word); out.print(": "); out.println(message); @@ -135,7 +151,7 @@ public final strictfp class ConsistencyT * @param crs the CRS to test. * @return the parsed CRS. */ - private static CoordinateReferenceSystem parseAndFormat(final WKTFormat f, + private CoordinateReferenceSystem parseAndFormat(final WKTFormat f, final String code, final CoordinateReferenceSystem crs) { String wkt = f.format(crs); Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/converter/SystemRegistry.java URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/converter/SystemRegistry.java?rev=1825252&r1=1825251&r2=1825252&view=diff ============================================================================== --- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/converter/SystemRegistry.java [UTF-8] (original) +++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/internal/converter/SystemRegistry.java [UTF-8] Sat Feb 24 15:44:08 2018 @@ -33,7 +33,7 @@ import org.apache.sis.internal.system.Mo * <ul> * <li>Fetch the list of converters from the content of all * {@code META-INF/services/org.apache.sis.util.ObjectConverter} files found on the classpath. - * The intend is to allow other modules to register their own converters.</li> + * The intent is to allow other modules to register their own converters.</li> * * <li>Apply heuristic rules in addition to the explicitly registered converters. * Those heuristic rules are provided in a separated class in order to keep the
