/** * Invoked when a factory can't be loaded. Log a warning, but do not stop the process. */ private static void loadingFailure(final Class<?> category, final Throwable error, final boolean showStackTrace) { final String name = Classes.getShortName(category); final StringBuilder cause = new StringBuilder(Classes.getShortClassName(error)); final String message = error.getLocalizedMessage(); if (message != null) { cause.append(": "); cause.append(message); } final LogRecord record = Loggings.format(Level.WARNING, LoggingKeys.CANT_LOAD_SERVICE_$2, name, cause.toString()); if (showStackTrace) { record.setThrown(error); } record.setSourceClassName(FactoryRegistry.class.getName()); record.setSourceMethodName("scanForPlugins"); record.setLoggerName(LOGGER.getName()); LOGGER.log(record); }
/** * Serializes this grid coverage. Before serialization, a {@linkplain SerializableRenderedImage * serializable rendered image} is created if it was not already done. */ private void writeObject(final ObjectOutputStream out) throws IOException { if (serializedImage == null) { RenderedImage source = image; while (source instanceof RenderedImageAdapter) { source = ((RenderedImageAdapter) source).getWrappedImage(); } if (source instanceof SerializableRenderedImage) { serializedImage = (SerializableRenderedImage) source; } else { if (tileEncoding == null) { tileEncoding = "gzip"; } serializedImage = new SerializableRenderedImage(source, false, null, tileEncoding, null, null); final LogRecord record = Loggings.format(Level.FINE, LoggingKeys.CREATED_SERIALIZABLE_IMAGE_$2, getName(), tileEncoding); record.setSourceClassName(GridCoverage2D.class.getName()); record.setSourceMethodName("writeObject"); record.setLoggerName(LOGGER.getName()); LOGGER.log(record); } } out.defaultWriteObject(); }
try { final Driver d = (Driver) Class.forName(driver).newInstance(); log = Loggings.format(Level.CONFIG, LoggingKeys.LOADED_JDBC_DRIVER_$3, driver, d.getMajorVersion(), d.getMinorVersion()); DRIVERS.add(driver);
return true; } catch (IllegalArgumentException exception) { final LogRecord record = Loggings.format(Level.SEVERE, LoggingKeys.CANT_REGISTER_JAI_OPERATION_$1, name);
/** * Register the "SampleTranscode" image operation to the operation registry of * the specified JAI instance. This method is invoked by the static initializer * of {@link GridSampleDimension}. */ public static void register(final JAI jai) { final OperationRegistry registry = jai.getOperationRegistry(); try { registry.registerDescriptor(new Descriptor()); registry.registerFactory(RenderedRegistryMode.MODE_NAME, OPERATION_NAME, "geotools.org", new CRIF()); } catch (IllegalArgumentException exception) { final LogRecord record = Loggings.format(Level.SEVERE, LoggingKeys.CANT_REGISTER_JAI_OPERATION_$1, OPERATION_NAME); // Note: GridSampleDimension is the public class that use this transcoder. record.setSourceClassName(GridSampleDimension.class.getName()); record.setSourceMethodName("<classinit>"); record.setThrown(exception); final Logger logger = AbstractGridCoverage.LOGGER; record.setLoggerName(logger.getName()); logger.log(record); } } }
final LogRecord record = Loggings.format(Level.FINE, LoggingKeys.CREATING_CACHED_EPSG_DATABASE_$1, VERSION); record.setLoggerName(logger.getName());
allowed ? nativeFactory : javaFactory, allowed ? javaFactory : nativeFactory); final LogRecord record = Loggings.format(Level.CONFIG, LoggingKeys.NATIVE_ACCELERATION_STATE_$2, operation, Integer.valueOf(allowed ? 1 : 0));