File JLanguageTool-0.9.9-ignore-jre-1.5.diff of Package libreoffice-languagetool

Index: build.xml
================================================================================
--- build.xml
+++ build.xml
@@ -414,11 +414,6 @@
 <copy file="${ext.commons.lang.lib}" todir="${dist.dir}" />
 <copy file="${ext.bliki.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/gui/Configuration.java
+++ src/java/de/danielnaber/languagetool/gui/Configuration.java
@@ -23,6 +23,7 @@
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.lang.ClassLoader;
 import java.util.*;
 
 import de.danielnaber.languagetool.Language;
@@ -145,7 +146,18 @@
       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) {
--- 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;
@@ -451,6 +452,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) {
@@ -614,9 +623,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;
openSUSE Build Service is sponsored by