changeset 432:da33275fb765

Check if roleData is null before reading it Fix for issue849
author Björn Ricks <bjoern.ricks@intevation.de>
date Fri, 28 Sep 2012 13:55:58 +0200
parents 29bd60a3ee67
children bd012f4720ae
files ChangeLog artifact-database/src/main/java/de/intevation/artifactdatabase/Backend.java
diffstat 2 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Sep 28 12:16:04 2012 +0200
+++ b/ChangeLog	Fri Sep 28 13:55:58 2012 +0200
@@ -1,3 +1,8 @@
+2012-09-29	Björn Ricks	<bjoern.ricks@intevation.de>
+
+	* artifact-database/src/main/java/de/intevation/artifactdatabase/Backend.java:
+	  Check if roles from database is null. Fix for issue849.
+
 2012-09-26	Björn Ricks	<bjoern.ricks@intevation.de>
 
 	* artifact-database/src/main/java/de/intevation/artifactdatabase/state/AbstractState.java:
--- a/artifact-database/src/main/java/de/intevation/artifactdatabase/Backend.java	Fri Sep 28 12:16:04 2012 +0200
+++ b/artifact-database/src/main/java/de/intevation/artifactdatabase/Backend.java	Fri Sep 28 13:55:58 2012 +0200
@@ -972,7 +972,10 @@
                 String account   = result.getString(3);
                 byte [] roleData = result.getBytes(4);
 
-                Document role = XMLUtils.fromByteArray(roleData, true);
+                Document role = null;
+                if (roleData != null) {
+                    role = XMLUtils.fromByteArray(roleData, true);
+                }
 
                 user[0] = factory.createUser(
                     identifier, name, account, role, context);
@@ -1009,7 +1012,10 @@
                 String account   = result.getString(3);
                 byte [] roleData = result.getBytes(4);
 
-                Document role = XMLUtils.fromByteArray(roleData, true);
+                Document role = null;
+                if (roleData != null) {
+                    role = XMLUtils.fromByteArray(roleData, true);
+                }
 
                 user[0] = factory.createUser(
                     identifier, name, account, role, context);

http://dive4elements.wald.intevation.org