}
public List<DroolsError> addProcessFromXml(final Resource resource) throws IOException {
Reader reader = resource.getReader();
PackageBuilderConfiguration configuration = packageBuilder.getPackageBuilderConfiguration();
XmlProcessReader xmlReader = new XmlProcessReader( configuration.getSemanticModules(), packageBuilder.getRootClassLoader() );
final ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
final ClassLoader newLoader = this.getClass().getClassLoader();
try {
Thread.currentThread().setContextClassLoader( newLoader );
String portRuleFlow = System.getProperty( "drools.ruleflow.port", "false" );
Reader portedReader = null;
if ( portRuleFlow.equalsIgnoreCase( "true" ) ) {
portedReader = portToCurrentVersion( reader );
} else {
portedReader = reader;
}
List<Process> processes = xmlReader.read(portedReader);
if (processes != null) {
// it is possible an xml file could not be parsed, so we need to
// stop null pointers
for (Process process : processes) {
buildProcess(process, resource);