This question is answered. Helpful answers available: 1. Correct answers available: 1.


Permlink Replies: 14 - Pages: 1 - Last Post: 25-Dec-2016 15:11 Last Post By: jGromit
fotofun2

Posts: 46
Registered: 3-Sep-2007
Chamelon Java Script error
Posted: 09-Nov-2016 06:44
 
  Click to reply to this thread Reply
Is this a jAlbum error or the Chameleon skin creating the error?

Stack trace for jAlbum 13.6.3 using skin Chameleon 4.6.7:

javax.script.ScriptException: bsh.EvalError: Sourced file: inline evaluation of: ``next.get("imagePath");'' : Attempt to resolve method: get() on undefined variable or class name: next : at Line: 1 : in file: inline evaluation of: ``next.get("imagePath");'' : next .get ( "imagePath" )
in inline evaluation of: ``next.get("imagePath");'' at line number 1 in slide.htt at line number 93
at se.datadosen.jalbum.TemplateParser.eval(TemplateParser.java:738)
at se.datadosen.jalbum.TemplateParser.handleScriptlet(TemplateParser.java:661)
at se.datadosen.jalbum.TemplateParser.parseElements(TemplateParser.java:186)
at se.datadosen.jalbum.TemplateParser.handleIfElse(TemplateParser.java:394)
at se.datadosen.jalbum.TemplateParser.parseElements(TemplateParser.java:176)
at se.datadosen.jalbum.TemplateParser.handleExpressionLanguage(TemplateParser.java:642)
at se.datadosen.jalbum.TemplateParser.parseElements(TemplateParser.java:188)
at se.datadosen.jalbum.TemplateParser.handleIfElse(TemplateParser.java:398)
at se.datadosen.jalbum.TemplateParser.parseElements(TemplateParser.java:176)
at se.datadosen.jalbum.TemplateParser.handleIfElse(TemplateParser.java:405)
at se.datadosen.jalbum.TemplateParser.parseElements(TemplateParser.java:176)
at se.datadosen.jalbum.TemplateParser.handleInclude(TemplateParser.java:528)
at se.datadosen.jalbum.TemplateParser.parseElements(TemplateParser.java:182)
at se.datadosen.jalbum.TemplateParser.handleIfElse(TemplateParser.java:398)
at se.datadosen.jalbum.TemplateParser.parseElements(TemplateParser.java:176)
at se.datadosen.jalbum.TemplateParser.handleIfElse(TemplateParser.java:398)
at se.datadosen.jalbum.TemplateParser.parseElements(TemplateParser.java:176)
at se.datadosen.jalbum.TemplateParser.handleIfElse(TemplateParser.java:408)
at se.datadosen.jalbum.TemplateParser.parseElements(TemplateParser.java:176)
at se.datadosen.jalbum.TemplateParser.handleExpressionLanguage(TemplateParser.java:642)
at se.datadosen.jalbum.TemplateParser.parseElements(TemplateParser.java:188)
at se.datadosen.jalbum.TemplateParser.handleIfElse(TemplateParser.java:398)
at se.datadosen.jalbum.TemplateParser.parseElements(TemplateParser.java:176)
at se.datadosen.jalbum.TemplateParser.handleExpressionLanguage(TemplateParser.java:642)
at se.datadosen.jalbum.TemplateParser.parseElements(TemplateParser.java:188)
at se.datadosen.jalbum.TemplateParser.handleIfElse(TemplateParser.java:405)
at se.datadosen.jalbum.TemplateParser.parseElements(TemplateParser.java:176)
at se.datadosen.jalbum.TemplateParser.handleInclude(TemplateParser.java:528)
at se.datadosen.jalbum.TemplateParser.parseElements(TemplateParser.java:182)
at se.datadosen.jalbum.TemplateParser.handleIfElse(TemplateParser.java:408)
at se.datadosen.jalbum.TemplateParser.parseElements(TemplateParser.java:176)
at se.datadosen.jalbum.TemplateParser.handleIfElse(TemplateParser.java:398)
at se.datadosen.jalbum.TemplateParser.parseElements(TemplateParser.java:176)
at se.datadosen.jalbum.TemplateParser.handleIfElse(TemplateParser.java:400)
at se.datadosen.jalbum.TemplateParser.parseElements(TemplateParser.java:176)
at se.datadosen.jalbum.TemplateParser.handleIfElse(TemplateParser.java:400)
at se.datadosen.jalbum.TemplateParser.parseElements(TemplateParser.java:176)
at se.datadosen.jalbum.TemplateParser.handleExpressionLanguage(TemplateParser.java:642)
at se.datadosen.jalbum.TemplateParser.parseElements(TemplateParser.java:188)
at se.datadosen.jalbum.TemplateParser.handleExpressionLanguage(TemplateParser.java:642)
at se.datadosen.jalbum.TemplateParser.parseElements(TemplateParser.java:188)
at se.datadosen.jalbum.TemplateParser.handleExpressionLanguage(TemplateParser.java:642)
at se.datadosen.jalbum.TemplateParser.parseElements(TemplateParser.java:188)
at se.datadosen.jalbum.TemplateParser.handleIfElse(TemplateParser.java:405)
at se.datadosen.jalbum.TemplateParser.parseElements(TemplateParser.java:176)
at se.datadosen.jalbum.TemplateParser.handleInclude(TemplateParser.java:528)
at se.datadosen.jalbum.TemplateParser.parseElements(TemplateParser.java:182)
at se.datadosen.jalbum.TemplateParser.handleExpressionLanguage(TemplateParser.java:642)
at se.datadosen.jalbum.TemplateParser.parseElements(TemplateParser.java:188)
at se.datadosen.jalbum.TemplateParser.handleIfElse(TemplateParser.java:398)
at se.datadosen.jalbum.TemplateParser.parseElements(TemplateParser.java:176)
at se.datadosen.jalbum.TemplateParser.handleIfElse(TemplateParser.java:405)
at se.datadosen.jalbum.TemplateParser.parseElements(TemplateParser.java:176)
at se.datadosen.jalbum.TemplateParser.handleIfElse(TemplateParser.java:405)
at se.datadosen.jalbum.TemplateParser.parseElements(TemplateParser.java:176)
at se.datadosen.jalbum.TemplateParser.handleIfElse(TemplateParser.java:405)
at se.datadosen.jalbum.TemplateParser.parseElements(TemplateParser.java:176)
at se.datadosen.jalbum.TemplateParser.handleExpressionLanguage(TemplateParser.java:642)
at se.datadosen.jalbum.TemplateParser.parseElements(TemplateParser.java:188)
at se.datadosen.jalbum.TemplateParser.handleExpressionLanguage(TemplateParser.java:642)
at se.datadosen.jalbum.TemplateParser.parseElements(TemplateParser.java:188)
at se.datadosen.jalbum.TemplateParser.handleScriptlet(TemplateParser.java:668)
at se.datadosen.jalbum.TemplateParser.parseElements(TemplateParser.java:186)
at se.datadosen.jalbum.TemplateParser.parseElements(TemplateParser.java:154)
at se.datadosen.jalbum.TemplateParser.parseElements(TemplateParser.java:129)
at se.datadosen.jalbum.AlbumBean.makeSlide(AlbumBean.java:3266)
at se.datadosen.jalbum.AlbumBean$StandardImageProcessor.processImages(AlbumBean.java:5201)
at se.datadosen.jalbum.AlbumBean$ImageProcessingTask.call(AlbumBean.java:5139)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
jGromit

