mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 18:29:37 +02:00
GP-1066: Making Framework Utility Java 1.8 compatible again
This commit is contained in:
parent
11149b9ef2
commit
c270a5d31e
1 changed files with 13 additions and 4 deletions
|
@ -15,11 +15,9 @@
|
|||
*/
|
||||
package ghidra;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.*;
|
||||
import java.net.URL;
|
||||
import java.net.URLDecoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
|
||||
import generic.jar.ResourceFile;
|
||||
|
@ -93,6 +91,17 @@ public class GhidraJarApplicationLayout extends GhidraApplicationLayout {
|
|||
* @return A {@link ResourceFile} from the given {@link URL}
|
||||
*/
|
||||
private ResourceFile fromUrl(URL url) {
|
||||
return new ResourceFile(URLDecoder.decode(url.toExternalForm(), StandardCharsets.UTF_8));
|
||||
String urlString = url.toExternalForm();
|
||||
try {
|
||||
// Decode the URL to replace things like %20 with real spaces.
|
||||
// Note: can't use URLDecoder.decode(String, Charset) because Utility must be
|
||||
// Java 1.8 compatible.
|
||||
urlString = URLDecoder.decode(urlString, "UTF-8");
|
||||
}
|
||||
catch (UnsupportedEncodingException e) {
|
||||
// Shouldn't happen, but failed to find UTF-8 encoding.
|
||||
// Proceed without decoding, and hope for the best.
|
||||
}
|
||||
return new ResourceFile(urlString);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue