diff options
author | Sven Gothel <[email protected]> | 2014-07-03 16:06:47 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-07-03 16:06:47 +0200 |
commit | df9ff7f340a5ab4e07efc613f5f264eeae63d4c7 (patch) | |
tree | 239ae276b82024b140428e6c0fe5d739fdd686a4 /src/java/com/jogamp/common/net | |
parent | eb47aaba63e3b1bf55f274a0f338f1010a017ae4 (diff) |
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74)
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74)
- Change non static accesses to static members using declaring type
- Change indirect accesses to static members to direct accesses (accesses through subtypes)
- Add final modifier to private fields
- Add final modifier to method parameters
- Add final modifier to local variables
- Remove unnecessary casts
- Remove unnecessary '$NON-NLS$' tags
- Remove trailing white spaces on all lines
Diffstat (limited to 'src/java/com/jogamp/common/net')
7 files changed, 26 insertions, 26 deletions
diff --git a/src/java/com/jogamp/common/net/AssetURLConnection.java b/src/java/com/jogamp/common/net/AssetURLConnection.java index 4f2a412..908e329 100644 --- a/src/java/com/jogamp/common/net/AssetURLConnection.java +++ b/src/java/com/jogamp/common/net/AssetURLConnection.java @@ -71,7 +71,7 @@ import java.net.URL; */ public class AssetURLConnection extends PiggybackURLConnection<AssetURLContext> { - public AssetURLConnection(URL url, AssetURLContext implHelper) { + public AssetURLConnection(final URL url, final AssetURLContext implHelper) { super(url, implHelper); } diff --git a/src/java/com/jogamp/common/net/AssetURLContext.java b/src/java/com/jogamp/common/net/AssetURLContext.java index 38691e8..2ada3c6 100644 --- a/src/java/com/jogamp/common/net/AssetURLContext.java +++ b/src/java/com/jogamp/common/net/AssetURLContext.java @@ -59,7 +59,7 @@ public abstract class AssetURLContext implements PiggybackURLContext { * @return * @throws MalformedURLException */ - public static URL createURL(String path, ClassLoader cl) throws MalformedURLException { + public static URL createURL(final String path, final ClassLoader cl) throws MalformedURLException { return new URL(null, path.startsWith(asset_protocol_prefix) ? path : asset_protocol_prefix + path, createHandler(cl)); } @@ -75,7 +75,7 @@ public abstract class AssetURLContext implements PiggybackURLContext { * @return * @throws MalformedURLException */ - public static URL createURL(String path) throws MalformedURLException { + public static URL createURL(final String path) throws MalformedURLException { return new URL(path.startsWith(asset_protocol_prefix) ? path : asset_protocol_prefix + path); } @@ -94,7 +94,7 @@ public abstract class AssetURLContext implements PiggybackURLContext { * * @return true if successful, otherwise false */ - public static boolean registerHandler(ClassLoader cl) { + public static boolean registerHandler(final ClassLoader cl) { final GenericURLStreamHandlerFactory f = GenericURLStreamHandlerFactory.register(); if( null != f ) { f.setHandler(asset_protocol, createHandler(cl)); @@ -141,11 +141,11 @@ public abstract class AssetURLContext implements PiggybackURLContext { * </p> **/ @Override - public URLConnection resolve(String path) throws IOException { + public URLConnection resolve(final String path) throws IOException { return resolve(path, getClassLoader()); } - public static URLConnection resolve(String path, ClassLoader cl) throws IOException { + public static URLConnection resolve(String path, final ClassLoader cl) throws IOException { URL url = null; URLConnection conn = null; int type = -1; @@ -155,7 +155,7 @@ public abstract class AssetURLContext implements PiggybackURLContext { } try { path = IOUtil.cleanPathString(path); - } catch (URISyntaxException uriEx) { + } catch (final URISyntaxException uriEx) { throw new IOException(uriEx); } @@ -164,7 +164,7 @@ public abstract class AssetURLContext implements PiggybackURLContext { url = new URL(path); conn = open(url); type = null != conn ? 1 : -1; - } catch(MalformedURLException e1) { if(DEBUG) { System.err.println("ERR(0): "+e1.getMessage()); } } + } catch(final MalformedURLException e1) { if(DEBUG) { System.err.println("ERR(0): "+e1.getMessage()); } } if(null == conn && null != cl) { // lookup via ClassLoader .. cleanup leading '/' @@ -183,13 +183,13 @@ public abstract class AssetURLContext implements PiggybackURLContext { if(null == conn) { // lookup as File try { - File file = new File(path); + final File file = new File(path); if(file.exists()) { url = IOUtil.toURISimple(file).toURL(); conn = open(url); type = null != conn ? 3 : -1; } - } catch (Throwable e) { if(DEBUG) { System.err.println("ERR(1): "+e.getMessage()); } } + } catch (final Throwable e) { if(DEBUG) { System.err.println("ERR(1): "+e.getMessage()); } } } if(DEBUG) { @@ -201,7 +201,7 @@ public abstract class AssetURLContext implements PiggybackURLContext { return conn; } - private static URLConnection open(URL url) { + private static URLConnection open(final URL url) { if(null==url) { return null; } @@ -209,7 +209,7 @@ public abstract class AssetURLContext implements PiggybackURLContext { final URLConnection c = url.openConnection(); c.connect(); // redundant return c; - } catch (IOException ioe) { if(DEBUG) { System.err.println("ERR: "+ioe.getMessage()); } } + } catch (final IOException ioe) { if(DEBUG) { System.err.println("ERR: "+ioe.getMessage()); } } return null; } diff --git a/src/java/com/jogamp/common/net/AssetURLStreamHandler.java b/src/java/com/jogamp/common/net/AssetURLStreamHandler.java index 6760646..88cedbb 100644 --- a/src/java/com/jogamp/common/net/AssetURLStreamHandler.java +++ b/src/java/com/jogamp/common/net/AssetURLStreamHandler.java @@ -22,12 +22,12 @@ import com.jogamp.common.net.AssetURLConnection; public class AssetURLStreamHandler extends URLStreamHandler { AssetURLContext ctx; - public AssetURLStreamHandler(AssetURLContext ctx) { + public AssetURLStreamHandler(final AssetURLContext ctx) { this.ctx = ctx; } @Override - protected URLConnection openConnection(URL u) throws IOException { + protected URLConnection openConnection(final URL u) throws IOException { final AssetURLConnection c = new AssetURLConnection(u, ctx); c.connect(); return c; diff --git a/src/java/com/jogamp/common/net/GenericURLStreamHandlerFactory.java b/src/java/com/jogamp/common/net/GenericURLStreamHandlerFactory.java index b5c5177..185142f 100644 --- a/src/java/com/jogamp/common/net/GenericURLStreamHandlerFactory.java +++ b/src/java/com/jogamp/common/net/GenericURLStreamHandlerFactory.java @@ -22,7 +22,7 @@ public class GenericURLStreamHandlerFactory implements URLStreamHandlerFactory { * * @return the previous set <code>handler</code>, or null if none was set. */ - public synchronized final URLStreamHandler setHandler(String protocol, URLStreamHandler handler) { + public synchronized final URLStreamHandler setHandler(final String protocol, final URLStreamHandler handler) { return protocolHandlers.put(protocol, handler); } @@ -30,12 +30,12 @@ public class GenericURLStreamHandlerFactory implements URLStreamHandlerFactory { * Returns the <code>protocol</code> handler previously set via {@link #setHandler(String, URLStreamHandler)}, * or null if none was set. */ - public synchronized final URLStreamHandler getHandler(String protocol) { + public synchronized final URLStreamHandler getHandler(final String protocol) { return protocolHandlers.get(protocol); } @Override - public synchronized final URLStreamHandler createURLStreamHandler(String protocol) { + public synchronized final URLStreamHandler createURLStreamHandler(final String protocol) { return getHandler(protocol); } @@ -52,11 +52,11 @@ public class GenericURLStreamHandlerFactory implements URLStreamHandlerFactory { @Override public GenericURLStreamHandlerFactory run() { boolean ok = false; - GenericURLStreamHandlerFactory f = new GenericURLStreamHandlerFactory(); + final GenericURLStreamHandlerFactory f = new GenericURLStreamHandlerFactory(); try { URL.setURLStreamHandlerFactory(f); ok = true; - } catch (Throwable e) { + } catch (final Throwable e) { System.err.println("GenericURLStreamHandlerFactory: Setting URLStreamHandlerFactory failed: "+e.getMessage()); } return ok ? f : null; diff --git a/src/java/com/jogamp/common/net/PiggybackURLConnection.java b/src/java/com/jogamp/common/net/PiggybackURLConnection.java index 3b774e8..6f5f4f0 100644 --- a/src/java/com/jogamp/common/net/PiggybackURLConnection.java +++ b/src/java/com/jogamp/common/net/PiggybackURLConnection.java @@ -24,7 +24,7 @@ public abstract class PiggybackURLConnection<I extends PiggybackURLContext> exte * @param url the specific URL for this instance * @param context the piggyback context, defining state independent code and constants */ - protected PiggybackURLConnection(URL url, I context) { + protected PiggybackURLConnection(final URL url, final I context) { super(url); this.context = context; } diff --git a/src/java/com/jogamp/common/net/URIQueryProps.java b/src/java/com/jogamp/common/net/URIQueryProps.java index fd91b9b..138ff9b 100644 --- a/src/java/com/jogamp/common/net/URIQueryProps.java +++ b/src/java/com/jogamp/common/net/URIQueryProps.java @@ -53,7 +53,7 @@ public class URIQueryProps { private final HashMap<String, String> properties = new HashMap<String, String>(); - private URIQueryProps(char querySeparator) { + private URIQueryProps(final char querySeparator) { query_separator = String.valueOf(querySeparator); } @@ -72,7 +72,7 @@ public class URIQueryProps { needsSep = true; } } - Iterator<Entry<String, String>> entries = properties.entrySet().iterator(); + final Iterator<Entry<String, String>> entries = properties.entrySet().iterator(); while(entries.hasNext()) { if(needsSep) { sb.append(query_separator); @@ -87,7 +87,7 @@ public class URIQueryProps { return sb.toString(); } - public final URI appendQuery(URI base) throws URISyntaxException { + public final URI appendQuery(final URI base) throws URISyntaxException { return new URI(base.getScheme(), base.getRawUserInfo(), base.getHost(), base.getPort(), base.getRawPath(), appendQuery(base.getRawQuery()), base.getRawFragment()); @@ -100,7 +100,7 @@ public class URIQueryProps { * @return * @throws IllegalArgumentException if <code>querySeparator</code> is illegal, i.e. neither <i>;</i> nor <i>&</i> */ - public static final URIQueryProps create(URI uri, char querySeparator) throws IllegalArgumentException { + public static final URIQueryProps create(final URI uri, final char querySeparator) throws IllegalArgumentException { if( ';' != querySeparator && '&' != querySeparator ) { throw new IllegalArgumentException("querySeparator is invalid: "+querySeparator); } @@ -109,7 +109,7 @@ public class URIQueryProps { final int q_l = null != q ? q.length() : -1; int q_e = -1; while(q_e < q_l) { - int q_b = q_e + 1; // next term + final int q_b = q_e + 1; // next term q_e = q.indexOf(querySeparator, q_b); if(0 == q_e) { // single separator diff --git a/src/java/com/jogamp/common/net/asset/Handler.java b/src/java/com/jogamp/common/net/asset/Handler.java index d622221..74fb015 100644 --- a/src/java/com/jogamp/common/net/asset/Handler.java +++ b/src/java/com/jogamp/common/net/asset/Handler.java @@ -29,7 +29,7 @@ public class Handler extends URLStreamHandler { } @Override - protected URLConnection openConnection(URL u) throws IOException { + protected URLConnection openConnection(final URL u) throws IOException { final AssetURLConnection c = new AssetURLConnection(u, localCL); c.connect(); return c; |