ALBERLAU blog

Blog about my personal experience in software development.

Wednesday, February 20, 2008

 

International characters in JEXL

When using i18n chars in string's i'm getting

org.apache.commons.jexl.parser.TokenMgrError: Lexical error at line 1,
column 17. Encountered: "\u0139" (313), after : "\'U"

Because of this problem in JEXL i compiled jar which solves that problem.


Below is Randy H. solution pasted from forum how to fix things.

1. Download and unzip jexl 1.1 source from:
http://www.axint.net/apache/jakarta/commons/jexl/source/commons-jexl-1.1-src.zip

2. Download and unzip JavaCC 4.0 from:
https://javacc.dev.java.net/files/documents/17/26777/javacc-4.0.zip

3. Run javacc-4.0\bin\javacc -UNICODE_INPUT
commons-jexl-1.1-src\src\java\org\apache\commons\jexl\parser\Parser.jj

4. Copy *.java to
commons-jexl-1.1-src\src\java\org\apache\commons\jexl\parser

5. Run ant -f commons-jexl-1.1-src\build.xml

6. Use the new jar commons-jexl-1.1-src\target\commons-jexl-1.1.jar

Labels: ,


Friday, February 01, 2008

 

JasperReports issues

Textfield border is not visible when rendering empty string using html exporter
When drawing table in JasperReports i'm not using lines, but placing text or static fields with borders set on them. Problem occures when there is empty string. Border is not rendered then. I think it is common problem to html, because in html tables you need to place & n b s p ; . In JasperReports nbsp will be rendered as nbsp in pdf exporter as well in html. If cell is empty you can place space instead of empty string. But what in case BigDecimal, Date or some other type?
The source causing this problem is in net.sf.jasperreports.engine.export.JRHtmlExporter .
emptyCellStringProvider =
new StringProvider()
{
public String getStringForCollapsedTD(Object value, int width, int height, String sizeUnit)
{
return " style=\"width: " + width + sizeUnit + "; height: " + height + sizeUnit + ";\">";
}
public String getStringForEmptyTD(Object value)
{
return "";
}
};

It is not possible to specify other emptyCellStringProvider. At least in 1.3.4 and 2.0.4 versions.
I think the line returning empty string should look as follows:
public String getStringForEmptyTD(Object value)
{
return " ";
}


Unfortunately i was unable to findout other way than to download sources, fix problem and make jar by myself.

Labels:


Archives

January 2008   February 2008   March 2009  

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]