-
Bug
-
Resolution: Unresolved
-
Critical
-
None
-
6.1.0
-
None
-
None
Steps to Reproduce
- <spreadsheet src="~./blank.xlsx"/>
- run the zul
Current Result
org.zkoss.zk.ui.UiException: resource for ~./blank.xlsx not found.
at io.keikai.ui.Spreadsheet.getSBook(Spreadsheet.java:735)
at io.keikai.ui.Spreadsheet.getSelectedSSheet(Spreadsheet.java:918)
at io.keikai.ui.Spreadsheet.doInvalidate(Spreadsheet.java:2890)
at io.keikai.ui.Spreadsheet.invalidate(Spreadsheet.java:2712)
at io.keikai.ui.Spreadsheet.setSrc(Spreadsheet.java:990)
Expected Result
keikai can load the file without the error
Debug Information
- almost all zk components can accept classpath web resource path ~./ (https://www.zkoss.org/wiki/ZK_Developer%27s_Reference/UI_Composing/ZUML/Include_a_Page#Classpath_Web_Resource_Path)
- it allows a spreadsheet in a spring-boot app (jar package) to load file in the classpath
- Spreadsheet.getSBook()
if (_src.startsWith("/")) {// try to load by application // context. WebApp wapp = Executions.getCurrent().getDesktop().getWebApp(); String path = wapp.getRealPath(_src); if (path != null) { File file = new File(path); // if (file.isDirectory()) // throw new IllegalArgumentException("Your input source is a directory, not a vaild file"); if (file.exists()) url = file.toURI().toURL(); } else url = wapp.getResource(_src); }
wapp.getResource(_src) can load the ~./ correctly but wrong implementation