Captures output
if(destFolder != null) {
File destFolderObj = new File(destFolder);
String destFile = destFolder +
Defaults.DOMAIN_XML_VERIFICATION_OUTPUT;
PrintStream out = System.out;
if(!destFolderObj.exists()) {
destFolderObj.mkdirs();
}
try {
out = new PrintStream(
new BufferedOutputStream(new FileOutputStream(destFile)), true);
} catch(FileNotFoundException fnfe) {
System.out.println(" File Not Found Exception ");
//ignore as output stream is set to System.out
fnfe.printStackTrace();
}
try {
String className = "com.sun.enterprise.config.serverbeans.validation.DomainXmlVerifier";
Class classObj = Class.forName(className);
Constructor[] constructors = classObj.getDeclaredConstructors();
constructors = classObj.getConstructors();
Constructor constructor =
classObj.getConstructor(
new Class[]{String.class, PrintStream.class});
Object obj = constructor.newInstance(new Object[]{xmlFile,out});
Method method = classObj.getMethod("invokeConfigValidator",(java.lang.Class[]) null);
method.invoke(obj, (java.lang.Object[] ) null);
return new FileData(new File(destFile).getName(),
DataType.DOMAIN_VALIDATION_DETAILS);
} catch (Exception ce) {
Throwable cause = ce.getCause();
while(cause!=null && !(cause instanceof org.xml.sax.SAXParseException))
cause = cause.getCause();
if(cause!=null)
out.println("XML: "+cause.getMessage());
else
ce.printStackTrace();
throw new DiagnosticException(ce.getMessage());
}finally {
out.flush();
out.close();
}
}
return null;