[OODT-999] Replaced File.toURL() method by File.toURI().toURL().
This replacement is recommended in the JAVADOC of File.toURL() method
diff --git a/commons/src/main/java/org/apache/oodt/commons/Configuration.java b/commons/src/main/java/org/apache/oodt/commons/Configuration.java
index a6e2fd3..a04c956 100644
--- a/commons/src/main/java/org/apache/oodt/commons/Configuration.java
+++ b/commons/src/main/java/org/apache/oodt/commons/Configuration.java
@@ -158,7 +158,7 @@
return getEmptyConfiguration();
}
}
- url = file.toURL();
+ url = file.toURI().toURL();
}
return getConfiguration(url);
diff --git a/curator/services/src/main/java/org/apache/oodt/cas/curation/service/MetadataResource.java b/curator/services/src/main/java/org/apache/oodt/cas/curation/service/MetadataResource.java
index 92901c2..bfc280e 100644
--- a/curator/services/src/main/java/org/apache/oodt/cas/curation/service/MetadataResource.java
+++ b/curator/services/src/main/java/org/apache/oodt/cas/curation/service/MetadataResource.java
@@ -662,7 +662,7 @@
InstantiationException, RepositoryManagerException {
String rootPolicyPath = this.cleanse(CurationService.config
.getPolicyUploadPath());
- String policyPath = new File(rootPolicyPath + policy).toURL()
+ String policyPath = new File(rootPolicyPath + policy).toURI().toURL()
.toExternalForm();
String[] policies = { policyPath };
XMLRepositoryManager repMgr = new XMLRepositoryManager(Arrays
@@ -678,7 +678,7 @@
CurationException {
String rootPolicyPath = this.cleanse(CurationService.config
.getPolicyUploadPath());
- String policyPath = new File(rootPolicyPath + policy).toURL()
+ String policyPath = new File(rootPolicyPath + policy).toURI().toURL()
.toExternalForm();
String[] policies = {policyPath};
XMLRepositoryManager repMgr = new XMLRepositoryManager(Arrays
diff --git a/curator/services/src/main/java/org/apache/oodt/cas/curation/service/PolicyResource.java b/curator/services/src/main/java/org/apache/oodt/cas/curation/service/PolicyResource.java
index c3bd174..6002078 100644
--- a/curator/services/src/main/java/org/apache/oodt/cas/curation/service/PolicyResource.java
+++ b/curator/services/src/main/java/org/apache/oodt/cas/curation/service/PolicyResource.java
@@ -264,7 +264,7 @@
RepositoryManagerException {
String rootPolicyPath = this.cleanse(CurationService.config
.getPolicyUploadPath());
- String policyPath = new File(rootPolicyPath + policy).toURL()
+ String policyPath = new File(rootPolicyPath + policy).toURI().toURL()
.toExternalForm();
String[] policies = { policyPath };
XMLRepositoryManager repMgr = new XMLRepositoryManager(Arrays
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ExpImpCatalog.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ExpImpCatalog.java
index c2db95f..ba53d32 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ExpImpCatalog.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ExpImpCatalog.java
@@ -110,7 +110,7 @@
// first load the source prop file
try {
System.getProperties().load(
- new File(sPropFilePath).toURL().openStream());
+ new File(sPropFilePath).toURI().toURL().openStream());
} catch (Exception e) {
throw new InstantiationException(e.getMessage());
}
@@ -125,7 +125,7 @@
// first load the dest prop file
try {
System.getProperties().load(
- new File(dPropFilePath).toURL().openStream());
+ new File(dPropFilePath).toURI().toURL().openStream());
} catch (Exception e) {
throw new InstantiationException(e.getMessage());
}
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/validation/XMLValidationLayer.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/validation/XMLValidationLayer.java
index 1c90e49..fe00437 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/validation/XMLValidationLayer.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/validation/XMLValidationLayer.java
@@ -469,7 +469,7 @@
InputStream xmlInputStream;
try {
- xmlInputStream = new File(xmlFile).toURL().openStream();
+ xmlInputStream = new File(xmlFile).toURI().toURL().openStream();
} catch (IOException e) {
LOG.log(Level.WARNING,
"IOException when getting input stream from [" + xmlFile
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/BasicVersioner.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/BasicVersioner.java
index 437c4d2..8795ce6 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/BasicVersioner.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/BasicVersioner.java
@@ -84,7 +84,7 @@
String dataStoreRef;
try {
- dataStoreRef = new File(new URI(productRepoPath)).toURL()
+ dataStoreRef = new File(new URI(productRepoPath)).toURI().toURL()
.toExternalForm();
if(!dataStoreRef.endsWith("/")){
dataStoreRef+="/";
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/DateTimeVersioner.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/DateTimeVersioner.java
index e72ab97..48e48aa 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/DateTimeVersioner.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/DateTimeVersioner.java
@@ -109,7 +109,7 @@
try {
dataStoreRef = new File(new URI(product.getProductType()
- .getProductRepositoryPath())).toURL()
+ .getProductRepositoryPath())).toURI().toURL()
.toExternalForm()
+ "/"
+ product.getProductName()
@@ -154,7 +154,7 @@
try {
String dataStoreRef = new File(new URI(product.getProductType()
- .getProductRepositoryPath())).toURL().toExternalForm()
+ .getProductRepositoryPath())).toURI().toURL().toExternalForm()
+ URLEncoder.encode(product.getProductName(), "UTF-8")
+ "/";
LOG.log(Level.INFO,
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/VersioningUtils.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/VersioningUtils.java
index 8028bec..72ddeb6 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/VersioningUtils.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/VersioningUtils.java
@@ -88,7 +88,7 @@
if (!dir.equals(dirRoot)) {
try {
Reference r = new Reference();
- r.setOrigReference(dir.toURL().toExternalForm());
+ r.setOrigReference(dir.toURI().toURL().toExternalForm());
r.setFileSize(dir.length());
references.add(r);
} catch (MalformedURLException e) {
@@ -106,7 +106,7 @@
// add the file references
try {
Reference r = new Reference();
- r.setOrigReference(file.toURL().toExternalForm());
+ r.setOrigReference(file.toURI().toURL().toExternalForm());
r.setFileSize(file.length());
references.add(r);
} catch (MalformedURLException e) {
@@ -221,7 +221,7 @@
String productRepoPathRef;
try {
- productRepoPathRef = new File(new URI(productRepoPath)).toURL()
+ productRepoPathRef = new File(new URI(productRepoPath)).toURI().toURL()
.toExternalForm();
if (!productRepoPathRef.endsWith("/")) {
diff --git a/metadata/src/main/java/org/apache/oodt/cas/metadata/extractors/CopyAndRewriteConfigReader.java b/metadata/src/main/java/org/apache/oodt/cas/metadata/extractors/CopyAndRewriteConfigReader.java
index 016b59e..d7deb08 100644
--- a/metadata/src/main/java/org/apache/oodt/cas/metadata/extractors/CopyAndRewriteConfigReader.java
+++ b/metadata/src/main/java/org/apache/oodt/cas/metadata/extractors/CopyAndRewriteConfigReader.java
@@ -46,7 +46,7 @@
throws MetExtractorConfigReaderException {
try {
CopyAndRewriteConfig config = new CopyAndRewriteConfig();
- config.load(configFile.toURL().openStream());
+ config.load(configFile.toURI().toURL().openStream());
return config;
} catch (Exception e) {
throw new MetExtractorConfigReaderException("Failed to parse '"
diff --git a/metadata/src/main/java/org/apache/oodt/cas/metadata/extractors/CopyAndRewriteExtractor.java b/metadata/src/main/java/org/apache/oodt/cas/metadata/extractors/CopyAndRewriteExtractor.java
index b3ba890..3314046 100644
--- a/metadata/src/main/java/org/apache/oodt/cas/metadata/extractors/CopyAndRewriteExtractor.java
+++ b/metadata/src/main/java/org/apache/oodt/cas/metadata/extractors/CopyAndRewriteExtractor.java
@@ -84,7 +84,7 @@
try {
met = new SerializableMetadata(new File(PathUtils
.replaceEnvVariables(((CopyAndRewriteConfig) this.config)
- .getProperty("orig.met.file.path"))).toURL()
+ .getProperty("orig.met.file.path"))).toURI().toURL()
.openStream());
} catch (Exception e) {
LOG.log(Level.SEVERE, e.getMessage());
diff --git a/pcs/input/src/main/java/org/apache/oodt/pcs/input/PGEXMLFileUtils.java b/pcs/input/src/main/java/org/apache/oodt/pcs/input/PGEXMLFileUtils.java
index 1fb8677..8f3795d 100644
--- a/pcs/input/src/main/java/org/apache/oodt/pcs/input/PGEXMLFileUtils.java
+++ b/pcs/input/src/main/java/org/apache/oodt/pcs/input/PGEXMLFileUtils.java
@@ -338,7 +338,7 @@
InputStream xmlInputStream;
try {
- xmlInputStream = new File(xmlFile).toURL().openStream();
+ xmlInputStream = new File(xmlFile).toURI().toURL().openStream();
} catch (IOException e) {
LOG.log(Level.WARNING, "IOException when getting input stream from ["
+ xmlFile + "]: returning null document root");
diff --git a/pge/src/main/java/org/apache/oodt/cas/pge/PGETask.java b/pge/src/main/java/org/apache/oodt/cas/pge/PGETask.java
index d55c532..68a4eda 100644
--- a/pge/src/main/java/org/apache/oodt/cas/pge/PGETask.java
+++ b/pge/src/main/java/org/apache/oodt/cas/pge/PGETask.java
@@ -79,11 +79,11 @@
}
SerializableMetadata sm = new SerializableMetadata("UTF-8", false);
- sm.loadMetadataFromXmlStream(new File(metadataFilePath).toURL()
+ sm.loadMetadataFromXmlStream(new File(metadataFilePath).toURI().toURL()
.openStream());
WorkflowTaskConfiguration config = new WorkflowTaskConfiguration();
config.getProperties().load(
- new File(configPropertiesPath).toURL().openStream());
+ new File(configPropertiesPath).toURI().toURL().openStream());
PGETask task = new PGETask(sm, config);
task.run(pgeTaskInstanceClasspath);
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/instrepo/WorkflowInstanceMetadataReader.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/instrepo/WorkflowInstanceMetadataReader.java
index 406846b..4929796 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/instrepo/WorkflowInstanceMetadataReader.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/instrepo/WorkflowInstanceMetadataReader.java
@@ -119,7 +119,7 @@
InputStream xmlInputStream;
try {
- xmlInputStream = new File(xmlFile).toURL().openStream();
+ xmlInputStream = new File(xmlFile).toURI().toURL().openStream();
} catch (IOException e) {
LOG.log(Level.WARNING,
"IOException when getting input stream from [" + xmlFile
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/lifecycle/WorkflowLifecyclesReader.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/lifecycle/WorkflowLifecyclesReader.java
index b42b8d8..9748c29 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/lifecycle/WorkflowLifecyclesReader.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/lifecycle/WorkflowLifecyclesReader.java
@@ -168,7 +168,7 @@
InputStream xmlInputStream;
try {
- xmlInputStream = new File(xmlFile).toURL().openStream();
+ xmlInputStream = new File(xmlFile).toURI().toURL().openStream();
} catch (IOException e) {
LOG.log(Level.WARNING,
"IOException when getting input stream from [" + xmlFile
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/policy/TaskPolicyReader.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/policy/TaskPolicyReader.java
index 3a0dc41..95b1400 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/policy/TaskPolicyReader.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/policy/TaskPolicyReader.java
@@ -186,7 +186,7 @@
InputStream xmlInputStream = null;
try {
- xmlInputStream = new File(xmlFile).toURL().openStream();
+ xmlInputStream = new File(xmlFile).toURI().toURL().openStream();
} catch (IOException e) {
LOG.log(Level.WARNING,
"IOException when getting input stream from [" + xmlFile
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/XMLWorkflowRepository.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/XMLWorkflowRepository.java
index 0b67db2..c946bbe 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/XMLWorkflowRepository.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/XMLWorkflowRepository.java
@@ -670,7 +670,7 @@
InputStream xmlInputStream;
try {
- xmlInputStream = new File(xmlFile).toURL().openStream();
+ xmlInputStream = new File(xmlFile).toURI().toURL().openStream();
} catch (IOException e) {
LOG.log(Level.WARNING,
"IOException when getting input stream from [" + xmlFile