openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p..@apache.org
Subject svn commit: r422769 - /incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java
Date Mon, 17 Jul 2006 17:35:39 GMT
Author: pcl
Date: Mon Jul 17 10:35:39 2006
New Revision: 422769

URL: http://svn.apache.org/viewvc?rev=422769&view=rev
Log:
Configurations changes on behalf of Abe

Modified:
    incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java

Modified: incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java?rev=422769&r1=422768&r2=422769&view=diff
==============================================================================
--- incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java
(original)
+++ incubator/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java
Mon Jul 17 10:35:39 2006
@@ -257,12 +257,13 @@
         if (obj == null)
             return;
 
-        Options opts = null;
+        Options opts;
         if (properties instanceof Options)
             opts = (Options) properties;
-        else if (properties != null) {
+        else { 
             opts = new Options();
-            opts.putAll(properties);
+            if (properties != null)
+                opts.putAll(properties);
         }
 
         Configurable configurable = null;
@@ -273,37 +274,33 @@
             configurable.setConfiguration(conf);
             configurable.startConfiguration();
         }
-        if (opts != null) {
-            Options invalidEntries = opts.setInto(obj);
-            if (obj instanceof GenericConfigurable)
-                ((GenericConfigurable) obj).setInto(invalidEntries);
+        Options invalidEntries = opts.setInto(obj);
+        if (obj instanceof GenericConfigurable)
+            ((GenericConfigurable) obj).setInto(invalidEntries);
 
-            if (!invalidEntries.isEmpty() && configurationName != null) {
-                String msg = null;
-                String first = (String) invalidEntries.keySet().iterator()
-                    .next();
-                if (invalidEntries.keySet().size() == 1 &&
-                    first.indexOf('.') == -1) {
-                    // if there's just one misspelling and this is not a
-                    // path traversal, check for near misses.
-                    Collection options = Options.findOptionsFor(obj.getClass());
-                    String close = StringDistance.getClosestLevenshteinDistance
-                        (first, options, 0.75f);
-                    if (close != null)
-                        msg = _loc.get("invalid-config-param-hint",
-                            new Object[]{
-                                configurationName, obj.getClass(), first, close,
-                                options, });
-                }
+		if (!invalidEntries.isEmpty() && configurationName != null) {
+			String msg = null;
+			String first = (String) invalidEntries.keySet().iterator().next();
+			if (invalidEntries.keySet().size() == 1 &&
+				first.indexOf('.') == -1) {
+				// if there's just one misspelling and this is not a
+				// path traversal, check for near misses.
+				Collection options = Options.findOptionsFor(obj.getClass());
+				String close = StringDistance.getClosestLevenshteinDistance
+					(first, options, 0.75f);
+				if (close != null)
+					msg = _loc.get("invalid-config-param-hint", new Object[]{
+						configurationName, obj.getClass(), first, close,
+						options, });
+			}
 
-                if (msg == null) {
-                    msg = _loc.get("invalid-config-params", new String[]{
-                        configurationName, obj.getClass().getName(),
-                        invalidEntries.keySet().toString(),
-                        Options.findOptionsFor(obj.getClass()).toString(), });
-                }
-                throw new ParseException(msg);
+            if (msg == null) {
+                msg = _loc.get("invalid-config-params", new String[]{
+                    configurationName, obj.getClass().getName(),
+                    invalidEntries.keySet().toString(),
+                    Options.findOptionsFor(obj.getClass()).toString(), });
             }
+            throw new ParseException(msg);
         }
         if (configurable != null)
             configurable.endConfiguration();



Mime
View raw message