BIRT 2.6 Bug?

J.Salazar
J.Salazar Member
edited February 11, 2022 in Analytics #1
I'm having some problems with the update from BIRT 2.5.2 to BIRT 2.6.

First, I've found the same problem than here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=322103

Second, I have troubles with "Divide by zero" error:
- Let's have some data like that:
A, B, C, CODE, DATA
0, 0, 0, 1, 2010-01-01
0, 0, 0, 2, 2010-02-01
0, 0, 0, 3, 2010-03-01
0, 0, 0, 4, 2010-04-01

- Let's generate a chart
* Chart Type: Line - 2D
* Data:
+ Serie 1: row["A"] (Sum)
+ Serie 2: row["B"] (Sum)
+ Serie 3: row["C"] (Sum)
Category X: row["DATA"]
Sort On: row["DATA"]
Group by: Enabled. Type: DateTime. Months. Interval: 1. Aggregate Expression: Sum

Now I have the error "Divide by 0".

At this point, I have tried some actions to avoid it and I have found that if I change the Aggregate Expression of Series 1 from Sum to Count the error dissapears. Furthermore if I add a new Series with row["A"] and Aggregate expression Sum, it does not fails unless I change back the Aggregate Expression of Series 1 from Count to Sum. Even I can hide Serie 1 and I have the graph I would like to see but I think it is not a good workaround.

It seems it is a bug of Birt 2.6 and I think it must be relationed with how BIRT calculate the scale of X-Axis.

Have you found the same problem?

Feel free to ask explanation of my poor English.

Regards

