denghuafeng / jforum2

Automatically exported from code.google.com/p/jforum2
Other
0 stars 0 forks source link

Exception thrown and shown in Browser if attachment without desription is attached #11

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create new issue
2. Attach a file
3. Press Submit

What is the expected output? What do you see instead?
Proper display of the topic with the attachment

What version of the product are you using? On what operating system?
JForum 2.3.3

Please provide any additional information below.

Here the Exception which is reported in the Browsers windows:

Expression a.info.comment is undefined on line 30, column 94 in 
default/post_show_attachments_inc.htm. The problematic instruction: ---------- 
==> if-else [on line 30, column 88 in default/post_show_attachments_inc.htm] in 
include "post_show_attachments_inc.htm" [on line 175, column 65 in 
default/post_show.htm] ---------- Java backtrace for programmers: ---------- 
freemarker.core.InvalidReferenceException: Expression a.info.comment is 
undefined on line 30, column 94 in default/post_show_attachments_inc.htm. at 
freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:125) at 
freemarker.core.Expression.getStringValue(Expression.java:118) at 
freemarker.core.Expression.getStringValue(Expression.java:93) at 
freemarker.core.BuiltIn$lengthBI._getAsTemplateModel(BuiltIn.java:291) at 
freemarker.core.Expression.getAsTemplateModel(Expression.java:89) at 
freemarker.core.ComparisonExpression.isTrue(ComparisonExpression.java:111) at 
freemarker.core.ParentheticalExpression.isTrue(ParentheticalExpression.java:66) 
at freemarker.core.IfBlock.accept(IfBlock.java:80) at 
freemarker.core.Environment.visit(Environment.java:221) at 
freemarker.core.MixedContent.accept(MixedContent.java:92) at 
freemarker.core.Environment.visit(Environment.java:221) at 
freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79) at 
freemarker.core.Environment.visit(Environment.java:221) at 
freemarker.core.MixedContent.accept(MixedContent.java:92) at 
freemarker.core.Environment.visit(Environment.java:221) at 
freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:167) at 
freemarker.core.Environment.visit(Environment.java:428) at 
freemarker.core.IteratorBlock.accept(IteratorBlock.java:102) at 
freemarker.core.Environment.visit(Environment.java:221) at 
freemarker.core.Environment.include(Environment.java:1508) at 
freemarker.core.Include.accept(Include.java:169) at 
freemarker.core.Environment.visit(Environment.java:221) at 
freemarker.core.MixedContent.accept(MixedContent.java:92) at 
freemarker.core.Environment.visit(Environment.java:221) at 
freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79) at 
freemarker.core.Environment.visit(Environment.java:221) at 
freemarker.core.MixedContent.accept(MixedContent.java:92) at 
freemarker.core.Environment.visit(Environment.java:221) at 
freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:167) at 
freemarker.core.Environment.visit(Environment.java:428) at 
freemarker.core.IteratorBlock.accept(IteratorBlock.java:102) at 
freemarker.core.Environment.visit(Environment.java:221) at 
freemarker.core.MixedContent.accept(MixedContent.java:92) at 
freemarker.core.Environment.visit(Environment.java:221) at 
freemarker.core.Environment.process(Environment.java:199) at 
freemarker.template.Template.process(Template.java:237) at 
net.jforum.JForum.processCommand(JForum.java:262) at 
net.jforum.JForum.service(JForum.java:228) at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at 
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.jav
a:1166) at 
net.jforum.util.legacy.clickstream.ClickstreamFilter.doFilter(ClickstreamFilter.
java:59) at 
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.jav
a:1157) at 
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388) at 
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at 
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at 
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) at 
org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418) at 
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollecti
on.java:230) at 
org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) 
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at 
org.mortbay.jetty.Server.handle(Server.java:326) at 
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) at 
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.ja
va:926) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549) at 
org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212) at 
org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at 
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410) at 
org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582) 

Original issue reported on code.google.com by kusi.gue...@gmail.com on 20 Dec 2011 at 3:05

GoogleCodeExporter commented 9 years ago
while I cannot reproduce the problem here (might depend on the databse-enginge 
perhaps) changing 
<#if (a.info.comment?length > 0)> to 
<#if a.info.comment?? && (a.info.comment?trim?length > 0)> in 
post_show_attachments_inc.htm should work for you (and work for all others as 
well)

The additional trim inserted here is not necessary to fix the problem for you, 
but it will also show the "no description" string when only whitespace is 
entered as comment.

Original comment by lohma...@googlemail.com on 3 Jan 2012 at 12:24

GoogleCodeExporter commented 9 years ago
Hi, I did the proposed change and it works. There is no more exception thrwon 
to the user.

Original comment by kusi.gue...@gmail.com on 8 Mar 2012 at 1:55

GoogleCodeExporter commented 9 years ago
Could you please correct this for the next release in the trunk. Thanks very 
much.

Original comment by kusi.gue...@gmail.com on 8 Mar 2012 at 1:56

GoogleCodeExporter commented 9 years ago
Fixed in revision r171

Original comment by andow...@gmail.com on 23 May 2012 at 9:00

GoogleCodeExporter commented 9 years ago
When using Oracle Database Express Edition 11g Release 2 as backend database, 
this issue can be reproduced. 

Original comment by andow...@gmail.com on 6 Jul 2012 at 2:12

GoogleCodeExporter commented 9 years ago
Fixed in r213

Original comment by andow...@gmail.com on 6 Jul 2012 at 4:36