String className;
BufferedReader svcIn = new BufferedReader(new InputStreamReader(service.openStream()));
try {
className = svcIn.readLine();
} catch (IOException ioe) {
compilationUnit.getErrorCollector().addError(new SimpleMessage(
"IOException reading the service definition at "
+ service.toExternalForm() + " because of exception " + ioe.toString(), null));
continue;
}
while (className != null) {
if (!className.startsWith("#") && className.length() > 0) {
if (transformNames.containsKey(className)) {
if (!service.equals(transformNames.get(className))) {
compilationUnit.getErrorCollector().addWarning(
WarningMessage.POSSIBLE_ERRORS,
"The global transform for class " + className + " is defined in both "
+ transformNames.get(className).toExternalForm()
+ " and "
+ service.toExternalForm()
+ " - the former definition will be used and the latter ignored.",
null,
null);
}
} else {
transformNames.put(className, service);
}
}
try {
className = svcIn.readLine();
} catch (IOException ioe) {
compilationUnit.getErrorCollector().addError(new SimpleMessage(
"IOException reading the service definition at "
+ service.toExternalForm() + " because of exception " + ioe.toString(), null));
//noinspection UnnecessaryContinue
continue;
}
}
}
} catch (IOException e) {
//FIXME the warning message will NPE with what I have :(
compilationUnit.getErrorCollector().addError(new SimpleMessage(
"IO Exception attempting to load global transforms:" + e.getMessage(),
null));
}
try {
Class.forName("java.lang.annotation.Annotation"); // test for 1.5 JVM