ref = new StringBuilder(ref.toString().trim());
if("".equals(ref.toString())) {
throw new MessageInvalidException(ProtocolErrorMessage.REF_PARSE_ERROR, "Error parsing ref from URL <"+urlString+ '>', identifier, false);
}
try {
fs = new SimpleFieldSet(ref.toString(), false, true, true);
} catch (IOException e) {
throw new MessageInvalidException(ProtocolErrorMessage.REF_PARSE_ERROR, "Error parsing ref from URL <"+urlString+">: "+e.getMessage(), identifier, false);
}
} else if(fileString != null) {
File f = new File(fileString);
if(!f.isFile()) {
throw new MessageInvalidException(ProtocolErrorMessage.NOT_A_FILE_ERROR, "The given ref file path <"+fileString+"> is not a file", identifier, false);
}
try {
in = new BufferedReader(new InputStreamReader(new FileInputStream(f), "UTF-8"));
ref = new StringBuilder(1024);
String line;
while((line = in.readLine()) != null) {
line = line.trim();
ref.append( line ).append('\n');
}
in.close();
} catch (FileNotFoundException e) {
throw new MessageInvalidException(ProtocolErrorMessage.FILE_NOT_FOUND, "File not found when retrieving ref file <"+fileString+">: "+e.getMessage(), identifier, false);
} catch (IOException e) {
throw new MessageInvalidException(ProtocolErrorMessage.FILE_PARSE_ERROR, "IO error while retrieving ref file <"+fileString+">: "+e.getMessage(), identifier, false);
}
ref = new StringBuilder(ref.toString().trim());
if("".equals(ref.toString())) {
throw new MessageInvalidException(ProtocolErrorMessage.REF_PARSE_ERROR, "Error parsing ref from file <"+fileString+ '>', identifier, false);
}
try {
fs = new SimpleFieldSet(ref.toString(), false, true, true);
} catch (IOException e) {
throw new MessageInvalidException(ProtocolErrorMessage.REF_PARSE_ERROR, "Error parsing ref from file <"+fileString+">: "+e.getMessage(), identifier, false);
}
}
fs.setEndMarker( "End" );