aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnsgar Radermacher2018-06-07 05:39:30 -0400
committerAnsgar Radermacher2018-06-07 10:21:20 -0400
commit4bcc40a183aa9f2a4131f884e20041c732ef9227 (patch)
treeb1426ab3f2c00154f436a5a8cefb67a22d42817d
parent4b434360f4e5647708924933a32183cc72f3eba6 (diff)
downloadorg.eclipse.papyrus-4bcc40a183aa9f2a4131f884e20041c732ef9227.tar.gz
org.eclipse.papyrus-4bcc40a183aa9f2a4131f884e20041c732ef9227.tar.xz
org.eclipse.papyrus-4bcc40a183aa9f2a4131f884e20041c732ef9227.zip
Bug 535644 - [Internationalization] Possibility of NPE during model save
- Fix local dependend "if condition" - Add additional conditions Signed-off-by: Ansgar Radermacher <ansgar.radermacher@cea.fr>
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/modelresource/InternationalizationModelResource.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/modelresource/InternationalizationModelResource.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/modelresource/InternationalizationModelResource.java
index 0ab2a1d5c08..83e74436069 100644
--- a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/modelresource/InternationalizationModelResource.java
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/modelresource/InternationalizationModelResource.java
@@ -633,7 +633,7 @@ public class InternationalizationModelResource extends AbstractModelWithSharedRe
// Calculate the new URI with the correct name (depending to locale)
URI newBaseURI = newURIwithoutExtension.trimFileExtension();
- if (null == locale || !locale.toString().isEmpty()) {
+ if (null != locale && !locale.toString().isEmpty()) {
String lastSegment = newBaseURI.lastSegment();
lastSegment = lastSegment + LocaleNameResolver.UNDERSCORE + locale.toString();
newBaseURI = newBaseURI.trimSegments(1);
@@ -645,9 +645,11 @@ public class InternationalizationModelResource extends AbstractModelWithSharedRe
resource.setURI(newBaseURI);
// Remove the old resource URI from map
- propertiesByLocale.get(initialURI).remove(locale);
- if (propertiesByLocale.get(initialURI).isEmpty()) {
- propertiesByLocale.remove(initialURI);
+ if (locale != null) {
+ propertiesByLocale.get(initialURI).remove(locale);
+ if (propertiesByLocale.get(initialURI).isEmpty()) {
+ propertiesByLocale.remove(initialURI);
+ }
}
// Add the new resource URI from map