Ignore:
Timestamp:
2016-07-04T14:18:17+02:00 (10 years ago)
Author:
donvip
Message:

checkstyle

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/cadastre-fr/src/cadastre_fr/CadastreInterface.java

    r32425 r32556  
    1 // License: GPL. v2 and later. Copyright 2008-2009 by Pieren <pieren3@gmail.com> and others
     1// License: GPL. For details, see LICENSE file.
    22package cadastre_fr;
    33
     
    4949        }
    5050    }
     51
    5152    private List<PlanImage> listOfFeuilles = new ArrayList<>();
    5253    private long cookieTimestamp;
     
    109110     * @return true if a cookie is delivered by WMS and false is WMS is not opening a client session
    110111     *         (too many clients or in maintenance)
    111      * @throws IOException
    112112     */
    113113    private void getCookie() throws IOException {
     
    117117            searchFormURL = new URL(BASE_URL + "/scpc/accueil.do");
    118118            while (!success && retries > 0) {
    119                 urlConn = (HttpURLConnection)searchFormURL.openConnection();
     119                urlConn = (HttpURLConnection) searchFormURL.openConnection();
    120120                urlConn.setRequestProperty("Connection", "close");
    121121                urlConn.setRequestMethod("GET");
     
    124124                    Main.info("GET "+searchFormURL);
    125125                    BufferedReader in = new BufferedReader(new InputStreamReader(urlConn.getInputStream(), StandardCharsets.UTF_8));
    126                     while(in.readLine() != null) {
     126                    while (in.readLine() != null) {
    127127                        // read the buffer otherwise we sent POST too early
    128128                    }
     
    132132                    CookieHandler cookieHandler = CookieHandler.getDefault();
    133133                    if (cookieHandler != null) {
    134                         if (handleCookie(cookieHandler.get(searchFormURL.toURI(), new HashMap<String,List<String>>()).get("Cookie").get(0))) {
     134                        if (handleCookie(cookieHandler.get(searchFormURL.toURI(), new HashMap<String, List<String>>()).get("Cookie").get(0))) {
    135135                            break;
    136136                        }
    137137                    } else {
    138138                        String headerName;
    139                         for (int i=1; (headerName = urlConn.getHeaderFieldKey(i))!=null; i++) {
     139                        for (int i = 1; (headerName = urlConn.getHeaderFieldKey(i)) != null; i++) {
    140140                            if ("Set-Cookie".equals(headerName) && handleCookie(urlConn.getHeaderField(i))) {
    141141                                break;
    142                             } 
     142                            }
    143143                        }
    144144                    }
     
    146146                    Main.warn("Request to home page failed. Http error:"+urlConn.getResponseCode()+". Try again "+retries+" times");
    147147                    CadastrePlugin.safeSleep(3000);
    148                     retries --;
     148                    retries--;
    149149                }
    150150            }
     
    238238    }
    239239
    240     private void openInterface() throws IOException  {
     240    private void openInterface() throws IOException {
    241241        try {
    242242            // finally, open the interface on server side giving access to the wms server
    243243            URL interfaceURL = new URL(BASE_URL + "/scpc/"+interfaceRef);
    244             urlConn = (HttpURLConnection)interfaceURL.openConnection();
     244            urlConn = (HttpURLConnection) interfaceURL.openConnection();
    245245            urlConn.setRequestMethod("GET");
    246246            setCookie();
     
    283283     * where QP224 is the code commune known by the WMS (or "afficherCarteTa.do?c=..." for raster images).
    284284     *
    285      * @param location
    286      * @param codeCommune
    287285     * @return retURL url to available code commune in the cadastre; "" if not found
    288      * @throws IOException
    289286     */
    290287    private String postForm(WMSLayer wmsLayer, String codeCommune) throws IOException {
     
    308305            content += "&x=0&y=0";
    309306            searchFormURL = new URL(BASE_URL + "/scpc/rechercherPlan.do");
    310             urlConn = (HttpURLConnection)searchFormURL.openConnection();
     307            urlConn = (HttpURLConnection) searchFormURL.openConnection();
    311308            urlConn.setRequestMethod("POST");
    312309            urlConn.setDoOutput(true);
     
    335332                if (!wmsLayer.isRaster() && lines.indexOf(C_INTERFACE_VECTOR) != -1) {  // "afficherCarteCommune.do"
    336333                    // shall be something like: interfaceRef = "afficherCarteCommune.do?c=X2269";
    337                     lines = lines.substring(lines.indexOf(C_INTERFACE_VECTOR),lines.length());
     334                    lines = lines.substring(lines.indexOf(C_INTERFACE_VECTOR), lines.length());
    338335                    lines = lines.substring(0, lines.indexOf('\''));
    339336                    lines = Entities.unescape(lines);
     
    369366        } catch (MalformedURLException e) {
    370367            throw (IOException) new IOException("Illegal url.").initCause(e);
    371         } catch (DuplicateLayerException e){
     368        } catch (DuplicateLayerException e) {
    372369            Main.error(e);
    373370        }
     
    401398        try {
    402399            URL getAllImagesURL = new URL(BASE_URL + "/scpc/listerFeuillesParcommune.do?keepVolatileSession=&offset=2000");
    403             urlConn2 = (HttpURLConnection)getAllImagesURL.openConnection();
     400            urlConn2 = (HttpURLConnection) getAllImagesURL.openConnection();
    404401            setCookie(urlConn2);
    405402            urlConn2.connect();
     
    491488     * and store the result in the wmsLayer as well.
    492489     * @param wmsLayer the WMSLayer where the commune data and images are stored
    493      * @throws IOException
    494490     */
    495491    public void retrieveCommuneBBox(WMSLayer wmsLayer) throws IOException {
     
    500496        content += "&dontSaveLastForward&keepVolatileSession=";
    501497        searchFormURL = new URL(content);
    502         urlConn = (HttpURLConnection)searchFormURL.openConnection();
     498        urlConn = (HttpURLConnection) searchFormURL.openConnection();
    503499        urlConn.setRequestMethod("GET");
    504500        setCookie();
     
    534530            int l = input.indexOf(C_BBOX_COMMUN_END, k+1);
    535531            double maxy = Double.parseDouble(input.substring(k+1, l));
    536             wmsLayer.setCommuneBBox( new EastNorthBound(new EastNorth(minx,miny), new EastNorth(maxx,maxy)));
     532            wmsLayer.setCommuneBBox(new EastNorthBound(new EastNorth(minx, miny), new EastNorth(maxx, maxy)));
    537533        }
    538534    }
Note: See TracChangeset for help on using the changeset viewer.