Page 1 of 1

Hunspell exceptions in Applet

Posted: Fri Dec 21, 2012 2:39 pm
by neon096
I've just added the following to the options.xml file in order to get the spell check to make sure we are using the right dictionary and automatic spell check is true. However we get the following exception. I believe I have the correct hunspell library and dictionaries on my class path. Any ideas as to what I'm missing?

Code: Select all


<entry>
<String>spell.check.options</String>
<spellCheckOptions>
<field name="automaticSpellCheck">
<Boolean>true</Boolean>
</field>
<field name="automaticSpellCheckContentTypes">
<String-array>
<String>text/xml</String>
</String-array>
</field>
<field name="spellCheckInComments">
<Boolean>false</Boolean>
</field>
<field name="spellCheckInAttributeValues">
<Boolean>false</Boolean>
</field>
<field name="spellCheckInText">
<Boolean>true</Boolean>
</field>
<field name="spellCheckInCDATA">
<Boolean>true</Boolean>
</field>
<field name="language">
<String>en_GB</String>
</field>
<field name="caseSensitive">
<Boolean>false</Boolean>
</field>
<field name="ignoreMixedCase">
<Boolean>false</Boolean>
</field>
<field name="ignoreAcronyms">
<Boolean>true</Boolean>
</field>
<field name="ignoreDigits">
<Boolean>true</Boolean>
</field>
<field name="ignoreDuplicates">
<Boolean>false</Boolean>
</field>
<field name="ignoreURL">
<Boolean>true</Boolean>
</field>
<field name="checkPunctuation">
<Boolean>false</Boolean>
</field>
<field name="allowCompound">
<Boolean>true</Boolean>
</field>
<field name="allowPrefixes">
<Boolean>false</Boolean>
</field>
<field name="allowFileExtensions">
<Boolean>true</Boolean>
</field>
<field name="obeyLangAttributes">
<Boolean>false</Boolean>
</field>
<field name="langAttrMissingUseDefault">
<Boolean>true</Boolean>
</field>
<field name="ignoreSpellCheckElements">
<String-array/>
</field>
<field name="preferredChecker">
<Integer>1</Integer>
</field>
</spellCheckOptions>
</entry>

Code: Select all


ERROR: ro.sync.ecss.component.f.c - java.io.FileNotFoundException: The Hunspell library was not created.
java.io.FileNotFoundException: The Hunspell library was not created.
at ro.sync.azcheck.ui.spellcontrol.hunspell.c$_c.<init>(Unknown Source)
at ro.sync.azcheck.ui.spellcontrol.hunspell.c.k(Unknown Source)
at ro.sync.azcheck.ui.spellcontrol.hunspell.d$_c.<init>(Unknown Source)
at ro.sync.azcheck.ui.spellcontrol.hunspell.d.eb(Unknown Source)
at ro.sync.azcheck.ui.spellcontrol.f.p(Unknown Source)
at ro.sync.azcheck.ui.n.w(Unknown Source)
at ro.sync.azcheck.ui.n.j(Unknown Source)
at ro.sync.ecss.component.f.c.vb(Unknown Source)
at ro.sync.ecss.component.f.c.pb(Unknown Source)
at ro.sync.ecss.component.f.c.cb(Unknown Source)
at ro.sync.ecss.component.bb$_b.actionPerformed(Unknown Source)
at javax.swing.Timer.fireActionPerformed(Timer.java:312)
at javax.swing.Timer$DoPostEvent.run(Timer.java:244)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:701)
at java.awt.EventQueue.access$000(EventQueue.java:102)
at java.awt.EventQueue$3.run(EventQueue.java:662)
at java.awt.EventQueue$3.run(EventQueue.java:660)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:671)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)

Re: Hunspell exceptions in Applet

Posted: Thu Dec 27, 2012 1:20 pm
by Radu
Hi Neil,

Sorry for the delay.

Are you testing the spell checking in the deployed component (embedded as an applet in a Web page) or by running its main class as a Java application?

If you are using the second approach, in the classpath you should also add a reference to the "lib" directory from the applet's project. You should also try to test the final deployed component because it should work.

I'm using Eclipse and in the ".classpath" I have an entry like
<classpathentry kind="lib" path="lib"/>
From what I remember I made this correction to the Author Component Sample Project available on our web site a couple of months ago.

Regards,
Radu

Re: Hunspell exceptions in Applet

Posted: Wed Jan 02, 2013 10:55 am
by neon096
I'm running the applet embedded as a web page. I've just noticed that I'm not having the issue with Windows, however the issue I'm having is on a Mac which means I'm not using JNLP in the webpage I'm using the <applet/> tag.

Re: Hunspell exceptions in Applet

Posted: Wed Jan 02, 2013 11:04 am
by Radu
Hi Neil,

Thanks for the details.

To what version of Oxygen do the Author Component Project libraries you are using correspond?

