Issue 23643 - wizards, scripting and JDK 1.3.1
Summary: wizards, scripting and JDK 1.3.1
Status: CLOSED FIXED
Alias: None
Product: porting
Classification: Code
Component: code (show other issues)
Version: current
Hardware: All All
: P3 Trivial (vote)
Target Milestone: OOo 1.1.1
Assignee: duncan.foster
QA Contact: issues@porting
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-12-17 20:23 UTC by pavel
Modified: 2004-01-08 18:30 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description pavel 2003-12-17 20:23:16 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);
Comment 1 pavel 2003-12-17 20:24:47 UTC
Sorry: This applies to cws_fix645_ooo111fix2 as well as cws_src680_ooo20031216.
Comment 2 Martin Hollmichel 2003-12-19 06:53:21 UTC
reassigned to tom
Comment 3 pavel 2003-12-20 10:32:32 UTC
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);
Comment 4 pavel 2003-12-20 10:34:52 UTC
scripting is of course only in 20031216.
Comment 5 tom 2003-12-23 13:15:51 UTC
I will take a look into this one.
Comment 6 tom 2004-01-07 10:35:35 UTC
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
Comment 7 tom 2004-01-07 17:48:12 UTC
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;
	}		
    }

Comment 8 tom 2004-01-07 17:53:07 UTC
Duncan, can you please take over for the scripting part?
Comment 9 Martin Hollmichel 2004-01-07 18:22:10 UTC
since scripting is only for 2.0 target we should open a new issue and mark this
one as fixed.
Comment 10 pavel 2004-01-07 19:10:13 UTC
Thanks Tom.

I reported #i24190# for scripting issue.

Marking as fixed.
Comment 11 pavel 2004-01-08 18:30:26 UTC
Verified in fix2, closing.