/** * Writes an event to the logger. */ private static void log(final Level level, final String method, final String message) { final LogRecord record = new LogRecord(level, message); record.setSourceClassName(Synchronizer.class.getName()); record.setSourceMethodName(method); Logging.getLogger("org.geotoolkit.sql").log(record); } }
/** * Logs a warning for a non-critical error. The callers should have a fallback. */ private static void warning(final String method, final Exception e) { Logging.recoverableException(Logging.getLogger(Modules.REFERENCING), IdentifiedObjects.class, method, e); }
/** * Invoked when a recoverable exception occurred. Those exceptions must be minor enough * that they can be silently ignored in most cases. */ static void recoverableException(final Class<? extends Static> caller, final TransformException exception) { Logging.recoverableException(Logging.getLogger(Loggers.GEOMETRY), caller, "transform", exception); }
/** * Logs a recoverable exception that happened (directly or indirectly) in the {@link #configuration()} method. */ private static void recoverableException(final String logger, final Exception e) { Logging.recoverableException(Logging.getLogger(logger), About.class, "configuration", e); } }
/** * Invoked for reporting exceptions that may be normal behavior. This method logs * the exception at {@link java.util.logging.Level#FINE} without stack trace. */ private static void recoverableException(final Exception warning) { Logging.recoverableException(Logging.getLogger(Modules.STORAGE), ChannelFactory.class, "prepare", warning); } }
/** * Logs a warning about a failure to compute the Bursa-Wolf parameters. */ private static void log(final String logger, final String method, final Exception e) { Logging.recoverableException(Logging.getLogger(logger), GeocentricAffine.class, method, e); } }
/** * Reports the given exception as an ignorable one. We consider {@link FactoryException} or * {@link TransformException} as ignorable exceptions only if they occurred while computing * whether a point is inside the domain of validity. Failure to answer that question is * considered as an indication that the point is outside the domain of validity. */ private static void warning(final Exception e) { Logging.recoverableException(Logging.getLogger("org.apache.sis.console"), TransformCommand.class, "run", e); } }
/** * Invoked when a recoverable exception occurred. Those exceptions must be minor enough * that they can be silently ignored in most cases. * * @param exception the exception that occurred. */ static void recoverableException(final Exception exception) { Logging.recoverableException(Logging.getLogger(Modules.RASTER), GridGeometry.class, "<init>", exception); }
/** * Logs a recoverable exception that happened (directly or indirectly) in the {@link #configuration()} method. */ private static void recoverableException(final String logger, final Exception e) { Logging.recoverableException(Logging.getLogger(logger), About.class, "configuration", e); } }
/** * Same as {@link DomUtilities#textAttributeValue(org.w3c.dom.Element, java.lang.String, java.lang.String, java.lang.Class) } * but dont throw any exception. */ public static <T> T textAttributeValueSafe(final Element parent, final String tagName, final String attributeName, final Class<T> clazz) { try { return textAttributeValue(parent, tagName,attributeName, clazz); } catch (UnconvertibleObjectException ex) { Logging.getLogger("org.geotoolkit.util").log(Level.WARNING, null, ex); return null; } }
/** * Logs a warning about an exception that can be safely ignored. */ final void warning(final String method, final RuntimeException e) { Logging.recoverableException(Logging.getLogger(Loggers.MATH), Vector.class, method, e); }
/** * Logs a warning about an unexpected but non-fatal exception. * * @param method the source method. * @param exception the exception to log. */ private static void unexpectedException(final String method, final Exception exception) { Logging.unexpectedException(Logging.getLogger(Loggers.CRS_FACTORY), EPSGDataAccess.class, method, exception); }
/** * Logs a warning about a failure to compute the Bursa-Wolf parameters. */ private static void log(final String logger, final String method, final Exception e) { Logging.recoverableException(Logging.getLogger(logger), GeocentricAffine.class, method, e); } }
/** * Logs a warning about an unexpected but non-fatal exception. * * @param method the source method. * @param exception the exception to log. */ private static void unexpectedException(final String method, final Exception exception) { Logging.unexpectedException(Logging.getLogger(Loggers.CRS_FACTORY), EPSGDataAccess.class, method, exception); }
/** * Same as {@link DomUtilities#textAttributeValue(org.w3c.dom.Element, java.lang.String, java.lang.String, java.lang.Class, java.lang.boolean) } * but dont throw any exception. */ public static <T> T textAttributeValueSafe(final Element parent, final String tagName, final String attributeName, final Class<T> clazz, final boolean recursive) { try { return textAttributeValue(parent, tagName,attributeName, clazz, recursive); } catch (UnconvertibleObjectException ex) { Logging.getLogger("org.geotoolkit.util").log(Level.WARNING, null, ex); return null; } }
/** * Invoked when an unexpected exception occurred. Those exceptions must be non-fatal, i.e. the caller * <strong>must</strong> have a reasonable fallback (otherwise it should propagate the exception). */ private static void unexpectedException(final String methodName, final Exception exception) { Logging.unexpectedException(Logging.getLogger(Modules.REFERENCING), CRS.class, methodName, exception); } }
/** * Logs the given record. This is used only when we can not use the {@link #warning warning methods}, * or when the information is not worth to report as a warning. */ final void log(final LogRecord record) { Logger logger = Logging.getLogger(Loggers.WKT); record.setSourceClassName(getPublicFacade()); record.setSourceMethodName(getFacadeMethod()); record.setLoggerName(logger.getName()); logger.log(record); }
/** * Rewrites the given code in a canonical format. * If the code can not be reformatted, then this method returns {@code null}. */ static String reformat(final String code) { try { return format(Integer.parseInt(code.substring(skipNamespace(code) & ~LEGACY_MASK))); } catch (NoSuchAuthorityCodeException | NumberFormatException e) { Logging.recoverableException(Logging.getLogger(Loggers.CRS_FACTORY), CommonAuthorityFactory.class, "reformat", e); return null; } }
/** * Invoked if JNDI lost connection to the server while preparing the {@code NamingEvent}. * Clears the data source anyway. In the worst case scenario, the application will fetch * it again from a the JNDI context. */ @Override public void namingExceptionThrown(NamingExceptionEvent event) { Logging.unexpectedException(Logging.getLogger(Loggers.SYSTEM), Listener.class, "namingExceptionThrown", event.getException()); objectChanged(null); } }
/** * Invoked if JNDI lost connection to the server while preparing the {@code NamingEvent}. * Clears the data source anyway. In the worst case scenario, the application will fetch * it again from a the JNDI context. */ @Override public void namingExceptionThrown(NamingExceptionEvent event) { Logging.unexpectedException(Logging.getLogger(Loggers.SYSTEM), Listener.class, "namingExceptionThrown", event.getException()); objectChanged(null); } }