Replace manual creating of URL (using, e.g., "file:" + f.getAbsolutePath() ) with progrematic one.
(File.toURI().toURL()). Good for cross platform (Mac vs. Windows) git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3953 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
parent
92c271bfa1
commit
1d4d158de3
|
@ -696,7 +696,7 @@ public class RhinoToAstTranslator {
|
|||
URL url;
|
||||
if (sourceModule instanceof SourceFileModule) {
|
||||
try {
|
||||
url = new URL("file://" + ((SourceFileModule) sourceModule).getFile());
|
||||
url = ((SourceFileModule) sourceModule).getFile().toURI().toURL();
|
||||
} catch (MalformedURLException e) {
|
||||
Assertions.UNREACHABLE();
|
||||
return null;
|
||||
|
|
|
@ -67,7 +67,7 @@ public class Generator {
|
|||
public static void main(String args[]) throws IOException {
|
||||
Generator g = new Generator();
|
||||
if (new File(args[0]).exists()) {
|
||||
g.generate(new URL("file:" + args[0]), new File(args[1]));
|
||||
g.generate(new File(args[0]).toURI().toURL(), new File(args[1]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -208,9 +208,9 @@ public abstract class TestCAstTranslator extends WalaTestCase {
|
|||
SourceFileModule[] fileNames = new SourceFileModule[args.length];
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
if (new File(args[i]).exists()) {
|
||||
fileNames[i] = Util.makeSourceModule(new URL("file:" + args[i]), args[i]);
|
||||
fileNames[i] = Util.makeSourceModule(new File(args[i]).toURI().toURL(), args[i]);
|
||||
} else if (new File(testPath + args[i]).exists()) {
|
||||
fileNames[i] = Util.makeSourceModule(new URL("file:" + testPath + args[i]), args[i]);
|
||||
fileNames[i] = Util.makeSourceModule(new File(testPath + args[i]).toURI().toURL(), args[i]);
|
||||
} else {
|
||||
URL url = getClass().getClassLoader().getResource(args[i]);
|
||||
fileNames[i] = Util.makeSourceModule(url, args[i]);
|
||||
|
|
|
@ -104,7 +104,7 @@ public class Util {
|
|||
for (int i = 0; i < fileNameArgs.length; i++) {
|
||||
if (new File(fileNameArgs[i]).exists()) {
|
||||
try {
|
||||
fileNames[i] = Util.makeSourceModule(new URL("file:" + fileNameArgs[i]), fileNameArgs[i]);
|
||||
fileNames[i] = Util.makeSourceModule(new File(fileNameArgs[i]).toURI().toURL(), fileNameArgs[i]);
|
||||
} catch (MalformedURLException e) {
|
||||
Assertions.UNREACHABLE(e.toString());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue