Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ language: java

# Configure the build to use Oracle JDK 9
jdk:
- openjdk11
- openjdk21

# Install the Ant JUnit package, which is missing from the Travis CI environment. See the Travis documentation: https://docs.travis-ci.com/user/installing-dependencies/#Adding-APT-Packages
addons:
Expand Down
4 changes: 2 additions & 2 deletions nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ javac.modulepath=
javac.processormodulepath=
javac.processorpath=\
${javac.classpath}
javac.source=11
javac.target=11
javac.source=21
javac.target=21
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
Expand Down
2 changes: 1 addition & 1 deletion release-build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ worldwind.classes.dir=${worldwind.build.dir}/classes
worldwind.doc.dir=${worldwind.build.dir}/doc
worldwind.jar.dir=${worldwind.build.dir}/jar
worldwind.test.results.dir=${worldwind.build.dir}/test-results
worldwind.jdk=11
worldwind.jdk=21
#worldwind.exclude.jackson=true

# MIL-STD-2525 package build properties
Expand Down
2 changes: 1 addition & 1 deletion release-build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
<pathelement location="gluegen-rt.jar"/>
<pathelement location="gdal.jar"/>
</classpath>
<link href="http://download.oracle.com/javase/8/docs/api/"/>
<link href="https://docs.oracle.com/en/java/javase/21/docs/api/"/>
<link href="https://jogamp.org/deployment/v2.4.0-rc-20200307/javadoc/"/>
</javadoc>
</target>
Expand Down
37 changes: 16 additions & 21 deletions src/gov/nasa/worldwind/wms/Capabilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,8 @@ public static Capabilities retrieve(URI uri, String service, Integer connectTime
CapabilitiesRequest req = new CapabilitiesRequest(uri, service);
URL capsURL = req.getUri().toURL();

URLRetriever retriever = URLRetriever.createRetriever(capsURL, new RetrievalPostProcessor()
{
public ByteBuffer run(Retriever retriever)
{
return retriever.getBuffer();
}
});
URLRetriever retriever = URLRetriever.createRetriever(capsURL,
(Retriever r) -> r.getBuffer());

if (retriever == null)
{
Expand Down Expand Up @@ -281,7 +276,7 @@ protected String[] getUniqueText(Element context, String path)
if (strings == null)
return null;

ArrayList<String> sarl = new ArrayList<String>();
ArrayList<String> sarl = new ArrayList<>();
for (String s : strings)
{
if (!sarl.contains(s))
Expand All @@ -300,7 +295,7 @@ protected Element getElement(Element context, String path)
if (node == null)
return null;

return node instanceof Element ? (Element) node : null;
return node instanceof Element e ? e : null;
}
catch (XPathExpressionException e)
{
Expand All @@ -321,8 +316,8 @@ protected Element[] getElements(Element context, String path)
for (int i = 0; i < nodes.getLength(); i++)
{
Node node = nodes.item(i);
if (node instanceof Element)
elements[i] = (Element) node;
if (node instanceof Element e)
elements[i] = e;
}
return elements;
}
Expand All @@ -338,7 +333,7 @@ protected Element[] getUniqueElements(Element context, String path, String uniqu
if (elements == null)
return null;

HashMap<String, Element> styles = new HashMap<String, Element>();
HashMap<String, Element> styles = new HashMap<>();
for (Element e : elements)
{
String name = this.getText(e, uniqueTag);
Expand All @@ -349,8 +344,8 @@ protected Element[] getUniqueElements(Element context, String path, String uniqu
return styles.values().toArray(new Element[1]);
}

private HashMap<Element, Layer> namedLayerElements = new HashMap<Element, Layer>();
private HashMap<String, Layer> namedLayers = new HashMap<String, Layer>();
private HashMap<Element, Layer> namedLayerElements = new HashMap<>();
private HashMap<String, Layer> namedLayers = new HashMap<>();

private void fillLayerList()
{
Expand Down Expand Up @@ -643,7 +638,7 @@ public Element getLayer()

protected static class Layer
{
protected HashMap<Element, Style> styleElements = new HashMap<Element, Style>();
protected HashMap<Element, Style> styleElements = new HashMap<>();
protected final Element element;
protected Layer layer;
protected String name;
Expand Down Expand Up @@ -725,8 +720,8 @@ public Element[] getLayerDimensions(Element layer)
if (dims == null || dims.length == 0)
return null;

ArrayList<Element> uniqueDims = new ArrayList<Element>();
ArrayList<String> dimNames = new ArrayList<String>();
ArrayList<Element> uniqueDims = new ArrayList<>();
ArrayList<String> dimNames = new ArrayList<>();
for (Element e : dims)
{
// Filter out dimensions with same name.
Expand All @@ -749,8 +744,8 @@ public Element[] getLayerExtents(Element layer)
if (extents == null || extents.length == 0)
return null;

ArrayList<Element> uniqueExtents = new ArrayList<Element>();
ArrayList<String> extentNames = new ArrayList<String>();
ArrayList<Element> uniqueExtents = new ArrayList<>();
ArrayList<String> extentNames = new ArrayList<>();
for (Element e : extents)
{
// Filter out dimensions with same name.
Expand Down Expand Up @@ -846,7 +841,7 @@ public Element[] getLayerStyles(Element layerElement)
if (styleElements == null)
return null;

layer.styleElements = new HashMap<Element, Style>();
layer.styleElements = new HashMap<>();
for (Element se : styleElements)
{
Style style = new Style(se, layer);
Expand Down Expand Up @@ -912,7 +907,7 @@ public String getLayerExtremeElevationsMax(Element layer)

// ********* Style Items ********* //

protected HashMap<Element, Style> styleElements = new HashMap<Element, Style>();
protected HashMap<Element, Style> styleElements = new HashMap<>();

protected static class Style
{
Expand Down
4 changes: 2 additions & 2 deletions src/gov/nasa/worldwind/wms/CapabilitiesV111.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public BoundingBox[] getLayerBoundingBoxes(Element layer)
if (es == null)
return null;

ArrayList<BoundingBox> bboxes = new ArrayList<BoundingBox>();
ArrayList<String> crses = new ArrayList<String>();
ArrayList<BoundingBox> bboxes = new ArrayList<>();
ArrayList<String> crses = new ArrayList<>();

for (Element e : es)
{
Expand Down
4 changes: 2 additions & 2 deletions src/gov/nasa/worldwind/wms/CapabilitiesV130.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public BoundingBox[] getLayerBoundingBoxes(Element layer)
if (es == null)
return null;

ArrayList<BoundingBox> bboxes = new ArrayList<BoundingBox>();
ArrayList<String> crses = new ArrayList<String>();
ArrayList<BoundingBox> bboxes = new ArrayList<>();
ArrayList<String> crses = new ArrayList<>();

for (Element e : es)
{
Expand Down
14 changes: 7 additions & 7 deletions src/gov/nasa/worldwind/wms/Request.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public abstract class Request
// Use a TreeMap to hold the query params so that they'll always be attached to the
// URL query string in the same order. This allows a simple string comparison to
// determine whether two url strings address the same document.
private TreeMap<String, String> queryParams = new TreeMap<String, String>();
private TreeMap<String, String> queryParams = new TreeMap<>();

/** Constructs a request for the default service, WMS. */
protected Request()
Expand Down Expand Up @@ -130,7 +130,7 @@ private void copyParamsTo(Request destinationRequest)

for (Map.Entry<String, String> entry : this.queryParams.entrySet())
{
destinationRequest.setParam((String) ((Map.Entry) entry).getKey(), (String) ((Map.Entry) entry).getValue());
destinationRequest.setParam(entry.getKey(), entry.getValue());
}
}

Expand Down Expand Up @@ -226,18 +226,18 @@ public URI getUri() throws URISyntaxException

private String buildQueryString(String existingQueryString)
{
StringBuffer queryString = new StringBuffer(existingQueryString != null ? existingQueryString : "");
StringBuilder queryString = new StringBuilder(existingQueryString != null ? existingQueryString : "");

if (queryString.length() > 1 && queryString.lastIndexOf("&") != queryString.length() - 1)
queryString = queryString.append("&");
queryString.append("&");

for (Map.Entry<String, String> entry : this.queryParams.entrySet())
{
if (((Map.Entry) entry).getKey() != null && ((Map.Entry) entry).getValue() != null)
if (entry.getKey() != null && entry.getValue() != null)
{
queryString.append(((Map.Entry) entry).getKey());
queryString.append(entry.getKey());
queryString.append("=");
queryString.append(((Map.Entry) entry).getValue());
queryString.append(entry.getValue());
queryString.append("&");
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/gov/nasa/worldwind/wms/WMSTiledImageLayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,10 @@ public URLBuilder(AVList params)

public URL getURL(Tile tile, String altImageFormat) throws MalformedURLException
{
StringBuffer sb;
StringBuilder sb;
if (this.URLTemplate == null)
{
sb = new StringBuffer(WWXML.fixGetMapString(tile.getLevel().getService()));
sb = new StringBuilder(WWXML.fixGetMapString(tile.getLevel().getService()));

if (!sb.toString().toLowerCase().contains("service=wms"))
sb.append("service=WMS");
Expand All @@ -236,7 +236,7 @@ public URL getURL(Tile tile, String altImageFormat) throws MalformedURLException
}
else
{
sb = new StringBuffer(this.URLTemplate);
sb = new StringBuilder(this.URLTemplate);
}

String format = (altImageFormat != null) ? altImageFormat : this.imageFormat;
Expand Down Expand Up @@ -396,10 +396,10 @@ protected Document createConfigurationDocument(AVList params)
public void getRestorableStateForAVPair(String key, Object value,
RestorableSupport rs, RestorableSupport.StateObject context)
{
if (value instanceof URLBuilder)
if (value instanceof URLBuilder urlBuilder)
{
rs.addStateValueAsString(context, "wms.Version", ((URLBuilder) value).wmsVersion);
rs.addStateValueAsString(context, "wms.Crs", ((URLBuilder) value).crs);
rs.addStateValueAsString(context, "wms.Version", urlBuilder.wmsVersion);
rs.addStateValueAsString(context, "wms.Crs", urlBuilder.crs);
}
else
{
Expand Down