You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2016/10/10 15:24:06 UTC
svn commit: r1764119 [2/11] - in /sis/trunk: ./ core/
core/sis-feature/src/main/java/org/apache/sis/feature/
core/sis-feature/src/main/java/org/apache/sis/feature/builder/
core/sis-feature/src/main/java/org/apache/sis/internal/feature/
core/sis-metadat...
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java?rev=1764119&r1=1764118&r2=1764119&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java [UTF-8] Mon Oct 10 15:24:03 2016
@@ -134,12 +134,13 @@ public final class ServicesForMetadata e
/**
* Creates an exception message for a spatial, vertical or temporal dimension not found.
+ * The given key must be one of {@code Resources.Keys} constants.
*/
- private static String dimensionNotFound(final short errorKey, final CoordinateReferenceSystem crs) {
+ private static String dimensionNotFound(final short resourceKey, final CoordinateReferenceSystem crs) {
if (crs == null) {
return Errors.format(Errors.Keys.UnspecifiedCRS);
} else {
- return Errors.format(errorKey, crs.getName());
+ return Resources.format(resourceKey, crs.getName());
}
}
@@ -169,7 +170,7 @@ public final class ServicesForMetadata e
try {
operation = factory.createOperation(crs, normalizedCRS);
} catch (FactoryException e) {
- throw new TransformException(Errors.format(Errors.Keys.CanNotTransformEnvelopeToGeodetic), e);
+ throw new TransformException(Resources.format(Resources.Keys.CanNotTransformEnvelopeToGeodetic), e);
}
envelope = Envelopes.transform(operation, envelope);
}
@@ -254,7 +255,7 @@ public final class ServicesForMetadata e
if (crs != null) {
normalizedCRS = CommonCRS.defaultGeographic();
} else if (envelope.getDimension() != 2) {
- throw new TransformException(dimensionNotFound(Errors.Keys.MissingHorizontalDimension_1, crs));
+ throw new TransformException(dimensionNotFound(Resources.Keys.MissingHorizontalDimension_1, crs));
}
}
setGeographicExtent(envelope, target, crs, normalizedCRS);
@@ -273,7 +274,7 @@ public final class ServicesForMetadata e
final CoordinateReferenceSystem crs = envelope.getCoordinateReferenceSystem();
final VerticalCRS verticalCRS = CRS.getVerticalComponent(crs, true);
if (verticalCRS == null && envelope.getDimension() != 1) {
- throw new TransformException(dimensionNotFound(Errors.Keys.MissingVerticalDimension_1, crs));
+ throw new TransformException(dimensionNotFound(Resources.Keys.MissingVerticalDimension_1, crs));
}
setVerticalExtent(envelope, target, crs, verticalCRS);
}
@@ -291,7 +292,7 @@ public final class ServicesForMetadata e
final CoordinateReferenceSystem crs = envelope.getCoordinateReferenceSystem();
final TemporalCRS temporalCRS = CRS.getTemporalComponent(crs);
if (temporalCRS == null) { // Mandatory for the conversion from numbers to dates.
- throw new TransformException(dimensionNotFound(Errors.Keys.MissingTemporalDimension_1, crs));
+ throw new TransformException(dimensionNotFound(Resources.Keys.MissingTemporalDimension_1, crs));
}
setTemporalExtent(envelope, target, crs, temporalCRS);
}
@@ -312,7 +313,7 @@ public final class ServicesForMetadata e
final VerticalCRS verticalCRS = CRS.getVerticalComponent(crs, true);
final TemporalCRS temporalCRS = CRS.getTemporalComponent(crs);
if (horizontalCRS == null && verticalCRS == null && temporalCRS == null) {
- throw new TransformException(dimensionNotFound(Errors.Keys.MissingSpatioTemporalDimension_1, crs));
+ throw new TransformException(dimensionNotFound(Resources.Keys.MissingSpatioTemporalDimension_1, crs));
}
/*
* Try to set the geographic bounding box first, because this operation may fail with a
@@ -379,7 +380,7 @@ public final class ServicesForMetadata e
final VerticalCRS verticalCRS = CRS.getVerticalComponent(crs, true);
final TemporalCRS temporalCRS = CRS.getTemporalComponent(crs);
if (horizontalCRS == null && verticalCRS == null && temporalCRS == null) {
- throw new TransformException(dimensionNotFound(Errors.Keys.MissingSpatioTemporalDimension_1, crs));
+ throw new TransformException(dimensionNotFound(Resources.Keys.MissingSpatioTemporalDimension_1, crs));
}
if (horizontalCRS != null) {
final DefaultGeographicBoundingBox extent = new DefaultGeographicBoundingBox();
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/SignReversalComment.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/SignReversalComment.java?rev=1764119&r1=1764118&r2=1764119&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/SignReversalComment.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/SignReversalComment.java [UTF-8] Mon Oct 10 15:24:03 2016
@@ -20,7 +20,6 @@ import java.util.Locale;
import java.io.Serializable;
import java.io.ObjectStreamException;
import org.apache.sis.util.iso.AbstractInternationalString;
-import org.apache.sis.util.resources.Messages;
/**
@@ -73,9 +72,9 @@ public final class SignReversalComment e
*/
@Override
public String toString(final Locale locale) {
- return Messages.getResources(locale).getString(opposite
- ? Messages.Keys.InverseOperationUsesOppositeSign
- : Messages.Keys.InverseOperationUsesSameSign);
+ return Resources.forLocale(locale).getString(opposite
+ ? Resources.Keys.InverseOperationUsesOppositeSign
+ : Resources.Keys.InverseOperationUsesSameSign);
}
/**
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/j2d/AffineMatrix.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/j2d/AffineMatrix.java?rev=1764119&r1=1764118&r2=1764119&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/j2d/AffineMatrix.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/j2d/AffineMatrix.java [UTF-8] Mon Oct 10 15:24:03 2016
@@ -20,10 +20,10 @@ import java.util.Arrays;
import java.io.Serializable;
import java.awt.geom.AffineTransform;
import org.opengis.referencing.operation.Matrix;
+import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.internal.referencing.ExtendedPrecisionMatrix;
import org.apache.sis.referencing.operation.matrix.Matrices;
import org.apache.sis.util.ArgumentChecks;
-import org.apache.sis.util.resources.Errors;
/**
@@ -168,7 +168,7 @@ final class AffineMatrix implements Exte
*/
@Override
public final void setElement(final int row, final int column, final double value) {
- throw new UnsupportedOperationException(Errors.format(Errors.Keys.UnmodifiableAffineTransform));
+ throw new UnsupportedOperationException(Resources.format(Resources.Keys.UnmodifiableAffineTransform));
}
/**
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/j2d/ImmutableAffineTransform.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/j2d/ImmutableAffineTransform.java?rev=1764119&r1=1764118&r2=1764119&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/j2d/ImmutableAffineTransform.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/j2d/ImmutableAffineTransform.java [UTF-8] Mon Oct 10 15:24:03 2016
@@ -18,7 +18,7 @@ package org.apache.sis.internal.referenc
import java.awt.geom.AffineTransform;
import java.awt.geom.NoninvertibleTransformException;
-import org.apache.sis.util.resources.Errors;
+import org.apache.sis.internal.referencing.Resources;
/**
@@ -81,7 +81,7 @@ public class ImmutableAffineTransform ex
* @throws UnsupportedOperationException if this affine transform is immutable.
*/
protected void checkPermission() throws UnsupportedOperationException {
- throw new UnsupportedOperationException(Errors.format(Errors.Keys.UnmodifiableAffineTransform));
+ throw new UnsupportedOperationException(Resources.format(Resources.Keys.UnmodifiableAffineTransform));
}
/**
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/DatumShiftGridLoader.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/DatumShiftGridLoader.java?rev=1764119&r1=1764118&r2=1764119&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/DatumShiftGridLoader.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/DatumShiftGridLoader.java [UTF-8] Mon Oct 10 15:24:03 2016
@@ -24,9 +24,9 @@ import java.nio.ByteBuffer;
import java.nio.channels.ReadableByteChannel;
import org.opengis.util.FactoryException;
import org.apache.sis.util.resources.Errors;
-import org.apache.sis.util.resources.Messages;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.internal.system.Loggers;
+import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.referencing.factory.FactoryDataException;
import org.apache.sis.referencing.factory.MissingFactoryResourceException;
@@ -146,7 +146,7 @@ class DatumShiftGridLoader {
* @param file The grid file, as a {@link String} or a {@link Path}.
*/
static void log(final Class<?> caller, final Object file) {
- final LogRecord record = Messages.getResources(null).getLogRecord(Level.FINE, Messages.Keys.LoadingDatumShiftFile_1, file);
+ final LogRecord record = Resources.forLocale(null).getLogRecord(Level.FINE, Resources.Keys.LoadingDatumShiftFile_1, file);
record.setLoggerName(Loggers.COORDINATE_OPERATION);
Logging.log(caller, "createMathTransform", record);
}
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Equirectangular.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Equirectangular.java?rev=1764119&r1=1764118&r2=1764119&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Equirectangular.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Equirectangular.java [UTF-8] Mon Oct 10 15:24:03 2016
@@ -32,9 +32,9 @@ import org.apache.sis.referencing.operat
import org.apache.sis.referencing.operation.transform.ContextualParameters;
import org.apache.sis.referencing.operation.transform.MathTransforms;
import org.apache.sis.internal.referencing.j2d.ParameterizedAffine;
+import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.internal.util.DoubleDouble;
import org.apache.sis.internal.util.Constants;
-import org.apache.sis.util.resources.Messages;
import static java.lang.Math.*;
@@ -173,7 +173,7 @@ public final class Equirectangular exten
.addName(Citations.NETCDF, "latitude_of_projection_origin")
.addName(Citations.GEOTIFF, "ProjCenterLat")
.addName(Citations.PROJ4, "lat_0")
- .setRemarks(Messages.formatInternational(Messages.Keys.ConstantProjParameterValue_1, 0))
+ .setRemarks(Resources.formatInternational(Resources.Keys.ConstantProjParameterValue_1, 0))
.setRequired(false));
// Do not declare the ESRI "Equidistant_Cylindrical" projection name below,
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertConformalWest.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertConformalWest.java?rev=1764119&r1=1764118&r2=1764119&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertConformalWest.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/LambertConformalWest.java [UTF-8] Mon Oct 10 15:24:03 2016
@@ -19,8 +19,8 @@ package org.apache.sis.internal.referenc
import javax.xml.bind.annotation.XmlTransient;
import org.opengis.parameter.ParameterDescriptor;
import org.opengis.parameter.ParameterDescriptorGroup;
+import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.parameter.ParameterBuilder;
-import org.apache.sis.util.resources.Messages;
/**
@@ -68,7 +68,7 @@ public final class LambertConformalWest
final ParameterBuilder builder = builder();
FALSE_WESTING = createShift(builder
.addNamesAndIdentifiers(LambertConformal1SP.FALSE_EASTING)
- .setRemarks(Messages.formatInternational(Messages.Keys.MisnamedParameter_1, "False westing")));
+ .setRemarks(Resources.formatInternational(Resources.Keys.MisnamedParameter_1, "False westing")));
PARAMETERS = builder
.addIdentifier(IDENTIFIER)
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java?rev=1764119&r1=1764118&r2=1764119&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java [UTF-8] Mon Oct 10 15:24:03 2016
@@ -36,6 +36,7 @@ import org.opengis.referencing.Reference
import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.MathTransformFactory;
import org.opengis.referencing.operation.Projection;
+import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.internal.util.Constants;
import org.apache.sis.measure.MeasurementRange;
import org.apache.sis.referencing.NamedIdentifier;
@@ -45,7 +46,6 @@ import org.apache.sis.parameter.DefaultP
import org.apache.sis.parameter.ParameterBuilder;
import org.apache.sis.parameter.Parameters;
import org.apache.sis.util.resources.Errors;
-import org.apache.sis.util.resources.Messages;
import org.apache.sis.util.Debug;
import static org.opengis.metadata.Identifier.AUTHORITY_KEY;
@@ -160,7 +160,7 @@ public abstract class MapProjection exte
throws IllegalArgumentException
{
if (Double.isNaN(value) || Double.isInfinite(value)) {
- throw new IllegalArgumentException(Errors.format(Errors.Keys.IllegalParameterValue_2,
+ throw new IllegalArgumentException(Resources.format(Resources.Keys.IllegalParameterValue_2,
descriptor.getName(), value));
}
final Comparable<? extends Number> min = descriptor.getMinimumValue();
@@ -356,6 +356,6 @@ public abstract class MapProjection exte
* @return a remarks saying that the parameter is actually defined in {@code origin}.
*/
static InternationalString notFormalParameter(final String origin) {
- return Messages.formatInternational(Messages.Keys.NotFormalProjectionParameter_1, origin);
+ return Resources.formatInternational(Resources.Keys.NotFormalProjectionParameter_1, origin);
}
}
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/TransverseMercatorSouth.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/TransverseMercatorSouth.java?rev=1764119&r1=1764118&r2=1764119&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/TransverseMercatorSouth.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/TransverseMercatorSouth.java [UTF-8] Mon Oct 10 15:24:03 2016
@@ -22,8 +22,8 @@ import org.opengis.parameter.ParameterDe
import org.apache.sis.metadata.iso.citation.Citations;
import org.apache.sis.parameter.ParameterBuilder;
import org.apache.sis.parameter.Parameters;
+import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.referencing.operation.projection.NormalizedProjection;
-import org.apache.sis.util.resources.Messages;
/**
@@ -59,7 +59,7 @@ public final class TransverseMercatorSou
final ParameterBuilder builder = builder();
final ParameterDescriptor<Double> falseSouthing = createShift(builder
.addNamesAndIdentifiers(FALSE_NORTHING)
- .setRemarks(Messages.formatInternational(Messages.Keys.MisnamedParameter_1, "False southing")));
+ .setRemarks(Resources.formatInternational(Resources.Keys.MisnamedParameter_1, "False southing")));
PARAMETERS = builder
.addIdentifier(IDENTIFIER)
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptorGroup.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptorGroup.java?rev=1764119&r1=1764118&r2=1764119&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptorGroup.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterDescriptorGroup.java [UTF-8] Mon Oct 10 15:24:03 2016
@@ -31,6 +31,7 @@ import org.opengis.parameter.ParameterNo
import org.opengis.parameter.InvalidParameterNameException;
import org.apache.sis.internal.jaxb.referencing.CC_OperationParameterGroup;
import org.apache.sis.internal.metadata.MetadataUtilities;
+import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.internal.util.UnmodifiableArrayList;
import org.apache.sis.util.resources.Errors;
@@ -214,8 +215,8 @@ public class DefaultParameterDescriptorG
final String name = parameter.getName().getCode();
for (int j=0; j<i; j++) {
if (IdentifiedObjects.isHeuristicMatchForName(parameters[j], name)) {
- throw new InvalidParameterNameException(Errors.getResources(properties).getString(
- Errors.Keys.DuplicatedParameterName_4, Verifier.getDisplayName(parameters[j]), j, name, i),
+ throw new InvalidParameterNameException(Resources.forProperties(properties).getString(
+ Resources.Keys.DuplicatedParameterName_4, Verifier.getDisplayName(parameters[j]), j, name, i),
name);
}
}
@@ -363,7 +364,7 @@ public class DefaultParameterDescriptorG
? Errors.format(Errors.Keys.AmbiguousName_3,
IdentifiedObjects.toString(fallback.getName()),
IdentifiedObjects.toString(ambiguity.getName()), name)
- : Errors.format(Errors.Keys.ParameterNotFound_2, Verifier.getDisplayName(this), name), name);
+ : Resources.format(Resources.Keys.ParameterNotFound_2, Verifier.getDisplayName(this), name), name);
}
/**
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java?rev=1764119&r1=1764118&r2=1764119&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java [UTF-8] Mon Oct 10 15:24:03 2016
@@ -39,6 +39,7 @@ import org.apache.sis.io.wkt.Convention;
import org.apache.sis.io.wkt.ElementKind;
import org.apache.sis.internal.jaxb.gml.Measure;
import org.apache.sis.internal.jaxb.gml.MeasureList;
+import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.internal.referencing.WKTUtilities;
import org.apache.sis.internal.metadata.MetadataUtilities;
import org.apache.sis.internal.metadata.WKTKeywords;
@@ -379,7 +380,7 @@ public class DefaultParameterValue<T> ex
private UnitConverter getConverterTo(final Unit<?> unit) {
final Unit<?> source = getUnit();
if (source == null) {
- throw new IllegalStateException(Errors.format(Errors.Keys.UnitlessParameter_1, Verifier.getDisplayName(descriptor)));
+ throw new IllegalStateException(Resources.format(Resources.Keys.UnitlessParameter_1, Verifier.getDisplayName(descriptor)));
}
ensureNonNull("unit", unit);
final short expectedID = Verifier.getUnitMessageID(source);
@@ -504,7 +505,7 @@ public class DefaultParameterValue<T> ex
if (value != null) {
throw new InvalidParameterTypeException(getClassTypeError(), name);
}
- throw new IllegalStateException(Errors.format(Errors.Keys.MissingValueForParameter_1, cause, name));
+ throw new IllegalStateException(Resources.format(Resources.Keys.MissingValueForParameter_1, name), cause);
}
/**
@@ -536,14 +537,14 @@ public class DefaultParameterValue<T> ex
if (value != null) {
return new InvalidParameterTypeException(getClassTypeError(), name);
}
- return new IllegalStateException(Errors.format(Errors.Keys.MissingValueForParameter_1, name));
+ return new IllegalStateException(Resources.format(Resources.Keys.MissingValueForParameter_1, name));
}
/**
* Formats an error message for illegal method call for the current value type.
*/
private String getClassTypeError() {
- return Errors.format(Errors.Keys.IllegalOperationForValueClass_1,
+ return Resources.format(Resources.Keys.IllegalOperationForValueClass_1,
(descriptor != null) ? ((ParameterDescriptor<?>) descriptor).getValueClass() : "?");
}
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java?rev=1764119&r1=1764118&r2=1764119&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValueGroup.java [UTF-8] Mon Oct 10 15:24:03 2016
@@ -35,6 +35,7 @@ import org.opengis.parameter.GeneralPara
import org.opengis.parameter.ParameterNotFoundException;
import org.opengis.parameter.InvalidParameterCardinalityException;
import org.apache.sis.internal.metadata.MetadataUtilities;
+import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.util.LenientComparable;
import org.apache.sis.util.ComparisonMode;
@@ -259,7 +260,7 @@ public class DefaultParameterValueGroup
*/
final GeneralParameterDescriptor descriptor = values.descriptor.descriptor(name);
if (!(descriptor instanceof ParameterDescriptor<?>) || descriptor.getMaximumOccurs() == 0) {
- throw new ParameterNotFoundException(Errors.format(Errors.Keys.ParameterNotFound_2,
+ throw new ParameterNotFoundException(Resources.format(Resources.Keys.ParameterNotFound_2,
Verifier.getDisplayName(values.descriptor), name), name);
}
/*
@@ -358,7 +359,7 @@ public class DefaultParameterValueGroup
if (groups.isEmpty()) {
final ParameterDescriptorGroup descriptor = values.descriptor;
if (!(descriptor.descriptor(name) instanceof ParameterDescriptorGroup)) {
- throw new ParameterNotFoundException(Errors.format(Errors.Keys.ParameterNotFound_2,
+ throw new ParameterNotFoundException(Resources.format(Resources.Keys.ParameterNotFound_2,
Verifier.getDisplayName(descriptor), name), name);
}
}
@@ -390,8 +391,8 @@ public class DefaultParameterValueGroup
final ParameterDescriptorGroup descriptor = values.descriptor;
final GeneralParameterDescriptor child = descriptor.descriptor(name);
if (!(child instanceof ParameterDescriptorGroup)) {
- throw new ParameterNotFoundException(Errors.format(
- Errors.Keys.ParameterNotFound_2, descriptor.getName(), name), name);
+ throw new ParameterNotFoundException(Resources.format(
+ Resources.Keys.ParameterNotFound_2, descriptor.getName(), name), name);
}
final ParameterValueGroup value = ((ParameterDescriptorGroup) child).createValue();
values.add(value);
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterValueList.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterValueList.java?rev=1764119&r1=1764118&r2=1764119&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterValueList.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/ParameterValueList.java [UTF-8] Mon Oct 10 15:24:03 2016
@@ -35,6 +35,7 @@ import org.apache.sis.util.ArraysExt;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.referencing.IdentifiedObjects;
+import org.apache.sis.internal.referencing.Resources;
/**
@@ -242,11 +243,11 @@ final class ParameterValueList extends A
final String code = name.getCode();
for (final GeneralParameterDescriptor descriptor : descriptors) {
if (IdentifiedObjects.isHeuristicMatchForName(descriptor, code)) {
- throw new IllegalArgumentException(Errors.format(
- Errors.Keys.MismatchedParameterDescriptor_1, name));
+ throw new IllegalArgumentException(Resources.format(
+ Resources.Keys.MismatchedParameterDescriptor_1, name));
}
}
- throw new InvalidParameterNameException(Errors.format(Errors.Keys.ParameterNotFound_2,
+ throw new InvalidParameterNameException(Resources.format(Resources.Keys.ParameterNotFound_2,
Verifier.getDisplayName(descriptor), name), code);
}
}
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java?rev=1764119&r1=1764118&r2=1764119&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/Parameters.java [UTF-8] Mon Oct 10 15:24:03 2016
@@ -27,6 +27,7 @@ import org.opengis.metadata.Identifier;
import org.opengis.metadata.citation.Citation;
import org.opengis.parameter.*; // We use almost all types from this package.
import org.apache.sis.internal.jaxb.metadata.replace.ServiceParameter;
+import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.measure.Range;
import org.apache.sis.measure.NumberRange;
import org.apache.sis.measure.MeasurementRange;
@@ -201,7 +202,7 @@ public abstract class Parameters impleme
// We require a strict equality - not type.isAssignableFrom(actual) - because in
// the later case we could have (to be strict) to return a <? extends T> type.
if (!valueClass.equals(actual)) {
- throw new ClassCastException(Errors.format(Errors.Keys.IllegalParameterType_2,
+ throw new ClassCastException(Resources.format(Resources.Keys.IllegalParameterType_2,
Verifier.getDisplayName(descriptor), actual));
}
}
@@ -231,7 +232,7 @@ public abstract class Parameters impleme
final ParameterDescriptor<?> descriptor = parameter.getDescriptor();
final Class<?> actual = descriptor.getValueClass();
if (!valueClass.equals(actual)) { // Same comment than cast(ParameterDescriptor).
- throw new ClassCastException(Errors.format(Errors.Keys.IllegalParameterType_2,
+ throw new ClassCastException(Resources.format(Resources.Keys.IllegalParameterType_2,
Verifier.getDisplayName(descriptor), actual));
}
}
@@ -518,7 +519,7 @@ public abstract class Parameters impleme
if (value != null) {
return value;
} else {
- throw new IllegalStateException(Errors.format(Errors.Keys.MissingValueForParameter_1,
+ throw new IllegalStateException(Resources.format(Resources.Keys.MissingValueForParameter_1,
Verifier.getDisplayName(parameter)));
}
}
@@ -533,7 +534,7 @@ public abstract class Parameters impleme
if (value != null) {
return value;
} else {
- throw new IllegalStateException(Errors.format(Errors.Keys.MissingValueForParameter_1,
+ throw new IllegalStateException(Resources.format(Resources.Keys.MissingValueForParameter_1,
Verifier.getDisplayName(parameter)));
}
}
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorParameters.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorParameters.java?rev=1764119&r1=1764118&r2=1764119&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorParameters.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorParameters.java [UTF-8] Mon Oct 10 15:24:03 2016
@@ -39,6 +39,7 @@ import org.apache.sis.referencing.NamedI
import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.referencing.operation.matrix.Matrices;
import org.apache.sis.internal.referencing.provider.Affine;
+import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.internal.util.Constants;
import org.apache.sis.metadata.iso.citation.Citations;
import org.apache.sis.measure.NumberRange;
@@ -616,8 +617,8 @@ public class TensorParameters<E> impleme
return param;
}
}
- throw (ParameterNotFoundException) new ParameterNotFoundException(Errors.format(
- Errors.Keys.ParameterNotFound_2, caller.getName(), name), name).initCause(cause);
+ throw (ParameterNotFoundException) new ParameterNotFoundException(Resources.format(
+ Resources.Keys.ParameterNotFound_2, caller.getName(), name), name).initCause(cause);
}
/**
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorValues.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorValues.java?rev=1764119&r1=1764118&r2=1764119&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorValues.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/TensorValues.java [UTF-8] Mon Oct 10 15:24:03 2016
@@ -33,6 +33,7 @@ import org.opengis.parameter.GeneralPara
import org.opengis.parameter.ParameterNotFoundException;
import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.referencing.operation.matrix.Matrices;
+import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.internal.referencing.WKTUtilities;
import org.apache.sis.internal.metadata.WKTKeywords;
import org.apache.sis.internal.util.Numerics;
@@ -238,8 +239,8 @@ final class TensorValues<E> extends Abst
return dimensions[i];
}
}
- throw (ParameterNotFoundException) new ParameterNotFoundException(Errors.format(
- Errors.Keys.ParameterNotFound_2, getName(), name), name).initCause(cause);
+ throw (ParameterNotFoundException) new ParameterNotFoundException(Resources.format(
+ Resources.Keys.ParameterNotFound_2, getName(), name), name).initCause(cause);
}
/**
@@ -358,7 +359,7 @@ final class TensorValues<E> extends Abst
*/
@Override
public List<ParameterValueGroup> groups(final String name) throws ParameterNotFoundException {
- throw new ParameterNotFoundException(Errors.format(Errors.Keys.ParameterNotFound_2, getName(), name), name);
+ throw new ParameterNotFoundException(Resources.format(Resources.Keys.ParameterNotFound_2, getName(), name), name);
}
/**
@@ -366,7 +367,7 @@ final class TensorValues<E> extends Abst
*/
@Override
public ParameterValueGroup addGroup(String name) throws ParameterNotFoundException, IllegalStateException {
- throw new ParameterNotFoundException(Errors.format(Errors.Keys.ParameterNotFound_2, getName(), name), name);
+ throw new ParameterNotFoundException(Resources.format(Resources.Keys.ParameterNotFound_2, getName(), name), name);
}
/**
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValueGroup.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValueGroup.java?rev=1764119&r1=1764118&r2=1764119&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValueGroup.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/UnmodifiableParameterValueGroup.java [UTF-8] Mon Oct 10 15:24:03 2016
@@ -31,6 +31,7 @@ import org.apache.sis.util.ArgumentCheck
import org.apache.sis.util.ComparisonMode;
import org.apache.sis.util.LenientComparable;
import org.apache.sis.util.resources.Errors;
+import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.internal.util.UnmodifiableArrayList;
// Branch-dependent imports
@@ -146,7 +147,7 @@ final class UnmodifiableParameterValueGr
if (value != null) {
return value;
}
- throw new ParameterNotFoundException(Errors.format(Errors.Keys.ParameterNotFound_2,
+ throw new ParameterNotFoundException(Resources.format(Resources.Keys.ParameterNotFound_2,
Verifier.getDisplayName(descriptor), name), name);
}
@@ -166,7 +167,7 @@ final class UnmodifiableParameterValueGr
}
if (groups.isEmpty()) {
if (!(descriptor.descriptor(name) instanceof ParameterDescriptorGroup)) {
- throw new ParameterNotFoundException(Errors.format(Errors.Keys.ParameterNotFound_2,
+ throw new ParameterNotFoundException(Resources.format(Resources.Keys.ParameterNotFound_2,
Verifier.getDisplayName(descriptor), name), name);
}
}
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/Verifier.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/Verifier.java?rev=1764119&r1=1764118&r2=1764119&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/Verifier.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/parameter/Verifier.java [UTF-8] Mon Oct 10 15:24:03 2016
@@ -29,6 +29,7 @@ import org.opengis.parameter.ParameterDe
import org.opengis.parameter.GeneralParameterDescriptor;
import org.opengis.parameter.InvalidParameterValueException;
import org.apache.sis.internal.referencing.EPSGParameterDomain;
+import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.internal.system.Semaphores;
import org.apache.sis.internal.system.Loggers;
import org.apache.sis.measure.Range;
@@ -46,16 +47,22 @@ import org.apache.sis.util.resources.Voc
*
* @author Martin Desruisseaux (IRD, Geomatys)
* @since 0.4
- * @version 0.7
+ * @version 0.8
* @module
*/
final class Verifier {
/**
- * The {@link Errors.Keys} value that describe the invalid value.
+ * The {@link Errors.Keys} or {@link Resources.Keys} value that describe the invalid value.
*/
private final short errorKey;
/**
+ * {@code false} if {@link #errorKey} is a {@code Errors.Keys} constants,
+ * or {@code true} if it is a {@code Resources.Keys} constant.
+ */
+ private final boolean internal;
+
+ /**
* {@code true} if the last element in {@link #arguments} shall be set to the erroneous value.
*/
private final boolean needsValue;
@@ -75,8 +82,9 @@ final class Verifier {
/**
* Stores information about an error.
*/
- private Verifier(final short errorKey, final boolean needsValue, final Object... arguments) {
+ private Verifier(final boolean internal, final short errorKey, final boolean needsValue, final Object... arguments) {
this.errorKey = errorKey;
+ this.internal = internal;
this.needsValue = needsValue;
this.arguments = arguments;
}
@@ -117,7 +125,7 @@ final class Verifier {
def = getCompatibleUnit(Parameters.getValueDomain(descriptor), unit);
if (def == null) {
final String name = getDisplayName(descriptor);
- throw new InvalidParameterValueException(Errors.format(Errors.Keys.UnitlessParameter_1, name), name, unit);
+ throw new InvalidParameterValueException(Resources.format(Resources.Keys.UnitlessParameter_1, name), name, unit);
}
}
if (!unit.equals(def)) {
@@ -133,7 +141,7 @@ final class Verifier {
if (!valueClass.isInstance(value)) {
final String name = getDisplayName(descriptor);
throw new InvalidParameterValueException(
- Errors.format(Errors.Keys.IllegalParameterValueClass_3,
+ Resources.format(Resources.Keys.IllegalParameterValueClass_3,
name, valueClass, value.getClass()), name, value);
}
/*
@@ -241,7 +249,7 @@ final class Verifier {
*/
assert valueDomain.getElementType() == valueClass : valueDomain;
if (!((Range) valueDomain).contains((Comparable<?>) convertedValue)) {
- return new Verifier(Errors.Keys.ValueOutOfRange_4, true, null,
+ return new Verifier(false, Errors.Keys.ValueOutOfRange_4, true, null,
valueDomain.getMinValue(), valueDomain.getMaxValue(), convertedValue);
}
} else {
@@ -253,7 +261,7 @@ final class Verifier {
for (int i=0; i<length; i++) {
final Object e = Array.get(convertedValue, i);
if (!((Range) valueDomain).contains((Comparable<?>) e)) {
- return new Verifier(Errors.Keys.ValueOutOfRange_4, true, i,
+ return new Verifier(false, Errors.Keys.ValueOutOfRange_4, true, i,
valueDomain.getMinValue(), valueDomain.getMaxValue(), e);
}
}
@@ -279,15 +287,16 @@ final class Verifier {
final Comparable<T> minimum, final Comparable<T> maximum, final Object convertedValue)
{
if (!valueClass.isInstance(convertedValue)) {
- return new Verifier(Errors.Keys.IllegalParameterValueClass_3, false, null, valueClass, convertedValue.getClass());
+ return new Verifier(true, Resources.Keys.IllegalParameterValueClass_3,
+ false, null, valueClass, convertedValue.getClass());
}
if (validValues != null && !validValues.contains(convertedValue)) {
- return new Verifier(Errors.Keys.IllegalParameterValue_2, true, null, convertedValue);
+ return new Verifier(true, Resources.Keys.IllegalParameterValue_2, true, null, convertedValue);
}
if ((minimum != null && minimum.compareTo((T) convertedValue) > 0) ||
(maximum != null && maximum.compareTo((T) convertedValue) < 0))
{
- return new Verifier(Errors.Keys.ValueOutOfRange_4, true, null, minimum, maximum, convertedValue);
+ return new Verifier(false, Errors.Keys.ValueOutOfRange_4, true, null, minimum, maximum, convertedValue);
}
return null;
}
@@ -300,7 +309,7 @@ final class Verifier {
* uses the inverse of that conversion for converting the given minimum and maximum values.
*/
private void convertRange(UnitConverter converter) {
- if (converter != null && errorKey == Errors.Keys.ValueOutOfRange_4) {
+ if (converter != null && !internal && errorKey == Errors.Keys.ValueOutOfRange_4) {
converter = converter.inverse();
Object minimumValue = arguments[1];
Object maximumValue = arguments[2];
@@ -344,7 +353,7 @@ final class Verifier {
if (needsValue) {
arguments[arguments.length - 1] = value;
}
- return Errors.getResources(properties).getString(errorKey, arguments);
+ return (internal ? Resources.forProperties(properties) : Errors.getResources(properties)).getString(errorKey, arguments);
}
/**
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java?rev=1764119&r1=1764118&r2=1764119&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java [UTF-8] Mon Oct 10 15:24:03 2016
@@ -65,11 +65,12 @@ import org.apache.sis.referencing.factor
import org.apache.sis.metadata.iso.citation.Citations;
import org.apache.sis.internal.referencing.provider.TransverseMercator;
import org.apache.sis.internal.referencing.Formulas;
+import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.internal.system.SystemListener;
import org.apache.sis.internal.system.Modules;
import org.apache.sis.internal.system.Loggers;
+import org.apache.sis.internal.util.Constants;
import org.apache.sis.util.resources.Vocabulary;
-import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.Exceptions;
@@ -373,11 +374,11 @@ public enum CommonCRS {
/**
* Creates a new constant for the given EPSG or SIS codes.
*
- * @param geographic The EPSG code for the two-dimensional geographic CRS.
- * @param geo3D The EPSG code of the three-dimensional geographic CRS, or 0 if none.
- * @param geocentric The EPSG code of the geocentric CRS, or 0 if none.
- * @param datum The EPSG code for the datum.
- * @param ellipsoid The EPSG code for the ellipsoid.
+ * @param geographic the EPSG code for the two-dimensional geographic CRS.
+ * @param geo3D the EPSG code of the three-dimensional geographic CRS, or 0 if none.
+ * @param geocentric the EPSG code of the geocentric CRS, or 0 if none.
+ * @param datum the EPSG code for the datum.
+ * @param ellipsoid the EPSG code for the ellipsoid.
*/
private CommonCRS(final short geographic, final short geo3D, final short geocentric, final short datum, final short ellipsoid,
final short northUTM, final short southUTM, final byte firstZone, final byte lastZone)
@@ -443,7 +444,7 @@ public enum CommonCRS {
* Since ISO 19115 {@link org.opengis.metadata.extent.GeographicBoundingBox} is approximative by definition,
* their datum can be arbitrary.
*
- * @return The default two-dimensional geographic CRS with (<var>longitude</var>, <var>latitude</var>) axis order.
+ * @return the default two-dimensional geographic CRS with (<var>longitude</var>, <var>latitude</var>) axis order.
*/
public static GeographicCRS defaultGeographic() {
return DEFAULT.normalizedGeographic();
@@ -468,7 +469,7 @@ public enum CommonCRS {
* <tr><td>WGS 84</td> <td>{@link #WGS84}</td> <td>CRS:84</td></tr>
* </table></blockquote>
*
- * @return The geographic CRS with non-standard (<var>longitude</var>, <var>latitude</var>) axis order.
+ * @return the geographic CRS with non-standard (<var>longitude</var>, <var>latitude</var>) axis order.
*
* @see CRS#forCode(String)
* @see DefaultGeographicCRS#forConvention(AxesConvention)
@@ -508,7 +509,7 @@ public enum CommonCRS {
* <tr><td>WGS 84</td> <td>{@link #WGS84}</td> <td>4326</td></tr>
* </table></blockquote>
*
- * @return The geographic CRS with standard (<var>latitude</var>, <var>longitude</var>) axis order.
+ * @return the geographic CRS with standard (<var>latitude</var>, <var>longitude</var>) axis order.
*
* @see CRS#forCode(String)
* @see DefaultGeographicCRS
@@ -563,7 +564,7 @@ public enum CommonCRS {
* <tr><td>WGS 84</td> <td>{@link #WGS84}</td> <td>4979</td></tr>
* </table></blockquote>
*
- * @return The three-dimensional geographic CRS associated to this enum.
+ * @return the three-dimensional geographic CRS associated to this enum.
*
* @see CRS#forCode(String)
* @see DefaultGeographicCRS
@@ -621,7 +622,7 @@ public enum CommonCRS {
* <tr><td>WGS 84</td> <td>{@link #WGS84}</td> <td>4978</td></tr>
* </table></blockquote>
*
- * @return The geocentric CRS associated to this enum.
+ * @return the geocentric CRS associated to this enum.
*
* @see CRS#forCode(String)
* @see DefaultGeocentricCRS
@@ -671,7 +672,7 @@ public enum CommonCRS {
* <li>Geocentric radius in metres oriented toward {@linkplain AxisDirection#UP up}.</li>
* </ol>
*
- * @return The geocentric CRS associated to this enum.
+ * @return the geocentric CRS associated to this enum.
*
* @see DefaultGeocentricCRS
*
@@ -729,7 +730,7 @@ public enum CommonCRS {
* <tr><td>World Geodetic System 1984</td> <td>{@link #WGS84}</td> <td>6326</td></tr>
* </table></blockquote>
*
- * @return The geodetic datum associated to this enum.
+ * @return the geodetic datum associated to this enum.
*
* @see org.apache.sis.referencing.datum.DefaultGeodeticDatum
*/
@@ -770,7 +771,7 @@ public enum CommonCRS {
* <tr><td>World Geodetic System (WGS) 1984</td> <td>{@link #WGS84}</td> <td>7030</td></tr>
* </table></blockquote>
*
- * @return The ellipsoid associated to this enum.
+ * @return the ellipsoid associated to this enum.
*
* @see org.apache.sis.referencing.datum.DefaultEllipsoid
*/
@@ -810,7 +811,7 @@ public enum CommonCRS {
* <tr><td>Greenwich</td> <td>{@link #WGS84}</td> <td>8901</td></tr>
* </table></blockquote>
*
- * @return The prime meridian associated to this enum.
+ * @return the prime meridian associated to this enum.
*
* @see org.apache.sis.referencing.datum.DefaultPrimeMeridian
*/
@@ -828,7 +829,7 @@ public enum CommonCRS {
cached = object = factory.createPrimeMeridian(StandardDefinitions.GREENWICH);
return object;
} catch (FactoryException e) {
- failure(this, "primeMeridian", e, (short) 8901);
+ failure(this, "primeMeridian", e, Constants.EPSG_GREENWICH);
}
object = StandardDefinitions.primeMeridian();
}
@@ -924,9 +925,9 @@ public enum CommonCRS {
*
* The coordinate system axes are (Easting, Northing) in metres.
*
- * @param latitude A latitude in the desired UTM projection zone.
- * @param longitude A longitude in the desired UTM projection zone.
- * @return A Universal Transverse Mercator projection for the zone containing the given point.
+ * @param latitude a latitude in the desired UTM projection zone.
+ * @param longitude a longitude in the desired UTM projection zone.
+ * @return a Universal Transverse Mercator projection for the zone containing the given point.
*
* @since 0.7
*/
@@ -943,7 +944,7 @@ public enum CommonCRS {
if (crs == null) {
int code = 0;
if (zone >= firstZone && zone <= lastZone) {
- code = JDK8.toUnsignedInt(isSouth ? southUTM : northUTM);
+ code = (isSouth ? southUTM : northUTM) & 0xFFFF;
if (code != 0) {
code += zone;
final CRSAuthorityFactory factory = crsFactory();
@@ -1184,7 +1185,7 @@ public enum CommonCRS {
* <tr><td>Other surface</td> <td>{@link #OTHER_SURFACE}</td> <td></td></tr>
* </table></blockquote>
*
- * @return The CRS associated to this enum.
+ * @return the CRS associated to this enum.
*
* @see DefaultVerticalCRS
*/
@@ -1249,7 +1250,7 @@ public enum CommonCRS {
* <tr><td>Other surface</td> <td>{@link #OTHER_SURFACE}</td> <td></td></tr>
* </table></blockquote>
*
- * @return The datum associated to this enum.
+ * @return the datum associated to this enum.
*
* @see DefaultVerticalDatum
*/
@@ -1432,7 +1433,7 @@ public enum CommonCRS {
* <tr><td>Unix/POSIX or Java</td> <td>{@link #UNIX}</td></tr>
* </table></blockquote>
*
- * @return The CRS associated to this enum.
+ * @return the CRS associated to this enum.
*
* @see DefaultTemporalCRS
*/
@@ -1501,7 +1502,7 @@ public enum CommonCRS {
* <tr><td>Unix/POSIX or Java</td> <td>{@link #UNIX}</td></tr>
* </table></blockquote>
*
- * @return The datum associated to this enum.
+ * @return the datum associated to this enum.
*
* @see DefaultTemporalDatum
*/
@@ -1554,8 +1555,8 @@ public enum CommonCRS {
/**
* Puts the name for the given key in a map of properties to be given to object constructors.
*
- * @param key A constant from {@link org.apache.sis.util.resources.Vocabulary.Keys}.
- * @return The properties to give to the object constructor.
+ * @param key a constant from {@link org.apache.sis.util.resources.Vocabulary.Keys}.
+ * @return the properties to give to the object constructor.
*/
static Map<String,?> properties(final short key) {
return properties(Vocabulary.formatInternational(key));
@@ -1624,7 +1625,7 @@ public enum CommonCRS {
* After invoking this method, the caller will fallback on hard-coded values.
*/
static void failure(final Object caller, final String method, final FactoryException e, final int code) {
- String message = Errors.format(Errors.Keys.CanNotInstantiate_1, "EPSG:" + code);
+ String message = Resources.format(Resources.Keys.CanNotInstantiateGeodeticObject_1, (Constants.EPSG + ':') + code);
message = Exceptions.formatChainedMessages(null, message, e);
final LogRecord record = new LogRecord(Level.WARNING, message);
if (!(e instanceof UnavailableFactoryException) || !AuthorityFactories.failure((UnavailableFactoryException) e)) {
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/EPSGFactoryFallback.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/EPSGFactoryFallback.java?rev=1764119&r1=1764118&r2=1764119&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/EPSGFactoryFallback.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/EPSGFactoryFallback.java [UTF-8] Mon Oct 10 15:24:03 2016
@@ -19,7 +19,6 @@ package org.apache.sis.referencing;
import java.util.Collections;
import java.util.Set;
import java.util.LinkedHashSet;
-import java.util.Locale;
import org.opengis.referencing.IdentifiedObject;
import org.opengis.referencing.NoSuchAuthorityCodeException;
import org.opengis.referencing.datum.DatumAuthorityFactory;
@@ -39,11 +38,11 @@ import org.apache.sis.metadata.iso.citat
import org.apache.sis.metadata.iso.citation.DefaultCitation;
import org.apache.sis.referencing.factory.GeodeticAuthorityFactory;
import org.apache.sis.internal.referencing.provider.TransverseMercator;
+import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.internal.util.Constants;
import org.apache.sis.internal.util.Fallback;
-import org.apache.sis.util.iso.SimpleInternationalString;
+import org.apache.sis.util.resources.Vocabulary;
import org.apache.sis.util.iso.DefaultNameSpace;
-import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.Debug;
@@ -79,6 +78,11 @@ final class EPSGFactoryFallback extends
private static final int CRS = 1, DATUM = 2, ELLIPSOID = 4, PRIME_MERIDIAN = 8;
/**
+ * The authority to report in exceptions. Not necessarily the same than the {@link #authority} title.
+ */
+ private static final String AUTHORITY = Constants.EPSG + "-subset";
+
+ /**
* The authority, created when first needed.
*/
private Citation authority;
@@ -97,7 +101,7 @@ final class EPSGFactoryFallback extends
public synchronized Citation getAuthority() {
if (authority == null) {
final DefaultCitation c = new DefaultCitation(Citations.EPSG);
- c.setTitle(new SimpleInternationalString("Subset of " + c.getTitle().toString(Locale.ENGLISH)));
+ c.setTitle(Vocabulary.formatInternational(Vocabulary.Keys.SubsetOf_1, c.getTitle()));
authority = c;
}
return authority;
@@ -206,7 +210,7 @@ final class EPSGFactoryFallback extends
}
/**
- * Implementation of the {@code createFoo(String)} methods.
+ * Implementation of all {@code createFoo(String)} methods in this fallback class.
*
* @param code the EPSG code.
* @param kind any combination of {@link #CRS}, {@link #DATUM}, {@link #ELLIPSOID} or {@link #PRIME_MERIDIAN} bits.
@@ -214,7 +218,6 @@ final class EPSGFactoryFallback extends
* @throws NoSuchAuthorityCodeException if no matching object has been found.
*/
private IdentifiedObject predefined(String code, final int kind) throws NoSuchAuthorityCodeException {
- NumberFormatException cause = null;
try {
/*
* Parse the value after the last ':'. We do not bother to verify if the part before ':' is legal
@@ -225,7 +228,7 @@ final class EPSGFactoryFallback extends
*/
code = CharSequences.trimWhitespaces(code, code.lastIndexOf(DefaultNameSpace.DEFAULT_SEPARATOR) + 1, code.length()).toString();
final int n = Integer.parseInt(code);
- if ((kind & PRIME_MERIDIAN) != 0 && n == 8901) {
+ if ((kind & PRIME_MERIDIAN) != 0 && n == Constants.EPSG_GREENWICH) {
return CommonCRS.WGS84.primeMeridian();
}
for (final CommonCRS crs : CommonCRS.values()) {
@@ -260,21 +263,27 @@ final class EPSGFactoryFallback extends
}
}
}
- } catch (NumberFormatException e) {
- cause = e;
+ } catch (NumberFormatException cause) {
+ final NoSuchAuthorityCodeException e = new NoSuchAuthorityCodeException(Resources.format(
+ Resources.Keys.NoSuchAuthorityCode_3, Constants.EPSG, toClass(kind), code), AUTHORITY, code);
+ e.initCause(cause);
+ throw e;
}
- final Class<?> type;
+ throw new NoSuchAuthorityCodeException(Resources.format(Resources.Keys.NoSuchAuthorityCodeInSubset_4,
+ Constants.EPSG, toClass(kind), code, "http://sis.apache.org/epsg.html"), AUTHORITY, code);
+ }
+
+ /**
+ * Returns the interface for the given {@link #CRS}, {@link #DATUM}, {@link #ELLIPSOID} or {@link #PRIME_MERIDIAN}
+ * constant. This is used for formatting error message only.
+ */
+ private static Class<?> toClass(final int kind) {
switch (kind) {
- case CRS: type = CoordinateReferenceSystem.class; break;
- case DATUM: type = Datum.class; break;
- case ELLIPSOID: type = Ellipsoid.class; break;
- case PRIME_MERIDIAN: type = PrimeMeridian.class; break;
- default: type = IdentifiedObject.class; break;
+ case CRS: return CoordinateReferenceSystem.class;
+ case DATUM: return Datum.class;
+ case ELLIPSOID: return Ellipsoid.class;
+ case PRIME_MERIDIAN: return PrimeMeridian.class;
+ default: return IdentifiedObject.class;
}
- final String authority = Constants.EPSG + "-subset";
- final NoSuchAuthorityCodeException e = new NoSuchAuthorityCodeException(Errors.format(
- Errors.Keys.NoSuchAuthorityCode_3, authority, type, code), authority, code);
- e.initCause(cause);
- throw e;
}
}
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java?rev=1764119&r1=1764118&r2=1764119&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/StandardDefinitions.java [UTF-8] Mon Oct 10 15:24:03 2016
@@ -82,6 +82,8 @@ import static org.apache.sis.internal.me
final class StandardDefinitions {
/**
* The EPSG code for Greenwich meridian.
+ *
+ * @see org.apache.sis.internal.util.Constants#EPSG_GREENWICH
*/
static final String GREENWICH = "8901";
@@ -94,11 +96,11 @@ final class StandardDefinitions {
/**
* Returns a map of properties for the given EPSG code, name and alias.
*
- * @param code The EPSG code, or 0 if none.
- * @param name The object name.
- * @param alias The alias, or {@code null} if none.
- * @param world {@code true} if the properties shall have an entry for the domain of validity.
- * @return The map of properties to give to constructors or factory methods.
+ * @param code the EPSG code, or 0 if none.
+ * @param name the object name.
+ * @param alias the alias, or {@code null} if none.
+ * @param world {@code true} if the properties shall have an entry for the domain of validity.
+ * @return the map of properties to give to constructors or factory methods.
*/
private static Map<String,Object> properties(final int code, final String name, final String alias, final boolean world) {
final Map<String,Object> map = new HashMap<>(8);
@@ -129,11 +131,11 @@ final class StandardDefinitions {
* This method restricts the factory to SIS implementation instead than arbitrary factory in order to meet
* the contract saying that {@link CommonCRS} methods should never fail.
*
- * @param code The EPSG code, or 0 if none.
- * @param baseCRS The geographic CRS on which the projected CRS is based.
- * @param latitude A latitude in the zone of the desired projection, to be snapped to 0�.
- * @param longitude A longitude in the zone of the desired projection, to be snapped to UTM central meridian.
- * @param derivedCS The projected coordinate system.
+ * @param code the EPSG code, or 0 if none.
+ * @param baseCRS the geographic CRS on which the projected CRS is based.
+ * @param latitude a latitude in the zone of the desired projection, to be snapped to 0�.
+ * @param longitude a longitude in the zone of the desired projection, to be snapped to UTM central meridian.
+ * @param derivedCS the projected coordinate system.
*/
static ProjectedCRS createUTM(final int code, final GeographicCRS baseCRS,
final double latitude, final double longitude, final CartesianCS derivedCS)
@@ -157,10 +159,10 @@ final class StandardDefinitions {
/**
* Creates a geodetic CRS from hard-coded values for the given code.
*
- * @param code The EPSG code.
- * @param datum The geodetic datum.
- * @param cs The coordinate system.
- * @return The geographic CRS for the given code.
+ * @param code the EPSG code.
+ * @param datum the geodetic datum.
+ * @param cs the coordinate system.
+ * @return the geographic CRS for the given code.
*/
static GeographicCRS createGeographicCRS(final short code, final GeodeticDatum datum, final EllipsoidalCS cs) {
final String name;
@@ -185,10 +187,10 @@ final class StandardDefinitions {
/**
* Creates a geodetic datum from hard-coded values for the given code.
*
- * @param code The EPSG code.
- * @param ellipsoid The datum ellipsoid.
- * @param meridian The datum prime meridian.
- * @return The geodetic datum for the given code.
+ * @param code the EPSG code.
+ * @param ellipsoid the datum ellipsoid.
+ * @param meridian the datum prime meridian.
+ * @return the geodetic datum for the given code.
*/
static GeodeticDatum createGeodeticDatum(final short code, final Ellipsoid ellipsoid, final PrimeMeridian meridian) {
final String name;
@@ -210,8 +212,8 @@ final class StandardDefinitions {
/**
* Creates an ellipsoid from hard-coded values for the given code.
*
- * @param code The EPSG code.
- * @return The ellipsoid for the given code.
+ * @param code the EPSG code.
+ * @return the ellipsoid for the given code.
*/
static Ellipsoid createEllipsoid(final short code) {
String name; // No default value
@@ -251,9 +253,9 @@ final class StandardDefinitions {
/**
* Creates a vertical CRS from hard-coded values for the given code.
*
- * @param code The EPSG code.
- * @param datum The vertical datum.
- * @return The vertical CRS for the given code.
+ * @param code the EPSG code.
+ * @param datum the vertical datum.
+ * @return the vertical CRS for the given code.
*/
static VerticalCRS createVerticalCRS(final short code, final VerticalDatum datum) {
String cs = "Vertical CS. Axis: height (H)."; // Default coordinate system
@@ -287,8 +289,8 @@ final class StandardDefinitions {
/**
* Creates a vertical datum from hard-coded values for the given code.
*
- * @param code The EPSG code.
- * @return The vertical datum for the given code.
+ * @param code the EPSG code.
+ * @return the vertical datum for the given code.
*/
static VerticalDatum createVerticalDatum(final short code) {
final String name;
@@ -306,8 +308,8 @@ final class StandardDefinitions {
* The coordinate system names used by this method contains only the first
* part of the names declared in the EPSG database.
*
- * @param code The EPSG code.
- * @return The coordinate system for the given code.
+ * @param code the EPSG code.
+ * @return the coordinate system for the given code.
*/
@SuppressWarnings("fallthrough")
static CoordinateSystem createCoordinateSystem(final short code) {
@@ -353,8 +355,8 @@ final class StandardDefinitions {
/**
* Creates an axis from hard-coded values for the given code.
*
- * @param code The EPSG code.
- * @return The coordinate system axis for the given code.
+ * @param code the EPSG code.
+ * @return the coordinate system axis for the given code.
*/
static CoordinateSystemAxis createAxis(final short code) {
final String name, abrv;
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java?rev=1764119&r1=1764118&r2=1764119&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java [UTF-8] Mon Oct 10 15:24:03 2016
@@ -36,6 +36,7 @@ import org.apache.sis.referencing.Abstra
import org.apache.sis.internal.referencing.WKTUtilities;
import org.apache.sis.internal.metadata.AxisDirections;
import org.apache.sis.internal.metadata.WKTKeywords;
+import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.io.wkt.ElementKind;
import org.apache.sis.io.wkt.Formatter;
import org.apache.sis.util.ComparisonMode;
@@ -175,12 +176,12 @@ public class AbstractCS extends Abstract
*/
switch (validateAxis(direction, unit)) {
case INVALID_DIRECTION: {
- throw new IllegalArgumentException(Errors.getResources(properties).getString(
- Errors.Keys.IllegalAxisDirection_2, getClass(), direction));
+ throw new IllegalArgumentException(Resources.forProperties(properties).getString(
+ Resources.Keys.IllegalAxisDirection_2, getClass(), direction));
}
case INVALID_UNIT: {
- throw new IllegalArgumentException(Errors.getResources(properties).getString(
- Errors.Keys.IllegalUnitFor_2, name, unit));
+ throw new IllegalArgumentException(Resources.forProperties(properties).getString(
+ Resources.Keys.IllegalUnitFor_2, name, unit));
}
}
/*
@@ -194,8 +195,8 @@ public class AbstractCS extends Abstract
final AxisDirection other = axes[j].getDirection();
final AxisDirection abs = AxisDirections.absolute(other);
if (dir.equals(abs) && !abs.equals(AxisDirection.FUTURE)) {
- throw new IllegalArgumentException(Errors.getResources(properties).getString(
- Errors.Keys.ColinearAxisDirections_2, direction, other));
+ throw new IllegalArgumentException(Resources.forProperties(properties).getString(
+ Resources.Keys.ColinearAxisDirections_2, direction, other));
}
}
}
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java?rev=1764119&r1=1764118&r2=1764119&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java [UTF-8] Mon Oct 10 15:24:03 2016
@@ -32,8 +32,8 @@ import org.apache.sis.measure.Units;
import org.apache.sis.util.Static;
import org.apache.sis.util.Classes;
import org.apache.sis.util.CharSequences;
-import org.apache.sis.util.resources.Errors;
import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.referencing.operation.matrix.Matrices;
import org.apache.sis.referencing.operation.matrix.MatrixSIS;
@@ -100,7 +100,7 @@ public final class CoordinateSystems ext
assert candidate == AxisDirections.valueOf(meridian.toString());
return candidate;
}
- throw new IllegalArgumentException(Errors.format(Errors.Keys.UnknownAxisDirection_1, name));
+ throw new IllegalArgumentException(Resources.format(Resources.Keys.UnknownAxisDirection_1, name));
}
/**
@@ -287,7 +287,7 @@ public final class CoordinateSystems ext
ensureNonNull("sourceCS", sourceCS);
ensureNonNull("targetCS", targetCS);
if (!Classes.implementSameInterfaces(sourceCS.getClass(), targetCS.getClass(), CoordinateSystem.class)) {
- throw new IllegalArgumentException(Errors.format(Errors.Keys.IncompatibleCoordinateSystemTypes));
+ throw new IllegalArgumentException(Resources.format(Resources.Keys.IncompatibleCoordinateSystemTypes));
}
final AxisDirection[] srcAxes = getAxisDirections(sourceCS);
final AxisDirection[] dstAxes = getAxisDirections(targetCS);
@@ -327,8 +327,8 @@ public final class CoordinateSystems ext
}
final UnitConverter converter = sourceUnit.getConverterToAny(targetUnit);
if (!(converter instanceof LinearConverter)) {
- throw new ConversionException(Errors.format(
- Errors.Keys.NonLinearUnitConversion_2, sourceUnit, targetUnit));
+ throw new ConversionException(Resources.format(
+ Resources.Keys.NonLinearUnitConversion_2, sourceUnit, targetUnit));
}
final double offset = converter.convert(0);
final double scale = Units.derivative(converter, 0);
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCartesianCS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCartesianCS.java?rev=1764119&r1=1764118&r2=1764119&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCartesianCS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultCartesianCS.java [UTF-8] Mon Oct 10 15:24:03 2016
@@ -22,7 +22,7 @@ import javax.xml.bind.annotation.XmlRoot
import org.opengis.referencing.cs.CartesianCS;
import org.opengis.referencing.cs.AxisDirection;
import org.opengis.referencing.cs.CoordinateSystemAxis;
-import org.apache.sis.util.resources.Errors;
+import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.measure.Angle;
@@ -196,8 +196,8 @@ public class DefaultCartesianCS extends
* they are not really for Cartesian CS because we do not know the grid geometry.
*/
if (angle != null && Math.abs(angle.degrees()) != 90) {
- throw new IllegalArgumentException(Errors.getResources(properties).getString(
- Errors.Keys.NonPerpendicularDirections_2, axis0, axis1));
+ throw new IllegalArgumentException(Resources.forProperties(properties).getString(
+ Resources.Keys.NonPerpendicularDirections_2, axis0, axis1));
}
}
}
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java?rev=1764119&r1=1764118&r2=1764119&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java [UTF-8] Mon Oct 10 15:24:03 2016
@@ -24,7 +24,7 @@ import org.opengis.referencing.cs.Ellips
import org.opengis.referencing.cs.AxisDirection;
import org.opengis.referencing.cs.CoordinateSystemAxis;
import org.apache.sis.internal.metadata.AxisDirections;
-import org.apache.sis.util.resources.Errors;
+import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.measure.Units;
@@ -206,8 +206,8 @@ public class DefaultEllipsoidalCS extend
while (--i >= 0) {
final AxisDirection direction = super.getAxis(i).getDirection();
if (AxisDirections.isVertical(direction) && --n < 0) {
- throw new IllegalArgumentException(Errors.getResources(properties).getString(
- Errors.Keys.IllegalAxisDirection_2, EllipsoidalCS.class, direction));
+ throw new IllegalArgumentException(Resources.forProperties(properties).getString(
+ Resources.Keys.IllegalAxisDirection_2, EllipsoidalCS.class, direction));
}
}
}
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java?rev=1764119&r1=1764118&r2=1764119&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/Normalizer.java [UTF-8] Mon Oct 10 15:24:03 2016
@@ -31,8 +31,8 @@ import org.opengis.referencing.cs.Spheri
import org.opengis.referencing.cs.CylindricalCS;
import org.opengis.referencing.cs.PolarCS;
import org.apache.sis.internal.metadata.AxisDirections;
+import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.referencing.IdentifiedObjects;
-import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.ArraysExt;
import org.apache.sis.measure.Units;
@@ -254,7 +254,7 @@ final class Normalizer implements Compar
c = unit.getConverterToAny(newUnit);
} catch (ConversionException e) {
// Use IllegalStateException because the public API is an AbstractCS member method.
- throw new IllegalStateException(Errors.format(Errors.Keys.IllegalUnitFor_2, "axis", unit), e);
+ throw new IllegalStateException(Resources.format(Resources.Keys.IllegalUnitFor_2, "axis", unit), e);
}
double minimum = c.convert(axis.getMinimumValue());
double maximum = c.convert(axis.getMaximumValue());
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java?rev=1764119&r1=1764118&r2=1764119&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/BursaWolfParameters.java [UTF-8] Mon Oct 10 15:24:03 2016
@@ -25,14 +25,15 @@ import org.opengis.referencing.datum.Pri
import org.opengis.referencing.operation.Matrix;
import org.apache.sis.referencing.operation.matrix.Matrix4;
import org.apache.sis.referencing.operation.matrix.Matrices;
+import org.apache.sis.referencing.operation.matrix.MatrixSIS;
+import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.io.wkt.FormattableObject;
import org.apache.sis.io.wkt.Formatter;
import org.apache.sis.util.Utilities;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.internal.util.DoubleDouble;
import org.apache.sis.internal.metadata.WKTKeywords;
-import org.apache.sis.referencing.IdentifiedObjects;
-import org.apache.sis.referencing.operation.matrix.MatrixSIS;
+import org.apache.sis.internal.referencing.Resources;
import static java.lang.Math.abs;
import static org.apache.sis.util.ArgumentChecks.*;
@@ -248,7 +249,7 @@ public class BursaWolfParameters extends
if (targetDatum != null) {
final PrimeMeridian actual = targetDatum.getPrimeMeridian();
if (actual.getGreenwichLongitude() != 0 && !Utilities.equalsIgnoreMetadata(pm, actual)) {
- throw new IllegalArgumentException(Errors.format(Errors.Keys.MismatchedPrimeMeridian_2,
+ throw new IllegalArgumentException(Resources.format(Resources.Keys.MismatchedPrimeMeridian_2,
IdentifiedObjects.getName(pm, null), IdentifiedObjects.getName(actual, null)));
}
}
@@ -530,7 +531,7 @@ public class BursaWolfParameters extends
throw new IllegalArgumentException(Errors.format(Errors.Keys.MismatchedMatrixSize_4, n, n, numRow, numCol));
}
if (!Matrices.isAffine(matrix)) {
- throw new IllegalArgumentException(Errors.format(Errors.Keys.NotAnAffineTransform));
+ throw new IllegalArgumentException(Resources.format(Resources.Keys.NotAnAffineTransform));
}
/*
* Translation terms, taken "as-is".
@@ -567,7 +568,7 @@ public class BursaWolfParameters extends
*/
for (int j=0; j < SIZE-1; j++) {
if (!(abs((matrix.getElement(j,j) - 1)*PPM - dS) <= tolerance)) {
- throw new IllegalArgumentException(Errors.format(Errors.Keys.NonUniformScale));
+ throw new IllegalArgumentException(Resources.format(Resources.Keys.NonUniformScale));
}
for (int i = j+1; i < SIZE-1; i++) {
S.setFrom(RS);
@@ -577,7 +578,7 @@ public class BursaWolfParameters extends
S.setFrom(RS);
S.inverseDivide(getNumber(matrix, i,j)); // Positive rotation term.
if (!(abs(value + S.value) <= tolerance)) { // We expect r1 \u2248 -r2
- throw new IllegalArgumentException(Errors.format(Errors.Keys.NotASkewSymmetricMatrix));
+ throw new IllegalArgumentException(Resources.format(Resources.Keys.NotASkewSymmetricMatrix));
}
S.subtract(value, error);
S.multiply(0.5, 0);
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java?rev=1764119&r1=1764118&r2=1764119&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultEllipsoid.java [UTF-8] Mon Oct 10 15:24:03 2016
@@ -36,13 +36,13 @@ import org.apache.sis.internal.jaxb.gml.
import org.apache.sis.internal.jaxb.referencing.SecondDefiningParameter;
import org.apache.sis.internal.metadata.MetadataUtilities;
import org.apache.sis.internal.referencing.Formulas;
+import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.internal.metadata.WKTKeywords;
import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.referencing.AbstractIdentifiedObject;
import org.apache.sis.io.wkt.Formatter;
import org.apache.sis.io.wkt.Convention;
import org.apache.sis.util.ComparisonMode;
-import org.apache.sis.util.resources.Errors;
import static java.lang.Math.*;
import static java.lang.Double.*;
@@ -614,7 +614,7 @@ public class DefaultEllipsoid extends Ab
return NaN;
}
// Other cases: no solution for this algorithm.
- throw new ArithmeticException(Errors.format(Errors.Keys.NoConvergenceForPoints_2,
+ throw new ArithmeticException(Resources.format(Resources.Keys.NoConvergenceForPoints_2,
new DirectPosition2D(toDegrees(\u03bb1), toDegrees(\u03c61)),
new DirectPosition2D(toDegrees(\u03bb2), toDegrees(\u03c62))));
}
Modified: sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/AuthorityFactoryIdentifier.java
URL: http://svn.apache.org/viewvc/sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/AuthorityFactoryIdentifier.java?rev=1764119&r1=1764118&r2=1764119&view=diff
==============================================================================
--- sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/AuthorityFactoryIdentifier.java [UTF-8] (original)
+++ sis/trunk/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/AuthorityFactoryIdentifier.java [UTF-8] Mon Oct 10 15:24:03 2016
@@ -29,10 +29,10 @@ import org.apache.sis.util.Debug;
import org.apache.sis.util.Classes;
import org.apache.sis.util.iso.DefaultNameSpace;
import org.apache.sis.util.resources.Vocabulary;
-import org.apache.sis.util.resources.Messages;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.internal.system.Loggers;
import org.apache.sis.internal.metadata.NameMeaning;
+import org.apache.sis.internal.referencing.Resources;
// Branch-dependent imports
import java.util.Objects;
@@ -48,6 +48,12 @@ import java.util.Objects;
*/
final class AuthorityFactoryIdentifier {
/**
+ * The locale to use for identifiers. This is not necessarily the same locale
+ * than the one used for logging or error messages.
+ */
+ private static final Locale IDENTIFIER_LOCALE = Locale.US;
+
+ /**
* Factory needed is {@link CRSAuthorityFactory}.
*/
static final byte CRS = 0;
@@ -154,8 +160,8 @@ final class AuthorityFactoryIdentifier {
* Only the version can be null.
*/
static AuthorityFactoryIdentifier create(final byte type, final String authority, final String version) {
- return new AuthorityFactoryIdentifier(type, authority.toUpperCase(Locale.US),
- (version == null) ? null : version.toLowerCase(Locale.US));
+ return new AuthorityFactoryIdentifier(type, authority.toUpperCase(IDENTIFIER_LOCALE),
+ (version == null) ? null : version.toLowerCase(IDENTIFIER_LOCALE));
}
/**
@@ -166,20 +172,20 @@ final class AuthorityFactoryIdentifier {
if (version == null && newAuthority.equals(authority)) {
return this;
}
- return new AuthorityFactoryIdentifier(type, newAuthority.toUpperCase(Locale.US), null);
+ return new AuthorityFactoryIdentifier(type, newAuthority.toUpperCase(IDENTIFIER_LOCALE), null);
}
/**
* Creates a new identifier for the same type and authority than this identifier, but a different version
* extracted from the given authority.
*
- * @param factory The factory's authority, or {@code null} for creating an identifier without version.
- * @return An identifier for the version of the given authority, or {@code this} if the version is the same.
+ * @param factory the factory's authority, or {@code null} for creating an identifier without version.
+ * @return an identifier for the version of the given authority, or {@code this} if the version is the same.
*/
AuthorityFactoryIdentifier versionOf(final Citation factory) {
String newVersion = NameMeaning.getVersion(factory);
if (newVersion != null) {
- newVersion = newVersion.toLowerCase(Locale.US);
+ newVersion = newVersion.toLowerCase(IDENTIFIER_LOCALE);
}
if (Objects.equals(version, newVersion)) {
return this;
@@ -258,10 +264,10 @@ final class AuthorityFactoryIdentifier {
* and another factory, if this instance has not already logged a warning. This method assumes that it is invoked
* by the {@code MultiAuthoritiesFactory.getAuthorityFactory(\u2026)} method.
*
- * @param used The factory which will be used.
+ * @param used the factory which will be used.
*/
void logConflict(final AuthorityFactory used) {
- log(Messages.getResources(null).getLogRecord(Level.WARNING, Messages.Keys.IgnoredServiceProvider_3,
+ log(Resources.forLocale(null).getLogRecord(Level.WARNING, Resources.Keys.IgnoredServiceProvider_3,
TYPES[type], getAuthorityAndVersion(), Classes.getClass(used)));
}
@@ -270,7 +276,7 @@ final class AuthorityFactoryIdentifier {
* {@code AuthorityFactoryIdentifier} fallback on a default version.
*/
void logFallback() {
- log(Messages.getResources(null).getLogRecord(Level.WARNING, Messages.Keys.FallbackDefaultFactoryVersion_2,
+ log(Resources.forLocale(null).getLogRecord(Level.WARNING, Resources.Keys.FallbackDefaultFactoryVersion_2,
authority, version));
}