Posts: 33,206
Registered: 31-Jan-2006
Re: Chamelon Java Script error
Posted: 09-Nov-2016 08:13   in response to: fotofun2 in response to: fotofun2
 
  Click to reply to this thread Reply
That's a very strange error - I don't recall ever seeing it before. It indicates that the jAlbum core program thinks there's a "next" image, but Chameleon doesn't. I can't duplicate the error, and Chameleon hasn't been changed in almost five years.

Time for some basic debugging. Create a new album project, with just a few images. Do you still get the error? If it's happening with just one album project, please attach the jalbum-settings.jap file to your post here - maybe there's some combination of settings that's causing the problem.
jGromit

Posts: 33,206
Registered: 31-Jan-2006
Re: Chamelon Java Script error
Posted: 09-Nov-2016 08:19   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
Playing a hunch, I found the problem. It's caused by trying to use the directory-chaining feature in jAlbum. Go to Settings > Advanced > General, uncheck Chain directories, and I believe the error will go away.

It's unlikely that Chameleon will be fixed. It's basically an unsupported skin at this stage of the game.
jGromit

Posts: 33,206
Registered: 31-Jan-2006
Re: Chamelon Java Script error
Posted: 09-Nov-2016 09:45   in response to: jGromit in response to: jGromit
Helpful
  Click to reply to this thread Reply
