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


Permlink Replies: 2 - Pages: 1 - Last Post: 3 Nov 22, 09:27 Last Post By: davidekholm
AndreWolff

Posts: 1,116
Registered: 14-Dec-2007
Groovy error MissingPropertyException: No such property
Posted: 2 Nov 22, 18:38
 
  Click to reply to this thread Reply
I have in file index.htt this ode:
<%
try { 
albumImage= IO.urlEncode(currentFolder.getThumbnailPath());
albumImage= albumImage.replace("thumbs","slides");
} // to prevent crash with an empty folder:
catch (NullPointerException e) { albumImage="";} 
%>
I use the variable albumImage in file File page-header.inc:
<ja:if test="<%= !isEmpty(albumImage) %>">
<meta property="og:image" content="${albumImageURL}">
</ja:if>
This works fine with BSH, but with Groovy I get an error:
se.datadosen.util.ScriptException: groovy.lang.MissingPropertyException: No such property:
 albumImage for class: Script494 in page-header.inc at line number 42

This error disappears if I repeat the first code block in file page-header.inc

So I wonder is the processing order of the files in Groovy differently as with BeanShell?

How should I solve this, without repeating code?
AndreWolff

Posts: 1,116
Registered: 14-Dec-2007
Re: Groovy error MissingPropertyException: No such property
Posted: 3 Nov 22, 08:50   in response to: AndreWolff in response to: AndreWolff
 
  Click to reply to this thread Reply
Problem solved:

index.htt did contain the statement:
String albumImage="";
after I changed it into
albumImage="";
the problem was solved.
davidekholm

Posts: 3,987
Registered: 18-Oct-2002
Re: Groovy error MissingPropertyException: No such property
Posted: 3 Nov 22, 09:27   in response to: AndreWolff in response to: AndreWolff
 
  Click to reply to this thread Reply
Good
Legend
Forum admins
Helpful Answer
Correct Answer

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