protected void finalizeExceptions() { inException = false; if (!exceptionSet) { tokenElement = new Element( StringTools.trimWhitespace(elements.toString()), caseSensitive, regExpression, tokenInflected); exceptionSet = true; } tokenElement.setNegation(tokenNegated); if (!StringTools.isEmpty(exceptions.toString()) || exceptionPosToken != null) { tokenElement.setStringPosException( StringTools.trimWhitespace(exceptions.toString()), exceptionStringRegExp, exceptionStringInflected, exceptionStringNegation, exceptionValidNext, exceptionValidPrev, exceptionPosToken, exceptionPosRegExp, exceptionPosNegation); exceptionPosToken = null; } if (exceptionSpaceBeforeSet) { tokenElement.setExceptionSpaceBefore(exceptionSpaceBefore); } resetException(); }
private void checkNumber(Attributes attrs) throws SAXException { if (StringTools.isEmpty(attrs.getValue("no"))) { throw new SAXException( "References cannot be empty: " + "\n Line: " + pLocator.getLineNumber() + ", column: " + pLocator.getColumnNumber() + "."); } else if (Integer.parseInt(attrs.getValue("no")) < 1) { throw new SAXException( "References must be larger than 0: " + attrs.getValue("no") + "\n Line: " + pLocator.getLineNumber() + ", column: " + pLocator.getColumnNumber() + "."); } }
public void testTranslationsAreNotEmpty() throws IOException { for (Language lang : Language.REAL_LANGUAGES) { final File file1 = getTranslationFile(lang); final File file2 = getTranslationFileWithVariant(lang); if (!file1.exists() && !file2.exists()) { System.err.println("Note: no translation available for " + lang); continue; } final File file = file1.exists() ? file1 : file2; final List<String> lines = loadFile(file); for (String line : lines) { line = line.trim(); if (StringTools.isEmpty(line) || line.charAt(0) == '#') { continue; } final String[] parts = line.split("="); if (parts.length < 2) { System.err.println("***** Empty translation: '" + line + "' in file " + file); // fail("Empty translation: '" + line + "' in file " + file); } } } }