Ignore:
Timestamp:
2014-12-19T17:12:01+01:00 (11 years ago)
Author:
donvip
Message:

[josm_cadastre-fr] replace calls to System.out/err by calls to Main.info/warn/error

File:
1 edited

Legend:

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

    r30738 r30859  
    115115                urlConn.connect();
    116116                if (urlConn.getResponseCode() == HttpURLConnection.HTTP_OK) {
    117                     System.out.println("GET "+searchFormURL);
     117                    Main.info("GET "+searchFormURL);
    118118                    BufferedReader in = new BufferedReader(new InputStreamReader(urlConn.getInputStream()));
    119119                    while(in.readLine() != null) {}  // read the buffer otherwise we sent POST too early
     
    124124                            cookie = cookie.substring(0, cookie.indexOf(";"));
    125125                            cookieTimestamp = new Date().getTime();
    126                             System.out.println("received cookie=" + cookie + " at " + new Date(cookieTimestamp));
     126                            Main.info("received cookie=" + cookie + " at " + new Date(cookieTimestamp));
    127127                            cookied = true;
    128128                        }
    129129                    }
    130130                } else {
    131                     System.out.println("Request to home page failed. Http error:"+urlConn.getResponseCode()+". Try again "+retries+" times");
     131                    Main.warn("Request to home page failed. Http error:"+urlConn.getResponseCode()+". Try again "+retries+" times");
    132132                    CadastrePlugin.safeSleep(3000);
    133133                    retries --;
     
    135135            }
    136136        } catch (MalformedURLException e) {
    137             throw (IOException) new IOException(
    138                 "Illegal url.").initCause(e);
     137            throw new IOException("Illegal url.", e);
    139138        }
    140139    }
     
    148147        long now = new Date().getTime();
    149148        if ((now - cookieTimestamp) > cCookieExpiration) {
    150             System.out.println("cookie received at "+new Date(cookieTimestamp)+" expired (now is "+new Date(now)+")");
     149            Main.info("cookie received at "+new Date(cookieTimestamp)+" expired (now is "+new Date(now)+")");
    151150            return true;
    152151        }
     
    222221                throw new IOException("Cannot open Cadastre interface. GET response:"+urlConn.getResponseCode());
    223222            }
    224             System.out.println("GET "+interfaceURL);
     223            Main.info("GET "+interfaceURL);
    225224            BufferedReader in = new BufferedReader(new InputStreamReader(urlConn.getInputStream()));
    226225            // read the buffer otherwise we sent POST too early
     
    305304                    lines = lines.substring(lines.indexOf(cInterfaceVector),lines.length());
    306305                    lines = lines.substring(0, lines.indexOf("'"));
    307                     System.out.println("interface ref.:"+lines);
     306                    Main.info("interface ref.:"+lines);
    308307                    return lines;
    309308                } else if (wmsLayer.isRaster() && lines.indexOf(cInterfaceRasterTA) != -1) { // "afficherCarteTa.do"
     
    320319                                wmsLayer.setCodeCommune(listOfFeuilles.elementAt(res).ref);
    321320                                lines = buildRasterFeuilleInterfaceRef(listOfFeuilles.elementAt(res).ref);
    322                                 System.out.println("interface ref.:"+lines);
     321                                Main.info("interface ref.:"+lines);
    323322                                return lines;
    324323                            }
     
    351350                    String lov = new String(input.substring(i+c0ptionListStart.length()-1, j));
    352351                    if (lov.indexOf(">") != -1) {
    353                         System.out.println("parse "+lov);
     352                        Main.info("parse "+lov);
    354353                        listOfCommunes.add(lov);
    355354                    } else
    356                         System.err.println("unable to parse commune string:"+lov);
     355                        Main.error("unable to parse commune string:"+lov);
    357356                }
    358357                input = input.substring(j+cOptionListEnd.length());
     
    481480            throw new IOException("Cannot get Cadastre response.");
    482481        }
    483         System.out.println("GET "+searchFormURL);
     482        Main.info("GET "+searchFormURL);
    484483        try (BufferedReader in = new BufferedReader(new InputStreamReader(urlConn.getInputStream()))) {
    485484            while ((ln = in.readLine()) != null) {
     
    541540//                wmsLayer.Y0 = Y0;
    542541//            }
    543 //            System.out.println("parse georef:"+unknown_yet+","+angle+","+scale_origin+","+dpi+","+fX+","+
     542//            Main.info("parse georef:"+unknown_yet+","+angle+","+scale_origin+","+dpi+","+fX+","+
    544543//                    fY+","+X0+","+Y0);
    545544//        }
     
    550549            for (Layer l : Main.map.mapView.getAllLayers()) {
    551550                if (l instanceof WMSLayer && l.getName().equals(wmsLayer.getName()) && (l != wmsLayer)) {
    552                     System.out.println("Try to grab into a new layer when "+wmsLayer.getName()+" is already opened.");
     551                        Main.info("Try to grab into a new layer when "+wmsLayer.getName()+" is already opened.");
    553552                    // remove the duplicated layer
    554553                    Main.main.removeLayer(wmsLayer);
Note: See TracChangeset for help on using the changeset viewer.