Ignore:
Timestamp:
2013-09-23T16:47:50+02:00 (11 years ago)
Author:
Don-vip
Message:

Rework console output:

  • new log level "error"
  • Replace nearly all calls to system.out and system.err to Main.(error|warn|info|debug)
  • Remove some unnecessary debug output
  • Some messages are modified (removal of "Info", "Warning", "Error" from the message itself -> notable i18n impact but limited to console error messages not seen by the majority of users, so that's ok)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/CacheFiles.java

    r6102 r6248  
    1414
    1515import org.openstreetmap.josm.Main;
     16import org.openstreetmap.josm.tools.Utils;
    1617
    1718/**
     
    115116            new RandomAccessFile(data, "r").readFully(bytes);
    116117            return bytes;
    117         } catch(Exception e) {
    118             System.out.println(e.getMessage());
     118        } catch (Exception e) {
     119            Main.warn(e);
    119120        }
    120121        return null;
     
    130131        try {
    131132            File f = getPath(ident);
    132             if(f.exists()) {
     133            if (f.exists()) {
    133134                f.delete();
    134135            }
    135136            // rws also updates the file meta-data, i.e. last mod time
    136             new RandomAccessFile(f, "rws").write(data);
    137         } catch(Exception e){
    138             System.out.println(e.getMessage());
     137            RandomAccessFile raf = new RandomAccessFile(f, "rws");
     138            try {
     139                raf.write(data);
     140            } finally {
     141                Utils.close(raf);
     142            }
     143        } catch (Exception e) {
     144            Main.warn(e);
    139145        }
    140146
     
    164170            }
    165171            return ImageIO.read(img);
    166         } catch(Exception e) {
    167             System.out.println(e.getMessage());
     172        } catch (Exception e) {
     173            Main.warn(e);
    168174        }
    169175        return null;
     
    176182     */
    177183    public void saveImg(String ident, BufferedImage image) {
    178         if(!enabled) return;
     184        if (!enabled) return;
    179185        try {
    180186            ImageIO.write(image, "png", getPath(ident, "png"));
    181         } catch(Exception e){
    182             System.out.println(e.getMessage());
     187        } catch (Exception e) {
     188            Main.warn(e);
    183189        }
    184190
Note: See TracChangeset for help on using the changeset viewer.