public static HashResource createRootElement(String rootElement) throws SyntaxException { if (rootElement == null || "".equals(rootElement.trim())) { return new HashResource(); } else { try { PanParser parser = new PanParser(new StringReader(rootElement)); ASTOperation ast = parser.dml(); Operation dml = PanParserAstUtils.astToDml(ast, true); return (HashResource) dml.execute(new CompileTimeContext()); } catch (SyntaxException e) { throw SyntaxException.create(null, MSG_INVALID_SYNTAX_ROOT_ELEMENT, e.getMessage()); } catch (ClassCastException e) { throw SyntaxException.create(null, MSG_INVALID_TYPE_FOR_ROOT_ELEMENT); } } }
private CompilerOptions createCompilerOptions() throws MojoExecutionException { LinkedList<File> includeDirectories = new LinkedList<File>(); includeDirectories.add(sourceDirectory); try { return new CompilerOptions( Pattern.compile(debugNsInclude), Pattern.compile(debugNsExclude), maxIteration, maxRecursion, formatters, outputDir, includeDirectories, warningsFromString(warnings), null, null, initialData, nthread); } catch (SyntaxException e) { throw new MojoExecutionException("error creating compiler options: " + e.getMessage()); } }