File JLanguageTool-0.9.9-ignore-jre-1.5.diff of Package OpenOffice_org-LanguageTool
--- build.xml
+++ build.xml
@@ -378,11 +378,6 @@
<copy file="${ext.segment.lib}" todir="${dist.dir}" />
<copy file="${ext.loomchild.util.lib}" todir="${dist.dir}" />
<copy file="${ext.junit.lib}" todir="${dist.dir}" />
-<!-- JAXB jars for Java 1.5 -->
-<copy file="${ext.jaxb-api.lib}" todir="${dist.dir}" />
-<copy file="${ext.jaxb-impl.lib}" todir="${dist.dir}" />
-<copy file="${ext.jsr.lib}" todir="${dist.dir}" />
-<copy file="${ext.activation.lib}" todir="${dist.dir}" />
<copy todir="${dist.dir}/linux">
--- src/java/de/danielnaber/languagetool/openoffice/Main.java
+++ src/java/de/danielnaber/languagetool/openoffice/Main.java
@@ -25,6 +25,7 @@
*/
import java.io.IOException;
import java.io.File;
+import java.lang.ClassLoader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
@@ -456,6 +457,14 @@
* @return An array of Locales supported by LT.
*/
public final Locale[] getLocales() {
+ // FIXME: hack to disable the functionality for JRE 1.5
+ // javax.xml.bind.JAXBException is part of JRE 1.6
+ try {
+ ClassLoader cl = ClassLoader.getSystemClassLoader();
+ cl.loadClass("javax.xml.bind.JAXBException");
+ } catch (ClassNotFoundException e) {
+ return new Locale[0];
+ }
try {
int dims = 0;
for (final Language element : Language.LANGUAGES) {
@@ -619,9 +628,9 @@
if (version != null
&& (version.startsWith("1.0") || version.startsWith("1.1")
|| version.startsWith("1.2") || version.startsWith("1.3") || version
- .startsWith("1.4"))) {
+ .startsWith("1.4") || version.startsWith("1.5"))) {
final DialogThread dt = new DialogThread(
- "Error: LanguageTool requires Java 1.5 or later. Current version: "
+ "Error: LanguageTool requires Java 1.6 or later. Current version: "
+ version);
dt.start();
return false;
--- src/java/de/danielnaber/languagetool/gui/Configuration.java.old 2009-01-01 23:39:30.000000000 +0100
+++ src/java/de/danielnaber/languagetool/gui/Configuration.java 2009-08-20 18:59:24.000000000 +0200
@@ -23,6 +23,7 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.lang.ClassLoader;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Properties;
@@ -154,7 +155,18 @@ public class Configuration {
final String motherTongueStr = (String) props
.get(MOTHER_TONGUE_CONFIG_KEY);
if (motherTongueStr != null) {
- motherTongue = Language.getLanguageForShortName(motherTongueStr);
+ // FIXME: hack to disable the functionality for JRE 1.5
+ // javax.xml.bind.JAXBException is part of JRE 1.6
+ boolean isJRE15 = false;
+ try {
+ ClassLoader cl = ClassLoader.getSystemClassLoader();
+ cl.loadClass("javax.xml.bind.JAXBException");
+ } catch (ClassNotFoundException e) {
+ isJRE15 = true;
+ }
+ if (!isJRE15) {
+ motherTongue = Language.getLanguageForShortName(motherTongueStr);
+ }
}
final String runServerString = (String) props.get(SERVER_RUN_CONFIG_KEY);
if (runServerString != null) {