sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] 02/03: Replace null argument by call to convenience StoreListeners.warning(…) method.
Date Sat, 07 Sep 2019 16:04:32 GMT
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git

commit 8201633d64b14b6869e8fc2f97679d5846c3aaa5
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Sat Sep 7 15:16:41 2019 +0200

    Replace null argument by call to convenience StoreListeners.warning(…) method.
---
 .../org/apache/sis/storage/earthobservation/LandsatReader.java    | 6 +++---
 .../main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java    | 2 +-
 .../java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java  | 4 ++--
 .../java/org/apache/sis/internal/netcdf/impl/FeaturesInfo.java    | 6 +++---
 .../java/org/apache/sis/internal/netcdf/ucar/DecoderWrapper.java  | 8 ++++----
 .../main/java/org/apache/sis/internal/netcdf/ucar/LogAdapter.java | 2 +-
 .../main/java/org/apache/sis/storage/netcdf/MetadataReader.java   | 2 +-
 .../org/apache/sis/internal/storage/DocumentedStoreProvider.java  | 2 +-
 .../src/main/java/org/apache/sis/internal/storage/csv/Store.java  | 4 ++--
 .../main/java/org/apache/sis/internal/storage/folder/Store.java   | 2 +-
 .../java/org/apache/sis/internal/storage/wkt/StoreFormat.java     | 2 +-
 .../src/main/java/org/apache/sis/internal/storage/xml/Store.java  | 2 +-
 .../org/apache/sis/internal/storage/xml/stream/StaxDataStore.java | 2 +-
 13 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java
b/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java
index 333e6d2..386b4b7 100644
--- a/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java
+++ b/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java
@@ -372,7 +372,7 @@ final class LandsatReader extends MetadataBuilder {
                 }
             }
         }
-        listeners.warning(errors().getString(Errors.Keys.UnexpectedEndOfFile_1, getFilename()),
null);
+        listeners.warning(errors().getString(Errors.Keys.UnexpectedEndOfFile_1, getFilename()));
     }
 
     /**
@@ -804,7 +804,7 @@ final class LandsatReader extends MetadataBuilder {
      */
     private DefaultBand band(final String key, int index) {
         if (index < 1 || index > BAND_NAMES.length) {
-            listeners.warning(errors().getString(Errors.Keys.UnexpectedValueInElement_2,
key + index, index), null);
+            listeners.warning(errors().getString(Errors.Keys.UnexpectedValueInElement_2,
key + index, index));
             return null;
         }
         DefaultBand band = bands[--index];
@@ -830,7 +830,7 @@ final class LandsatReader extends MetadataBuilder {
         if (projection != null) {
             projection.parameter(name).setValue(Double.parseDouble(value), isLinear ? Units.METRE
: Units.DEGREE);
         } else {
-            listeners.warning(errors().getString(Errors.Keys.UnexpectedProperty_2, filename,
key), null);
+            listeners.warning(errors().getString(Errors.Keys.UnexpectedProperty_2, filename,
key));
         }
     }
 
diff --git a/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java
b/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java
index 1689296..ecbc331 100644
--- a/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java
+++ b/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java
@@ -198,7 +198,7 @@ public class GeoTiffStore extends DataStore implements Aggregate {
                 builder.setFormat(Constants.GEOTIFF);
             } catch (MetadataStoreException e) {
                 builder.addFormatName(Constants.GEOTIFF);
-                warning(null, e);
+                listeners.warning(e);
             }
             builder.addEncoding(encoding, MetadataBuilder.Scope.METADATA);
             builder.addResourceScope(ScopeCode.COVERAGE, null);
diff --git a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java
b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java
index 32f876d..c7e5481 100644
--- a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java
+++ b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java
@@ -848,7 +848,7 @@ public final class ChannelDecoder extends Decoder {
         if (value instanceof CharSequence) try {
             return StandardDateFormat.toDate(StandardDateFormat.FORMAT.parse((CharSequence)
value));
         } catch (DateTimeException | ArithmeticException e) {
-            listeners.warning(null, e);
+            listeners.warning(e);
         }
         return null;
     }
@@ -874,7 +874,7 @@ public final class ChannelDecoder extends Decoder {
                 }
             }
         } catch (IncommensurableException | ParserException | DateTimeException | ArithmeticException
e) {
-            listeners.warning(null, e);
+            listeners.warning(e);
         }
         return dates;
     }
