Changeset 13828 in josm for trunk/src


Ignore:
Timestamp:
2018-05-24T23:53:37+02:00 (7 years ago)
Author:
wiktorn
Message:

Sonar fixes, javadocs.

See: #16249

Location:
trunk/src/org/openstreetmap/josm
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java

    r13827 r13828  
    140140            if (!GraphicsEnvironment.isHeadless()) {
    141141                JOptionPane.showMessageDialog(Main.parent, tr("Could not parse WMTS layer list."),
    142                         tr("WMS Error"), JOptionPane.ERROR_MESSAGE);
     142                        tr("WMTS Error"), JOptionPane.ERROR_MESSAGE);
    143143            }
    144144            Logging.log(Logging.LEVEL_ERROR, "Could not parse WMTS layer list.", e);
  • trunk/src/org/openstreetmap/josm/data/imagery/GetCapabilitiesParseHelper.java

    r13824 r13828  
    7575
    7676    /**
     77     * Returns reader with properties set for parsing WM(T)S documents
     78     *
    7779     * @param in InputStream with pointing to GetCapabilities XML stream
    7880     * @return safe XMLStreamReader, that is not validating external entities, nor loads DTD's
     
    235237
    236238    /**
     239     * Normalize url
     240     *
    237241     * @param url URL
    238242     * @return normalized URL
  • trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java

    r13824 r13828  
    2424import javax.json.Json;
    2525import javax.json.JsonObject;
     26import javax.json.JsonReader;
    2627import javax.json.stream.JsonCollectors;
    2728import javax.swing.ImageIcon;
     
    556557        modTileFeatures = e.modTileFeatures;
    557558        if (e.default_layers != null) {
    558             defaultLayers = Json.createReader(new StringReader(e.default_layers)).
    559                     readArray().
    560                     stream().
    561                     map(x -> DefaultLayer.fromJson((JsonObject) x, imageryType)).
    562                     collect(Collectors.toList());
     559            try (JsonReader jsonReader = Json.createReader(new StringReader(e.default_layers))) {
     560                defaultLayers = jsonReader.
     561                        readArray().
     562                        stream().
     563                        map(x -> DefaultLayer.fromJson((JsonObject) x, imageryType)).
     564                        collect(Collectors.toList());
     565            }
    563566        }
    564567        customHttpHeaders = e.customHttpHeaders;
  • trunk/src/org/openstreetmap/josm/data/imagery/TileLoaderFactory.java

    r13733 r13828  
    1717
    1818    /**
     19     * Creates TileLoaderFactory - factory that creates tile loaders with all options already set
     20     *
    1921     * @param listener that will be notified, when tile has finished loading
    2022     * @param headers that will be sent with requests to TileSource. <code>null</code> indicates none
  • trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java

    r13824 r13828  
    1414import java.util.Collection;
    1515import java.util.Collections;
     16import java.util.Deque;
    1617import java.util.LinkedHashSet;
     18import java.util.LinkedList;
    1719import java.util.List;
    1820import java.util.Map;
     
    2123import java.util.Optional;
    2224import java.util.SortedSet;
    23 import java.util.Stack;
    2425import java.util.TreeSet;
    2526import java.util.concurrent.ConcurrentHashMap;
     
    252253
    253254    /**
    254      * Exception thrown when praser doesn't find expected information in GetCapabilities document
     255     * Exception thrown when parser doesn't find expected information in GetCapabilities document
    255256     *
    256257     */
     
    258259
    259260        /**
     261         * Create WMTS exception
    260262         * @param cause description of cause
    261263         */
     
    265267
    266268        /**
     269         * Create WMTS exception
    267270         * @param cause description of cause
    268271         * @param t nested exception
     
    373376
    374377    /**
     378     * Call remote server and parse response to WMTSCapabilities object
     379     *
    375380     * @param url of the getCapabilities document
    376381     * @param headers HTTP headers to set when calling getCapabilities url
     
    479484    private static Layer parseLayer(XMLStreamReader reader) throws XMLStreamException {
    480485        Layer layer = new Layer();
    481         Stack<QName> tagStack = new Stack<>();
     486        Deque<QName> tagStack = new LinkedList<>();
    482487        List<String> supportedMimeTypes = new ArrayList<>(Arrays.asList(ImageIO.getReaderMIMETypes()));
    483488        supportedMimeTypes.add("image/jpgpng");         // used by ESRI
  • trunk/src/org/openstreetmap/josm/gui/preferences/imagery/AddWMSLayerPanel.java

    r13824 r13828  
    4242    private final transient WMSLayerTree tree = new WMSLayerTree();
    4343    private final JComboBox<String> formats = new JComboBox<>();
    44     private final JLabel wmsInstruction;
    4544    private final JosmTextArea wmsUrl = new JosmTextArea(3, 40).transferFocusOnTab();
    4645    private final JButton showBounds = new JButton(tr("Show bounds"));
     
    7372        addCommonSettings();
    7473
    75         wmsInstruction = new JLabel(tr("{0} Edit generated {1} URL (optional)", "6.", "WMS"));
     74        JLabel wmsInstruction = new JLabel(tr("{0} Edit generated {1} URL (optional)", "6.", "WMS"));
    7675        add(wmsInstruction, GBC.eol());
    7776        wmsInstruction.setLabelFor(wmsUrl);
  • trunk/src/org/openstreetmap/josm/gui/preferences/imagery/AddWMTSLayerPanel.java

    r13824 r13828  
    4646        JButton getLayers = new JButton(tr("{0} Get layers", "3."));
    4747        getLayers.setEnabled(setDefaultLayer.isSelected());
    48         setDefaultLayer.addActionListener(e -> {
    49                 getLayers.setEnabled(setDefaultLayer.isSelected());
    50         });
     48        setDefaultLayer.addActionListener(e -> getLayers.setEnabled(setDefaultLayer.isSelected()));
    5149        add(setDefaultLayer, GBC.eop());
    5250        add(getLayers, GBC.eop().fill(GBC.HORIZONTAL));
     
    7674                layerPanel.revalidate();
    7775            } catch (IOException | WMTSGetCapabilitiesException ex) {
     76                Logging.trace(ex);
    7877                JOptionPane.showMessageDialog(
    7978                        getParent(),
  • trunk/src/org/openstreetmap/josm/gui/preferences/imagery/HeadersTable.java

    r13742 r13828  
    8181    }
    8282
    83     private final JTable table;
    8483    private List<String[]> headers;
    8584
     
    9897        super(new GridBagLayout());
    9998        this.headers = getHeadersAsVector(headers);
    100         table = new JTable(new HeaderTableModel());
     99        JTable table = new JTable(new HeaderTableModel());
    101100        table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    102101        table.setAutoCreateRowSorter(true);
  • trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java

    r13827 r13828  
    177177                capabilitiesUrl = new URL(workingAddress);
    178178            } catch (MalformedURLException e) {
    179                 if (savedExc != null) {
     179                if (savedExc == null) {
    180180                    savedExc = e;
    181181                }
Note: See TracChangeset for help on using the changeset viewer.