Bug 59907 - HSSFClientAnchor.setAnchorType API was broken (problem with jasperreports-5.1.0 and poi-3.14)
Summary: HSSFClientAnchor.setAnchorType API was broken (problem with jasperreports-5.1...
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: SS Common (show other bugs)
Version: 3.14-FINAL
Hardware: PC All
: P2 regression with 8 votes (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on: 58636
Blocks: 59836
  Show dependency tree
 
Reported: 2016-07-28 05:53 UTC by muthukumar
Modified: 2017-02-01 01:15 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description muthukumar 2016-07-28 05:53:03 UTC

    
Comment 1 muthukumar 2016-07-28 05:59:27 UTC
In jasperreports-5.1.0.jar there is a file called JRXlsExporter.java
Previously i used poi 3.11  and now want to update to poi 3.14 When i update
there is a problem occured with JRXlsExporter.java in line 1549 

				anchor.setAnchorType(ImageAnchorTypeEnum.getByName(currentAnchorType).getValue());

in poi 3.11 the argument for HSSFClientAnchor.setAnchorType is int
in poi 3.14 the argument for HSSFClientAnchor.setAnchorType is AnchorType

so when  compiling i meet this error:

jasperreports_5_1_0/src/net/sf/jasperreports/engine/export/JRXlsExporter.java:1549: error: method setAnchorType in class HSSFClientAnchor cannot be applied to given types;
   			anchor.setAnchorType(ImageAnchorTypeEnum.getByName(currentAnchorType).getValue());

required: AnchorType
found: byte



How to i use jasperreports-5.1.0.jar with poi 3.14??????
Comment 2 Nick Burch 2016-07-28 10:06:44 UTC
Can you try with a recent nightly build of Apache POI? (Link on http://poi.apache.org/download.html). We may have already fixed this, as we've done a bit of work recently on enums/ints/etc, including fixing a few accidental breaks
Comment 3 muthukumar 2016-07-28 13:14:52 UTC
In which version of poi this fixes are available
Comment 4 muthukumar 2016-07-28 13:37:44 UTC
i also check with POI-3.15-beta2.jar this bug is not fixed.
Comment 5 Andreas Beeker 2016-07-28 14:14:26 UTC
(In reply to muthukumar from comment #1)
> In jasperreports-5.1.0.jar there is a file called JRXlsExporter.java
> Previously i used poi 3.11  and now want to update to poi 3.14 When i update
> there is a problem occured with JRXlsExporter.java ...
> 
> How to i use jasperreports-5.1.0.jar with poi 3.14??????

I would simply copy&paste the jasper exporter and fix the call.
This assumes, that you instantiate and invoke the exporter yourself.
Comment 6 muthukumar 2016-07-28 14:54:45 UTC
Its my scenerio what i do?
Comment 7 Dominik Stadler 2016-07-28 19:11:34 UTC
The change was done under bug #58636
Comment 8 Javen O'Neal 2016-09-14 02:52:50 UTC
This affects both HSSF and XSSF.

In r1760617, I have restored ClientAnchor#setAnchorType(int) to regain backwards compatibility with POI 3.13 that was broken in POI 3.14 beta 1 thru POI 3.15 final RC2. ClientAnchor#setAnchorType(int) will be available in 3.15 final RC3 and removed no earlier than 3.17.

I have opened discussion for how to handle getAnchorType() returns int or AnchorType enum on the dev mailing list. Reverting back to 3.13's behavior of returning an int would break backwards compatibility for those who upgraded to 3.14, and break compatibility when we switch to only supporting enums.

Assuming Jasper Reports does not call AnchorType.getAnchorType(), the commit mentioned above should fix your problem from comment 1.
Comment 9 Javen O'Neal 2016-10-11 16:28:12 UTC
Because this regression was accidentally included in 3.15 final, we will leave this backwards breaking change in, rather than breathing another release to revert Tue behavior.

Please upgrade your Jasper reports code to use enums.
Comment 10 Javen O'Neal 2016-10-11 17:16:25 UTC
(In reply to Javen O'Neal from comment #8)
> I have opened discussion for how to handle getAnchorType() returns int or
> AnchorType enum on the dev mailing list. 

https://lists.apache.org/thread.html/e8b4b6c5c54497d2a64b0855093569a53edddbfa6bf559a10a10ddb1@<dev.poi.apache.org>

https://lists.apache.org/thread.html/f7a862484826f01bdd3c8a8c82e143ec02c434bce916d3495c48ae8b@<dev.poi.apache.org>
Comment 11 alexey.izmaylov 2016-11-08 16:03:34 UTC
Hi,

Can you keep both methods: new for enum and obsolete for int? 

setAnchorType(int) should be marked as @Deprecated and removed in next major release (not minor).
Comment 12 Javen O'Neal 2016-11-08 17:21:02 UTC
(HX)SSFClientAnchor.setAnchorType(int) was restored in r1760617, which was after the release of POI 3.15 final. This will be available again in POI 3.16 beta 1 and  3.16 final.