Ignore:
Timestamp:
2014-10-19T01:27:04+02:00 (10 years ago)
Author:
donvip
Message:

[josm_plugins] fix java 7 warnings / global usage of try-with-resource

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/opendata/includes/org/apache/poi/hssf/record/formula/function/FunctionMetadataReader.java

    r30737 r30738  
    2222import java.io.InputStream;
    2323import java.io.InputStreamReader;
    24 import java.io.UnsupportedEncodingException;
    2524import java.util.Arrays;
    2625import java.util.HashSet;
     
    3231/**
    3332 * Converts the text meta-data file into a <tt>FunctionMetadataRegistry</tt>
    34  * 
     33 *
    3534 * @author Josh Micich
    3635 */
     
    3837
    3938        private static final String METADATA_FILE_NAME = "functionMetadata.txt";
    40        
     39
    4140        /** plain ASCII text metadata file uses three dots for ellipsis */
    4241        private static final String ELLIPSIS = "...";
     
    5958                }
    6059
    61                 BufferedReader br;
    62                 try {
    63                         br = new BufferedReader(new InputStreamReader(is,"UTF-8"));
    64                 } catch(UnsupportedEncodingException e) {
    65                         throw new RuntimeException(e);
    66                 }
    6760                FunctionDataBuilder fdb = new FunctionDataBuilder(400);
    6861
    69                 try {
     62                try (BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF-8"))) {
    7063                        while (true) {
    7164                                String line = br.readLine();
     
    8275                                processLine(fdb, line);
    8376                        }
    84                         br.close();
    8577                } catch (IOException e) {
    8678                        throw new RuntimeException(e);
     
    10799                validateFunctionName(functionName);
    108100                // TODO - make POI use isVolatile
    109                 fdb.add(functionIndex, functionName, minParams, maxParams, 
     101                fdb.add(functionIndex, functionName, minParams, maxParams,
    110102                                returnClassCode, parameterClassCodes, hasNote);
    111103        }
    112        
     104
    113105
    114106        private static byte parseReturnTypeCode(String code) {
     
    164156
    165157        /**
    166          * Makes sure that footnote digits from the original OOO document have not been accidentally 
     158         * Makes sure that footnote digits from the original OOO document have not been accidentally
    167159         * left behind
    168160         */
     
    182174                        return;
    183175                }
    184                 throw new RuntimeException("Invalid function name '" + functionName 
     176                throw new RuntimeException("Invalid function name '" + functionName
    185177                                + "' (is footnote number incorrectly appended)");
    186178        }
Note: See TracChangeset for help on using the changeset viewer.