Comments

  • mwilliams
    mwilliams Member
    edited December 31, 1969 #2
    Hi J.Salazar,

    I don't see the same when I set up a similar example. Can you recreate this issue in a way that I can run it to see what you're seeing?
    Warning No formatter is installed for the format ipb
  • J.Salazar
    J.Salazar Member
    edited December 31, 1969 #3
    <blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="67482" data-time="1282142649" data-date="18 August 2010 - 07:44 AM"><p>
    Hi J.Salazar,<br />
    <br />
    I don't see the same when I set up a similar example. Can you recreate this issue in a way that I can run it to see what you're seeing?<br /></p></blockquote>
    <br />
    Hi, mwilliams<br />
    <br />
    Thanks for your reply.<br />
    <br />
    I have tried to recreate it but I'm not able. Let's try to explain my situation.<br />
    <br />
    I have a report from BIRT 2.5 connected to a MySQL database with the "divide by 0" error. In this report, I repeat the same problem when using a flat file but no when using sample database.<br />
    <br />
    I have created a new report with BIRT 2.6. In this report, I only find the problem with MySQL database but not when using a flat file or sample database so I don't know how to create a sample report with this issue. <br />
    <br />
    I'm using mysql-connector-java-3.1.12-bin.jar<br />
    <br />
    Any idea? <br />
    <br />
    Can anybody try to connect to a MySQL database, create a dataset and a chart like I'm trying?<br />
    <br />
    The dataset must be like that:<br />
    select 0 A, 0 B, 0 C, 1 code, str_to_date("20100101","%Y%m%d") date<br />
    from dual<br />
    union<br />
    select 0 A, 0 Tancades, 0 Curs, 2 codi, str_to_date("20100201","%Y%m%d")<br />
    from dual<br />
    union<br />
    select 0 A, 0 Tancades, 0 Curs, 3 codi, str_to_date("20100301","%Y%m%d")<br />
    from dual<br />
    union<br />
    select 0 A, 0 Tancades, 0 Curs, 4 codi, str_to_date("20100401","%Y%m%d")<br />
    from dual<br />
    <br />
    Thanks for your time!
  • J.Salazar
    J.Salazar Member
    edited December 31, 1969 #4
    More information.

    I'm debugging simple report and console shows some extended info about the exception.

    SEVERE: Divide by 0
    org.eclipse.birt.chart.exception.ChartException: Divide by 0
    at org.eclipse.birt.chart.reportitem.ChartReportItemPresentationBase.onRowSets(ChartReportItemPresentationBase.java:822)
    at org.eclipse.birt.chart.reportitem.ChartReportItemPresentationProxy.onRowSets(ChartReportItemPresentationProxy.java:108)
    at org.eclipse.birt.report.engine.presentation.LocalizedContentVisitor.processExtendedContent(LocalizedContentVisitor.java:1014)
    at org.eclipse.birt.report.engine.presentation.LocalizedContentVisitor.localizeForeign(LocalizedContentVisitor.java:579)
    at org.eclipse.birt.report.engine.presentation.LocalizedContentVisitor.localize(LocalizedContentVisitor.java:163)
    at org.eclipse.birt.report.engine.internal.executor.l18n.LocalizedReportItemExecutor.execute(LocalizedReportItemExecutor.java:37)
    at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:65)
    at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:90)
    at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:99)
    at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun(RunAndRenderTask.java:172)
    at org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run(RunAndRenderTask.java:75)
    at org.eclipse.birt.report.debug.internal.core.launcher.ReportLauncher.createReport(ReportLauncher.java:594)
    at org.eclipse.birt.report.debug.internal.core.launcher.ReportLauncher.renderReport(ReportLauncher.java:541)
    at org.eclipse.birt.report.debug.internal.core.launcher.ReportLauncher.run(ReportLauncher.java:455)
    at org.eclipse.birt.report.debug.internal.core.launcher.ReportLauncher.main(ReportLauncher.java:104)
    at org.eclipse.birt.report.debug.internal.core.ReportDebugger.start(ReportDebugger.java:39)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
    Caused by: java.lang.ArithmeticException: Divide by 0
    at com.ibm.icu.math.BigDecimal.dodivide(BigDecimal.java:3633)
    at com.ibm.icu.math.BigDecimal.divide(BigDecimal.java:1569)
    at org.eclipse.birt.chart.util.ChartUtil.adjustDataSets(ChartUtil.java:2222)
    at org.eclipse.birt.chart.util.ChartUtil.adjustBigNumberWithinDataSets(ChartUtil.java:2113)
    at org.eclipse.birt.chart.internal.datafeed.DataProcessor.generateRuntimeSeries(DataProcessor.java:1458)
    at org.eclipse.birt.chart.internal.datafeed.DataProcessor.generateRuntimeSeries(DataProcessor.java:507)
    at org.eclipse.birt.chart.factory.Generator.bindData(Generator.java:652)
    at org.eclipse.birt.chart.reportitem.ChartReportItemPresentationBase.bindData(ChartReportItemPresentationBase.java:683)
    at org.eclipse.birt.chart.reportitem.ChartReportItemPresentationBase.onRowSets(ChartReportItemPresentationBase.java:801)
    ... 28 more
  • J.Salazar
    J.Salazar Member
    edited December 31, 1969 #5
    EUREKA!!!

    The problem is the data type.

    Here you have a report connecting with sample database. The first chart have the data in Y-Axis with data type Integer and it does not fail. The second chart have the data in Y-Axis with data type Decimal and it fails.

    Is it a bug of Birt 2.6?
  • mwilliams
    mwilliams Member
    edited December 31, 1969 #6
    J.Salazar,

    Yes, this looks like a bug. Please log it at http://www.birt-exchange.org/org/resources/bug-reporting/. Thanks!
    Warning No formatter is installed for the format ipb
  • dzish
    dzish Member
    edited December 31, 1969 #7
    Hi J.Saalazar,

    I see it's maybe same problem as http://www.birt-exchange.org/org/forum/index.php/topic/20086-bar-chart-with-2-series-in-birt-2-6

    I already added this bug to bugzilla. It will be repaired in BIR 2.6.1
  • J.Salazar
    J.Salazar Member
    edited December 31, 1969 #8
    Thank you! I will wait for BIRT 2.6.1
  • mwilliams
    mwilliams Member
    edited December 31, 1969 #9
    Great! Thanks for the info dzish!
    Warning No formatter is installed for the format ipb
  • Arithmetic exceptions are raised during run time by Java Virtual Machine when you try to perform any arithmetic operation which is not possible in mathematics. In most cases, when a number is divided by zero, the result is undefined and that is when this ArithmeticException occurs.

    You can handle Java ArithmeticException in the following methods:

    • You should make sure the divisor isn't zero (0) before attempting any division.
    • You can handle the ArithmeticException using Java try and catch blocks.