PDA

View Full Version : Error while loading dynamically an image


manuelmeyer
10-17-2004, 02:32 PM
Hi All,

first of all, thanks a lot for your product, we are certainly at the beginning of something very big.

I have a problem loading dynamically an image :
<canvas width="1024">
<resource name="img_test" src="images/x125_20607_p0001353.001.jpg" />
<dataset name="album">
<album>
<opus category="painting">
<author>Delacroix</author>
<desc>this is a test</desc>
<img>http:images/x125_20607_p0001353.001.jpg</img>
</opus>
</album>
</dataset>

<view x="0" y ="0" id="v_mainmenu">
<tabs>
<tabpane selected="true">Recherche Simple
</tabpane>
<tabpane>Recherche avancee
</tabpane>
<tabpane text="Subliminal">
</tabpane>
<tabpane text="Par salle">
</tabpane>
<tabpane text="Par departement">
</tabpane>
<tabpane text="Acquisition recente">
</tabpane>
<tabpane text="Aide">
</tabpane>
<tabpane text="Album">
</tabpane>
</tabs>
</view>
<view id="v_album" y="${v_mainmenu.height + 10}" width="1024">
<simplelayout axis="y"/>
<view name="list" datapath="album:/album/opus">
<simplelayout axis="x"/>
<!-- 1 -->
<view resource="$path{'img/text()'}"/>
<text datapath="author/text()"/>
<text datapath="desc/text()"/>
</view>

</view>
</canvas>

and the debugger at the client side shows the following :
«string#0| java.text.ParseException: Unparseable date: "Sun, 17 Oct 2004 21:05:56 GMT" : Exception stack: com.laszlosystems.utils.ChainedException: java.text.ParseException: Unparseable date: "Sun, 17 Oct 2004 21:05:56 GMT" at com.laszlosystems.utils.LZHttpUtils.getDate(LZHttp Utils.java:132) at com.laszlosystems.data.HTTPDataSource$HttpData.las tModified(HTTPDataSource.java:492) at com.laszlosystems.cache.RequestCache.getItemStream AsSWF(RequestCache.java:324) at com.laszlosystems.cache.RequestCache.getAsSWF(Requ estCache.java:132) at com.laszlosystems.servlets.responders.ResponderCac he.respondImpl(ResponderCache.java:362) at com.laszlosystems.servlets.responders.Responder.re spond(Responder.java:220) at com.laszlosystems.servlets.LZServlet._doGet(LZServ let.java:306) at com.laszlosystems.servlets.LZServlet.doGet(LZServl et.java:242) at javax.servlet.http.HttpServlet.service(HttpServlet .java:689) at javax.servlet.http.HttpServlet.service(HttpServlet .java:802) at org.apache.catalina.core.ApplicationFil...»

I set log4j on debug mode, and saw that the last modified date of my image in the anwser is :

DEBUG - << "ETag: W/"3317-1098047156169"[\r][\n]"
DEBUG - << "Last-Modified: Sun, 17 Oct 2004 21:05:56 GMT[\r][\n]"
DEBUG - << "Content-Type: image/jpeg[\r][\n]"
DEBUG - << "Content-Length: 3317[\r][\n]"
DEBUG - << "Date: Sun, 17 Oct 2004 22:04:50 GMT[\r][\n]"
DEBUG - << "Server: Apache-Coyote/1.1[\r][\n]"

which looks correct?
Is it a problem of regionnal settings ?

Thanks for your help,

Manuel

manuelmeyer
10-18-2004, 09:26 AM
it works if I am using the tomcat included in the lps distribution, not when I am using the one I donwloaded from jakarta.apache.org

Tx,

M/

manuelmeyer
10-18-2004, 10:13 AM
Hum....
Sorry I've spoken too fast...
it's still does not work, for exemple the http://localhost:8080/lps-2.2/examples/image-loading/dataimage.lzx?debug=true

is giving me the same error messages

«string#0| java.text.ParseException: Unparseable date: "Thu, 09 Sep 2004 23:58:16 GMT" : Exception stack: com.laszlosystems.utils.ChainedException: java.text.ParseException: Unparseable date: "Thu, 09 Sep 2004 23:58:16 GMT" at com.laszlosystems.utils.LZHttpUtils.getDate(LZHttp Utils.java:132) at com.laszlosystems.data.HTTPDataSource$HttpData.las tModified(HTTPDataSource.java:492) at com.laszlosystems.cache.RequestCache.getItemStream AsSWF(RequestCache.java:324) at com.laszlosystems.cache.RequestCache.getAsSWF(Requ estCache.java:132) at com.laszlosystems.servlets.responders.ResponderCac he.respondImpl(ResponderCache.java:362) at com.laszlosystems.servlets.responders.Responder.re spond(Responder.java:220) at com.laszlosystems.servlets.LZServlet._doGet(LZServ let.java:306) at com.laszlosystems.servlets.LZServlet.doGet(LZServl et.java:242) at javax.servlet.http.HttpServlet.service(HttpServlet .java:697) at javax.servlet.http.HttpServlet.service(HttpServlet .java:810) at org.apache.catalina.core.ApplicationFil...»

Sorry to annoy you with that...

Cheers,
M

Fresh Mike
10-21-2004, 03:13 AM
Dear manuelmeyer, I guess by the sound of your name that you're french just like me. Though, in order for other people to understand the conversation, I'll write in english.

I have the same problem as you. When dynamically setting the source of a view to an image file, every other time it throws an exception. I do not know why the structure of my program makes it that it does work only once every other time, but all I know is that, as m.weidemann has explained after having the same problem, changing the Windows Regional Settings to English (United States) and restarting Tomcat solves the problem!

Check this link for the discussion: http://www.laszlosystems.com/developers/community/forums/showthread.php?threadid=841
Please read this discussion carefully, because at first antun says it is a problem of LZX code. Maybe m.weidemann had miscoded something, but after having corrected his code to use antun's code (setSource who's the only way of assigning a specific image dynamically), the problem persists.

There is no doubt and it is after all more than logical that non-english Regional Settings cause a problem of date parsing. I beg the Laszlo team to take into account non-english developers. If Laszlo wants to become a universal and ubiquitous platform, it has to deal with regional settings. However, I'm having some doubts because in the discussion I linked above, antun says he filed this as a bug and he may need some more details in the future. antun's message is dated 04-28-2004 and in the latest LPS 2.2 version, the problem has been solved. I wonder what kind of details he may need considering the fact that he only has to change the server's regional settings to "French (France)" for instance to trigger the bug. It is not the problem of a single machine that has some unknown problems. I have tested my program on several machines, including Windows 2000 Professional French and Windows XP SP1 French, and the bug is still there. As this is not a very acceptable solution to expect the developers to use another regional setting, because other applications may be running on the same server that require the right regional setting, I pray that the Laszlo team will finally treat this problem seriously. I very much appreciate their work on LPS, I find it a very exciting technology, and they shouldn't let this bug get in the way to success, especially when you know how important it is when delivering dynamic content, to be able to load images on the fly.

I'm convinced, as the logical IT engineer that I am, that this error is really related to the regional settings, and not to a human error in the LZX code: if it were a human coding error, then http://localhost:8080/lps-2.2/examples/image-loading/dataimage.lzx?debug=true would work on our machines with french regional settings (and it does not work, the debugger displays a list of exceptions, all of them "unparseable date").

To antun and manuelmeyer, my best regards! Any answer from you antun is appreciated. If any of you have had the same problems with the "unparseable date" exception and setSource, please post a message here to help have this critical problem solved.

manuelmeyer
10-21-2004, 04:01 AM
Hi,
thanks for your mail/reply.

I have investigated a bit further, donwloading laszlo source code and came with this conclusion :
if I start tomcat under the command line, calanila start, every thing is fine, what ever is the regional setting, while under eclipse I have the same error.

In fact, I saw that when laszlo is getting an image using common-httpclient, it takes the Last-Modified header and parse it with a hard wired date format (so it has nothing do deal with regionnal setting, still according to what I understood).

When I take laszlo format and build a little test to parse a last-modified-like date in a small java app, it works, event under eclipse, but does not using tomcat/laszlo under eclipse.
So, in order to go furher, I 've downloaded the commons-httpclient and rebuilt it to return 'null' when laszlo ask the 'last-modified' header info...

That is not great, I know, but it is the only way I found to go further.


If you want to do the same, download the commons-httpclient (by the way, laszlo is using the rc-1 and we are in 2.2) and change in HttpMethodBase by the following :
public Header getResponseHeader(String headerName) {
if("Last-Modified".equalsIgnoreCase(headerName)) {
return null;
}
if (headerName == null) {
return null;
} else {
return getResponseHeaderGroup().getCondensedHeader(header Name);
}
}

It is dirty, but it works...
I am still looking for another clean solution.

Cheers,
M/

Fresh Mike
10-21-2004, 04:31 AM
Sorry manuelmeyer, but I think that regional settings have everything to do with the "unparseable date" exception for the following reasons:

- If it did not have anything to do with Regional Settings, then why changing the Regional Settings helps me (as well as m.weidemann).

- I'm not saying that Regional Settings is the cause of the bug, I'm saying that the bug is linked to 1) the way the dates are expressed on a non-english machine, and 2) to the setSource function.

- Maybe you do not have the same reason behind the "unparseable date" bug, but that doesn't prevent the others from having it for another reason.

Finally, I think you're not helping the resolution of this bug by giving arguments to those who might pretend that this is not a bug, that it's not related to regional settings or the date format, and that it's the developer's fault, as usual. I know that developer errors are commonplace, but when several experienced people begin having the same problem, that's generally the sign of a non-human error, or at worst, of the use of a very badly documented function.

I'd still like to hear antun about the current state of this bug.

Fresh Mike
10-21-2004, 04:40 AM
Finally, I forgot to mention the following facts that are pro-"the regional date format cause":

It cannot be a human coding error, that's why I don't even bother sending the lzx code of my application. Why? Because the demo application packaged with LPS 2.2 itself doesn't work. Why don't you try changing your regional settings to "French (France)" and then restart the default Tomcat (the one packaged with LPS 2.2) and then launch:
http://localhost:8080/lps-2.2/examples/image-loading/dataimage.lzx?debug=true
If it works, it means that the bug has to do with the conjunction of the regional settings and something else that's not on your machine/configuration.
If it doesn't work, then my point is made, and it is a simple problem of date parsing due to an unexpected date format.

manuelmeyer
10-21-2004, 04:50 AM
Hi Fresh Mike,

don't be upset, it is only my understanding of the situation and the way I've tried to get rid of it.

I am juste saying that in the source code that you've surely look:

in LZHttpUtils.java
the following method is called :
/**
* Convert an HTTP Date String to a long
*/
public static long getDate(String s) {
try {
SimpleDateFormat dateFormatter = getGMTFormatter();
return dateFormatter.parse(s).getTime();
} catch (java.text.ParseException e) {
throw new ChainedException(e);
}
}

and this method is generating an exception.

Or, the getGMTFormatter() is (a couple of lines higher) :

/**
* Return a formatter for HTTP date headers
*/
private static SimpleDateFormat getGMTFormatter() {
SimpleDateFormat dateFormatter =
new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z");
TimeZone tz = TimeZone.getTimeZone("GMT");
dateFormatter.setTimeZone(tz);
return dateFormatter;
}
which is, as you know, the standard HTTP header response date format.

And this those not work for a reason I cannot understand.
This is what happened to me, which might be different from what you are facing.

My investigations are only to give my understanding of the error, to have a chance to get rid of this error, you can of course totally disagree, while arguying and staying in the mood of the forum.

Regards,
M.

Fresh Mike
10-21-2004, 04:59 AM
While searching "unparseable date" throughout the forums, I found one interesting thread.

http://www.laszlosystems.com/developers/community/forums/showthread.php?threadid=34

It is dated in january 2003, so quite a long time ago.

That's a german guy who has a different problem than ours, not about the setSource, but a bigger problem: error 500, nothing displayed, etc. At that time, he must have used a much older version of LPS.

When looking at the error message, you can see - I quote:
<< Unparseable date: "January 31, 2003" >>

The answer from antun is - I quote:
<< This is most likely due to your locale. I'm guessing you're not in the US. >>

The german guy answers - I quote:
<< yes, I'm located in Germany. >>

Then antun says - I quote:
<< In that case, the only thing I can suggest is that you change your locale to US:
Control Panel>Regional and Language Options
Then select United States as the location. You'll only need to do this when you want to start and stop the LPS.
It's annoying I know, but right now it's the only way. This issue is fixed in the upcoming 1.0 release.
Antun >>

Well my conclusion is, even though the "regional date format" bug must have been solved in one instance, for some reason, it is still present with setSource on LPS version 2.2. So I guess that now, we can let the Laszlo team work on it, politely hoping that they'll keep us informed.

Fresh Mike
10-21-2004, 05:06 AM
I'm not upset, I understand you've tried to solve the problem at the source, inside the source code. After a quick look, I myself don't really see what's wrong with the code, but Laszlo will take care of fixing this, as we have found the way to circumvent it in an unpractical way (changing regional settings). You're not telling me if before trying to change the source code, you've tried to change the regional settings. It's a much simpler solution.

My will is just to keep the "victims" of this bug united, so that it is treated in one time as a whole.

manuelmeyer
10-21-2004, 05:11 AM
I've tried, and it worked !

But when I run tomcat under (my)eclipse, the behaviour is the same, what ever are the regional settings...

That is why I've changed the commons-httpclient to be able to work under eclipse, because my concern is more on the server side trying to set up a struts app in front of a laszlo front end.

Cheers,
M/

Fresh Mike
10-21-2004, 05:45 AM
You're saying that it works when you change the regional settings when using the default tomcat. That's a good thing because it shows that you encounter the same bug as us, and when the Laszlo team will fix it, it will fix it for you too.

If it doesn't fix the bug when you use tomcat under eclipse, to me it means the following: it doesn't take into account the local system's regional settings at the start.

Also, I'd like to add that, as antun said in his post to the german guy in january 2003, setting the locale to English/United States just before starting Tomcat works. You can change back the locale to its original value right afterwards, when Tomcat is running without affecting the behaviour. So - I'm talking to antun now - apparently, the problem is located in the initialization phase of Tomcat. If you can't find the source of the bug and fix it inside the code, then you could patch the default installation of Tomcat provided with LPS so that it always initializes to English/United States. It will only be a temporary solution, clearly better than nothing, but changing the locale may have implications over time when more and more non-english-speaking people use Laszlo.

Fresh Mike
10-26-2004, 12:42 AM
I have to notice, much to my disappointment, that noone from Laszlo seemed to have cared enough to answer yet to this bug report. :eek:

Even though I've been spreading the buzz about Laszlo all around me, including at my company :cool:, I must recognize that this bug has stopped my development work :mad:, since the thing I want to do (dynamically loading images) cannot be done otherwise :confused:. No more than two weeks after having learnt LZX, I may already be about to drop Laszlo... :o Don't let that happen, Laszlo team! :(

jsundman
10-28-2004, 06:26 AM
Team Laszlo is very small!

In the last month, we have
-- put out a new release of LPS
-- turned the whole company to Open Source
-- moved our office from San Francisco to San Mateo
-- changed our IT infrastructure to support the increased demand for Laszlo

I'm the Laszlo documentation guy and I don't know the answer to your question(s). I'll see if I can find out, but I make no promises. After all, I have lots of other (Laszlo) work to do!

Laszlo wants to support the new community, of course. But the sources are there and free, and the community is going to have to figure out some issues for itself. I hope this does not sound rude!

Of course, Laszlo aslo sells support contracts. If you buy a support contract, you can count on rapid responses to your questions.

Please understand that we Laszlo engineers want to help and of course we want the community to prosper. But there are simply too few of us to handle all the forum questions -- we're up to our ears working on the next releases and setting up OpenLaszlo.org.

Regards,

John, the doc guy.

Fresh Mike
10-29-2004, 12:07 AM
Dear John, the doc guy

First of all, if you're really the doc guy, then let me first congratulate you for the Laszlo documentation! At first sight, when I didn't know yet that Laszlo wasn't free and open source from the beginning, I thought it was very well documented for an open source project, both in quantity and quality. And I'm talking to the whole Laszlo team, you all did a fine job with LPS 2.2.

But let's get back to your post.

I'm sorry that you had so much work in so little time lately, I'm sure you'll do fine with all these changes. I understand that you cannot answer in a timely manner to all the community problems, because you have other tasks with a higher priority, including support contracts with some customers.

When you say that: the community is going to have to figure out some issues for itself I have to agree. If there has to be an open source community, they must help each other on this forum, for instance about issues of programming methods, or:
what's the best way to do that I don't find the method/object I need could you add that feature in the next release I can't configure Tomcat to work on my server etc.

But when you say: If you buy a support contract, you can count on rapid responses to your questions.you imply that I need to buy a support contract in order for you to look into the dynamic image loading problem. While that may be right on a legal basis - nothing forces you to look into this problem at all - it is wrong on a technical and commercial basis.

I'm not expecting you to skip your more important tasks and send me a fix in less than a day. I'm not asking about a missing feature or how to do that. Other people and myself are reporting a bug on what seems to me an essential function of the product: dynamically loading images. It's not about some spelling mistake in the name of a method.

Actually, I'm not using Laszlo on a commercial / professional project right now, so buying a support contract does not apply to me. But as I'm working for a 7000-employee IT company in France, and I have the responsibility of choosing the software we use on some projects, I'm just testing the technology with a quite simple LSX application I wrote (3 pages of code), in order to evaluate it and see if it has any chance of answering to our corporate needs. Is it stable? yes Is it affordable and profitable? yes, I mean it's not Flex Is it well documented? yes Can getting a support contract be profitable? I think so Is it fast? I have to say not really... The final question being Can I propose it to one of our customers? well not unless this dynamic image bug is fixed and there is some sign that serious bug reports will be looked into.
Don't get me wrong, this is no threat at all, just a stone cold logical conclusion drawn from the facts.

The community can help itself, but it's also a powerful tool for getting fine bug reports to the product's developing team. Sure, you don't have to answer in any way at all to the community's problems, but you have to take into account any bug report from them, especially when it's a bug about a dynamic/data-driven thing in a dynamic/data-driven product, don't you agree? ;)

jsundman
10-29-2004, 11:51 AM
To tell the truth, I have not really looked at the code in this thread yet. Nothing jumped out at me, so I made a note to "come back later."

I'm on deadline today, but I'll see if I can get to it over the weekend or early next week. I expect there's an easy answer.

(Yes, I really am the guy in charge of Laszlo's documentation. Most of it was created by other engineers, but I edited it and put it together. I wrote about 15 chapters of the Dguide from scratch; the rest of the guide was edited, assembled and debugged by me. Many more improvements are in the works.)

Finally it is true that Laszlo sells support contracts. We of course want the Laszo "ecosystem" to become established and to thrive; that's why we do participate here. But your guarantee of top-line support is through a contract.

In haste,

jrs

Fresh Mike
11-04-2004, 02:04 AM
I'll wait for your answer.

Be sure to read my messages in this thread about how the bug happens and what's the quick fix I found.

Let us know about whether or not the bug fix is planned for the next version of LPS.

Fresh Mike
11-09-2004, 08:15 AM
Have you made any progress on qualifying the bug? Is a fix planned yet?

manuelmeyer
11-09-2004, 11:53 PM
Hi Fresh Mike

you are putting a big preasure on their shoulders ! ;-)

Why don't you send me a mail, we could see what we can do on our side

Sorry for the other users to have added half private messages

Tx

Fresh Mike
11-10-2004, 02:53 AM
Hi manuelmeyer!
I'm not trying to put them under pressure, I'm just following jsundman's word that he would take a look at it. Even if there's still no response, I'm hopeful that there will be one soon. I'm not under a big pressure to make my LZX application work as I don't have to deploy this test application. I was evaluating the technology for future use. So far, I consider that LPS works... on an english-language server, not on a french one. That means I don't see myself advise its use to my french IT company yet.

As I was just evaluating the technology, it's obvious I'm not interested in buying a suppotr contract right now. There are several projects that are both open source and commercial like MySQL, and even if getting help requires you to have a support contract, I don't think they only try to fix bugs that are reported by paying clients. Any kind of bug should be a problem I think. Actually, lots of companies count on having as many users reporting bugs to them as possible, because it's cheaper than hiring debuggers.

