Apache OpenOffice (AOO) Bugzilla – Issue 23643
wizards, scripting and JDK 1.3.1
Last modified: 2004-01-08 18:30:26 UTC
Hi, javac -classpath ".:../../../../../unxlngi4.pro/class:/usr/lib/java/jre/lib/rt.jar:.:/home/pavel/BuildDir/ooo_1.1.1_src/solver/645/unxlngi4.pro/bin/unoil.jar:/home/pavel/BuildDir/ooo_1.1.1_src/solver/645/unxlngi4.pro/bin/jurt.jar:/home/pavel/BuildDir/ooo_1.1.1_src/solver/645/unxlngi4.pro/bin/ridl.jar:/home/pavel/BuildDir/ooo_1.1.1_src/solver/645/unxlngi4.pro/bin/sandbox.jar:/home/pavel/BuildDir/ooo_1.1.1_src/solver/645/unxlngi4.pro/bin/juh.jar:/home/pavel/BuildDir/ooo_1.1.1_src/solver/645/unxlngi4.pro/bin/jut.jar:/home/pavel/BuildDir/ooo_1.1.1_src/solver/645/unxlngi4.pro/bin/java_uno.jar:/home/pavel/BuildDir/ooo_1.1.1_src/solver/645/unxlngi4.pro/bin/java_uno_accessbridge" -d ../../../../../unxlngi4.pro/class TextDocument.java Tools.java UNODialogs.java Tools.java:874: decode(java.lang.String) in java.net.URLDecoder cannot be applied to (java.lang.String,java.lang.String) URLPath = oURL.decode(URLPath, "UTF-8"); ^ 1 error dmake: Error code 1, while making '../../../../../unxlngi4.pro/misc/common_dummy.java' I use this change for now: - try { - URLPath = oURL.decode(URLPath, "UTF-8"); - }catch (java.io.UnsupportedEncodingException jexception){ - jexception.printStackTrace(System.out); - } + URLPath = oURL.decode(URLPath);
Sorry: This applies to cws_fix645_ooo111fix2 as well as cws_src680_ooo20031216.
reassigned to tom
The same applies to scripting/java/com/sun/star/script/framework/provider/PathUtils.java: @@ -266,12 +266,7 @@ LogUtils.DEBUG("toScriptLocation, share path: " + sharePath); LogUtils.DEBUG("toScriptLocation, user path: " + userPath); - try { - path = URLDecoder.decode(path, "UTF-8"); - } - catch (java.io.UnsupportedEncodingException ignore) { - // ignore - } + path = URLDecoder.decode(path); if (m_windows) { path = replaceWindowsPathSeparators(path);
scripting is of course only in 20031216.
I will take a look into this one.
pjanik, the fix you suggest is using the simple method "decode" wwhich uses standard encoding. The problem is that OO.o uses UTF-8 for URLs. A simple decode would lead to a false path when the URL contains a special character (öäüß, etc). This can lead to a big problem, since we have a lot of localizations that might install OO.o into a path that includes special characters. Currently there is no UNO service that can do that decoding in 1.1. One is being developed for OO 2.0. So the question is what is more important: -Java 1.3 compatibility -Support for paths that include special characters
Ok, I did a fix that implements the URL decoding functionality without the use of Java internal classes, but using OO.o API: public static String convertfromURLNotation(XMultiServiceFactory xmsf, String URLPath){ try { Object fcv = xmsf.createInstance("com.sun.star.ucb.FileContentProvider"); XFileIdentifierConverter filenameConverter = (XFileIdentifierConverter) UnoRuntime.queryInterface( XFileIdentifierConverter.class,fcv); return filenameConverter.getSystemPathFromFileURL(URLPath); } catch (Exception ex) { ex.printStackTrace(); return null; } }
Duncan, can you please take over for the scripting part?
since scripting is only for 2.0 target we should open a new issue and mark this one as fixed.
Thanks Tom. I reported #i24190# for scripting issue. Marking as fixed.
Verified in fix2, closing.