sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1683803 - in /sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt: GeodeticObjectParser.java WKTFormat.java
Date Fri, 05 Jun 2015 16:40:03 GMT
Author: desruisseaux
Date: Fri Jun  5 16:40:03 2015
New Revision: 1683803

URL: http://svn.apache.org/r1683803
Log:
Referencing: removed reflection code which are not needed anymore after the migration of GeodeticObjectParser
into the "sis-metadata" module.

Modified:
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java?rev=1683803&r1=1683802&r2=1683803&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
[UTF-8] Fri Jun  5 16:40:03 2015
@@ -187,13 +187,6 @@ final class GeodeticObjectParser extends
     /**
      * Constructs a parser for the specified set of symbols using the specified set of factories.
      *
-     * This constructor is for internal usage by Apache SIS only — <b>do not use!</b>
-     *
-     * <p><b>Maintenance note:</b> this constructor is invoked through
reflection by
-     * {@link WKTFormat#parse(CharSequence, ParsePosition)} because of modularization.
-     * Do not change the method signature even if it doesn't break the compilation,
-     * unless the reflection code is also updated.</p>
-     *
      * @param symbols       The set of symbols to use.
      * @param convention    The WKT convention to use.
      * @param isAxisIgnored {@code true} if {@code AXIS} elements should be ignored.

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java?rev=1683803&r1=1683802&r2=1683803&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/WKTFormat.java
[UTF-8] Fri Jun  5 16:40:03 2015
@@ -28,13 +28,11 @@ import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.text.ParsePosition;
 import java.text.ParseException;
-import java.lang.reflect.Constructor;
 import javax.measure.unit.Unit;
 import javax.measure.unit.UnitFormat;
 import org.opengis.util.Factory;
 import org.opengis.metadata.citation.Citation;
 import org.opengis.referencing.IdentifiedObject;
-import org.apache.sis.internal.util.LocalizedParseException;
 import org.apache.sis.io.CompoundFormat;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.resources.Errors;
@@ -98,13 +96,6 @@ public class WKTFormat extends CompoundF
     private static final long serialVersionUID = -2909110214650709560L;
 
     /**
-     * The constructor for WKT parsers, fetched when first needed. We have to use reflection
-     * because {@link GeodeticObjectParser} is defined in a separated module which is not
-     * guaranteed to be on the classpath.
-     */
-    private static volatile Constructor<? extends Parser> parserConstructor;
-
-    /**
      * The indentation value to give to the {@link #setIndentation(int)}
      * method for formatting the complete object on a single line.
      */
@@ -508,22 +499,11 @@ public class WKTFormat extends CompoundF
      */
     @Override
     public Object parse(final CharSequence text, final ParsePosition pos) throws ParseException
{
-        if (parser == null) try {
-            Constructor<? extends Parser> c = parserConstructor;
-            if (c == null) {
-                c = Class.forName("org.apache.sis.io.wkt.GeodeticObjectParser").asSubclass(Parser.class)
-                         .getDeclaredConstructor(Symbols.class, Convention.class, Boolean.TYPE,
Locale.class, Map.class);
-                parserConstructor = c;
-            }
+        if (parser == null) {
             if (factories == null) {
                 factories = new HashMap<>();
             }
-            parser = c.newInstance(symbols, convention, false, getLocale(Locale.Category.DISPLAY),
factories);
-        } catch (ClassNotFoundException e) {
-            throw (ParseException) new LocalizedParseException(getLocale(Locale.Category.DISPLAY),
-                    Errors.Keys.MissingRequiredModule_1, new String[] {"sis-referencing"},
0).initCause(e);
-        } catch (ReflectiveOperationException e) {
-            throw (ParseException) new ParseException(e.getMessage(), 0).initCause(e);
+            parser = new GeodeticObjectParser(symbols, convention, false, getLocale(Locale.Category.DISPLAY),
factories);
         }
         return parser.parseObject(text.toString(), pos);
     }



Mime
View raw message