/[packages]/updates/2/libreoffice/current/SOURCES/0001-fdo-49517-Revert-fdo-46102-Load-Java-scripts-with-cl.patch
ViewVC logotype

Contents of /updates/2/libreoffice/current/SOURCES/0001-fdo-49517-Revert-fdo-46102-Load-Java-scripts-with-cl.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 395235 - (show annotations) (download)
Thu Feb 7 22:09:33 2013 UTC (11 years, 2 months ago) by dmorgan
File size: 10702 byte(s)
- Resolves: rhbz#760765 Impress doesn't copy custom styles from one file
  to another
- Resolves: rhbz#810739 Incorrect displaying attached rtf document
- Resolves: rhbz#876606 regressions in MSO binary import filters
- Resolves: rhbz#890080 crash in SwXTextDocument::getRendererCount
- Resolves: fdo#58730 ODF fo:margin 100% bug
- Resolves: fdo#59366: Document Conversion wizard: enable "StarOffice" again
- Resolves: rhbz#894223 crash on export of .docx
- Resolves: rendering documents in browser plug-in
- Resolves: rhbz#882240 end of undo stack crash
- Resolves: rhbz#875140 fix position of cell-anchored charts
- Resolves: fdo#49517 Java macro embedded in document will not run
- Resolves: rhbz#865058 increase number of user-defined format codes
- Resolves: rhbz#854451 fdo#46278 Calc: import/export .xlsx comment visibility
- Resolves: rhbz#864858 Calc: import more than 256 sheets from .xlsx
- Resolves: rhbz#868953 Calc: open HTML documents from file dialog
- Resolves: rhbz#868479 guard against duplicated ~ in OK/Cancel
- Resolves: rhbz#863052 fix ZipIOException on mismatched timestamps
- Resolves: rhbz#820283 Writer: fix crashes in DOCX table import
- Resolves: rhbz#861680 Writer: DOCX import: fix crash on tables in substreams
- Related: rhbz#826526 Inform user about unsupported PDF encryption formats
- Resolves: rhbz#852128 Writer: avoid table undo crash
- Resolves: rhbz#689053 Writer: fix crash following delete at last table cell
- Resolves: rhbz#820283 Writer: fix crashes in DOCX table import
- Resolves: rhbz#827695 Writer: prevent crashes after incomplete print
- Resolves: fdo#54565 text misaligned in pptx
- Resolves: rhbz#855541 XIOError handler multithread woes
- Resolves: rhbz#836827 Connection to datasource could not be established using
  gcj
- Related: rhbz#850709 hunspell en-US available standalone so
  make English langpack require hunspell-en and core just
  bare bones hunspell-en-US
- Resolves: rhbz#855507 large ole2 compound files fail to load
- Resolves: rhbz#855972 crash on switching to outline view
- Resolves: rhbz#846775 Clipboard must be disposed before Selection
- Resolves: rhbz#842292 crash in scrolling multiselection in draw
- Resolves: rhbz#842552 crash in pptx import
- Resolves: rhbz#832603 abi problems with c++11
- Resolves: rhbz#836937 insanely slow with Zemberek

SILENT: Sync with fedora