Author Component corresponding to Oxygen versions older than 14.0 indeed did not have Hunspell spell checking working when the classic <applet/> approach was used.

We fixed this in the Author Component project corresponding to Oxygen 14.0.

Regards,
Radu

Re: Hunspell exceptions in Applet

Posted: Wed Jan 02, 2013 11:18 am
by neon096
I believe it is 14.0

Re: Hunspell exceptions in Applet

Posted: Wed Jan 02, 2013 11:26 am
by Radu
Hi Neil,

In the oxygen.jar library there is a folder "META-INF" containing a "MANIFEST.MF" file which has a Build-Number: property. What value does it have in your case?

Regards,
Radu

Re: Hunspell exceptions in Applet

Posted: Wed Jan 02, 2013 11:30 am
by neon096
I've just had a thought I'm using the oxygen 14.0 but the hunspell stuff I think I'm using the version that came with 13.4.

Re: Hunspell exceptions in Applet

Posted: Wed Jan 02, 2013 11:43 am
by Radu
Hi Neil,

There was no 13.4, the last 13.x was 13.2 which was released in January 2012:

http://www.oxygenxml.com/whatisnew13.2.html

Looking in the oxygen.jar for the manifest property I suggested earlier should give us the date when the library was build.

If the component libraries you are using are from 13.2 you would need to upgrade them in order to have spell checking also work with the classic applet:

http://www.oxygenxml.com/oxygen_sdk.htm ... _component

By the way, the latest Java updates on MAC (Java 1.7) added support to run the applet with JNLP also on Mac. But unfortunately it added some other problems (when showing dialogs in the applet) which were fixed in the latest component project available on our web site.

Regards,
Radu

Re: Hunspell exceptions in Applet

Posted: Wed Jan 02, 2013 12:31 pm
by neon096
Build-Number: 2012060116

Re: Hunspell exceptions in Applet

Posted: Wed Jan 02, 2013 1:01 pm
by neon096
We can't just upgrade Java on a Mac as that only applies to Lion and Mountain Lion versions of OS X.

Re: Hunspell exceptions in Applet

Posted: Wed Jan 02, 2013 4:29 pm
by neon096
I've updated the Hunspell and the oxygen stuff to use the build 2012120716. I'm still getting error messages.

Code: Select all

INFO : ro.sync.azcheck.ui.spellcontrol.hunspell.d - No system property showing where the application was installed. Using the working directory instead.
WARN : ro.sync.azcheck.ui.n - Could not create the AZCheck spell checker due to:java.lang.NoClassDefFoundError: azcheck/engine/SpellException
WARN : ro.sync.azcheck.ui.n - java.io.FileNotFoundException: The Hunspell library was not created.
java.io.FileNotFoundException: The Hunspell library was not created.
The azcheck/engine/SpellException doesn't appear to be a java class that I can find (so I'm assuming its one of the native libraries). I've got the libhunspell-darwin library on the classpath.

Re: Hunspell exceptions in Applet

Posted: Thu Jan 03, 2013 11:57 am
by Radu
Hi Neil,

If you look in the sample project in the HTML file "author-component-dita-classic.html" it references libraries like:

Code: Select all

<applet width="100%" height="600" code="ro.sync.ecss.samples.AuthorComponentSampleApplet" name="authorComponentAppletName" id="authorComponentApplet"
archive="lib/oxygen-author-component-sample.jar,
lib/oxygen.jar,
lib/oxygenTokenMarkers.jar,
lib/oxygen-jing.jar,
lib/resolver.jar,
lib/xml-apis.jar,
lib/oxygen-xercesImpl.jar,
lib/oxygen-saxon9he.jar,
lib/oxygen-saxon.jar,
lib/nekohtml.jar,
lib/jna.jar,
lib/jna-native.jar,
lib/hunspell-native.jar,
lib/dicts-hunspell.jar,
lib/batik-all-1.7.jar,
lib/log4j.jar,
lib/xml-apis-ext.jar,
lib/xml-apis-xpath.jar,
lib/jide.jar,
resources/frameworks.zip.jar,
resources/options.zip.jar">....
Please make sure your <applet/> properly references the "lib/jna-native.jar", "lib/hunspell-native.jar" and "lib/dicts-hunspell.jar" and that the libraries are built and accessible to the applet in those referenced locations.

Regards,
Radu

Re: Hunspell exceptions in Applet

Posted: Thu Jan 03, 2013 4:54 pm
by neon096
I've checked the class path and compared it with the demo and I've the following.

Code: Select all

