geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1819018 - in /geronimo/components/config/branches/ConfigJSR/impl: ./ src/main/java/org/apache/geronimo/config/ src/main/java/org/apache/geronimo/config/converters/
Date Fri, 22 Dec 2017 09:24:15 GMT
Author: struberg
Date: Fri Dec 22 09:24:15 2017
New Revision: 1819018

URL: http://svn.apache.org/viewvc?rev=1819018&view=rev
Log:
adopt to implicit converter spec changes

Removed:
    geronimo/components/config/branches/ConfigJSR/impl/src/main/java/org/apache/geronimo/config/converters/InstantConverter.java
    geronimo/components/config/branches/ConfigJSR/impl/src/main/java/org/apache/geronimo/config/converters/LocalDateConverter.java
    geronimo/components/config/branches/ConfigJSR/impl/src/main/java/org/apache/geronimo/config/converters/LocalDateTimeConverter.java
    geronimo/components/config/branches/ConfigJSR/impl/src/main/java/org/apache/geronimo/config/converters/LocalTimeConverter.java
    geronimo/components/config/branches/ConfigJSR/impl/src/main/java/org/apache/geronimo/config/converters/OffsetDateTimeConverter.java
    geronimo/components/config/branches/ConfigJSR/impl/src/main/java/org/apache/geronimo/config/converters/OffsetTimeConverter.java
Modified:
    geronimo/components/config/branches/ConfigJSR/impl/debug-suite.xml
    geronimo/components/config/branches/ConfigJSR/impl/src/main/java/org/apache/geronimo/config/ConfigImpl.java
    geronimo/components/config/branches/ConfigJSR/impl/src/main/java/org/apache/geronimo/config/converters/ImplicitConverter.java

Modified: geronimo/components/config/branches/ConfigJSR/impl/debug-suite.xml
URL: http://svn.apache.org/viewvc/geronimo/components/config/branches/ConfigJSR/impl/debug-suite.xml?rev=1819018&r1=1819017&r2=1819018&view=diff
==============================================================================
--- geronimo/components/config/branches/ConfigJSR/impl/debug-suite.xml (original)
+++ geronimo/components/config/branches/ConfigJSR/impl/debug-suite.xml Fri Dec 22 09:24:15
2017
@@ -23,7 +23,7 @@
 
     <classes>
         <!-- Issues in the spec -->
-        <class name="org.eclipse.configjsr.ArrayConverterTest">
+        <class name="org.eclipse.configjsr.PrivateImplicitConverterTest">
             <methods>
                 <include name=".*"/>
             </methods>

Modified: geronimo/components/config/branches/ConfigJSR/impl/src/main/java/org/apache/geronimo/config/ConfigImpl.java
URL: http://svn.apache.org/viewvc/geronimo/components/config/branches/ConfigJSR/impl/src/main/java/org/apache/geronimo/config/ConfigImpl.java?rev=1819018&r1=1819017&r2=1819018&view=diff
==============================================================================
--- geronimo/components/config/branches/ConfigJSR/impl/src/main/java/org/apache/geronimo/config/ConfigImpl.java
(original)
+++ geronimo/components/config/branches/ConfigJSR/impl/src/main/java/org/apache/geronimo/config/ConfigImpl.java
Fri Dec 22 09:24:15 2017
@@ -20,12 +20,6 @@ import java.lang.reflect.ParameterizedTy
 import java.lang.reflect.Type;
 import java.net.URL;
 import java.time.Duration;
-import java.time.Instant;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-import java.time.OffsetDateTime;
-import java.time.OffsetTime;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
@@ -43,14 +37,8 @@ import org.apache.geronimo.config.conver
 import org.apache.geronimo.config.converters.DurationConverter;
 import org.apache.geronimo.config.converters.FloatConverter;
 import org.apache.geronimo.config.converters.ImplicitConverter;
-import org.apache.geronimo.config.converters.InstantConverter;
 import org.apache.geronimo.config.converters.IntegerConverter;
-import org.apache.geronimo.config.converters.LocalDateConverter;
-import org.apache.geronimo.config.converters.LocalDateTimeConverter;
-import org.apache.geronimo.config.converters.LocalTimeConverter;
 import org.apache.geronimo.config.converters.LongConverter;
-import org.apache.geronimo.config.converters.OffsetDateTimeConverter;
-import org.apache.geronimo.config.converters.OffsetTimeConverter;
 import org.apache.geronimo.config.converters.StringConverter;
 import org.apache.geronimo.config.converters.URLConverter;
 import javax.config.Config;
@@ -93,12 +81,6 @@ public class ConfigImpl implements Confi
         converters.put(long.class, LongConverter.INSTANCE);
 
         converters.put(Duration.class, DurationConverter.INSTANCE);
-        converters.put(LocalTime.class, LocalTimeConverter.INSTANCE);
-        converters.put(LocalDate.class, LocalDateConverter.INSTANCE);
-        converters.put(LocalDateTime.class, LocalDateTimeConverter.INSTANCE);
-        converters.put(OffsetTime.class, OffsetTimeConverter.INSTANCE);
-        converters.put(OffsetDateTime.class, OffsetDateTimeConverter.INSTANCE);
-        converters.put(Instant.class, InstantConverter.INSTANCE);
 
         converters.put(URL.class, URLConverter.INSTANCE);
     }

Modified: geronimo/components/config/branches/ConfigJSR/impl/src/main/java/org/apache/geronimo/config/converters/ImplicitConverter.java
URL: http://svn.apache.org/viewvc/geronimo/components/config/branches/ConfigJSR/impl/src/main/java/org/apache/geronimo/config/converters/ImplicitConverter.java?rev=1819018&r1=1819017&r2=1819018&view=diff
==============================================================================
--- geronimo/components/config/branches/ConfigJSR/impl/src/main/java/org/apache/geronimo/config/converters/ImplicitConverter.java
(original)
+++ geronimo/components/config/branches/ConfigJSR/impl/src/main/java/org/apache/geronimo/config/converters/ImplicitConverter.java
Fri Dec 22 09:24:15 2017
@@ -80,18 +80,19 @@ public abstract class ImplicitConverter
     private static Converter hasConverterMethod(Class<?> clazz, String methodName,
Class<?> paramType) {
         // handle valueOf with CharSequence param
         try {
-            final Method method = clazz.getMethod(methodName, paramType);
+            final Method method = clazz.getDeclaredMethod(methodName, paramType);
             if (!method.isAccessible()) {
                 method.setAccessible(true);
             }
-            if (Modifier.isStatic(method.getModifiers())) {
+            if (Modifier.isStatic(method.getModifiers()) && method.getReturnType().equals(clazz))
{
                 return new Converter() {
                     @Override
                     public Object convert(String value) {
                         try {
                             return method.invoke(null, value);
                         } catch (Exception e) {
-                            throw new RuntimeException(e);
+                            throw new IllegalArgumentException("Error while converting the
value " + value +
+                                    " to type " + method.getReturnType());
                         }
                     }
                 };



Mime
View raw message