summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Groeger <groeger@itestra.de>2013-11-28 10:27:28 +0100
committerPhilip Rauwolf <rauwolf@itestra.de>2013-11-29 17:32:32 +0100
commit4758e3056e045a1684b36bf87713cf514b9532ad (patch)
treedd9ca9fbe5975bc6bbc9dbc57f7be9a50e47915a
parent3e6129d40d278c7f780640bfa3615174ca22cbae (diff)
downloadgenivi-common-api-runtime-4758e3056e045a1684b36bf87713cf514b9532ad.tar.gz
fixed NullPointerException in addPreferences()
Change-Id: Iedaa3a94352f3c573c41e5911125eba07db75160
-rw-r--r--org.genivi.commonapi.core/src/org/genivi/commonapi/core/preferences/FPreferences.java24
1 files changed, 16 insertions, 8 deletions
diff --git a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/preferences/FPreferences.java b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/preferences/FPreferences.java
index f3c5021..02e63dc 100644
--- a/org.genivi.commonapi.core/src/org/genivi/commonapi/core/preferences/FPreferences.java
+++ b/org.genivi.commonapi.core/src/org/genivi/commonapi/core/preferences/FPreferences.java
@@ -32,7 +32,7 @@ public class FPreferences {
private FPreferences() {
preferences = new HashMap<IResource, Map<String, String>>();
}
-
+
public void resetPreferences(){
preferences.clear();
}
@@ -46,7 +46,7 @@ public class FPreferences {
public void addPreferences(IResource res) {
Map<String, String> map = new HashMap<String, String>();
-
+
if (res != null) {
try {
QualifiedName useProjectSettingsIdentifier = new QualifiedName(PreferenceConstants.PROJECT_PAGEID, PreferenceConstants.USEPROJECTSETTINGS);
@@ -69,16 +69,25 @@ public class FPreferences {
}
} else {
- if(!preferences.get(null).containsKey(PreferenceConstants.USEPROJECTSETTINGS))
+ if (preferences.get(null) == null) {
+ preferences.put(res, map);
+ }
+
+ if (!preferences.get(null).containsKey(PreferenceConstants.USEPROJECTSETTINGS)) {
map.put(PreferenceConstants.USEPROJECTSETTINGS, Boolean.FALSE.toString());
- if(!preferences.get(null).containsKey(PreferenceConstants.P_OUTPUT))
+ }
+ if (!preferences.get(null).containsKey(PreferenceConstants.P_OUTPUT)) {
map.put(PreferenceConstants.P_OUTPUT, PreferenceConstants.DEFAULT_OUTPUT);
- if(!preferences.get(null).containsKey(PreferenceConstants.P_LICENSE))
+ }
+ if (!preferences.get(null).containsKey(PreferenceConstants.P_LICENSE)) {
map.put(PreferenceConstants.P_LICENSE, PreferenceConstants.DEFAULT_LICENSE);
- if(!preferences.get(null).containsKey(PreferenceConstants.P_GENERATESTUB))
+ }
+ if (!preferences.get(null).containsKey(PreferenceConstants.P_GENERATESTUB)) {
map.put(PreferenceConstants.P_GENERATESTUB, Boolean.TRUE.toString());
- if(!preferences.get(null).containsKey(PreferenceConstants.P_GENERATEPROXY))
+ }
+ if (!preferences.get(null).containsKey(PreferenceConstants.P_GENERATEPROXY)) {
map.put(PreferenceConstants.P_GENERATEPROXY, Boolean.TRUE.toString());
+ }
map.putAll(preferences.get(null));
}
preferences.put(res, map);
@@ -181,5 +190,4 @@ public class FPreferences {
defaultstore.getString(PreferenceConstants.P_GENERATESTUB));
}
}
-
}