<applet code="com.xxx.xxx.oxygen.author.AuthoringApplet" name="Editor" id="authorComponentApplet" archive="lib/topics-oxygen-plugin-4.0.0-SNAPSHOT.jar,
lib/jna-14.1.jar,
lib/jna-native-14.1.jar,
lib/oxygen-14.1.jar,
lib/token-markers-14.1.jar,
lib/resolver-14.1.jar,
lib/xercesImpl-14.1.jar,
lib/saxon9he-14.1.jar,
lib/saxon-14.1.jar,
lib/spring-aop-3.1.1.RELEASE.jar,
lib/spring-asm-3.1.1.RELEASE.jar,
lib/spring-beans-3.1.1.RELEASE.jar,
lib/spring-context-3.1.1.RELEASE.jar,
lib/spring-core-3.1.1.RELEASE.jar,
lib/spring-expression-3.1.1.RELEASE.jar,
lib/log4j-1.2.16.jar,
lib/commons-logging-1.1.1.jar,
resources/frameworks.zip-20130103-1226.jar,
resources/options.zip-20130103-1226.jar,
lib/jide-14.1.jar,
lib/batik-all-1.7.jar,
lib/dicts-hunspell-14.1.jar,
lib/commons-io-1.3.2.jar,
lib/gson-2.2.2.jar,
lib/xml-apis-ext-1.0.jar,
lib/hunspell-native-14.1.jar"
height="458"
width="100%">...</applet>
This only seems to be an issue on Mac's when I set the spell.check.options in the options.xml. Does your demo have the spell.check.options set in the options.xml?

Re: Hunspell exceptions in Applet

Posted: Fri Jan 04, 2013 12:31 pm
by Radu
Hi Neil,

Here's what I tested:

I created a new Eclipse project starting from the Author Component Sample project on our web site:
http://www.oxygenxml.com/oxygen_sdk.htm ... _component

In that project I added the certificate information.
I also modified the options.zip.jar accordingly to activate auto spell check by default.
Then I run "ant" on the build file.

I moved the signed contents from the "dist" folder on our web server and opened the "author-component-dita-classic.html" both on Windows and Mac OSX. The applet worked for me, the auto spell checking was enabled from the start and misspelled words were highlighted.

Could you try to reproduce the issue on your side using such a simple project, without any additional changes to the used libraries?

If the issue can still be reproduced on your side, could you enable the Java console with maximum verbosity and send me the entire console output obtained in it? (using support@oxygenxml.com).

By the way, there is also a way to enable auto spell checking from thew Java code:

Code: Select all

AuthorComponentFactory factory = AuthorComponentFactory.getInstance();
SpellCheckOptions spellCheckOptions = factory.getSpellCheckOptions();
spellCheckOptions.automaticSpellCheck = true;
factory.setSpellCheckOptions(spellCheckOptions);
Regards,
Radu

Re: Hunspell exceptions in Applet

Posted: Thu Apr 18, 2013 6:06 pm
by sebastienlavandier
Hi Radu,

Thanks for all your explanations about it. It's great !
But, do you know where is the file where are saved the learned words ?
And secondly, do you have an idea about how solve these errors/warnings :

Code: Select all


16:44:13,347 INFO  [ro.sync.azcheck.ui.spellcontrol.hunspell.d] No system property showing where the application was installed. Using the working directory instead.
16:44:13,354 WARN [ro.sync.azcheck.ui.n] Could not create the AZCheck spell checker due to:java.lang.NoClassDefFoundError: azcheck/engine/SpellException
16:44:13,416 ERROR [ro.sync.azcheck.ui.spellcontrol.hunspell.c] The temporary library could not be deleted. Should not be a problem, will be rewritten next time.
16:44:17,157 WARN [ro.sync.ecss.images.ImageHandlerDispatcher] Cannot load the JEuclid MathML handler.
Rendering of MathML equations is not possible using JEuclid.net/sourceforge/jeuclid/LayoutContext
16:44:38,236 WARN [ro.sync.azcheck.ui.n] Could not create the AZCheck spell checker due to:java.lang.NoClassDefFoundError: azcheck/engine/SpellException
Thanks in advance for your help.

Sébastien

Re: Hunspell exceptions in Applet

Posted: Mon Apr 22, 2013 11:28 am
by Radu
Hi Sébastien,

You can ignore those warnings in the Java console. The component does not come with the "AZCheck" spell checker (which is an older alternative to the Hunspell spell checker).
The component also does not come by default with the JEuclid libraries, used to render MathML equations, they can be added to it but only if you need to render MathML equations.

About this question:
But, do you know where is the file where are saved the learned words ?
If you look in this topic:

http://www.oxygenxml.com/doc/ug-oxygen/ ... oting.html

step 4 will show you where all the component's cache is stored on the user's disk.

In the same folder you should find a spell folder which has files with the .tdi extension which should contain these learned words:

http://www.oxygenxml.com/doc/ug-oxygen/ ... words.html

But you could probably also distribute to the user modified dictionaries if you want them all to benefit from a certain set of controlled terms which should not be considered spell check mistakes.

Regards,
Radu