From 703336953e8bbbdd8a3703120ce70b8d9b8497dc Mon Sep 17 00:00:00 2001
From: Sebastian Schulz
Date: Fri, 8 Oct 2021 22:25:31 +0200
Subject: [PATCH 1/2] Fix SpotBug and apply code-formatter in
'org.locationtech.udig.catalog.wfs'
---
.../internal/wfs/WFSGeoResourceImpl.java | 80 ++++---
.../internal/wfs/WFSGeoResourceInfo.java | 42 ++--
.../catalog/internal/wfs/WFSServiceImpl.java | 89 +++++---
.../udig/catalog/internal/wfs/WfsPlugin.java | 195 ++++++++----------
.../wfs/ui/WFSRegistryWizardPage.java | 2 +-
5 files changed, 210 insertions(+), 198 deletions(-)
diff --git a/plugins/org.locationtech.udig.catalog.wfs/src/org/locationtech/udig/catalog/internal/wfs/WFSGeoResourceImpl.java b/plugins/org.locationtech.udig.catalog.wfs/src/org/locationtech/udig/catalog/internal/wfs/WFSGeoResourceImpl.java
index 61cd2b7d8f..63fa663b0b 100644
--- a/plugins/org.locationtech.udig.catalog.wfs/src/org/locationtech/udig/catalog/internal/wfs/WFSGeoResourceImpl.java
+++ b/plugins/org.locationtech.udig.catalog.wfs/src/org/locationtech/udig/catalog/internal/wfs/WFSGeoResourceImpl.java
@@ -15,36 +15,39 @@
import java.net.MalformedURLException;
import java.net.URL;
-import org.locationtech.udig.catalog.IGeoResource;
-import org.locationtech.udig.catalog.IGeoResourceInfo;
-import org.locationtech.udig.catalog.IService;
-
import org.eclipse.core.runtime.IProgressMonitor;
import org.geotools.data.FeatureStore;
import org.geotools.data.simple.SimpleFeatureSource;
import org.geotools.data.simple.SimpleFeatureStore;
import org.geotools.data.wfs.WFSDataStore;
+import org.locationtech.udig.catalog.IGeoResource;
+import org.locationtech.udig.catalog.IGeoResourceInfo;
+import org.locationtech.udig.catalog.IService;
/**
* Access a feature type in a wfs.
- *
+ *
* @author David Zwiers, Refractions Research
* @since 0.6
*/
public class WFSGeoResourceImpl extends IGeoResource {
WFSServiceImpl parent;
+
String typename = null;
+
private URL identifier;
+ @SuppressWarnings("unused")
private WFSGeoResourceImpl() {/* not for use */
}
+
/**
* Construct WFSGeoResourceImpl
.
- *
+ *
* @param parent
* @param typename
*/
- public WFSGeoResourceImpl( WFSServiceImpl parent, String typename ) {
+ public WFSGeoResourceImpl(WFSServiceImpl parent, String typename) {
this.service = parent;
this.parent = parent;
this.typename = typename;
@@ -55,67 +58,77 @@ public WFSGeoResourceImpl( WFSServiceImpl parent, String typename ) {
}
}
+ @Override
public URL getIdentifier() {
return identifier;
}
- /*
+ /**
* @see org.locationtech.udig.catalog.IGeoResource#getStatus()
*/
+ @Override
public Status getStatus() {
return parent.getStatus();
}
- /*
+ /**
* @see org.locationtech.udig.catalog.IGeoResource#getStatusMessage()
*/
+ @Override
public Throwable getMessage() {
return parent.getMessage();
}
- /*
- * Required adaptions: - IGeoResourceInfo.class
- IService.class
+ /**
+ * Required adoptions:
+ *
+ * - IGeoResourceInfo.class
+ *
- IService.class
+ *
+ *
* @see org.locationtech.udig.catalog.IResolve#resolve(java.lang.Class,
- * org.eclipse.core.runtime.IProgressMonitor)
+ * org.eclipse.core.runtime.IProgressMonitor)
*/
- public T resolve( Class adaptee, IProgressMonitor monitor ) throws IOException {
- if (adaptee == null){
+ @Override
+ public T resolve(Class adaptee, IProgressMonitor monitor) throws IOException {
+ if (adaptee == null) {
return null;
}
- if (adaptee.isAssignableFrom(WFSDataStore.class)){
+ if (adaptee.isAssignableFrom(WFSDataStore.class)) {
return parent.resolve(adaptee, monitor);
}
- if (adaptee.isAssignableFrom(IGeoResource.class)){
+ if (adaptee.isAssignableFrom(IGeoResource.class)) {
return adaptee.cast(this);
}
- if (adaptee.isAssignableFrom(IGeoResourceInfo.class)){
+ if (adaptee.isAssignableFrom(IGeoResourceInfo.class)) {
return adaptee.cast(createInfo(monitor));
}
if (adaptee.isAssignableFrom(SimpleFeatureSource.class)) {
WFSDataStore wfs = parent.getDS(monitor);
SimpleFeatureSource featureSource = wfs.getFeatureSource(typename);
- return adaptee.cast(featureSource);
+ return adaptee.cast(featureSource);
}
if (adaptee.isAssignableFrom(FeatureStore.class)) {
WFSDataStore wfs = parent.getDS(monitor);
SimpleFeatureSource featureSource = wfs.getFeatureSource(typename);
- if( featureSource instanceof FeatureStore){
+ if (featureSource instanceof FeatureStore) {
return adaptee.cast(featureSource);
- }
- else {
+ } else {
return null; // write access not available
}
}
return super.resolve(adaptee, monitor);
}
- /*
+
+ /**
* @see org.locationtech.udig.catalog.IResolve#canResolve(java.lang.Class)
*/
- public boolean canResolve( Class adaptee ) {
- if (adaptee == null){
+ @Override
+ public boolean canResolve(Class adaptee) {
+ if (adaptee == null) {
return false;
}
- if (adaptee.isAssignableFrom(SimpleFeatureSource.class)){
+ if (adaptee.isAssignableFrom(SimpleFeatureSource.class)) {
return true;
}
if (adaptee.isAssignableFrom(SimpleFeatureStore.class)) {
@@ -124,23 +137,24 @@ public boolean canResolve( Class adaptee ) {
WFSGeoResourceInfo wfsInfo = (WFSGeoResourceInfo) info;
return wfsInfo.isWritable();
}
- if( service.getID().toString().indexOf("1.1.0") != -1){
+ if (service.getID().toString().indexOf("1.1.0") != -1) { //$NON-NLS-1$
return false; // 1.1.0 not writable yet
- }
- else {
+ } else {
return true;
}
}
return (adaptee.isAssignableFrom(IGeoResourceInfo.class)
- || adaptee.isAssignableFrom(WFSDataStore.class) || adaptee
- .isAssignableFrom(IService.class))
- || super.canResolve(adaptee);
+ || adaptee.isAssignableFrom(WFSDataStore.class)
+ || adaptee.isAssignableFrom(IService.class)) || super.canResolve(adaptee);
}
+
@Override
- public WFSGeoResourceInfo getInfo( IProgressMonitor monitor ) throws IOException {
+ public WFSGeoResourceInfo getInfo(IProgressMonitor monitor) throws IOException {
return (WFSGeoResourceInfo) super.getInfo(monitor);
}
- protected WFSGeoResourceInfo createInfo( IProgressMonitor monitor ) throws IOException {
+
+ @Override
+ protected WFSGeoResourceInfo createInfo(IProgressMonitor monitor) throws IOException {
if (getStatus() == Status.BROKEN) {
return null; // could not connect
}
diff --git a/plugins/org.locationtech.udig.catalog.wfs/src/org/locationtech/udig/catalog/internal/wfs/WFSGeoResourceInfo.java b/plugins/org.locationtech.udig.catalog.wfs/src/org/locationtech/udig/catalog/internal/wfs/WFSGeoResourceInfo.java
index e793ed3c5a..cd6789eeee 100644
--- a/plugins/org.locationtech.udig.catalog.wfs/src/org/locationtech/udig/catalog/internal/wfs/WFSGeoResourceInfo.java
+++ b/plugins/org.locationtech.udig.catalog.wfs/src/org/locationtech/udig/catalog/internal/wfs/WFSGeoResourceInfo.java
@@ -1,7 +1,7 @@
-/*
- * uDig - User Friendly Desktop Internet GIS client
- * http://udig.refractions.net
- * (C) 2012, Refractions Research Inc.
+/**
+ * uDig - User Friendly Desktop Internet GIS client
+ * http://udig.refractions.net
+ * (C) 2012, Refractions Research Inc.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -17,34 +17,31 @@
import java.util.Set;
import java.util.TreeSet;
-import org.locationtech.udig.catalog.IGeoResourceInfo;
-import org.locationtech.udig.ui.graphics.Glyph;
-
import org.geotools.data.FeatureSource;
import org.geotools.data.FeatureStore;
-import org.geotools.data.QueryCapabilities;
import org.geotools.data.ResourceInfo;
import org.geotools.data.wfs.WFSDataStore;
+import org.locationtech.udig.catalog.IGeoResourceInfo;
+import org.locationtech.udig.ui.graphics.Glyph;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.simple.SimpleFeatureType;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
class WFSGeoResourceInfo extends IGeoResourceInfo {
- /**
- *
- */
private final WFSGeoResourceImpl wfsResource;
+
CoordinateReferenceSystem crs = null;
+
private boolean writable = false;
-
+
WFSGeoResourceInfo(WFSGeoResourceImpl wfsGeoResourceImpl) throws IOException {
wfsResource = wfsGeoResourceImpl;
WFSDataStore ds = wfsResource.parent.getDS(null);
-
+
FeatureSource featureSource = ds
.getFeatureSource(wfsResource.typename);
-
+
writable = featureSource instanceof FeatureStore;
ResourceInfo resourceInfo = featureSource.getInfo();
@@ -52,17 +49,13 @@ class WFSGeoResourceInfo extends IGeoResourceInfo {
try {
ft = ds.getSchema(wfsResource.typename);
} catch (Exception crippled) {
- // unable to handle the describe feature type response for this
- // typeName
+ // unable to handle the describe feature type response for this typeName
if (WfsPlugin.getDefault().isDebugging()) {
crippled.printStackTrace();
}
}
bounds = resourceInfo.getBounds();
-
- // relax bounds for wfs ...
- // bounds = ReferencedEnvelopeCache.getReferencedEnvelope( crs );
-
+
description = resourceInfo.getDescription();
title = resourceInfo.getTitle();
@@ -70,7 +63,7 @@ class WFSGeoResourceInfo extends IGeoResourceInfo {
if (crs == null && ft != null) {
crs = ft.getCoordinateReferenceSystem();
}
-
+
name = wfsResource.typename;
schema = resourceInfo.getSchema();
if (schema == null) {
@@ -84,21 +77,22 @@ class WFSGeoResourceInfo extends IGeoResourceInfo {
schema = null;
}
}
- Set tags = new TreeSet();
+ Set tags = new TreeSet<>();
try {
tags.addAll(resourceInfo.getKeywords());
} catch (Throwable t) {
WfsPlugin.trace("Could not retrieve keywords", t); //$NON-NLS-1$
// no keywords for you
}
- tags.addAll(Arrays.asList(new String[]{"wfs", wfsResource.typename})); //$NON-NLS-1$
+ tags.addAll(Arrays.asList(new String[] { "wfs", wfsResource.typename })); //$NON-NLS-1$
keywords = tags.toArray(new String[0]);
icon = Glyph.icon(ft);
}
- /*
+ /**
* @see org.locationtech.udig.catalog.IGeoResourceInfo#getCRS()
*/
+ @Override
public CoordinateReferenceSystem getCRS() {
if (crs != null)
return crs;
diff --git a/plugins/org.locationtech.udig.catalog.wfs/src/org/locationtech/udig/catalog/internal/wfs/WFSServiceImpl.java b/plugins/org.locationtech.udig.catalog.wfs/src/org/locationtech/udig/catalog/internal/wfs/WFSServiceImpl.java
index fba63ce7f0..a7e8938122 100644
--- a/plugins/org.locationtech.udig.catalog.wfs/src/org/locationtech/udig/catalog/internal/wfs/WFSServiceImpl.java
+++ b/plugins/org.locationtech.udig.catalog.wfs/src/org/locationtech/udig/catalog/internal/wfs/WFSServiceImpl.java
@@ -1,7 +1,7 @@
-/*
- * uDig - User Friendly Desktop Internet GIS client
- * http://udig.refractions.net
- * (C) 2004, Refractions Research Inc.
+/**
+ * uDig - User Friendly Desktop Internet GIS client
+ * http://udig.refractions.net
+ * (C) 2004, Refractions Research Inc.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -38,33 +38,45 @@
/**
* Handle for a WFS service.
- *
+ *
* @author David Zwiers, Refractions Research
* @since 0.6
*/
public class WFSServiceImpl extends IService {
private URL identifier = null;
+
private Map params = null;
+
private volatile List members = null;
+
protected Lock rLock = new UDIGDisplaySafeLock();
private Throwable msg = null;
+
private volatile WFSDataStoreFactory dsf;
+
private volatile WFSDataStore ds = null;
+
private static final Lock dsLock = new UDIGDisplaySafeLock();
- public WFSServiceImpl( URL identifier, Map dsParams ) {
+ public WFSServiceImpl(URL identifier, Map dsParams) {
this.identifier = identifier;
this.params = dsParams;
}
-
- /*
- * Required adaptions: - IServiceInfo.class
- List.class
+
+ /**
+ * Required adoptions:
+ *
+ * - IServiceInfo.class
+ *
- List.class
+ *
+ *
* @see org.locationtech.udig.catalog.IService#resolve(java.lang.Class,
- * org.eclipse.core.runtime.IProgressMonitor)
+ * org.eclipse.core.runtime.IProgressMonitor)
*/
- public T resolve( Class adaptee, IProgressMonitor monitor ) throws IOException {
+ @Override
+ public T resolve(Class adaptee, IProgressMonitor monitor) throws IOException {
if (adaptee == null)
return null;
if (adaptee.isAssignableFrom(WFSDataStore.class)) {
@@ -73,40 +85,43 @@ public T resolve( Class adaptee, IProgressMonitor monitor ) throws IOExce
return super.resolve(adaptee, monitor);
}
- /*
+ /**
* @see org.locationtech.udig.catalog.IResolve#canResolve(java.lang.Class)
*/
- public boolean canResolve( Class adaptee ) {
+ @Override
+ public boolean canResolve(Class adaptee) {
if (adaptee == null)
return false;
return adaptee.isAssignableFrom(WFSDataStore.class) || super.canResolve(adaptee);
}
- public void dispose( IProgressMonitor monitor ) {
+ @Override
+ public void dispose(IProgressMonitor monitor) {
super.dispose(monitor);
- if (members != null){
+ if (members != null) {
members = null;
}
- if( ds != null ){
+ if (ds != null) {
ds.dispose();
ds = null;
}
}
- /*
+ /**
* @see org.locationtech.udig.catalog.IResolve#members(org.eclipse.core.runtime.IProgressMonitor)
*/
- public List resources( IProgressMonitor monitor ) throws IOException {
+ @Override
+ public List resources(IProgressMonitor monitor) throws IOException {
if (members == null) {
rLock.lock();
try {
if (members == null) {
getDS(monitor); // load ds
- members = new LinkedList();
+ members = new LinkedList<>();
String[] typenames = ds.getTypeNames();
if (typenames != null)
- for( int i = 0; i < typenames.length; i++ ) {
+ for (int i = 0; i < typenames.length; i++) {
try {
members.add(new WFSGeoResourceImpl(this, typenames[i]));
} catch (Exception e) {
@@ -122,13 +137,15 @@ public List resources( IProgressMonitor monitor ) throws IOE
}
@Override
- public IServiceInfo getInfo( IProgressMonitor monitor ) throws IOException {
- return (IServiceInfo) super.getInfo(monitor);
+ public IServiceInfo getInfo(IProgressMonitor monitor) throws IOException {
+ return super.getInfo(monitor);
}
- /*
+
+ /**
* @see org.locationtech.udig.catalog.IService#getInfo(org.eclipse.core.runtime.IProgressMonitor)
*/
- protected IServiceInfo createInfo( IProgressMonitor monitor ) throws IOException {
+ @Override
+ protected IServiceInfo createInfo(IProgressMonitor monitor) throws IOException {
DataStore dataStore = getDS(monitor); // load ds
if (dataStore == null) {
return null; // could not connect no info for you
@@ -141,14 +158,15 @@ protected IServiceInfo createInfo( IProgressMonitor monitor ) throws IOException
}
}
- /*
+ /**
* @see org.locationtech.udig.catalog.IService#getConnectionParams()
*/
+ @Override
public Map getConnectionParams() {
return params;
}
- WFSDataStore getDS( IProgressMonitor monitor ) throws IOException {
+ WFSDataStore getDS(IProgressMonitor monitor) throws IOException {
if (ds == null) {
if (monitor == null)
monitor = new NullProgressMonitor();
@@ -167,9 +185,9 @@ WFSDataStore getDS( IProgressMonitor monitor ) throws IOException {
// TODO Review : explicitly ask for WFS 1.0
URL url = (URL) params.get(WFSDataStoreFactory.URL.key);
url = WFSDataStoreFactory.createGetCapabilitiesRequest(url);
- params = new HashMap(params);
+ params = new HashMap<>(params);
params.put(WFSDataStoreFactory.URL.key, url);
- ds = (WFSDataStore) dsf.createDataStore(params);
+ ds = dsf.createDataStore(params);
monitor.worked(1);
} catch (IOException e) {
msg = e;
@@ -182,32 +200,35 @@ WFSDataStore getDS( IProgressMonitor monitor ) throws IOException {
monitor.done();
}
IResolveDelta delta = new ResolveDelta(this, IResolveDelta.Kind.CHANGED);
- ((CatalogImpl) CatalogPlugin.getDefault().getLocalCatalog())
- .fire(new ResolveChangeEvent(this, IResolveChangeEvent.Type.POST_CHANGE, delta));
+ ((CatalogImpl) CatalogPlugin.getDefault().getLocalCatalog()).fire(
+ new ResolveChangeEvent(this, IResolveChangeEvent.Type.POST_CHANGE, delta));
}
return ds;
}
- /*
+ /**
* @see org.locationtech.udig.catalog.IResolve#getStatus()
*/
+ @Override
public Status getStatus() {
- if( ds == null ){
+ if (ds == null) {
return super.getStatus();
}
return Status.CONNECTED;
}
- /*
+ /**
* @see org.locationtech.udig.catalog.IResolve#getMessage()
*/
+ @Override
public Throwable getMessage() {
return msg;
}
- /*
+ /**
* @see org.locationtech.udig.catalog.IResolve#getIdentifier()
*/
+ @Override
public URL getIdentifier() {
return identifier;
}
diff --git a/plugins/org.locationtech.udig.catalog.wfs/src/org/locationtech/udig/catalog/internal/wfs/WfsPlugin.java b/plugins/org.locationtech.udig.catalog.wfs/src/org/locationtech/udig/catalog/internal/wfs/WfsPlugin.java
index 579fed5460..734c944c6a 100644
--- a/plugins/org.locationtech.udig.catalog.wfs/src/org/locationtech/udig/catalog/internal/wfs/WfsPlugin.java
+++ b/plugins/org.locationtech.udig.catalog.wfs/src/org/locationtech/udig/catalog/internal/wfs/WfsPlugin.java
@@ -1,7 +1,7 @@
-/*
- * uDig - User Friendly Desktop Internet GIS client
- * http://udig.refractions.net
- * (C) 2012, Refractions Research Inc.
+/**
+ * uDig - User Friendly Desktop Internet GIS client
+ * http://udig.refractions.net
+ * (C) 2012, Refractions Research Inc.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -12,145 +12,127 @@
import java.util.MissingResourceException;
import java.util.ResourceBundle;
-import java.util.logging.ConsoleHandler;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.geotools.data.wfs.WFSDataStore;
-import org.geotools.xml.gml.GMLSchema;
import org.osgi.framework.BundleContext;
/**
* The main plugin class to be used in the desktop.
*/
public class WfsPlugin extends AbstractUIPlugin {
- //The shared instance.
- private static WfsPlugin plugin;
- //Resource bundle.
- private ResourceBundle resourceBundle;
- public static final String ID = "org.locationtech.udig.catalog.internal.wfs"; //$NON-NLS-1$
-
- /**
- * The constructor.
- */
- public WfsPlugin() {
- super();
- plugin = this;
- }
+ // The shared instance.
+ private static WfsPlugin plugin = new WfsPlugin();
+
+ private ResourceBundle resourceBundle;
+
+ public static final String ID = "org.locationtech.udig.catalog.internal.wfs"; //$NON-NLS-1$
+
+ /**
+ * The constructor.
+ */
+ private WfsPlugin() {
+ super();
+ plugin = this;
+ }
- /**
+ /**
* This method is called upon plug-in activation
*/
- public void start( BundleContext context ) throws Exception {
+ @Override
+ public void start(BundleContext context) throws Exception {
super.start(context);
- /*
- ClassLoader current = Thread.currentThread().getContextClassLoader();
- try {
- Thread.currentThread().setContextClassLoader(WFSDataStore.class.getClassLoader());
- setLoggerLevel("org.geotools.data.wfs", "org.locationtech.udig.catalog.wfs/debug/wfs"); //$NON-NLS-1$ //$NON-NLS-2$
- setLoggerLevel("org.geotools.xml", "org.locationtech.udig.catalog.wfs/debug/wfs"); //$NON-NLS-1$ //$NON-NLS-2$
- setLoggerLevel("org.geotools.xml.sax", "org.locationtech.udig.catalog.wfs/debug/wfs"); //$NON-NLS-1$ //$NON-NLS-2$
- if (isDebugging("org.locationtech.udig.catalog.wfs/debug/gml")) //$NON-NLS-1$
- GMLSchema.setLogLevel(Level.FINE);
- else
- GMLSchema.setLogLevel(Level.SEVERE);
- } finally {
- Thread.currentThread().setContextClassLoader(current);
- }
- */
}
- /*
- private void setLoggerLevel( String loggerID, String traceID ) {
- Logger logger = Logger.getLogger(loggerID);
- if( isDebugging(traceID) )
- logger.setLevel(Level.FINE);
- else
- logger.setLevel(Level.SEVERE);
- ConsoleHandler consoleHandler = new ConsoleHandler();
- consoleHandler.setLevel(Level.ALL);
- logger.addHandler(consoleHandler);
- }*/
+ /**
+ * This method is called when the plug-in is stopped
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ resourceBundle = null;
+ super.stop(context);
+ }
- /**
- * This method is called when the plug-in is stopped
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- resourceBundle = null;
- super.stop(context);
- }
+ /**
+ * Returns the shared instance.
+ */
+ public static WfsPlugin getDefault() {
+ return plugin;
+ }
- /**
- * Returns the shared instance.
- */
- public static WfsPlugin getDefault() {
- return plugin;
- }
+ /**
+ * Returns the string from the plugin's resource bundle, or 'key' if not found.
+ */
+ public static String getResourceString(String key) {
+ ResourceBundle bundle = WfsPlugin.getDefault().getResourceBundle();
+ try {
+ return (bundle != null) ? bundle.getString(key) : key;
+ } catch (MissingResourceException e) {
+ return key;
+ }
+ }
- /**
- * Returns the string from the plugin's resource bundle,
- * or 'key' if not found.
- */
- public static String getResourceString(String key) {
- ResourceBundle bundle = WfsPlugin.getDefault().getResourceBundle();
- try {
- return (bundle != null) ? bundle.getString(key) : key;
- } catch (MissingResourceException e) {
- return key;
- }
- }
+ /**
+ * Returns the plugin's resource bundle,
+ */
+ public ResourceBundle getResourceBundle() {
+ try {
+ if (resourceBundle == null)
+ resourceBundle = ResourceBundle
+ .getBundle("org.locationtech.udig.catalog.internal.wfs.WfsPluginResources"); //$NON-NLS-1$
+ } catch (MissingResourceException x) {
+ resourceBundle = null;
+ }
+ return resourceBundle;
+ }
- /**
- * Returns the plugin's resource bundle,
- */
- public ResourceBundle getResourceBundle() {
- try {
- if (resourceBundle == null)
- resourceBundle = ResourceBundle.getBundle("org.locationtech.udig.catalog.internal.wfs.WfsPluginResources"); //$NON-NLS-1$
- } catch (MissingResourceException x) {
- resourceBundle = null;
- }
- return resourceBundle;
- }
/**
* Logs the Throwable in the plugin's log.
*
- * This will be a user visable ERROR iff:
+ * This will be a user visible ERROR iff:
*
* - t is an Exception we are assuming it is human readable or if a message is provided
*
*
- * @param message
- * @param t
+ *
+ * @param message
+ * @param t
*/
- public static void log( String message, Throwable t ) {
+ public static void log(String message, Throwable t) {
int status = t instanceof Exception || message != null ? IStatus.ERROR : IStatus.WARNING;
getDefault().getLog().log(new Status(status, ID, IStatus.OK, message, t));
}
+
/**
* Messages that only engage if getDefault().isDebugging()
*
- * It is much prefered to do this:
+ * It is much preferred to do this:
+ *
+ *
+ *
* private static final String RENDERING = "org.locationtech.udig.project/render/trace";
* if( ProjectUIPlugin.getDefault().isDebugging() && "true".equalsIgnoreCase( RENDERING ) ){
* System.out.println( "your message here" );
* }
- *
+ *
+ *
*
- * @param message
- * @param e
+ *
+ * @param message
+ * @param e
*/
- public static void trace( String message, Throwable e) {
- if( getDefault().isDebugging() ) {
- if( message != null ) System.out.println( message );
- if( e != null ) e.printStackTrace();
+ public static void trace(String message, Throwable e) {
+ if (getDefault().isDebugging()) {
+ if (message != null)
+ System.out.println(message);
+ if (e != null)
+ e.printStackTrace();
}
}
+
/**
* Performs the Platform.getDebugOption true check on the provided trace
*
@@ -158,12 +140,13 @@ public static void trace( String message, Throwable e) {
*
* - Trace.RENDER - trace rendering progress
*
- *
+ *
+ *
* @param trace currently only RENDER is defined
- * @return true if -debug is on for this plugin
+ * @return true if -debug is on for this plugin
*/
- public static boolean isDebugging( final String trace ){
- return getDefault().isDebugging() &&
- "true".equalsIgnoreCase(Platform.getDebugOption(trace)); //$NON-NLS-1$
- }
+ public static boolean isDebugging(final String trace) {
+ return getDefault().isDebugging()
+ && "true".equalsIgnoreCase(Platform.getDebugOption(trace)); //$NON-NLS-1$
+ }
}
diff --git a/plugins/org.locationtech.udig.catalog.wfs/src/org/locationtech/udig/catalog/internal/wfs/ui/WFSRegistryWizardPage.java b/plugins/org.locationtech.udig.catalog.wfs/src/org/locationtech/udig/catalog/internal/wfs/ui/WFSRegistryWizardPage.java
index 014e4ef189..a48de83996 100644
--- a/plugins/org.locationtech.udig.catalog.wfs/src/org/locationtech/udig/catalog/internal/wfs/ui/WFSRegistryWizardPage.java
+++ b/plugins/org.locationtech.udig.catalog.wfs/src/org/locationtech/udig/catalog/internal/wfs/ui/WFSRegistryWizardPage.java
@@ -478,7 +478,7 @@ public Map getParams() {
/**
* @see org.locationtech.udig.catalog.ui.UDIGImportPage#getResources(org.eclipse.core.runtime.
- * IProgressMonitor)
+ * IProgressMonitor)
*/
public List getResources(IProgressMonitor monitor) throws Exception {
if (!isPageComplete())
From 945c2a2a43ea0a20e1185fd96cbe046ec155347a Mon Sep 17 00:00:00 2001
From: Frank Gasdorf
Date: Sun, 10 Oct 2021 14:57:32 +0200
Subject: [PATCH 2/2] spotbugs : apply suggested checkout config
Signed-off-by: Frank Gasdorf
---
.github/workflows/maven-jdk8-linux.yml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.github/workflows/maven-jdk8-linux.yml b/.github/workflows/maven-jdk8-linux.yml
index 3fca32d73a..b049fbac14 100644
--- a/.github/workflows/maven-jdk8-linux.yml
+++ b/.github/workflows/maven-jdk8-linux.yml
@@ -16,6 +16,8 @@ jobs:
steps:
- uses: actions/checkout@v2
+ with:
+ ref: ${{ github.event.pull_request.head.sha }}
- name: Set up JDK 8
uses: actions/setup-java@v2
with: