Users - xml file import problems. Jacopo?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Users - xml file import problems. Jacopo?

Hans Bakker

when importing xml files in the webtools component i get the problem
below....going back to version 6209 resolves the problem....

Expression messages is undefined on line 50, column 10 in EntityImport.ftl.
The problematic instruction: ---------- ==> list messages as message [on line
50, column 3 in EntityImport.ftl] ---------- Java backtrace for programmers:
---------- freemarker.core.InvalidReferenceException: Expression messages is
undefined on line 50, column 10 in EntityImport.ftl. at
freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124) at
freemarker.core.IteratorBlock.accept(IteratorBlock.java:93) at
freemarker.core.Environment.visit(Environment.java:196) at
freemarker.core.MixedContent.accept(MixedContent.java:92) at
freemarker.core.Environment.visit(Environment.java:196) at
--
Regards,
Hans Bakker
ANT Websystems Co.,Ltd (http://www.antwebsystems.com)

If you want to verify that this message really originates from
from the above person, download the public key from:
http://www.antwebsystems.com/hbakkerAntwebsystems.asc

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users

attachment0 (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Users - xml file import problems. Jacopo?

Jacopo Cappellato
Hans,

thanks for the report.

It seems that David has only partially committed a wrong (older) patch
instead of the one attached to OFBIZ-595.
If you apply that patch everything should work fine.

David, could you please verify what went wrong?

Thanks,

Jacopo


Hans Bakker wrote:

> when importing xml files in the webtools component i get the problem
> below....going back to version 6209 resolves the problem....
>
> Expression messages is undefined on line 50, column 10 in EntityImport.ftl.
> The problematic instruction: ---------- ==> list messages as message [on line
> 50, column 3 in EntityImport.ftl] ---------- Java backtrace for programmers:
> ---------- freemarker.core.InvalidReferenceException: Expression messages is
> undefined on line 50, column 10 in EntityImport.ftl. at
> freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124) at
> freemarker.core.IteratorBlock.accept(IteratorBlock.java:93) at
> freemarker.core.Environment.visit(Environment.java:196) at
> freemarker.core.MixedContent.accept(MixedContent.java:92) at
> freemarker.core.Environment.visit(Environment.java:196) at
>
>
> ------------------------------------------------------------------------
>
>  
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/users

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - xml file import problems. Jacopo?

David E. Jones

The patch that I applied was the one attached to OFBIZ-595, but  
perhaps not everything made it through. I just re-applied the patch  
to my latest checkout (which anyone can play with if they'd like) and  
if looks like some stuff in the services.xml file and the  
WebToolsServices.java file didn't make it through. There is also an  
error about the end of the file saying the "patch unexpectedly ends  
in middle of line" and that the patch is malformed. It may be that  
not having an empty line at the end of the file is causing problems,  
and it look like the last file in the set is the EntityImport.ftl  
file, so maybe something there didn't make it through.

Okay, nevermind about the files I mentioned above that had changes  
after re-applying the patch. It just screwed them up by appending the  
full file to the end of the existing file.

-David


On Nov 30, 2005, at 1:57 AM, Jacopo Cappellato wrote:

> Hans,
>
> thanks for the report.
>
> It seems that David has only partially committed a wrong (older)  
> patch instead of the one attached to OFBIZ-595.
> If you apply that patch everything should work fine.
>
> David, could you please verify what went wrong?
>
> Thanks,
>
> Jacopo
>
>
> Hans Bakker wrote:
>> when importing xml files in the webtools component i get the  
>> problem below....going back to version 6209 resolves the  
>> problem.... Expression messages is undefined on line 50, column 10  
>> in EntityImport.ftl. The problematic instruction: ---------- ==>  
>> list messages as message [on line 50, column 3 in  
>> EntityImport.ftl] ---------- Java backtrace for programmers:  
>> ---------- freemarker.core.InvalidReferenceException: Expression  
>> messages is undefined on line 50, column 10 in EntityImport.ftl.  
>> at freemarker.core.TemplateObject.assertNonNull
>> (TemplateObject.java:124) at freemarker.core.IteratorBlock.accept
>> (IteratorBlock.java:93) at freemarker.core.Environment.visit
>> (Environment.java:196) at freemarker.core.MixedContent.accept
>> (MixedContent.java:92) at freemarker.core.Environment.visit
>> (Environment.java:196) at
>> ---------------------------------------------------------------------
>> ---
>>  _______________________________________________
>> Users mailing list
>> [hidden email]
>> http://lists.ofbiz.org/mailman/listinfo/users
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/users

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users

smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Users - xml file import problems. Jacopo?

Hans Bakker
I just checked, but it not yet working....I use this pretty often to create
initial datafiles and see if they are properly loaded....

Jacopo, can you please check?

On Thursday 01 December 2005 15:01, David E. Jones wrote:

> The patch that I applied was the one attached to OFBIZ-595, but
> perhaps not everything made it through. I just re-applied the patch
> to my latest checkout (which anyone can play with if they'd like) and
> if looks like some stuff in the services.xml file and the
> WebToolsServices.java file didn't make it through. There is also an
> error about the end of the file saying the "patch unexpectedly ends
> in middle of line" and that the patch is malformed. It may be that
> not having an empty line at the end of the file is causing problems,
> and it look like the last file in the set is the EntityImport.ftl
> file, so maybe something there didn't make it through.
>
> Okay, nevermind about the files I mentioned above that had changes
> after re-applying the patch. It just screwed them up by appending the
> full file to the end of the existing file.
>
> -David
>
> On Nov 30, 2005, at 1:57 AM, Jacopo Cappellato wrote:
> > Hans,
> >
> > thanks for the report.
> >
> > It seems that David has only partially committed a wrong (older)
> > patch instead of the one attached to OFBIZ-595.
> > If you apply that patch everything should work fine.
> >
> > David, could you please verify what went wrong?
> >
> > Thanks,
> >
> > Jacopo
> >
> > Hans Bakker wrote:
> >> when importing xml files in the webtools component i get the
> >> problem below....going back to version 6209 resolves the
> >> problem.... Expression messages is undefined on line 50, column 10
> >> in EntityImport.ftl. The problematic instruction: ---------- ==>
> >> list messages as message [on line 50, column 3 in
> >> EntityImport.ftl] ---------- Java backtrace for programmers:
> >> ---------- freemarker.core.InvalidReferenceException: Expression
> >> messages is undefined on line 50, column 10 in EntityImport.ftl.
> >> at freemarker.core.TemplateObject.assertNonNull
> >> (TemplateObject.java:124) at freemarker.core.IteratorBlock.accept
> >> (IteratorBlock.java:93) at freemarker.core.Environment.visit
> >> (Environment.java:196) at freemarker.core.MixedContent.accept
> >> (MixedContent.java:92) at freemarker.core.Environment.visit
> >> (Environment.java:196) at
> >> ---------------------------------------------------------------------
> >> ---
> >>  _______________________________________________
> >> Users mailing list
> >> [hidden email]
> >> http://lists.ofbiz.org/mailman/listinfo/users
> >
> > _______________________________________________
> > Users mailing list
> > [hidden email]
> > http://lists.ofbiz.org/mailman/listinfo/users
--
Regards,
Hans Bakker
ANT Websystems Co.,Ltd (http://www.antwebsystems.com)

If you want to verify that this message really originates from
from the above person, download the public key from:
http://www.antwebsystems.com/hbakkerAntwebsystems.asc

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users

attachment0 (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Users - xml file import problems. Jacopo?

Jacopo Cappellato
Hans,

with rev 6228 it should be fixed.

Please let me know!

Jacopo

Hans Bakker wrote:

> I just checked, but it not yet working....I use this pretty often to create
> initial datafiles and see if they are properly loaded....
>
> Jacopo, can you please check?
>
> On Thursday 01 December 2005 15:01, David E. Jones wrote:
>
>>The patch that I applied was the one attached to OFBIZ-595, but
>>perhaps not everything made it through. I just re-applied the patch
>>to my latest checkout (which anyone can play with if they'd like) and
>>if looks like some stuff in the services.xml file and the
>>WebToolsServices.java file didn't make it through. There is also an
>>error about the end of the file saying the "patch unexpectedly ends
>>in middle of line" and that the patch is malformed. It may be that
>>not having an empty line at the end of the file is causing problems,
>>and it look like the last file in the set is the EntityImport.ftl
>>file, so maybe something there didn't make it through.
>>
>>Okay, nevermind about the files I mentioned above that had changes
>>after re-applying the patch. It just screwed them up by appending the
>>full file to the end of the existing file.
>>
>>-David
>>
>>On Nov 30, 2005, at 1:57 AM, Jacopo Cappellato wrote:
>>
>>>Hans,
>>>
>>>thanks for the report.
>>>
>>>It seems that David has only partially committed a wrong (older)
>>>patch instead of the one attached to OFBIZ-595.
>>>If you apply that patch everything should work fine.
>>>
>>>David, could you please verify what went wrong?
>>>
>>>Thanks,
>>>
>>>Jacopo
>>>
>>>Hans Bakker wrote:
>>>
>>>>when importing xml files in the webtools component i get the
>>>>problem below....going back to version 6209 resolves the
>>>>problem.... Expression messages is undefined on line 50, column 10
>>>>in EntityImport.ftl. The problematic instruction: ---------- ==>
>>>>list messages as message [on line 50, column 3 in
>>>>EntityImport.ftl] ---------- Java backtrace for programmers:
>>>>---------- freemarker.core.InvalidReferenceException: Expression
>>>>messages is undefined on line 50, column 10 in EntityImport.ftl.
>>>>at freemarker.core.TemplateObject.assertNonNull
>>>>(TemplateObject.java:124) at freemarker.core.IteratorBlock.accept
>>>>(IteratorBlock.java:93) at freemarker.core.Environment.visit
>>>>(Environment.java:196) at freemarker.core.MixedContent.accept
>>>>(MixedContent.java:92) at freemarker.core.Environment.visit
>>>>(Environment.java:196) at
>>>>---------------------------------------------------------------------
>>>>---
>>>> _______________________________________________
>>>>Users mailing list
>>>>[hidden email]
>>>>http://lists.ofbiz.org/mailman/listinfo/users
>>>
>>>_______________________________________________
>>>Users mailing list
>>>[hidden email]
>>>http://lists.ofbiz.org/mailman/listinfo/users
>
>
>
> ------------------------------------------------------------------------
>
>  
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/users

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Users - xml file import problems. Jacopo?

Hans Bakker
Hi Jacopo,
it is working now thanks....however......

1.
when the file does not exist there is NPE at webtoolsservices.java at line 111

2.
errors in the xml file are not reported on screen, only in the log file. the
message on-screen will still say: The action was performed successfully.

3.
you disabled most 'catch' messages in the file causing point 1,2?

regards,
Hans

On Friday 02 December 2005 13:35, Jacopo Cappellato wrote:

> Hans,
>
> with rev 6228 it should be fixed.
>
> Please let me know!
>
> Jacopo
>
> Hans Bakker wrote:
> > I just checked, but it not yet working....I use this pretty often to
> > create initial datafiles and see if they are properly loaded....
> >
> > Jacopo, can you please check?
> >
> > On Thursday 01 December 2005 15:01, David E. Jones wrote:
> >>The patch that I applied was the one attached to OFBIZ-595, but
> >>perhaps not everything made it through. I just re-applied the patch
> >>to my latest checkout (which anyone can play with if they'd like) and
> >>if looks like some stuff in the services.xml file and the
> >>WebToolsServices.java file didn't make it through. There is also an
> >>error about the end of the file saying the "patch unexpectedly ends
> >>in middle of line" and that the patch is malformed. It may be that
> >>not having an empty line at the end of the file is causing problems,
> >>and it look like the last file in the set is the EntityImport.ftl
> >>file, so maybe something there didn't make it through.
> >>
> >>Okay, nevermind about the files I mentioned above that had changes
> >>after re-applying the patch. It just screwed them up by appending the
> >>full file to the end of the existing file.
> >>
> >>-David
> >>
> >>On Nov 30, 2005, at 1:57 AM, Jacopo Cappellato wrote:
> >>>Hans,
> >>>
> >>>thanks for the report.
> >>>
> >>>It seems that David has only partially committed a wrong (older)
> >>>patch instead of the one attached to OFBIZ-595.
> >>>If you apply that patch everything should work fine.
> >>>
> >>>David, could you please verify what went wrong?
> >>>
> >>>Thanks,
> >>>
> >>>Jacopo
> >>>
> >>>Hans Bakker wrote:
> >>>>when importing xml files in the webtools component i get the
> >>>>problem below....going back to version 6209 resolves the
> >>>>problem.... Expression messages is undefined on line 50, column 10
> >>>>in EntityImport.ftl. The problematic instruction: ---------- ==>
> >>>>list messages as message [on line 50, column 3 in
> >>>>EntityImport.ftl] ---------- Java backtrace for programmers:
> >>>>---------- freemarker.core.InvalidReferenceException: Expression
> >>>>messages is undefined on line 50, column 10 in EntityImport.ftl.
> >>>>at freemarker.core.TemplateObject.assertNonNull
> >>>>(TemplateObject.java:124) at freemarker.core.IteratorBlock.accept
> >>>>(IteratorBlock.java:93) at freemarker.core.Environment.visit
> >>>>(Environment.java:196) at freemarker.core.MixedContent.accept
> >>>>(MixedContent.java:92) at freemarker.core.Environment.visit
> >>>>(Environment.java:196) at
> >>>>---------------------------------------------------------------------
> >>>>---
> >>>> _______________________________________________
> >>>>Users mailing list
> >>>>[hidden email]
> >>>>http://lists.ofbiz.org/mailman/listinfo/users
> >>>
> >>>_______________________________________________
> >>>Users mailing list
> >>>[hidden email]
> >>>http://lists.ofbiz.org/mailman/listinfo/users
> >
> > ------------------------------------------------------------------------
> >
> >
> > _______________________________________________
> > Users mailing list
> > [hidden email]
> > http://lists.ofbiz.org/mailman/listinfo/users
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/users
--
Regards,
Hans Bakker
ANT Websystems Co.,Ltd (http://www.antwebsystems.com)

If you want to verify that this message really originates from
from the above person, download the public key from:
http://www.antwebsystems.com/hbakkerAntwebsystems.asc

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users

attachment0 (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Users - xml file import problems. Jacopo?

Jacopo Cappellato
Hi Hans,

thanks for your reports that are really helping me to fix all the issues
in the Entity Import tools.
I hope this is not wasting you too much time.
With the patch attached to this message (and also to the OFBIZ-595) I
have improved the error handling in the service (that code was written
for a jsp page and it didn't work so well inside a service), I've tested
it and now it should report all errors in the right way.

Please let me know (again!) if you see something wrong.

Jacopo



Hans Bakker wrote:

> Hi Jacopo,
> it is working now thanks....however......
>
> 1.
> when the file does not exist there is NPE at webtoolsservices.java at line 111
>
> 2.
> errors in the xml file are not reported on screen, only in the log file. the
> message on-screen will still say: The action was performed successfully.
>
> 3.
> you disabled most 'catch' messages in the file causing point 1,2?
>
> regards,
> Hans
>
> On Friday 02 December 2005 13:35, Jacopo Cappellato wrote:
>
>>Hans,
>>
>>with rev 6228 it should be fixed.
>>
>>Please let me know!
>>
>>Jacopo
>>
>>Hans Bakker wrote:
>>
>>>I just checked, but it not yet working....I use this pretty often to
>>>create initial datafiles and see if they are properly loaded....
>>>
>>>Jacopo, can you please check?
>>>
>>>On Thursday 01 December 2005 15:01, David E. Jones wrote:
>>>
>>>>The patch that I applied was the one attached to OFBIZ-595, but
>>>>perhaps not everything made it through. I just re-applied the patch
>>>>to my latest checkout (which anyone can play with if they'd like) and
>>>>if looks like some stuff in the services.xml file and the
>>>>WebToolsServices.java file didn't make it through. There is also an
>>>>error about the end of the file saying the "patch unexpectedly ends
>>>>in middle of line" and that the patch is malformed. It may be that
>>>>not having an empty line at the end of the file is causing problems,
>>>>and it look like the last file in the set is the EntityImport.ftl
>>>>file, so maybe something there didn't make it through.
>>>>
>>>>Okay, nevermind about the files I mentioned above that had changes
>>>>after re-applying the patch. It just screwed them up by appending the
>>>>full file to the end of the existing file.
>>>>
>>>>-David
>>>>
>>>>On Nov 30, 2005, at 1:57 AM, Jacopo Cappellato wrote:
>>>>
>>>>>Hans,
>>>>>
>>>>>thanks for the report.
>>>>>
>>>>>It seems that David has only partially committed a wrong (older)
>>>>>patch instead of the one attached to OFBIZ-595.
>>>>>If you apply that patch everything should work fine.
>>>>>
>>>>>David, could you please verify what went wrong?
>>>>>
>>>>>Thanks,
>>>>>
>>>>>Jacopo
>>>>>
>>>>>Hans Bakker wrote:
>>>>>
>>>>>>when importing xml files in the webtools component i get the
>>>>>>problem below....going back to version 6209 resolves the
>>>>>>problem.... Expression messages is undefined on line 50, column 10
>>>>>>in EntityImport.ftl. The problematic instruction: ---------- ==>
>>>>>>list messages as message [on line 50, column 3 in
>>>>>>EntityImport.ftl] ---------- Java backtrace for programmers:
>>>>>>---------- freemarker.core.InvalidReferenceException: Expression
>>>>>>messages is undefined on line 50, column 10 in EntityImport.ftl.
>>>>>>at freemarker.core.TemplateObject.assertNonNull
>>>>>>(TemplateObject.java:124) at freemarker.core.IteratorBlock.accept
>>>>>>(IteratorBlock.java:93) at freemarker.core.Environment.visit
>>>>>>(Environment.java:196) at freemarker.core.MixedContent.accept
>>>>>>(MixedContent.java:92) at freemarker.core.Environment.visit
>>>>>>(Environment.java:196) at
>>>>>>---------------------------------------------------------------------
>>>>>>---
>>>>>>_______________________________________________
>>>>>>Users mailing list
>>>>>>[hidden email]
>>>>>>http://lists.ofbiz.org/mailman/listinfo/users
>>>>>
>>>>>_______________________________________________
>>>>>Users mailing list
>>>>>[hidden email]
>>>>>http://lists.ofbiz.org/mailman/listinfo/users
>>>
>>>------------------------------------------------------------------------
>>>
>>>
>>>_______________________________________________
>>>Users mailing list
>>>[hidden email]
>>>http://lists.ofbiz.org/mailman/listinfo/users
>>
>>_______________________________________________
>>Users mailing list
>>[hidden email]
>>http://lists.ofbiz.org/mailman/listinfo/users
>
>
>
> ------------------------------------------------------------------------
>
>  
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/users

Index: framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java
===================================================================
--- framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java (revision 6225)
+++ framework/webtools/src/org/ofbiz/webtools/WebToolsServices.java (working copy)
@@ -103,16 +103,15 @@
         if (filename != null && filename.length() > 0) {
             try {
                 url = isUrl?new URL(filename):UtilURL.fromFilename(filename);
-            } catch(MalformedURLException e) {
-//                errorMessageList.add("ERROR: " + e.getMessage());
+                InputStream is = url.openStream();
+                ins = new InputSource(is);
+            } catch(MalformedURLException mue) {
+                return ServiceUtil.returnError("ERROR: invalid file name (" + filename + "): " + mue.getMessage());
+            } catch(IOException ioe) {
+                return ServiceUtil.returnError("ERROR reading file name (" + filename + "): " + ioe.getMessage());
+            } catch(Exception exc) {
+                return ServiceUtil.returnError("ERROR: reading file name (" + filename + "): " + exc.getMessage());
             }
-            InputStream is = null;
-            try {
-                is = url.openStream();
-            } catch(IOException e) {
-//                errorMessageList.add("ERROR: " + e.getMessage());
-            }
-            ins = new InputSource(is);
         }
 
         // #############################
@@ -132,7 +131,7 @@
             try {
                 templateReader = new FileReader(fmfilename);
             } catch(FileNotFoundException e) {
-//                errorMessageList.add("ERROR: " + e.getMessage());
+                return ServiceUtil.returnError("ERROR reading template file (" + fmfilename + "): " + e.getMessage());
             }
 
             StringWriter outWriter = new StringWriter();
@@ -152,7 +151,7 @@
                 template.process(fmcontext, outWriter);
                 s = outWriter.toString();
             } catch(Exception ex) {
-//                errorMessageList.add("ERROR: " + ex.getMessage());
+                return ServiceUtil.returnError("ERROR processing template file (" + fmfilename + "): " + ex.getMessage());
             }
         }
 
@@ -176,11 +175,14 @@
                     }
                 }
                 Map outputMap = dispatcher.runSync("parseEntityXmlFile", inputMap);
-                Long numberRead = (Long)outputMap.get("rowProcessed");
-
-                messages.add("Got " + numberRead.longValue() + " entities to write to the datasource.");
+                if (ServiceUtil.isError(outputMap)) {
+                    return ServiceUtil.returnError("ERROR: " + ServiceUtil.getErrorMessage(outputMap));
+                } else {
+                    Long numberRead = (Long)outputMap.get("rowProcessed");
+                    messages.add("Got " + numberRead.longValue() + " entities to write to the datasource.");
+                }
             } catch (Exception ex){
-//                errorMessageList.add("ERROR: " + exc.getMessage());
+                return ServiceUtil.returnError("ERROR parsing Entity Xml file: " + ex.getMessage());
             }
         } else {
             messages.add("No filename/URL or complete XML document specified, doing nothing.");
@@ -326,7 +328,7 @@
             long numberRead = (url != null? reader.parse(url): reader.parse(xmltext));
             rowProcessed = new Long(numberRead);
         } catch (Exception ex){
-            return ServiceUtil.returnError("Error parsing entity xml file: " + ex.getMessage());
+            return ServiceUtil.returnError("Error parsing entity xml file: " + ex.toString());
         }
         // send the notification
         Map resp = UtilMisc.toMap("rowProcessed", rowProcessed);

 
_______________________________________________
Users mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/users