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/tageditor/src/org/openstreetmap/josm/plugins/tageditor/tagspec/TagSpecifications.java

    r30737 r30738  
    2626/**
    2727 * This class manages a list of {@link TagSpecification}s.
    28  * 
     28 *
    2929 * It also provides a method for reading a list of {@link TagSpecification}s from
    3030 * an XML file.
    31  * 
     31 *
    3232 * @author Gubaer
    3333 *
     
    6363     * loads the tag specifications from the resource file given by
    6464     * {@link #RES_NAME_TAG_SPECIFICATIONS}.
    65      * 
     65     *
    6666     * @return the list of {@link TagSpecification}s
    6767     * @throws Exception thrown, if an exception occurs
     
    7171        if (in == null) {
    7272            logger.log(Level.SEVERE, "failed to create input stream for resource '" + RES_NAME_TAG_SPECIFICATIONS + "'");
    73         }
    74         BufferedReader reader = new BufferedReader(new InputStreamReader(in));
    75         TagSpecifications spec = new TagSpecifications();
    76         spec.load(reader);
    77         reader.close();
    78         instance = spec;
    79 
     73            return;
     74        }
     75        try (BufferedReader reader = new BufferedReader(new InputStreamReader(in))) {
     76                TagSpecifications spec = new TagSpecifications();
     77                spec.load(reader);
     78                instance = spec;
     79        }
    8080    }
    8181
     
    9797    /**
    9898     * loads the tag specifications from a specific reader
    99      * 
     99     *
    100100     * @param in  the reader to read from
    101101     * @throws Exception thrown, if an exception occurs
     
    156156        return items;
    157157    }
    158    
     158
    159159    /**
    160160     * replies a list of {@see KeyValuePair}s for all {@see TagSpecification}s and
    161161     * {@see LableSpecification}s.
    162      * 
     162     *
    163163     * @return the list
    164164     */
     
    178178    /**
    179179     * The SAX handler for reading XML files with tag specifications
    180      * 
     180     *
    181181     * @author gubaer
    182182     *
     
    212212         * parses a string value consisting of 'yes' or 'no' (exactly, case
    213213         * sensitive)
    214          * 
     214         *
    215215         * @param value the string value
    216216         * @return true, if value is <code>yes</code>; false, if value is <code>no</code>
     
    228228        /**
    229229         * handles a start element with name <code>osm-tag-definitions</code>
    230          * 
     230         *
    231231         * @param atts  the XML attributes
    232232         * @throws SAXException
     
    238238        /**
    239239         * handles an end element with name <code>osm-tag-specifications</code>
    240          * 
     240         *
    241241         * @throws SAXException
    242242         */
     
    247247        /**
    248248         * handles a start element with name <code>tag</code>
    249          * 
     249         *
    250250         * @param atts the XML attributes of the element
    251251         * @throws SAXException
     
    285285        /**
    286286         * handles a start element with name <code>label</code>
    287          * 
     287         *
    288288         * @param atts the XML attributes
    289289         * @throws SAXException
     
    311311        /**
    312312         * handles an end element with name <code>label</code>
    313          * 
     313         *
    314314         * @throws SAXException
    315315         */
     
    352352    class ResourceEntityResolver implements EntityResolver {
    353353
    354         public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
     354        @Override
     355                public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
    355356            if (systemId != null && systemId.endsWith(DTD)) {
    356357                InputStream stream = TagSpecifications.class.getResourceAsStream("/resources/"+DTD);
Note: See TracChangeset for help on using the changeset viewer.