Skip to content

Commit

Permalink
AUS-4069
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisvpeters committed Nov 1, 2024
1 parent ab52e84 commit 5afc54d
Show file tree
Hide file tree
Showing 5 changed files with 1,328 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,10 @@ public ModelAndView getIRISStations(
@RequestParam("serviceUrl") String serviceUrl,
@RequestParam("networkCode") String networkCode) {
serviceUrl = ensureTrailingForwardslash(serviceUrl);

// System.out.println("[getIRISStations] serviceUrl ="+serviceUrl+",networkCode ="+networkCode);

try {
Document irisDoc = getDocumentFromURL(serviceUrl + "fdsnws/station/1/query?net=" + networkCode + "&level=channel");

//TODO VT: As part of the review for AGOS-15 , we should be following the same architecture as the rest of portal and
// create a xslt file to do the transformation from xml to kml
NodeList stations = irisDoc.getDocumentElement().getElementsByTagName("Station");
Expand Down Expand Up @@ -201,7 +199,9 @@ public ModelAndView getIRISStations(
}
kml.append("</Document></kml>");

return generateJSONResponseMAV(true, "gml", kml.toString(), null);
// & character needs to be escaped i.e. &amp
String irisResponse = kml.toString().replaceAll("&(?!amp;|apos;|quot;|lt;|gt;)", "&amp;");
return generateJSONResponseMAV(true, "gml", irisResponse, null);
} catch (Exception e) {
return generateJSONResponseMAV(false, e.getMessage(), "Failed.");
}
Expand Down
18 changes: 9 additions & 9 deletions src/main/resources/layers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -508,14 +508,14 @@
iris:
selector: [ "1F","https://auspass.edu.au" ]
# Removed until AUS-4069 is fixed
#"seismology-minq":
# name: "MINQ: Mount Isa Northern Queensland"
# description: "The MINQ seismic array feed from AusPass: the Australian Passive Seismic Server."
# group: "Passive Seismic"
# proxyUrl: "getIRISStations.do"
# order: "263"
# iris:
# selector: [ "ZR","https://auspass.edu.au" ]
"seismology-minq":
name: "MINQ: Mount Isa Northern Queensland"
description: "The MINQ seismic array feed from AusPass: the Australian Passive Seismic Server."
group: "Passive Seismic"
proxyUrl: "getIRISStations.do"
order: "263"
iris:
selector: [ "ZR","https://auspass.edu.au" ]
"seismology-eal1":
name: "EAL1: Eastern Australia Linkage"
description: "The EAL1 seismic array feed from AusPass: the Australian Passive Seismic Server."
Expand Down Expand Up @@ -2192,7 +2192,7 @@
order: "ind01"
vmf:
selector: "Indigenous Map"
endPoint: "https://native-land.ca/wp-json/nativeland/v1/api/index.php"
endPoint: "https://native-land.ca/wp-json/nativeland/v1/api/index.php?maps=territories"
polygon_geojson: [[111.64,-17.61],[132.45,-8.23],[146.26,-10.53],[159.37,-24.57],[147.95,-45.25],[110.29,-34.29]]

"regolith-depth-layer":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,24 @@ public void getStationChannels_channelResponseBadXML_ResultantModelHasSuccessSet
// Assert
Assert.assertFalse((Boolean) result.getModel().get("success"));
}

@Test
public void getIRISStations_stationResponseUnescapedAmbersandXML_ResultantModelHasSuccessSetToFalse() {
// Act
// e.g. unescaped & - <Name>Burke & Wills Roadhouse, Stokes, QLD</Name>
ModelAndView result = this.controller.getIRISStations("org/auscope/portal/iris/StationNameContainsUnescapedSpecialCharacter.xml", "");

// Assert
Assert.assertFalse((Boolean) result.getModel().get("success"));
}

@Test
public void getIRISStations_stationResponseEscapedAmbersandXML_ResultantModelHasSuccessSetToTrue() {
// Act
// e.g. unescaped & - <Name>Burke & Wills Roadhouse, Stokes, QLD</Name>
ModelAndView result = this.controller.getIRISStations("org/auscope/portal/iris/StationNameContainsEscapedSpecialCharacter.xml", "");

// Assert
Assert.assertTrue((Boolean) result.getModel().get("success"));
}
}
Loading

0 comments on commit 5afc54d

Please sign in to comment.