I can cure this error, but there is a side-effect. If I open slide.htt and comment out (or just delete) lines 92-97, the error is gone, and you can use Chameleon with directory chaining.

So, what are those lines doing? They're placing some Javascript on the slide pages that defines next_image and previous_image variables. Those are used solely to trigger preloading of the images on the next and previous pages, which would speed the response if you are on a relatively slow server, or have a slow internet connection.

Edited by: jGromit on 09-Nov-2016 03:51, to post new information.
jGromit

Posts: 33,206
Registered: 31-Jan-2006
Re: Chamelon Java Script error
Posted: 09-Nov-2016 10:03   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
This is actually a bug in the jAlbum core program. It's just a lucky accident that no other skin has encountered it. I've posted a bug report about it.
jGromit

Posts: 33,206
Registered: 31-Jan-2006
Re: Chamelon Java Script error
Posted: 09-Nov-2016 14:03   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
Edit: Potential fix removed - it requires jQuery, and Chameleon doesn't use jQuery. I'll post back if I have a better idea.
jGromit

Posts: 33,206
Registered: 31-Jan-2006
Re: Chamelon Java Script error
Posted: 10-Nov-2016 20:41   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
Simple fix. Open the skin template files for editing - Tools, Skin developer, Edit skin files - go to the slide.htt file, and replace this (on lines 92-97):
<ja:if exists="nextPage"><script language="javascript" type="text/javascript">/* <![CDATA[ */
next_image=new Image(); next_image.src="<%=next.get("imagePath")%>";
/* ]]> */</script></ja:if>
<ja:if exists="previousPage"><script language="javascript" type="text/javascript">/* <![CDATA[ */
previous_image=new Image(); previous_image.src="<%=previous.get("imagePath")%>";
/* ]]> */</script></ja:if>
With this:
<ja:if exists="next"><script type="text/javascript">
next_image=new Image(); next_image.src="<%=next.get("imagePath")%>";
</script></ja:if>
<ja:if exists="previous"><script type="text/javascript">
previous_image=new Image(); previous_image.src="<%=previous.get("imagePath")%>";
</script></ja:if>
Until the underlying error in the jAlbum core is fixed, this will avoid the crash. It will enable preloading of slide images, but not across directory boundaries.

Edited by: jGromit on 10-Nov-2016 18:45, to provide line numbers
Laza

Posts: 9,472
Registered: 6-Sep-2005
Re: Chamelon Java Script error
Posted: 11-Nov-2016 10:06   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
My first idea was the nextPage exists because a custom page was added, but next image isn't. However, when testing the error happened even with no custom pages. Strange it doesn't break any other skin.
jGromit

Posts: 33,206
Registered: 31-Jan-2006
Re: Chamelon Java Script error
Posted: 11-Nov-2016 13:13   in response to: Laza in response to: Laza
 
  Click to reply to this thread Reply
Laza wrote:
Strange it doesn't break any other skin.

I've looked at a bunch of other skins (including some of yours), and so far Chameleon is the only one that's checking for nextPage, but then using next.

