File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed
src/main/java/org/owasp/esapi/reference Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change 2020import java .io .FileNotFoundException ;
2121import java .io .IOException ;
2222import java .io .InputStream ;
23+ import java .net .URISyntaxException ;
2324import java .net .URL ;
2425import java .util .ArrayList ;
2526import java .util .Arrays ;
@@ -581,13 +582,17 @@ public File getResourceFile(String filename) {
581582 }
582583
583584 if (fileUrl != null ) {
584- String fileLocation = fileUrl .getFile ();
585- f = new File (fileLocation );
586- if (f .exists ()) {
587- logSpecial ("Found in SystemResource Directory/resourceDirectory: " + f .getAbsolutePath ());
588- return f ;
589- } else {
590- logSpecial ("Not found in SystemResource Directory/resourceDirectory (this should never happen): " + f .getAbsolutePath ());
585+ try {
586+ String fileLocation = fileUrl .toURI ().getPath ();
587+ f = new File (fileLocation );
588+ if (f .exists ()) {
589+ logSpecial ("Found in SystemResource Directory/resourceDirectory: " + f .getAbsolutePath ());
590+ return f ;
591+ } else {
592+ logSpecial ("Not found in SystemResource Directory/resourceDirectory (this should never happen): " + f .getAbsolutePath ());
593+ }
594+ } catch (URISyntaxException e ) {
595+ logSpecial ("Error while converting URL " + fileUrl + " to file path: " + e .getMessage ());
591596 }
592597 } else {
593598 logSpecial ("Not found in SystemResource Directory/resourceDirectory: " + resourceDirectory + File .separator + filename );
You can’t perform that action at this time.
0 commit comments