List<Token> tokenize() { List<Token> tokenList = new ArrayList<Token>(); while (true) { String currentLine; try { currentLine = lineReader.readLine(); } catch (IOException e) { throw new MessageConveyorException("Failed to read input stream", e); } if (currentLine == null) { break; } if(state != State.TRAILING_BACKSLASH) { state = State.START; } tokenizeLine(tokenList, currentLine); tokenList.add(Token.EOL); } return tokenList; }
private <E extends Enum<?>> CAL10NBundle lookupResourceBundleByEnumClassAndLocale(Class<E> declaringClass) throws MessageConveyorException { AnnotationExtractorViaEnumClass annotationExtractor = new AnnotationExtractorViaEnumClass(declaringClass); // basename is declared via an annotation on the declaringClass String baseName = annotationExtractor.getBaseName(); if (baseName == null) { throw new MessageConveyorException( "Missing @BaseName annotation in enum type [" + declaringClass.getName() + "]. See also " + CAL10NConstants.MISSING_BN_ANNOTATION_URL); } String charset = annotationExtractor.extractCharset(locale); // use the declaring class' loader instead of // this.getClass().getClassLoader() // see also http://jira.qos.ch/browse/CAL-8 CAL10NBundleFinderByClassloader cal10NBundleFinderByClassloader = new CAL10NBundleFinderByClassloader(declaringClass.getClassLoader()); CAL10NBundle rb = cal10NBundleFinderByClassloader.getBundle( baseName, locale, charset); if (rb == null) { throw new MessageConveyorException( "Failed to locate resource bundle [" + baseName + "] for locale [" + locale + "] for enum type [" + declaringClass.getName() + "]"); } return rb; }