cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ksen...@apache.org
Subject svn commit: r1332170 - /cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/pref/DataNodeDefaults.java
Date Mon, 30 Apr 2012 12:01:43 GMT
Author: kseniak
Date: Mon Apr 30 12:01:42 2012
New Revision: 1332170

URL: http://svn.apache.org/viewvc?rev=1332170&view=rev
Log:
CAY-12(Cayenne Internal). Fixed NPE on selecting null local datasource

Modified:
    cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/pref/DataNodeDefaults.java

Modified: cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/pref/DataNodeDefaults.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/pref/DataNodeDefaults.java?rev=1332170&r1=1332169&r2=1332170&view=diff
==============================================================================
--- cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/pref/DataNodeDefaults.java
(original)
+++ cayenne/main/trunk/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/pref/DataNodeDefaults.java
Mon Apr 30 12:01:42 2012
@@ -23,9 +23,9 @@ import java.util.prefs.Preferences;
 import org.apache.cayenne.pref.RenamedPreferences;
 
 public class DataNodeDefaults extends RenamedPreferences {
-    
+
     private String localDataSource;
-    
+
     public static final String LOCAL_DATA_SOURCE_PROPERTY = "localDataSource";
 
     public DataNodeDefaults(Preferences pref) {
@@ -35,12 +35,14 @@ public class DataNodeDefaults extends Re
     public void setLocalDataSource(String localDataSource) {
         if (getCurrentPreference() != null) {
             this.localDataSource = localDataSource;
-            getCurrentPreference().put(LOCAL_DATA_SOURCE_PROPERTY, localDataSource);
+            if (localDataSource != null) {
+                getCurrentPreference().put(LOCAL_DATA_SOURCE_PROPERTY, localDataSource);
+            }
         }
     }
 
     public String getLocalDataSource() {
-        if(localDataSource == null){
+        if (localDataSource == null) {
             localDataSource = getCurrentPreference().get(LOCAL_DATA_SOURCE_PROPERTY, "");
         }
         return localDataSource;



Mime
View raw message