@Override public String getDescription() { // Load the lang pack using the current locale String locale = resources.getLocale(); String description = null; try { // All of this will be changed to a few lines of code after the locale database refactor. InputStream in = resources.getInputStream("langpacks/" + locale + ".xml"); LocaleDatabase langpack = new LocaleDatabase(in); description = langpack.get(DESCRIPTION_LOCALE_DATABASE_KEY); } catch (Exception e) { /* * We'll just log the exception if something happens and provide the * default value. */ logger.log(Level.WARNING, e.getMessage(), e); } if (description == null) { description = DEFAULT_DESCRIPTION; } return description; }
private boolean readSpec() { InputStream input; try { input = ResourceManager.getInstance().getInputStream(SPEC_RESOURCE_NAME); } catch (Exception e) { e.printStackTrace(); return false; } IXMLParser parser = new XMLParser(); try { this.spec = parser.parse(input); } catch (Exception e) { System.out.println("Error parsing XML specification for compilation."); e.printStackTrace(); return false; } if (!this.spec.hasChildren()) { return false; } this.compilerArgumentsList = new ArrayList<String>(); this.compilerList = new ArrayList<String>(); // read <global> information IXMLElement global = this.spec.getFirstChildNamed("global"); // use some default values if no <global> section found if (global != null) { // get list of compilers this.compilerSpec = global.getFirstChildNamed("compiler"); if (this.compilerSpec != null) { readChoices(this.compilerSpec, this.compilerList); } this.compilerArgumentsSpec = global.getFirstChildNamed("arguments"); if (this.compilerArgumentsSpec != null) { // basicly perform sanity check readChoices(this.compilerArgumentsSpec, this.compilerArgumentsList); } } // supply default values if no useful ones where found if (this.compilerList.size() == 0) { this.compilerList.add("javac"); this.compilerList.add("jikes"); } if (this.compilerArgumentsList.size() == 0) { this.compilerArgumentsList.add("-O -g:none"); this.compilerArgumentsList.add("-O"); this.compilerArgumentsList.add("-g"); this.compilerArgumentsList.add(""); } return true; }