if (contents == null) {
return null;
}
String[] lines = StringUtil.parse(contents, format.getEndOfLineSymbols());
if (lines == null) {
throw new DataAccessException("[MemberDA::readData]Record not found.");
} else {
if (lines.length < 1) {
throw new DataAccessException("[MemberDA::readData]Record not found.");
}
dataObjectSet = new ArrayList<Tuple3<NameValue<String>, NameValue<String>, NameValue<Integer>>>();
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("[MemberDA::readData]Unable to read record no " + (String.valueOf(i + 1)));
} else {
if (fields.length != 3) {
Logger.getLogger(MemberDA.class.getName()).log(Level.SEVERE, "[MemberDA::readData]Record no " + (String.valueOf(i + 1)) + " is corrupted");
} else {
String code = fields[0];
String name = fields[1];
int point = -1;
try {
point = Integer.parseInt(fields[2]);
} catch (NumberFormatException nfx) {
throw new DataAccessException(nfx.getMessage(), nfx);
}
NameValue<String> memberID = new NameValue<String>("MemberID", code);
NameValue<String> memberName = new NameValue<String>("MemberName", name);
NameValue<Integer> memberPoint = new NameValue<Integer>("MemberPoint", point);
dataObjectSet.add(new Tuple3<NameValue<String>, NameValue<String>, NameValue<Integer>>(memberID, memberName, memberPoint));
}
}
}
}
} else {
throw new DataAccessException("[MemberDA::readData]File not found.");
}
} catch (IOException ex) {
throw new DataAccessException(ex.getMessage(), ex);
} finally {
if (br != null) {
try {
br.close();
} catch (IOException ex) {