handling translation errors

0 views
Skip to first unread message

Ashok

unread,
Apr 24, 2009, 11:30:51 AM4/24/09
to akomantoso-dev
Hi Luca,

How do i use this functionality ?

I dont see them being used in the unit tests ... Can you give me an
example ?

Ashok

Luca Cervone

unread,
Apr 27, 2009, 6:25:14 AM4/27/09
to akomant...@googlegroups.com
Sorry Ashok, but I didn't understand the question ... 

Ciao 
Luca
Luca Cervone
Web and XML solutions designer

e-mail:     cervo...@gmail.com

mobile phone:    0039 348 26 27 545
home   phone:  0039 051 199 82 854

skype:   cervoneluca



Ashok Hariharan

unread,
Apr 27, 2009, 7:32:03 AM4/27/09
to akomant...@googlegroups.com
I mean how do I trap and present validation errors ?

There is a function call in translate() to :

SchemaValidator.getInstance().validate(fileToReturn,
this.akomantosoSchemaPath);

How do i use the errors it may return ?

Luca Cervone

unread,
Apr 28, 2009, 4:02:10 AM4/28/09
to akomant...@googlegroups.com
Dear Ashok, 
Apologies for the delay. 
Sorry but I still can't understand what you are meaning. 
The functionality that you are talking about is built in in the translator mechanism. 
It throws an exception every time the validator founds an error.
The exception contains the line of the error. If you remember we had talk about the mechanism to link the error to the line of the original ODF document (that one that the user sees on the screen).
I have prepared the mechanism but I need the file that I requested to you. 
Let me know it is clearer. 

Ciao
Luca

Ashok Hariharan

unread,
Apr 29, 2009, 2:45:57 AM4/29/09
to akomant...@googlegroups.com
Hi Luca:

Please find attached a small script that outputs the file as you had specified :

section_id: first line of text from section

it works like this :

java -jar ExtractSections.jar <input odf file with sections> <path to
output text file with section info>

there is some sample output in the gzip file ... in out.txt ...

Is that the input your system is expecting ?
xtractsectioninfo.tar.gz

Luca Cervone

unread,
Apr 29, 2009, 5:50:28 AM4/29/09
to akomant...@googlegroups.com
Ashok, 
Probably it is exactly what I need.
Let me test it and then I will reply to you. 

Ciao
Luca

<xtractsectioninfo.tar.gz>

Ashok Hariharan

unread,
May 4, 2009, 5:52:04 AM5/4/09
to akomant...@googlegroups.com
Hello Luca,

Were you able to test this ?

thanks

Ashok

Luca Cervone

unread,
May 5, 2009, 6:51:04 AM5/5/09
to akomant...@googlegroups.com
Dear Ashok, 
I have an error with the extractor

The launched exception is this

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Logger
at XtractSections.<clinit>(XtractSections.java:25)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:288)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
... 1 more

Can You fix it? 

However I seen the sample output that you sent to me. It looks like this: 

debaterecord:NATIONAL ASSEMBLYOFFICIAL REPORTThursday, 9th December, 2004The House met at 2.3
masthead:NATIONAL ASSEMBLYOFFICIAL REPORTThursday, 9th December, 2004The House met at 2.3
comment1:[Mr. Deputy Speaker in the Chair] 
comment2:PRAYERS


But in the part after the ":" I should have the number of the line in witch the section start. 
But for me is the same If you want we can also display the first words of the section 


Ciao
Luca
 
<xtractsectioninfo.tar.gz>

Ashok Hariharan

unread,
May 5, 2009, 8:10:57 AM5/5/09
to akomant...@googlegroups.com
On Tue, May 5, 2009 at 1:51 PM, Luca Cervone <cervo...@gmail.com> wrote:
Dear Ashok, 
I have an error with the extractor

I just tried on mac os x and it works fine for me. Are you sure extracted also the 'lib' folder  ?

the application looks for log4j in the ./lib folder ... i.e. if the jar is in a folder called 'xtract' the lib files must be in a folder called 'lib' within 'xtract'
 

The launched exception is this

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Logger
at XtractSections.<clinit>(XtractSections.java:25)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:288)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
... 1 more

Can You fix it? 

However I seen the sample output that you sent to me. It looks like this: 

debaterecord:NATIONAL ASSEMBLYOFFICIAL REPORTThursday, 9th December, 2004The House met at 2.3
masthead:NATIONAL ASSEMBLYOFFICIAL REPORTThursday, 9th December, 2004The House met at 2.3
comment1:[Mr. Deputy Speaker in the Chair] 
comment2:PRAYERS


But in the part after the ":" I should have the number of the line in witch the section start. 
But for me is the same If you want we can also display the first words of the section 


Line number is really a 'virtual concept' for the document since it depends on the application rendering the  file...or the orientation with which the file is being viewed (landscape or portrait)...


Ashok



--
++++ Ashok Hariharan ++++

Luca Cervone

unread,
May 5, 2009, 11:00:56 AM5/5/09
to akomant...@googlegroups.com


Dear Ashok, 
The Extractor now works well. 
I'm setting the ODTTranslator in order to map the error. 

So, when an error occurs we will have something like: "some data are missing in the section starting with ... " (of course the message will be more specific). 
But remember that the input that you have to give to the translator will be the ODT file and the section file. 

So what do you think is the better solution? 

1) you give in input the ODT and the file produced to by the Extractor
2) I use the Extractor from my side and you give to the translator only the ODT file (in this case you have to give me the source code or the documentation of the extractor)

Let me know. 
Ciao
Luca

Ashok Hariharan

unread,
May 7, 2009, 6:50:58 AM5/7/09
to akomant...@googlegroups.com
Hello Luca,

See attached the source of the extractor ---

On the issue of line-number (since we cannot provide a line number...) ... would paragraph number  be more relevant ?

How exactly does the error reporter work ? ... Does it identify the text fragment which has the error ... or does it simply report that the section has an error ... ? I am asking becuase you could have a section spanning 2-3 pages... so simply reporting an error at the section level may be inadequate ...

Ashok
XtractSections.java.zip
Reply all
Reply to author
Forward
0 new messages