1 From cabcfa6732224ad36db52e33fb96f1d776c43f2d Mon Sep 17 00:00:00 2001
2 From: Stephan Bergmann <sbergman@redhat.com>
3 Date: Fri, 26 Oct 2012 16:22:16 +0200
4 Subject: [PATCH] fdo#49517: Revert "fdo#46102: Load Java scripts with class
5 loaders [...]"
6
7 This reverts commit dd6c4f4db1d62268d73e09ae52d23f760a967dcc "fdo#46102: Load
8 Java scripts with class loaders that actually find them." That commit broke
9 support for macros embedded in documents (as
10 new java.net.URL("vnd.sun.star.tdoc:...") throws a MalformedURLExcetpion), and
11 it looks like that commit was not necessary after all -- or rather that what it
12 tried to work around must have been some other problem that has been fixed
13 meanwhile. "It is unclear to me how the Java script provider shall ever have
14 found the script jars in the past" indicates that something must have been
15 fishy, and what I failed to notice back then is that createURL creates
16 java.net.URL instances with a UCBStreamHandler that does allow to obtain content
17 from weird-looking URLs.
18
19 Anyway, with that reverted, all three following scenarios work on both current
20 master (towards LO 3.7) and libreoffice-3-6 (towards LO 3.6.4); I haven't yet
21 come around to test on libreoffice-3-5:
22
23 1 Stock macros, "Tools - Macros - Run Macro... - LibreOffice Macros -
24 HelloWorld", running all of the four "helloworld.bsh", "helloworld.js",
25 "HelloWorldPyhton", and
26 "org.libreoffice.example.java_scripts.HelloWorld.printHW".
27
28 2 Per-document macros, loading test.odt attached to fdo#49517, then "Tools -
29 Macros - Run Macro... - test.odt - HelloWorld", running
30 "org.libreoffice.example.java_scripts.HelloWorld.printHW".
31
32 3 Extension macros, installing ScriptDispatch.oxt attached to fdo#46012 as
33 shared extension, then loading StartScriptDispatch.odt attached to fdo#46012 and
34 pressing the "Start Java via ScriptProvider" button.
35
36 Change-Id: I31cd16b3720ffeb1058722d4d1fdffb773f8a067
37 (cherry picked from commit 7ea7fb009ddcfb0723e88ba0c5778b5fdbe2b553)
38 ---
39 .../script/framework/container/ScriptMetaData.java | 46 ++--------------------
40 .../framework/provider/ClassLoaderFactory.java | 6 +--
41 .../beanshell/ScriptEditorForBeanShell.java | 3 +-
42 .../beanshell/ScriptProviderForBeanShell.java | 3 +-
43 .../provider/java/ScriptProviderForJava.java | 2 +-
44 .../javascript/ScriptProviderForJavaScript.java | 3 +-
45 6 files changed, 9 insertions(+), 54 deletions(-)
46
47 diff --git a/scripting/java/com/sun/star/script/framework/container/ScriptMetaData.java b/scripting/java/com/sun/star/script/framework/container/ScriptMetaData.java
48 index 178f480..1cf99d7 100755
49 --- a/scripting/java/com/sun/star/script/framework/container/ScriptMetaData.java
50 +++ b/scripting/java/com/sun/star/script/framework/container/ScriptMetaData.java
51 @@ -50,14 +50,7 @@ import com.sun.star.script.framework.io.UCBStreamHandler;
52
53 import com.sun.star.ucb.XSimpleFileAccess2;
54
55 -import com.sun.star.uno.AnyConverter;
56 import com.sun.star.uno.UnoRuntime;
57 -import com.sun.star.uno.XComponentContext;
58 -
59 -import com.sun.star.uri.UriReferenceFactory;
60 -import com.sun.star.uri.XVndSunStarExpandUrl;
61 -
62 -import com.sun.star.util.XMacroExpander;
63
64 public class ScriptMetaData extends ScriptEntry implements Cloneable {
65 private boolean hasSource = false;
66 @@ -253,8 +246,7 @@ public class ScriptMetaData extends ScriptEntry implements Cloneable {
67 return "\nParcelLocation = " + getParcelLocation() + "\nLocationPlaceHolder = " + locationPlaceHolder + super.toString();
68 }
69
70 - public URL[] getClassPath(XComponentContext context)
71 - throws java.net.MalformedURLException
72 + public URL[] getClassPath() throws java.net.MalformedURLException
73 {
74 try
75 {
76 @@ -282,7 +274,7 @@ public class ScriptMetaData extends ScriptEntry implements Cloneable {
77 {
78 String relativeClasspath = (String)stk.nextElement();
79 String pathToProcess = PathUtils.make_url( parcelPath, relativeClasspath);
80 - URL url = expandURL( context, pathToProcess );
81 + URL url = createURL( pathToProcess );
82 if ( url != null )
83 {
84 classPathVec.add ( url );
85 @@ -291,7 +283,7 @@ public class ScriptMetaData extends ScriptEntry implements Cloneable {
86 }
87 if ( classPathVec.size() == 0)
88 {
89 - URL url = expandURL( context, parcelPath );
90 + URL url = createURL( parcelPath );
91 if ( url != null )
92 {
93 classPathVec.add(url);
94 @@ -308,38 +300,6 @@ public class ScriptMetaData extends ScriptEntry implements Cloneable {
95 }
96
97 }
98 -
99 - private URL expandURL(XComponentContext context, String url)
100 - throws java.net.MalformedURLException
101 - {
102 - XVndSunStarExpandUrl exp = UnoRuntime.queryInterface(
103 - XVndSunStarExpandUrl.class,
104 - UriReferenceFactory.create(context).parse(url));
105 - String expurl;
106 - if (exp == null) {
107 - expurl = url;
108 - } else {
109 - XMacroExpander expander;
110 - try {
111 - expander = (XMacroExpander) AnyConverter.toObject(
112 - XMacroExpander.class,
113 - context.getValueByName(
114 - "/singletons/com.sun.star.util.theMacroExpander"));
115 - } catch (com.sun.star.lang.IllegalArgumentException e) {
116 - throw new RuntimeException(e);
117 - }
118 - try {
119 - expurl = exp.expand(expander);
120 - } catch (com.sun.star.lang.IllegalArgumentException e) {
121 - java.net.MalformedURLException e2 =
122 - new java.net.MalformedURLException(e.toString());
123 - e2.initCause(e);
124 - throw e2;
125 - }
126 - }
127 - return new URL(expurl);
128 - }
129 -
130 private URL createURL( String path ) throws java.net.MalformedURLException
131 {
132 URL url = null;
133 diff --git a/scripting/java/com/sun/star/script/framework/provider/ClassLoaderFactory.java b/scripting/java/com/sun/star/script/framework/provider/ClassLoaderFactory.java
134 index 081204f..641ca58 100755
135 --- a/scripting/java/com/sun/star/script/framework/provider/ClassLoaderFactory.java
136 +++ b/scripting/java/com/sun/star/script/framework/provider/ClassLoaderFactory.java
137 @@ -31,7 +31,6 @@ import java.net.*;
138
139 import com.sun.star.script.framework.log.LogUtils;
140 import com.sun.star.script.framework.container.ScriptMetaData;
141 -import com.sun.star.uno.XComponentContext;
142
143 /**
144 * Class Loader Factory
145 @@ -43,12 +42,11 @@ public class ClassLoaderFactory
146 {
147 private ClassLoaderFactory() {}
148
149 - public static ClassLoader getURLClassLoader(
150 - XComponentContext context, ScriptMetaData scriptData )
151 + public static ClassLoader getURLClassLoader( ScriptMetaData scriptData )
152 throws NoSuitableClassLoaderException, MalformedURLException
153 {
154 ClassLoader parent = scriptData.getClass().getClassLoader();
155 - URL[] classPath = scriptData.getClassPath(context);
156 + URL[] classPath = scriptData.getClassPath();
157 LogUtils.DEBUG("Classpath has length " + classPath.length );
158 for ( int i=0; i < classPath.length; i++ )
159 {
160 diff --git a/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java b/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java
161 index 9f6739d..cbbcfc3 100755
162 --- a/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java
163 +++ b/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptEditorForBeanShell.java
164 @@ -202,8 +202,7 @@ public class ScriptEditorForBeanShell
165 try {
166 ClassLoader cl = null;
167 try {
168 - cl = ClassLoaderFactory.getURLClassLoader(
169 - context.getComponentContext(), entry );
170 + cl = ClassLoaderFactory.getURLClassLoader( entry );
171 }
172 catch (Exception ignore) // TODO re-examine error handling
173 {
174 diff --git a/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptProviderForBeanShell.java b/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptProviderForBeanShell.java
175 index 22a9ea8..95c7278 100755
176 --- a/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptProviderForBeanShell.java
177 +++ b/scripting/java/com/sun/star/script/framework/provider/beanshell/ScriptProviderForBeanShell.java
178 @@ -196,8 +196,7 @@ class ScriptImpl implements XScript
179 ClassLoader cl = null;
180 URL sourceUrl = null;
181 try {
182 - cl = ClassLoaderFactory.getURLClassLoader(
183 - m_xContext, metaData );
184 + cl = ClassLoaderFactory.getURLClassLoader( metaData );
185 sourceUrl = metaData.getSourceURL();
186 }
187 catch ( java.net.MalformedURLException mfu )
188 diff --git a/scripting/java/com/sun/star/script/framework/provider/java/ScriptProviderForJava.java b/scripting/java/com/sun/star/script/framework/provider/java/ScriptProviderForJava.java
189 index 3f392f7..707ea05 100755
190 --- a/scripting/java/com/sun/star/script/framework/provider/java/ScriptProviderForJava.java
191 +++ b/scripting/java/com/sun/star/script/framework/provider/java/ScriptProviderForJava.java
192 @@ -205,7 +205,7 @@ class ScriptImpl implements XScript
193 try {
194 LogUtils.DEBUG( "Classloader starting..." );
195 scriptLoader = ClassLoaderFactory.getURLClassLoader(
196 - m_xContext, metaData );
197 + metaData );
198 LogUtils.DEBUG( "Classloader finished..." );
199 }
200 catch (MalformedURLException mfe )
201 diff --git a/scripting/java/com/sun/star/script/framework/provider/javascript/ScriptProviderForJavaScript.java b/scripting/java/com/sun/star/script/framework/provider/javascript/ScriptProviderForJavaScript.java
202 index 39205d4..9f04d91 100755
203 --- a/scripting/java/com/sun/star/script/framework/provider/javascript/ScriptProviderForJavaScript.java
204 +++ b/scripting/java/com/sun/star/script/framework/provider/javascript/ScriptProviderForJavaScript.java
205 @@ -195,8 +195,7 @@ class ScriptImpl implements XScript
206 ClassLoader cl = null;
207 URL sourceUrl = null;
208 try {
209 - cl = ClassLoaderFactory.getURLClassLoader(
210 - m_xContext, metaData );
211 + cl = ClassLoaderFactory.getURLClassLoader( metaData );
212 sourceUrl = metaData.getSourceURL();
213 }
214 catch ( java.net.MalformedURLException mfu )
215 --
216 1.7.11.7
217

  ViewVC Help
Powered by ViewVC 1.1.30