File tree Expand file tree Collapse file tree 3 files changed +20
-9
lines changed
Expand file tree Collapse file tree 3 files changed +20
-9
lines changed Original file line number Diff line number Diff line change 2323import java .io .File ;
2424import java .io .PrintStream ;
2525import java .net .URL ;
26+ import java .nio .file .Path ;
2627import javax .swing .ImageIcon ;
2728import javax .swing .UIManager ;
2829import jfs .conf .JFSConfig ;
@@ -64,8 +65,16 @@ public static String getHome() {
6465
6566 // JFS started from JAR:
6667 if (packageUrl .getProtocol ().equals ("jar" )) {
67- URL jarUrl = new URL (packageUrl .getFile ());
68- File jfsFile = new File (jarUrl .toURI ());
68+ String uriString = packageUrl .getFile ();
69+ int idx = uriString .indexOf ('!' );
70+ if (idx >0 ) {
71+ uriString = uriString .substring (0 , idx );
72+ } // if
73+ idx = uriString .lastIndexOf ("file:" );
74+ if (idx >=0 ) {
75+ uriString =uriString .substring (idx +5 );
76+ }
77+ File jfsFile = new File (uriString );
6978 jfsLibDir = jfsFile .getParentFile ().getParentFile ();
7079 }
7180
Original file line number Diff line number Diff line change 3939import java .net .MalformedURLException ;
4040import java .net .URISyntaxException ;
4141import java .net .URL ;
42+ import java .nio .file .Path ;
4243import java .text .SimpleDateFormat ;
4344import java .util .Date ;
4445import java .util .Enumeration ;
@@ -159,12 +160,15 @@ private String getAppTitle(String appName) {
159160 File jfsFile = null ;
160161 // JFS started from JAR:
161162 if (packageUrl .getProtocol ().equals ("jar" )) {
162- URL jarUrl = new URL (packageUrl .getFile ());
163- String uriString = jarUrl .toURI ().getPath ();
163+ String uriString = packageUrl .getFile ();
164164 int idx = uriString .indexOf ('!' );
165165 if (idx >0 ) {
166166 uriString = uriString .substring (0 , idx );
167167 } // if
168+ idx = uriString .lastIndexOf ("file:" );
169+ if (idx >=0 ) {
170+ uriString =uriString .substring (idx +5 );
171+ }
168172 jfsFile = new File (uriString );
169173 }
170174 // JFS started from classes directory:
@@ -175,8 +179,6 @@ private String getAppTitle(String appName) {
175179 buildInfo += " - build date " +formatter .format (new Date (jfsFile .lastModified ()))+" " ;
176180 } catch (URISyntaxException use ) {
177181 ;
178- } catch (MalformedURLException mue ) {
179- ;
180182 } // try/catch
181183
182184 String version = JFSConst .getInstance ().getString ("jfs.version" );
Original file line number Diff line number Diff line change 11/*
2- * Copyright (C) 2010-2022 Martin Goellnitz
2+ * Copyright (C) 2010-2026 Martin Goellnitz
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
2424import java .io .InputStream ;
2525import java .io .OutputStream ;
2626import java .io .UnsupportedEncodingException ;
27- import java .net .URL ;
2827import java .net .URLEncoder ;
28+ import java .nio .file .Paths ;
2929import java .util .List ;
3030import jfs .conf .JFSConfig ;
3131import jfs .sync .JFSFile ;
@@ -328,7 +328,7 @@ public JFSFile[] getList() {
328328 List <DavResource > listing = ((JFSWebDavFileProducer )getFileProducer ()).getListing (url );
329329 if (listing .size ()>1 ) {
330330 list = new JFSWebDavFile [listing .size ()-1 ];
331- int rootLength = new URL (getFileProducer ().getRootPath ()).getPath ().length ();
331+ int rootLength = Paths . get (getFileProducer ().getRootPath ()). toUri (). toURL ( ).getPath ().length ();
332332
333333 int i = 0 ;
334334 for (DavResource resource : listing ) {
You can’t perform that action at this time.
0 commit comments