use of com.sun.enterprise.tools.verifier.apiscan.classfile.ClosureCompilerImpl in project Payara by payara.
the class WebArchiveClassesLoadable method check.
public Result check(WebBundleDescriptor descriptor) {
Result result = getInitializedResult();
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
String archiveUri = getAbstractArchiveUri(descriptor);
Iterator entries;
try {
entries = getClassNames(descriptor).iterator();
} catch (Exception e) {
// e.printStackTrace();
result.failed(smh.getLocalString(getClass().getName() + ".exception", "Error: [ {0} ] exception while loading the archive [ {1} ].", new Object[] { e, descriptor.getName() }));
return result;
}
boolean allPassed = true;
ClosureCompiler closureCompiler = getVerifierContext().getClosureCompiler();
// org.apache.jasper takes care of internal JSP stuff
((ClosureCompilerImpl) closureCompiler).addExcludedPattern("org.apache.jasper");
// DefaultServlet takes care of the default servlet in GlassFish.
// For some reason, for every web app, this is returned as a component
((ClosureCompilerImpl) closureCompiler).addExcludedClass("org.apache.catalina.servlets.DefaultServlet");
if (getVerifierContext().isAppserverMode())
((ClosureCompilerImpl) closureCompiler).addExcludedPattern("com.sun.enterprise");
while (entries.hasNext()) {
String className = (String) entries.next();
boolean status = closureCompiler.buildClosure(className);
allPassed = status && allPassed;
}
if (allPassed) {
result.setStatus(Result.PASSED);
addGoodDetails(result, compName);
result.passed(smh.getLocalString(getClass().getName() + ".passed", "All the classes are loadable within [ {0} ] without any linkage error.", new Object[] { archiveUri }));
} else {
result.setStatus(Result.FAILED);
addErrorDetails(result, compName);
result.addErrorDetails(WebArchiveLoadableHelper.getFailedResults(closureCompiler, getVerifierContext().getOutDir()));
result.addErrorDetails(smh.getLocalString("com.sun.enterprise.tools.verifier.tests.loadableError", "Please either bundle the above mentioned classes in the application " + "or use optional packaging support for them."));
}
return result;
}
use of com.sun.enterprise.tools.verifier.apiscan.classfile.ClosureCompilerImpl in project Payara by payara.
the class ClassContainsNativeMethod method check.
public Result check(Descriptor descriptor) {
ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
Result result = getInitializedResult();
result.setStatus(Result.PASSED);
ClosureCompilerImpl cc = ClosureCompilerImpl.class.cast(getVerifierContext().getClosureCompiler());
Collection<String> nativeMethods = cc.getNativeMethods();
if (!nativeMethods.isEmpty()) {
addWarningDetails(result, compName);
result.warning(smh.getLocalString(getClass().getName() + ".warning", "Supplied below is the list of method names " + "(in the format <package.classname>.<methodName>) " + "that are defined as native methods and used by the application:\n"));
for (String m : nativeMethods) {
result.warning("\n\t" + m);
}
result.warning(smh.getLocalString(getClass().getName() + ".suggestion", "Please make sure that they are implemented on all operating systems."));
}
return result;
}
Aggregations