Bug 58326

Summary: Forbidden APIs patches
Product: POI Reporter: Andreas Beeker <kiwiwings>
Component: POI OverallAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: enhancement Keywords: PatchAvailable
Priority: P2    
Version: 3.13-dev   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: [PATCH] patch for forbidden apis - v1

Description Andreas Beeker 2015-09-04 09:28:26 UTC
This bug entry is used to track the patches due to the forbidden apis check.
Currently my tests run through ("ant test"), but I'd like to apply the 
forbidden apis check not only to our normal sources, but also to our tests.

As I haven't fixed all the tests, there will be either a new version of the 
patch or if you think v1 is ok, I'll commit the other changes right away ...
Comment 1 Andreas Beeker 2015-09-04 09:32:29 UTC
Created attachment 33060 [details]
[PATCH] patch for forbidden apis - v1
Comment 2 Dominik Stadler 2015-09-05 07:41:26 UTC
I like the separate LocaleUtil class which encapsulates the selection of all these items, 

I think it would be good to apply these changes now without enabling more forbidden-api-checks in order to get tests running fine again for now and then fix the remaining api-checks in the main sources. 

Then take a look at all the items in tests separately step-by-step while maintaining a green CI-build.
Comment 3 Andreas Beeker 2015-09-07 20:21:34 UTC
first set of changes for locale and timezone settings with r1701688
also includes fixes for
- name shadowing 
- unused deprecated method "getClipRect" in classes extending Graphics2d
- HexDump - replaced intermediate String.format calls with custom padding
- convert testcases to junit4
- closing resources

also tested with an arbitary timezone (PST) and locale (ru)

supresses forbidden apis check for
- LocaleUtil (the only place where Locale.getDefault() and 
TimeZone.getDefault() should be called)
- Classes using FontMetrics - without the actual text it's difficult to return 
something sane

Some usage of UTC and Locale.ROOT might be still wrong, e.g. in MapiMessage we 
don't access the
extended mapi properties, which might contain the timezone

DataFormatter has now a Observable property which need to be observed when 
custom formats are used
and the Locale changes
Comment 4 Andreas Beeker 2015-09-08 00:07:44 UTC
The charset fixes are applied with r1701713

So it looks like, there's only - a probably not so easy to catch - error with 
CellDateFormatter to fix ...
Comment 5 Andreas Beeker 2015-11-02 00:18:52 UTC
Although there are still areas where we use forbidden apis, and we probably add further method signatures to the poi custom signature file, I'm closing this for now, as the main goal seems to be reached ...