File tree Expand file tree Collapse file tree
src/main/java/org/apache/commons/codec/language/bm Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -158,20 +158,24 @@ public static Languages getInstance(final String languagesResourceName) {
158158 }
159159
160160 final Scanner lsScanner = new Scanner (langIS , ResourceConstants .ENCODING );
161- boolean inExtendedComment = false ;
162- while (lsScanner .hasNextLine ()) {
163- final String line = lsScanner .nextLine ().trim ();
164- if (inExtendedComment ) {
165- if (line .endsWith (ResourceConstants .EXT_CMT_END )) {
166- inExtendedComment = false ;
167- }
168- } else {
169- if (line .startsWith (ResourceConstants .EXT_CMT_START )) {
170- inExtendedComment = true ;
171- } else if (line .length () > 0 ) {
172- ls .add (line );
161+ try {
162+ boolean inExtendedComment = false ;
163+ while (lsScanner .hasNextLine ()) {
164+ final String line = lsScanner .nextLine ().trim ();
165+ if (inExtendedComment ) {
166+ if (line .endsWith (ResourceConstants .EXT_CMT_END )) {
167+ inExtendedComment = false ;
168+ }
169+ } else {
170+ if (line .startsWith (ResourceConstants .EXT_CMT_START )) {
171+ inExtendedComment = true ;
172+ } else if (line .length () > 0 ) {
173+ ls .add (line );
174+ }
173175 }
174176 }
177+ } finally {
178+ lsScanner .close ();
175179 }
176180
177181 return new Languages (Collections .unmodifiableSet (ls ));
You can’t perform that action at this time.
0 commit comments