if (contents == null) {
return null;
}
String[] lines = StringUtil.parse(contents, format.getEndOfLineSymbols());
if (lines == null) {
throw new DataAccessException("[CategoryDA::readData]Record not found.");
} else {
if (lines.length < 1) {
throw new DataAccessException("[CategoryDA::readData]Record not found.");
}
dataObjectSet = new ArrayList<Tuple2<NameValue<String>, NameValue<String>>>();
for (int i = 0; i < lines.length; i++) {
String record = lines[i];
String[] fields = StringUtil.parse(record, String.valueOf((char) format.getDelimiterChar()));
if (fields == null) {
throw new DataAccessException("[CategoryDA::readData]Unable to read record no " + (String.valueOf(i + 1)));
} else {
if (fields.length != 2) {
Logger.getLogger(CategoryDA.class.getName()).log(Level.SEVERE, "[CategoryDA::readData]Record no " + (String.valueOf(i + 1)) + " is corrupted");
} else {
NameValue<String> categoryCode = new NameValue<String>("CategoryCode", fields[0]);
NameValue<String> categoryName = new NameValue<String>("CategoryName", fields[1]);
dataObjectSet.add(new Tuple2<NameValue<String>, NameValue<String>>(categoryCode, categoryName));
}
}
}
}
} else {
throw new DataAccessException("[CategoryDA::readData]File not found.");
}
} catch (IOException ex) {
throw new DataAccessException(ex.getMessage(), ex);
} finally {
if (br != null) {
try {
br.close();
} catch (IOException ex) {