BufferedReader reader = null;
try {
reader = new BufferedReader(new InputStreamReader(in));
String line = reader.readLine();
if (line == null) {
throw new BeanDefinitionStoreException("Empty file found for: " + uri);
}
line = line.trim();
Class answer = null;
try {
answer = loadClass(line);
}
catch (ClassNotFoundException e) {
throw new BeanDefinitionStoreException("Could not find class: " + line, e);
}
try {
return (ElementProcessor) answer.newInstance();
}
catch (Exception e) {
throw new BeanDefinitionStoreException("Failed to instantiate bean of type: " + answer.getName() + ". Reason: " + e, e);
}
}
catch (IOException e) {
throw new BeanDefinitionStoreException("Failed to load file for URI: " + uri + ". Reason: " + e, e);
}
finally {
try {
reader.close();
}