[
https://issues.apache.org/struts/browse/WW-3348?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mark Gorokhov updated WW-3348:
------------------------------
Description:
Scenario:
- Jasper report with 4 subreports.
- Subreports content is provided from
org.apache.struts2.views.jasperreports.ValueStackDataSource
Exception
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
is thrown from org.apache.struts2.views.jasperreports.ValueStackDataSource:
public boolean next() throws JRException {
if (firstTimeThrough) {
firstTimeThrough = false;
} else {
valueStack.pop(); <== throws exception
}
. . .
}
Exception is thrown if the last row from subreport fits the current page and a
new page is started. Thus the exception is data dependent.
The following workaround works nicely:
public boolean next() throws JRException {
if (firstTimeThrough) {
firstTimeThrough = false;
} else {
if (valueStack.size() > 0) {
valueStack.pop();
}
}
. . .
}
Please test and implement in the next release.
The following does not work (main report is generated partially, stops on empty
valueStack condition):
public boolean next() throws JRException {
if (firstTimeThrough) {
firstTimeThrough = false;
} else {
if (valueStack.size() == 0) {
return false;
}
valueStack.pop();
}
. . .
}
was:
Scenario:
- Jasper report with 4 subreports.
- Subreports content is provided from
org.apache.struts2.views.jasperreports.ValueStackDataSource
Exception
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
is thrown from:
public boolean next() throws JRException {
if (firstTimeThrough) {
firstTimeThrough = false;
} else {
valueStack.pop(); <== throws exception
}
. . .
}
Exception is thrown if the last row from subreport fits the current page and a
new page is started. Thus the exception is data dependent.
The following workaround works nicely:
if (valueStack.size() > 0) {
valueStack.pop();
}
Please test and implement in the next release.
The following does not work (cuts off the main report on empty valueStack
condition):
if (valueStack.size() == 0) {
return false;
}
valueStack.pop();
> IndexOutOfBoundsException in ValueStackDataSource
> -------------------------------------------------
>
> Key: WW-3348
> URL: https://issues.apache.org/struts/browse/WW-3348
> Project: Struts 2
> Issue Type: Bug
> Components: Plugin - JasperReports
> Affects Versions: 2.1.8
> Environment: WinXP, Tomcat
> Reporter: Mark Gorokhov
>
> Scenario:
> - Jasper report with 4 subreports.
> - Subreports content is provided from
> org.apache.struts2.views.jasperreports.ValueStackDataSource
> Exception
> java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
> is thrown from org.apache.struts2.views.jasperreports.ValueStackDataSource:
> public boolean next() throws JRException {
> if (firstTimeThrough) {
> firstTimeThrough = false;
> } else {
> valueStack.pop(); <== throws exception
> }
> . . .
> }
> Exception is thrown if the last row from subreport fits the current page and
> a new page is started. Thus the exception is data dependent.
> The following workaround works nicely:
> public boolean next() throws JRException {
> if (firstTimeThrough) {
> firstTimeThrough = false;
> } else {
> if (valueStack.size() > 0) {
> valueStack.pop();
> }
> }
> . . .
> }
> Please test and implement in the next release.
> The following does not work (main report is generated partially, stops on
> empty valueStack condition):
> public boolean next() throws JRException {
> if (firstTimeThrough) {
> firstTimeThrough = false;
> } else {
> if (valueStack.size() == 0) {
> return false;
> }
> valueStack.pop();
> }
> . . .
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.