org.apache.sis.util.logging.WarningListeners.warning()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(133)

本文整理了Java中org.apache.sis.util.logging.WarningListeners.warning()方法的一些代码示例,展示了WarningListeners.warning()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WarningListeners.warning()方法的具体详情如下:
包路径:org.apache.sis.util.logging.WarningListeners
类名称:WarningListeners
方法名:warning

WarningListeners.warning介绍

[英]Reports a warning represented by the given message and exception. At least one of message and exception shall be non-null. If both are non-null, then the exception message will be concatenated after the given message. If the exception is non-null, its stack trace will be omitted at logging time for avoiding to pollute console output (keeping in mind that this method should be invoked only for non-fatal warnings). See #warning(Level,String,Exception) for more explanation.

This method is a shortcut for #warning(Level,String,Exception)( Level#WARNING, message, exception).
[中]报告由给定消息和异常表示的警告。消息和异常中至少有一个应为非空。如果两者都不为null,则异常消息将在给定消息之后串联。如果异常为非null,则在记录时将忽略其堆栈跟踪,以避免污染控制台输出(请记住,此方法应仅在非致命警告时调用)。有关更多说明,请参阅#警告(级别、字符串、异常)。
此方法是[$0$]的快捷方式。

代码示例

代码示例来源:origin: org.apache.sis.storage/sis-netcdf

  1. /**
  2. * Invoked when a non-fatal exception occurred while reading metadata.
  3. * This method sends a record to the registered listeners if any,
  4. * or logs the record otherwise.
  5. */
  6. private void warning(final Exception e) {
  7. decoder.listeners.warning(null, e);
  8. }

代码示例来源:origin: apache/sis

  1. /**
  2. * Reports a warning represented by the given message and exception.
  3. * At least one of {@code message} and {@code exception} shall be non-null.
  4. *
  5. * @param message the message to log, or {@code null} if none.
  6. * @param exception the exception to log, or {@code null} if none.
  7. */
  8. final void warning(final String message, final Exception exception) {
  9. listeners.warning(message, exception);
  10. }

代码示例来源:origin: apache/sis

  1. /**
  2. * Invoked by the UCAR netCDF library when an error occurred.
  3. *
  4. * @param message the error message.
  5. */
  6. @Override
  7. public void setError(final String message) {
  8. listeners.warning(message, null);
  9. }

代码示例来源:origin: apache/sis

  1. /**
  2. * Invoked when a non-fatal exception occurred while reading metadata.
  3. * This method sends a record to the registered listeners if any,
  4. * or logs the record otherwise.
  5. */
  6. private void warning(final Exception e) {
  7. decoder.listeners.warning(null, e);
  8. }

代码示例来源:origin: org.apache.sis.storage/sis-netcdf

  1. /**
  2. * Invoked by the UCAR netCDF library when an error occurred.
  3. *
  4. * @param message the error message.
  5. */
  6. @Override
  7. public void setError(final String message) {
  8. listeners.warning(message, null);
  9. }

代码示例来源:origin: org.apache.sis.storage/sis-storage

  1. /** Reports the occurrence of a non-fatal error during XML unmarshalling. */
  2. @Override public void warningOccured(final Object source, final LogRecord warning) {
  3. warning.setLoggerName(Loggers.XML);
  4. listeners.warning(warning);
  5. }
  6. });

代码示例来源:origin: apache/sis

  1. /** Reports the occurrence of a non-fatal error during XML unmarshalling. */
  2. @Override public void warningOccured(final Object source, final LogRecord warning) {
  3. warning.setLoggerName(Loggers.XML);
  4. listeners.warning(warning);
  5. }
  6. });

代码示例来源:origin: apache/sis

  1. /**
  2. * Logs a warning as if it originated from the {@link #features(boolean)} method.
  3. * This is a callback method for {@link FeatureIterator}.
  4. */
  5. final void log(final LogRecord warning) {
  6. warning.setSourceClassName(Store.class.getName());
  7. warning.setSourceMethodName("features");
  8. listeners.warning(warning);
  9. }

代码示例来源:origin: org.apache.sis.storage/sis-storage

  1. /**
  2. * Logs a warning as if it originated from the {@link #features(boolean)} method.
  3. * This is a callback method for {@link FeatureIterator}.
  4. */
  5. final void log(final LogRecord warning) {
  6. warning.setSourceClassName(Store.class.getName());
  7. warning.setSourceMethodName("features");
  8. listeners.warning(warning);
  9. }

代码示例来源:origin: org.apache.sis.storage/sis-storage

  1. /**
  2. * Reports a warning.
  3. */
  4. private void log(final LogRecord record) {
  5. record.setSourceClassName(Store.class.getName());
  6. record.setSourceMethodName("getMetadata"); // Public facade for the parse() method.
  7. record.setLoggerName(Loggers.WKT);
  8. listeners.warning(record);
  9. }

代码示例来源:origin: org.apache.sis.storage/sis-storage

  1. /**
  2. * Reports a warning, if non-null.
  3. */
  4. private void log(final LogRecord record) {
  5. if (record != null) {
  6. record.setSourceClassName(Store.class.getName());
  7. record.setSourceMethodName("getMetadata"); // Public facade for the parse() method.
  8. record.setLoggerName(Loggers.XML);
  9. listeners.warning(record);
  10. }
  11. }

代码示例来源:origin: apache/sis

  1. /**
  2. * Reports a warning, if non-null.
  3. */
  4. private void log(final LogRecord record) {
  5. if (record != null) {
  6. record.setSourceClassName(Store.class.getName());
  7. record.setSourceMethodName("getMetadata"); // Public facade for the parse() method.
  8. record.setLoggerName(Loggers.XML);
  9. listeners.warning(record);
  10. }
  11. }

代码示例来源:origin: org.apache.sis.core/sis-metadata

  1. /**
  2. * Reports a warning.
  3. *
  4. * @param source the source class, either {@code MetadataSource} or {@code MetadataWriter}.
  5. * @param method the method to report as the warning emitter.
  6. * @param record the warning to report.
  7. */
  8. final void warning(final Class<? extends MetadataSource> source, final String method, final LogRecord record) {
  9. record.setSourceClassName(source.getCanonicalName());
  10. record.setSourceMethodName(method);
  11. record.setLoggerName(Loggers.SQL);
  12. listeners.warning(record);
  13. }

代码示例来源:origin: org.apache.sis.storage/sis-netcdf

  1. /**
  2. * Sends the given message to the listeners if the message is non-white.
  3. */
  4. private void warning(CharSequence message) {
  5. message = CharSequences.trimWhitespaces(message);
  6. if (message.length() != 0) {
  7. listeners.warning(message.toString(), null);
  8. }
  9. }
  10. }

代码示例来源:origin: apache/sis

  1. /**
  2. * Sends the given message to the listeners if the message is non-white.
  3. */
  4. private void warning(CharSequence message) {
  5. message = CharSequences.trimWhitespaces(message);
  6. if (message.length() != 0) {
  7. listeners.warning(message.toString(), null);
  8. }
  9. }
  10. }

代码示例来源:origin: org.apache.sis.storage/sis-storage

  1. /**
  2. * Logs a warning about a file that could be read, but happen to be a directory that we have read previously.
  3. * We could add the existing {@link Aggregate} instance in the parent {@code Aggregate} that we are building,
  4. * but doing so may create a cycle. Current version logs a warning instead because users may not be prepared
  5. * to handle cycles. Not that we have no guarantee that a cycle really exists at this stage, only that it may
  6. * exist.
  7. */
  8. private void sharedRepository(final Path candidate) {
  9. if (!sharedRepositoryReported) {
  10. sharedRepositoryReported = true;
  11. listeners.warning(message(Resources.Keys.SharedDirectory_1, candidate), null);
  12. }
  13. }

代码示例来源:origin: apache/sis

  1. /**
  2. * Logs a warning about a file that could be read, but happen to be a directory that we have read previously.
  3. * We could add the existing {@link Aggregate} instance in the parent {@code Aggregate} that we are building,
  4. * but doing so may create a cycle. Current version logs a warning instead because users may not be prepared
  5. * to handle cycles. Not that we have no guarantee that a cycle really exists at this stage, only that it may
  6. * exist.
  7. */
  8. private void sharedRepository(final Path candidate) {
  9. if (!sharedRepositoryReported) {
  10. sharedRepositoryReported = true;
  11. listeners.warning(message(Resources.Keys.SharedDirectory_1, candidate), null);
  12. }
  13. }

代码示例来源:origin: apache/sis

  1. /**
  2. * Logs a warning using the localized error resource bundle for the locale given by
  3. * {@link WarningListeners#getLocale()}.
  4. *
  5. * @param key one of {@link Errors.Keys} values.
  6. */
  7. private void warning(final short key, final Object p1, final Object p2, final Exception e) {
  8. final WarningListeners<DataStore> listeners = decoder.listeners;
  9. listeners.warning(Errors.getResources(listeners.getLocale()).getString(key, p1, p2), e);
  10. }

代码示例来源:origin: org.apache.sis.storage/sis-storage

  1. /**
  2. * Reports a warning for a WKT that can not be read. This method should be invoked only when the CRS
  3. * can not be created at all; it should not be invoked if the CRS has been created with some warnings.
  4. */
  5. final void log(final Exception e) {
  6. final DataStore store = listeners.getSource();
  7. listeners.warning(Resources.forLocale(store.getLocale())
  8. .getString(Resources.Keys.CanNotReadCRS_WKT_1, store.getDisplayName()), e);
  9. }

代码示例来源:origin: apache/sis

  1. /**
  2. * Reports a warning for a WKT that can not be read. This method should be invoked only when the CRS
  3. * can not be created at all; it should not be invoked if the CRS has been created with some warnings.
  4. */
  5. final void log(final Exception e) {
  6. final DataStore store = listeners.getSource();
  7. listeners.warning(Resources.forLocale(store.getLocale())
  8. .getString(Resources.Keys.CanNotReadCRS_WKT_1, store.getDisplayName()), e);
  9. }

相关文章