diff --git a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/FeaturesInfo.java
b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/FeaturesInfo.java
index 1648df0..8f30f9d 100644
--- a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/FeaturesInfo.java
+++ b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/FeaturesInfo.java
@@ -193,7 +193,7 @@ search: for (final VariableInfo counts : decoder.variables) {
                     final DimensionInfo sampleDimension = decoder.findDimension(sampleDimName);
                     if (sampleDimension == null) {
                         decoder.listeners.warning(decoder.resources().getString(Resources.Keys.DimensionNotFound_3,
-                                decoder.getFilename(), counts.getName(), sampleDimName),
null);
+                                decoder.getFilename(), counts.getName(), sampleDimName));
                         continue;
                     }
                     /*
@@ -222,7 +222,7 @@ search: for (final VariableInfo counts : decoder.variables) {
                         }
                         if (identifiers == null) {
                             decoder.listeners.warning(decoder.resources().getString(Resources.Keys.VariableNotFound_2,
-                                    decoder.getFilename(), featureDimension.name), null);
+                                    decoder.getFilename(), featureDimension.name));
                             continue;
                         }
                     }
@@ -241,7 +241,7 @@ search: for (final VariableInfo counts : decoder.variables) {
                             decoder.listeners.warning(decoder.resources().getString(
                                     Resources.Keys.UnexpectedDimensionForVariable_4,
                                     decoder.getFilename(), identifiers.getName(),
-                                    featureDimension.getName(), identifiers.dimensions[i].name),
null);
+                                    featureDimension.getName(), identifiers.dimensions[i].name));
                             continue search;
                         }
                     }
diff --git a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/DecoderWrapper.java
b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/DecoderWrapper.java
index 419af42..d9c6306 100644
--- a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/DecoderWrapper.java
+++ b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/DecoderWrapper.java
@@ -319,7 +319,7 @@ public final class DecoderWrapper extends Decoder implements CancelTask
{
                         try {
                             date = CalendarDateFormatter.isoStringToCalendarDate(Calendar.proleptic_gregorian,
value);
                         } catch (IllegalArgumentException e) {
-                            listeners.warning(null, e);
+                            listeners.warning(e);
                             continue;
                         }
                         return new Date(date.getMillis());
@@ -343,8 +343,8 @@ public final class DecoderWrapper extends Decoder implements CancelTask
{
         final DateUnit unit;
         try {
             unit = new DateUnit(symbol);
-        } catch (Exception e) { // Declared by the DateUnit constructor.
-            listeners.warning(null, e);
+        } catch (Exception e) {                 // Declared by the DateUnit constructor.
+            listeners.warning(e);
             return dates;
         }
         for (int i=0; i<values.length; i++) {
@@ -527,7 +527,7 @@ public final class DecoderWrapper extends Decoder implements CancelTask
{
      */
     @Override
     public void setError(final String message) {
-        listeners.warning(message, null);
+        listeners.warning(message);
     }
 
     /**
diff --git a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/LogAdapter.java
b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/LogAdapter.java
index 97c0d7b..3f9451b 100644
--- a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/LogAdapter.java
+++ b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/ucar/LogAdapter.java
@@ -117,7 +117,7 @@ final class LogAdapter implements Appendable {
     private void warning(CharSequence message) {
         message = CharSequences.trimWhitespaces(message);
         if (message.length() != 0) {
-            listeners.warning(message.toString(), null);
+            listeners.warning(message.toString());
         }
     }
 }
diff --git a/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java
b/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java
index 8d1a4c7..4b1c6c7 100644
--- a/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java
+++ b/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/MetadataReader.java
@@ -197,7 +197,7 @@ final class MetadataReader extends MetadataBuilder {
      * or logs the record otherwise.
      */
     private void warning(final Exception e) {
-        decoder.listeners.warning(null, e);
+        decoder.listeners.warning(e);
     }
 
     /**
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/DocumentedStoreProvider.java
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/DocumentedStoreProvider.java
index 6170f40..3e27da3 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/DocumentedStoreProvider.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/DocumentedStoreProvider.java
@@ -96,7 +96,7 @@ public abstract class DocumentedStoreProvider extends URIDataStore.Provider
{
             return MetadataSource.getProvided().lookup(Format.class, name);
         } catch (MetadataStoreException e) {
             if (listeners != null) {
-                listeners.warning(null, e);
+                listeners.warning(e);
             } else {
                 final Level level;
                 if (!logged) {
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java
index 51ce839..aae37b3 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/csv/Store.java
@@ -646,7 +646,7 @@ final class Store extends URIDataStore implements FeatureSet {
                 builder.setFormat(format);
             } catch (MetadataStoreException e) {
                 builder.addFormatName(format);
-                listeners.warning(null, e);
+                listeners.warning(e);
             }
             builder.addEncoding(encoding, MetadataBuilder.Scope.ALL);
             builder.addResourceScope(ScopeCode.DATASET, null);
@@ -659,7 +659,7 @@ final class Store extends URIDataStore implements FeatureSet {
                  * Failed to set the temporal components if the sis-temporal module was
                  * not on the classpath, but the other dimensions still have been set.
                  */
-                listeners.warning(null, e);
+                listeners.warning(e);
             }
             builder.addFeatureType(featureType, -1);
             addTitleOrIdentifier(builder);
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/Store.java
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/Store.java
index 6b42068..86582c1 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/Store.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/folder/Store.java
@@ -383,7 +383,7 @@ class Store extends DataStore implements StoreResource, Aggregate, DirectoryStre
     private void sharedRepository(final Path candidate) {
         if (!sharedRepositoryReported) {
             sharedRepositoryReported = true;
-            listeners.warning(message(Resources.Keys.SharedDirectory_1, candidate), null);
+            listeners.warning(message(Resources.Keys.SharedDirectory_1, candidate));
         }
     }
 
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/StoreFormat.java
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/StoreFormat.java
index d7342f0..811e595 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/StoreFormat.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/wkt/StoreFormat.java
@@ -143,7 +143,7 @@ public final class StoreFormat extends WKTFormat {
                 if (warning != null) log(warning);
             }
         } catch (FactoryException e) {
-            listeners.warning(null, e);
+            listeners.warning(e);
         }
     }
 
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/Store.java
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/Store.java
index 4000afa..2cb658d 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/Store.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/xml/Store.java
@@ -164,7 +164,7 @@ final class Store extends URIDataStore {
                 log(v.warning(false));
             }
         } catch (FactoryException e) {
-            listeners.warning(null, e);
+            listeners.warning(e);
         }
     }
 
diff --git a/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxDataStore.java
b/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxDataStore.java
index e7d59e5..299e6b4 100644
--- a/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxDataStore.java
+++ b/storage/sis-xmlstore/src/main/java/org/apache/sis/internal/storage/xml/stream/StaxDataStore.java
@@ -279,7 +279,7 @@ public abstract class StaxDataStore extends URIDataStore {
                 return true;
             }
         } catch (InvalidSeekException e) {
-            listeners.warning(null, e);
+            listeners.warning(e);
         }
         return false;
     }


Mime
View raw message