Thank you for proposing your help in this case, but as you can understand, I'm not willing to spend time on trying to change the source code or Tomcat's configuration when it's not really my work. Furthermore, they don't have the time to look into the problem, right? So even if we found a fix for this problem, they wouldn't have the time to integrate it in the next version.

manuelmeyer
11-10-2004, 04:27 AM
sure, I already know that

my concern was more to talk about what kind of development your are in, for my personnal interest no more (as I already have a way to avoid the bug).
As you've set your profile as 'deny personnal message, I went tru that thread, but the purpose is out of that forum

C U

M/

Fresh Mike
11-10-2004, 04:40 AM
I don't get it. My "Enable Private Messaging?" option is set to yes, I've checked twice. Let me try to send you a private message.

bloch
11-20-2004, 08:15 AM
Hey Guys,

I think this symptom shows 3 bugs (!), only one of them serious

The first (and serious one) is that the code for LZHttpUtils.getGMTFormatter() used for parsing and generating HTTP dates always produces dates in your locale, which is simply wrong for HTTP Dates. The only way, for now, to make the LPS work correctly here is to make sure the locale that Java is running in, produces dates like the HTTP Spec requires. US english will work. A few others may as well. (Running Java in the US locale doesn't have to keep you from running an i18-able LZX application in 3.0, if your backend and the LPS don't need to share the same jvm instance. But this fact won't console everyone, I'm sure).

The second bug is that the HTTP date format used for parsing dates is too strict according to the HTTP 1.1 spec: (I quote below)

3.3.1 Full Date

HTTP applications have historically allowed three different formats
for the representation of date/time stamps:

Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
---

HTTP apps are only allowed to produce the first format, but for some reason, are required to parse the other two. The LPS attempts to only parse the first. (This seems like a minor bug, one arguably, not worth fixing, since the spec seems particularly strange here... unless this is an undocumented HTTP 1.0/0.9 bwcompat issue)


There is a third "bug" in the LPS here, too. Rather than throwing an exception on the unparseable date, it should probably log a warning/error and just assume it didn't get a Last-Modified header. This would be friendlier and nicer in the case of truly bad formats.

We're about to open up a section of the openlaszlo wiki real soon now for bug reports like this. And a real bug tracking system is coming soon.

Best,

-Eric Bloch
Laszlo Systems
Director of Engineering

bloch
11-20-2004, 08:18 AM
I forgot to say that there is actually a way to make this work ok today in non-US locales.

1) Build the LPS from source and
2) Patch getGMTDateFormatter

I realize this is onerous for most folks.

I'm about to be on vacation for the next week (thanksgiving and all here) so I'm going silent for a while.

Best,
-Eric Bloch

Holomatrix
04-05-2005, 01:28 PM
Hello guys,

I use the 3 Beta2 Version and the regional bug is still there. I located in Germany and I am NOT willing to do any regional changes on our server, because this is a bug! Are there any conclusions in the meantime to fix that ParseException Problem? When I develop under Windows XP and change the regional settings, all works fine. When I will use my app on our Linux test-server, parseExceptions occur.

It makes me really sad, that you american guys do not look overseas that there may be s.o. who uses other regional settings than English USA.

Openlaszlo is a really cool and productive piece of software, but in my oppinion this has to be fixed urgently.

Kind regards,
Ingo

bloch
04-05-2005, 09:13 PM
I believe the fix missed b2 train... but it will be in for 3.0 final one way or another .

-Eric

mdavis
04-06-2005, 03:21 PM
We have a fix for this bug in a pre-release candidate that I'd like to give out to anyone willing to test for this issue in their locale.

This build is neither 3.0b2 nor is it 3.0 RC1 but I'd like to know before we freeze that this issue is completely resolved.

Please email mdavis@laszlosystems.com if you'd like to try this build out.

An RC build will be available shortly as well.

Thank you in advance for your help.

Mark Davis
QA Manager -- Laszlo Systems
${this.title} -- OpenLaszlo.org

loziosecchi
04-20-2005, 11:05 PM
I've just installed the rc1.
On a first try (amazon and dashboartd apps) the bug seems to be fixed

Thank you guys!