sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1660119 - in /sis/branches/JDK8/core: sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ sis-utility/src/main/java/org/apache/sis/util/resources/
Date Mon, 16 Feb 2015 13:52:26 GMT
Author: desruisseaux
Date: Mon Feb 16 13:52:26 2015
New Revision: 1660119

URL: http://svn.apache.org/r1660119
Log:
Redimenion the OperationMethod before to return the MathTransform.

Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java?rev=1660119&r1=1660118&r2=1660119&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java
[UTF-8] Mon Feb 16 13:52:26 2015
@@ -615,44 +615,46 @@ public class DefaultMathTransformFactory
         OperationMethod method = null;
         try {
             method = getOperationMethod(methodName);
-        } finally {
-            lastMethod.set(method); // May be null in case of failure, which is intended.
-        }
-        if (!(method instanceof MathTransformProvider)) {
-            throw new NoSuchIdentifierException(Errors.format( // For now, handle like an
unknown operation.
-                    Errors.Keys.UnsupportedImplementation_1, Classes.getClass(method)), methodName);
-        }
-        /*
-         * If the "official" parameter descriptor was used, that descriptor should have already
-         * enforced argument validity. Consequently, there is no need to performs the check
and
-         * we will avoid it as a performance enhancement.
-         */
-        final ParameterDescriptorGroup expected = method.getParameters();
-        final boolean isConform = expected.equals(parameters.getDescriptor());
-        MathTransform transform;
-        try {
-            if (!isConform) {
-                /*
-                 * Copies all values from the user-supplied group to the provider-supplied
group.
-                 * The later should perform all needed checks. It is supplier's responsibility
to
-                 * know about alias (e.g. OGC, EPSG, ESRI),  since the caller probably used
names
-                 * from only one authority.
-                 */
-                final ParameterValueGroup copy = expected.createValue();
-                Parameters.copy(parameters, copy);
-                parameters = copy;
+            if (!(method instanceof MathTransformProvider)) {
+                throw new NoSuchIdentifierException(Errors.format( // For now, handle like
an unknown operation.
+                        Errors.Keys.UnsupportedImplementation_1, Classes.getClass(method)),
methodName);
             }
-            transform  = ((MathTransformProvider) method).createMathTransform(parameters);
-        } catch (IllegalArgumentException | IllegalStateException exception) {
             /*
-             * Catch only exceptions which may be the result of improper parameter
-             * usage (e.g. a value out of range). Do not catch exception caused by
-             * programming errors (e.g. null pointer exception).
+             * If the "official" parameter descriptor was used, that descriptor should have
already
+             * enforced argument validity. Consequently, there is no need to performs the
check and
+             * we will avoid it as a performance enhancement.
              */
-            throw new FactoryException(exception);
+            final ParameterDescriptorGroup expected = method.getParameters();
+            final boolean isConform = expected.equals(parameters.getDescriptor());
+            MathTransform transform;
+            try {
+                if (!isConform) {
+                    /*
+                     * Copies all values from the user-supplied group to the provider-supplied
group.
+                     * The later should perform all needed checks. It is supplier's responsibility
to
+                     * know about alias (e.g. OGC, EPSG, ESRI),  since the caller probably
used names
+                     * from only one authority.
+                     */
+                    final ParameterValueGroup copy = expected.createValue();
+                    Parameters.copy(parameters, copy);
+                    parameters = copy;
+                }
+                transform  = ((MathTransformProvider) method).createMathTransform(parameters);
+            } catch (IllegalArgumentException | IllegalStateException exception) {
+                /*
+                 * Catch only exceptions which may be the result of improper parameter
+                 * usage (e.g. a value out of range). Do not catch exception caused by
+                 * programming errors (e.g. null pointer exception).
+                 */
+                throw new FactoryException(exception);
+            }
+            transform = pool.unique(transform);
+            method = DefaultOperationMethod.redimension(method,
+                    transform.getSourceDimensions(), transform.getTargetDimensions());
+            return transform;
+        } finally {
+            lastMethod.set(method); // May be null in case of failure, which is intended.
         }
-        transform = pool.unique(transform);
-        return transform;
     }
 
     /**

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java?rev=1660119&r1=1660118&r2=1660119&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
[UTF-8] Mon Feb 16 13:52:26 2015
@@ -333,7 +333,7 @@ public final class Errors extends Indexe
         public static final short IllegalMemberType_2 = 37;
 
         /**
-         * Dimensions of “{0}” operation can not be ({1}, {2}).
+         * Dimensions of “{0}” operation can not be ({1} → {2}).
          */
         public static final short IllegalOperationDimension_3 = 180;
 

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties?rev=1660119&r1=1660118&r2=1660119&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
[ISO-8859-1] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
[ISO-8859-1] Mon Feb 16 13:52:26 2015
@@ -76,7 +76,7 @@ IllegalClass_2                    = Clas
 IllegalFormatPatternForClass_2    = The \u201c{1}\u201d pattern can not be applied to formating
of objects of type \u2018{0}\u2019.
 IllegalLanguageCode_1             = The \u201c{0}\u201d language is not recognized.
 IllegalMemberType_2               = Member \u201c{0}\u201d can not be associated to type
\u201c{1}\u201d.
-IllegalOperationDimension_3       = Dimensions of \u201c{0}\u201d operation can not be ({1},
{2}).
+IllegalOperationDimension_3       = Dimensions of \u201c{0}\u201d operation can not be ({1}
\u2192 {2}).
 IllegalOperationForValueClass_1   = This operation can not be applied to values of class
\u2018{0}\u2019.
 IllegalOptionValue_2              = Option \u2018{0}\u2019 can not take the \u201c{1}\u201d
value.
 IllegalOrdinateRange_3            = The [{0} \u2026 {1}] range of ordinate values is not
valid for the \u201c{2}\u201d axis.

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties?rev=1660119&r1=1660118&r2=1660119&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
[ISO-8859-1] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
[ISO-8859-1] Mon Feb 16 13:52:26 2015
@@ -66,7 +66,7 @@ IllegalClass_2                    = La c
 IllegalFormatPatternForClass_2    = Le mod\u00e8le \u00ab\u202f{1}\u202f\u00bb ne peut pas
\u00eatre appliqu\u00e9 au formatage d\u2019objets de type \u2018{0}\u2019.
 IllegalLanguageCode_1             = Le code de langue \u00ab\u202f{0}\u202f\u00bb n\u2019est
pas reconnu.
 IllegalMemberType_2               = Le membre \u00ab\u202f{0}\u202f\u00bb ne peut pas \u00eatre
associ\u00e9 au type \u00ab\u202f{1}\u202f\u00bb.
-IllegalOperationDimension_3       = Les dimensions de l\u2019op\u00e9ration \u00ab\u202f{0}\u202f\u00bb
ne peuvent pas \u00eatre ({1}, {2}).
+IllegalOperationDimension_3       = Les dimensions de l\u2019op\u00e9ration \u00ab\u202f{0}\u202f\u00bb
ne peuvent pas \u00eatre ({1} \u2192 {2}).
 IllegalOperationForValueClass_1   = Cette op\u00e9ration ne peut pas s\u2019appliquer aux
valeurs de classe \u2018{0}\u2019.
 IllegalOptionValue_2              = L\u2019option \u2018{0}\u2019 n\u2019accepte pas la valeur
\u00ab\u202f{1}\u202f\u00bb.
 IllegalOrdinateRange_3            = La plage de valeurs de coordonn\u00e9es [{0} \u2026 {1}]
n\u2019est pas valide pour l\u2019axe \u00ab\u202f{2}\u202f\u00bb.



Mime
View raw message