Added new inputlocation for downloading jars from maven#1045
Added new inputlocation for downloading jars from maven#1045
Conversation
...ecode/src/main/java/sootup/java/bytecode/inputlocation/DownloadJarAnalysisInputLocation.java
Outdated
Show resolved
Hide resolved
| HttpURLConnection connection; | ||
| String tempDirPath = System.getProperty("java.io.tmpdir"); | ||
| String filename = downloadURL.substring(downloadURL.lastIndexOf("/") + 1); | ||
| File file = new File(tempDirPath, filename); |
There was a problem hiding this comment.
Hmm shouldn't we use a real tmpfile? Writing to arbitrary files in the tmpdir
is not so nice:)
There was a problem hiding this comment.
This is the real temp file, tmp directory by JVM.
There was a problem hiding this comment.
A user could have intentionally created a file called /tmp/foo-1.2.3.jar,
which is then overwritten by the downloader. IMHO, we shouldn't do that.
Let's use a "real" tmpfile, which is created, for instance, via
Files.createTempFile(...).
| } | ||
| } | ||
| } catch (IOException e) { | ||
| throw new RuntimeException(e); |
There was a problem hiding this comment.
Hmm maybe an UncheckedIOException?
There was a problem hiding this comment.
I don't think Unchecked is really needed here. Simple file operations, so IOException itself is enough i think.
There was a problem hiding this comment.
I was talking about "new RuntimeException(e)" vs. "new UncheckedIOException(e)".
No description provided.