()
| 55 | chooser.showOpenDialog(frame, new Runnable() { |
| 56 | |
| 57 | @Override |
| 58 | public void run() { |
| 59 | File file = chooser.getSelectedFile(); |
| 60 | String path = file.getAbsolutePath(); |
| 61 | if (!path.endsWith(".trz")) |
| 62 | return; |
| 63 | System.out.println("TRZ path " + path); |
| 64 | |
| 65 | OSPRuntime.setPreference("file_chooser_directory", file.getParent()); |
| 66 | OSPRuntime.savePreferences(); |
| 67 | |
| 68 | Map<String, ZipEntry> map = ResourceLoader.getZipContents(path, false); |
| 69 | |
| 70 | for (String next : map.keySet()) { |
| 71 | if (next.contains(".htm")) { |
| 72 | System.out.println("zip entry: " + next); |
| 73 | URL url0 = null; |
| 74 | Resource res = null; |
| 75 | try { |
| 76 | url0 = new URL("jar", null, new URL("file", null, path + "!/" + next).toString()); //$NON-NLS-1$ //$NON-NLS-2$ |
| 77 | res = new Resource(url0); |
| 78 | } catch (MalformedURLException e) { |
| 79 | } |
| 80 | |
| 81 | if (res != null) |
| 82 | try { |
| 83 | URL url = res.getURL(); |
| 84 | // see https://bugs.openjdk.java.net/browse/JDK-8239054?page=com.atlassian.jira.plugin.system.issuetabpanels%3Aall-tabpanel |
| 85 | InputStream stream = getInputStreamNoCache1(url); |
| 86 | // also works: |
| 87 | // //InputStream stream = getInputStreamNoCache2(url); |
| 88 | stream.close(); |
| 89 | } catch (Exception e) { |
| 90 | System.err.println(e); |
| 91 | } |
| 92 | |
| 93 | try { |
| 94 | Files.delete(file.toPath()); |
| 95 | } catch (Exception e) { |
| 96 | System.err.println(e); |
| 97 | } |
| 98 | System.out.println("file deleted? " + !file.exists()); |
| 99 | } |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | }, null); |
| 104 | } |
nothing calls this directly
no test coverage detected