Ignore:
Timestamp:
2017-08-22T22:26:32+02:00 (9 years ago)
Author:
Don-vip
Message:

see #15182 - deprecate all Main logging methods and introduce suitable replacements in Logging for most of them

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java

    r12321 r12620  
    177177                }
    178178            } catch (NumberFormatException | ReflectiveOperationException e) {
    179                 Main.error(e);
     179                Logging.error(e);
    180180            }
    181181        }
     
    304304            sb.append(" (").append(getCurrentBuild()).append(')');
    305305        } catch (ReflectiveOperationException e) {
    306             Main.error(e);
     306            Logging.error(e);
    307307        }
    308308        return sb.toString();
     
    346346            insecurePubKey = KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(INSECURE_PUBLIC_KEY));
    347347        } catch (InvalidKeySpecException | NoSuchAlgorithmException e) {
    348             Main.error(e);
     348            Logging.error(e);
    349349            return;
    350350        }
     
    362362                } catch (InvalidKeyException | NoSuchProviderException | SignatureException e) {
    363363                    // If exception this is not a certificate related to JOSM, just trace it
    364                     Main.trace(alias + " --> " + e.getClass().getName());
    365                     Main.trace(e);
     364                    Logging.trace(alias + " --> " + e.getClass().getName());
     365                    Logging.trace(e);
    366366                }
    367367            }
     
    385385            JOptionPane.showMessageDialog(Main.parent, message.toString(), tr("Warning"), JOptionPane.WARNING_MESSAGE);
    386386            for (String alias : insecureCertificates) {
    387                 Main.warn(tr("Removing insecure certificate from {0} keystore: {1}", WINDOWS_ROOT, alias));
     387                Logging.warn(tr("Removing insecure certificate from {0} keystore: {1}", WINDOWS_ROOT, alias));
    388388                try {
    389389                    ks.deleteEntry(alias);
    390390                } catch (KeyStoreException e) {
    391                     Main.error(e, tr("Unable to remove insecure certificate from keystore: {0}", e.getMessage()));
     391                    Logging.log(Logging.LEVEL_ERROR, tr("Unable to remove insecure certificate from keystore: {0}", e.getMessage()), e);
    392392                }
    393393            }
     
    404404            if (alias != null) {
    405405                // JOSM certificate found, return
    406                 Main.debug(tr("JOSM localhost certificate found in {0} keystore: {1}", WINDOWS_ROOT, alias));
     406                Logging.debug(tr("JOSM localhost certificate found in {0} keystore: {1}", WINDOWS_ROOT, alias));
    407407                return false;
    408408            }
    409409        } catch (ArrayIndexOutOfBoundsException e) {
    410410            // catch error of JDK-8172244 as bug seems to not be fixed anytime soon
    411             Main.error(e, "JDK-8172244 occured. Abort HTTPS setup");
     411            Logging.log(Logging.LEVEL_ERROR, "JDK-8172244 occured. Abort HTTPS setup", e);
    412412            return false;
    413413        }
     
    425425        }
    426426        // install it to Windows-ROOT keystore, used by IE, Chrome and Safari, but not by Firefox
    427         Main.info(tr("Adding JOSM localhost certificate to {0} keystore", WINDOWS_ROOT));
     427        Logging.info(tr("Adding JOSM localhost certificate to {0} keystore", WINDOWS_ROOT));
    428428        ks.setEntry(entryAlias, trustedCert, null);
    429429        return true;
     
    508508        Path templateFile = FileSystems.getDefault().getPath(javaLibPath, templateFileName);
    509509        if (!Files.isReadable(templateFile)) {
    510             Main.warn("extended font config - unable to find font config template file {0}", templateFile.toString());
     510            Logging.warn("extended font config - unable to find font config template file {0}", templateFile.toString());
    511511            return;
    512512        }
     
    532532                            extras.add(entry);
    533533                        } else {
    534                             Main.trace("extended font config - already registered font for charset ''{0}'' - skipping ''{1}''",
     534                            Logging.trace("extended font config - already registered font for charset ''{0}'' - skipping ''{1}''",
    535535                                    entry.charset, entry.name);
    536536                        }
    537537                    } else {
    538                         Main.trace("extended font config - Font ''{0}'' not found on system - skipping", entry.name);
     538                        Logging.trace("extended font config - Font ''{0}'' not found on system - skipping", entry.name);
    539539                    }
    540540                }
     
    548548                    String prevValue = props.getProperty(key);
    549549                    if (prevValue != null && !prevValue.equals(value)) {
    550                         Main.warn("extended font config - overriding ''{0}={1}'' with ''{2}''", key, prevValue, value);
     550                        Logging.warn("extended font config - overriding ''{0}={1}'' with ''{2}''", key, prevValue, value);
    551551                    }
    552552                    w.append(key + '=' + value + '\n');
     
    561561                    String prevValue = props.getProperty(key);
    562562                    if (prevValue != null && !prevValue.equals(value)) {
    563                         Main.warn("extended font config - overriding ''{0}={1}'' with ''{2}''", key, prevValue, value);
     563                        Logging.warn("extended font config - overriding ''{0}={1}'' with ''{2}''", key, prevValue, value);
    564564                    }
    565565                    w.append(key + '=' + value + '\n');
     
    575575            Utils.updateSystemProperty("sun.awt.fontconfig", fontconfigFile.toString());
    576576        } catch (IOException ex) {
    577             Main.error(ex);
     577            Logging.error(ex);
    578578        }
    579579    }
     
    603603            fontsAvail.add(""); // for devanagari
    604604        } catch (IOException ex) {
    605             Main.error(ex, false);
    606             Main.warn("extended font config - failed to load available Fonts");
     605            Logging.log(Logging.LEVEL_ERROR, ex);
     606            Logging.warn("extended font config - failed to load available Fonts");
    607607            fontsAvail = null;
    608608        }
Note: See TracChangeset for help on using the changeset viewer.