Skins that don't use slide pages, of course, don't face the problem at all. Most skins that do use slide pages aren't trying to preload an image from the next page, so they don't have trouble.

In your other slide-page skins, like Base, you're checking for next and using next, so those don't blow up - they just don't get any image preloading when directory boundaries are crossed, which is something most users would never notice.
jGromit

Posts: 33,206
Registered: 31-Jan-2006
Re: Chamelon Java Script error
Posted: 03-Dec-2016 14:13   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
Because of a similar (related?) bug in jAlbum, my fix is only partially effective.

http://jalbum.net/forum/thread.jspa?threadID=52069

Because of this bug in the definition of next and previous, you will sometimes get broken links in the image preloader, with or without directory chaining. This won't crash jAlbum, or be visible to your site visitors, but you will start seeing some mysterious 404's in your server logs

I thought I could avoid this bug by doing a double test, like this:
<ja:if exists="previousPage"><ja:if exists="previous">get the image</ja:if></ja:if>
But that still produces broken links in some fairly ordinary situations, like a folder followed by a few images at the top level, with directory chaining turned on.

I don't know how to code around this one without engaging in some fairly extensive skin-based traversal of the album objects, independently of the jAlbum core, or perhaps by examing the imagePath that's returned and rejecting it if it contains a slash - "/".
fotofun2

Posts: 46
Registered: 3-Sep-2007
Re: Chamelon Java Script error
Posted: 10-Dec-2016 09:50   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
I'll work on it as a small project later. I moved to the jGromit skin which, for all intensive purposes, does a very good job for what I need. Thanks for the commentary and quick response.
fotofun2

Posts: 46
Registered: 3-Sep-2007
Re: Chamelon Java Script error
Posted: 10-Dec-2016 09:59   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
That seems to be the story of my tech support part of my life. I'm always finding crazy errors that no one else encounters. Maybe it's because I tinker too much with changing the settings to see what an effect with have with the change. So far, however, I haven't encountered any scripting errors with the jGromit skin. Only a couple of nuances which I've reported for a possible design element script improvement for image commenting.
fotofun2

Posts: 46
Registered: 3-Sep-2007
Re: Chamelon Java Script error
Posted: 10-Dec-2016 10:09   in response to: jGromit in response to: jGromit
 
  Click to reply to this thread Reply
Oh my, these "Next" and "Previous" statements take me back a few years when I was writing one of those ancient languages known as COBOL and later with FOX Database code. Now, I remember why I stopped writing code. I can read most of it and figure out what it is doing. Unfortunately, no longer have the stamina nor patience to deal with scripting errors and debugging.

It's good to know, however, that the error I found will help clean up some scripting in the jAlbum core. Who would have ever thunk that the outcome would come to finding a core error in scripting? Good job to both of you.
davidekholm

Posts: 21,490
Registered: 18-Oct-2002
Re: Chamelon Java Script error
Posted: 12-Dec-2016 15:49   in response to: fotofun2 in response to: fotofun2
 
  Click to reply to this thread Reply
Please try the 13.8 beta and report if it behaves like it should now. http://jalbum.net/download/beta/jalbum-core.jar
jGromit

Posts: 33,206
Registered: 31-Jan-2006
Re: Chamelon Java Script error
Posted: 20-Dec-2016 14:21   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
Attachment slide.htt (12,0 KB)
To cure the Java crash when making an album, open the skin directory - Tools, Open directories, Skin directory - and replace the slide.htt file with the attached version.

With versions of jAlbum before 13.8, you may still see some "404" errors in your server logs. Updating to jAlbum 13.8 or better cures that problem.

With chained directories, you will not get the benefit of image pre-loading when crossing directory boundaries. There may eventually be a jAlbum core fix for that issue, but it's exceptionally difficult.

With these two fixes - new slide.htt file and jAlbum 13.8 or better - you will get the benefit of image pre-loading within each directory (folder), and you won't get any errors.
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums