Skip to content

Commit 9cdc89f

Browse files
author
haileyajohnson
authored
Merge pull request #920 from ethanrd/fix-https-namespaces
[5.x]: Clean up Unidata XML Namespace URIs mistakenly converted to "https:"
2 parents 75553c1 + fbf8064 commit 9cdc89f

5 files changed

Lines changed: 13 additions & 3 deletions

File tree

cdm/core/src/main/java/thredds/client/catalog/Catalog.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ public class Catalog extends DatasetNode {
3030
public static final String CATALOG_NAMESPACE_10 = "http://www.unidata.ucar.edu/namespaces/thredds/InvCatalog/v1.0";
3131
public static final Namespace defNS = Namespace.getNamespace(CATALOG_NAMESPACE_10);
3232
public static final String NJ22_NAMESPACE = "http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2";
33+
// The following line (and related code) handles incorrect HTTPS variant of NcML Namespace URI.
34+
// NOTE: The HTTPS variant is incorrect (according to recent, Oct 2021, decision).
35+
// The variant probably appeared when Unidata servers started requiring HTTPS.
36+
// NcML is only place HTTPS namespace variants are handled (and tested in testReadHttps.xml).
37+
// Should probably just be dropped.
3338
public static final String NJ22_NAMESPACE_HTTPS = "https://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2";
3439
public static final Namespace ncmlNS = Namespace.getNamespace("ncml", NJ22_NAMESPACE);
3540
public static final Namespace ncmlNSHttps = Namespace.getNamespace("ncml", NJ22_NAMESPACE_HTTPS);

cdm/core/src/main/java/ucar/nc2/ncml/NcMLWriter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
@Deprecated
4444
public class NcMLWriter {
4545
/**
46-
* A default namespace constructed from the NcML URI: {@code https://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2}.
46+
* A default namespace constructed from the NcML URI: {@code http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2}.
4747
*/
4848
// A default namespace means that we can use it without having to prepend the "ncml:" prefix to every element name.
4949
// thredds.client.catalog.Catalog.ncmlNS is *not* default and therefore *does* require the prefix.

cdm/core/src/main/java/ucar/nc2/write/NcmlWriter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public class NcmlWriter {
5757
private static final Logger log = LoggerFactory.getLogger(NcmlWriter.class);
5858

5959
/**
60-
* A default namespace constructed from the NcML URI: {@code https://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2}.
60+
* A default namespace constructed from the NcML URI: {@code http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2}.
6161
*/
6262
// A default namespace means that we can use it without having to prepend the "ncml:" prefix to every element name.
6363
// thredds.client.catalog.Catalog.ncmlNS is *not* default and therefore *does* require the prefix.

cdm/core/src/test/data/ncml/testReadHttps.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2+
<!-- DO NOT Change namespace URI
3+
- Used to test handling of alternate/incorrect namespace URI.
4+
- (See note in Catalog.java.)
5+
-->
26
<nc:netcdf xmlns:nc="https://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2"
37
location="file:src/test/data/example1.nc">
48

cdm/core/src/test/java/ucar/nc2/ncml/TestNcmlRead.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,8 @@ public TestRead2(String name) {
266266

267267
static public class TestReadHttps extends TestNcmlRead {
268268

269-
// equivalent dataset using "readMetadata"
269+
// Test handling of incorrect https variant of NcML namespace URI.
270+
// See note in Catalog.java.
270271
public TestReadHttps(String name) {
271272
super(name);
272273
ncfile = null;

0 commit comments

Comments
 (0)