comparison artifact-database/src/main/java/de/intevation/artifactdatabase/Backend.java @ 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 f5ecca16f601
children e79ad624f94c
comparison
equal deleted inserted replaced
431:29bd60a3ee67 432:da33275fb765
970 // omit id 970 // omit id
971 String name = result.getString(2); 971 String name = result.getString(2);
972 String account = result.getString(3); 972 String account = result.getString(3);
973 byte [] roleData = result.getBytes(4); 973 byte [] roleData = result.getBytes(4);
974 974
975 Document role = XMLUtils.fromByteArray(roleData, true); 975 Document role = null;
976 if (roleData != null) {
977 role = XMLUtils.fromByteArray(roleData, true);
978 }
976 979
977 user[0] = factory.createUser( 980 user[0] = factory.createUser(
978 identifier, name, account, role, context); 981 identifier, name, account, role, context);
979 return true; 982 return true;
980 } 983 }
1007 String identifier = result.getString(1); 1010 String identifier = result.getString(1);
1008 String name = result.getString(2); 1011 String name = result.getString(2);
1009 String account = result.getString(3); 1012 String account = result.getString(3);
1010 byte [] roleData = result.getBytes(4); 1013 byte [] roleData = result.getBytes(4);
1011 1014
1012 Document role = XMLUtils.fromByteArray(roleData, true); 1015 Document role = null;
1016 if (roleData != null) {
1017 role = XMLUtils.fromByteArray(roleData, true);
1018 }
1013 1019
1014 user[0] = factory.createUser( 1020 user[0] = factory.createUser(
1015 identifier, name, account, role, context); 1021 identifier, name, account, role, context);
1016 return true; 1022 return true;
1017 } 1023 }

http://dive4elements.wald.intevation.org