Mercurial > dive4elements > framework
comparison artifact-database/src/main/java/de/intevation/artifactdatabase/ArtifactDatabaseImpl.java @ 417:410a1bfb9590
Fix for NPE on empty user database
artifacts/trunk@5270 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Mon, 27 Aug 2012 08:33:05 +0000 |
parents | d4a846ee35b8 |
children | 8d8aed23c323 |
comparison
equal
deleted
inserted
replaced
416:733e76413bf8 | 417:410a1bfb9590 |
---|---|
1215 ArtifactNamespaceContext.NAMESPACE_URI, | 1215 ArtifactNamespaceContext.NAMESPACE_URI, |
1216 ArtifactNamespaceContext.NAMESPACE_PREFIX); | 1216 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
1217 | 1217 |
1218 Element root = ec.create("users"); | 1218 Element root = ec.create("users"); |
1219 result.appendChild(root); | 1219 result.appendChild(root); |
1220 | 1220 |
1221 for (User user: users) { | 1221 if(users != null) { |
1222 Element ue = ec.create("user"); | 1222 for (User user: users) { |
1223 ec.addAttr(ue, "uuid", user.identifier(), true); | 1223 Element ue = ec.create("user"); |
1224 ec.addAttr(ue, "name", user.getName(), true); | 1224 ec.addAttr(ue, "uuid", user.identifier(), true); |
1225 Element ua = ec.create("account"); | 1225 ec.addAttr(ue, "name", user.getName(), true); |
1226 ec.addAttr(ua, "name", user.getAccount(), true); | 1226 Element ua = ec.create("account"); |
1227 ue.appendChild(ua); | 1227 ec.addAttr(ua, "name", user.getAccount(), true); |
1228 | 1228 ue.appendChild(ua); |
1229 Document role = user.getRole(); | 1229 |
1230 | 1230 Document role = user.getRole(); |
1231 if (role != null) { | 1231 |
1232 ue.appendChild(result.importNode(role.getFirstChild(), true)); | 1232 if (role != null) { |
1233 ue.appendChild(result.importNode(role.getFirstChild(), true)); | |
1234 } | |
1235 | |
1236 root.appendChild(ue); | |
1237 | |
1233 } | 1238 } |
1234 | |
1235 root.appendChild(ue); | |
1236 | |
1237 } | 1239 } |
1238 | 1240 |
1239 return result; | 1241 return result; |
1240 } | 1242 } |
1241 | 1243 |