Bug 60787 - CellUtil.class with print strings
Summary: CellUtil.class with print strings
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks: 60805
  Show dependency tree
 
Reported: 2017-02-28 15:07 UTC by kamile.demirel
Modified: 2017-03-02 19:22 UTC (History)
0 users



Attachments
Methods with printed lines (4.21 KB, text/plain)
2017-02-28 15:07 UTC, kamile.demirel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description kamile.demirel 2017-02-28 15:07:54 UTC
Created attachment 34786 [details]
Methods with printed lines

The CellUtil.class has got methods, which print lines 
like "BorderStyle short usage" in method getBorderStyle(Map<String, Object> properties, String name) at line 525. 
The same is in method getFillPattern(Map<String, Object> properties, String name) with "FillPatternType short usage" at line 558, 
in method getHorizontalAlignment(Map<String, Object> properties, String name) with "HorizontalAlignment short usage" at line 5910 
and in method getVerticalAlignment(Map<String, Object> properties, String name) with "VerticalAlignment usage " + name + " " + value" at line 624.
Comment 1 Javen O'Neal 2017-02-28 16:41:56 UTC
What are you asking to change with the existing implementation?
Comment 2 kamile.demirel 2017-03-01 06:54:40 UTC
I use this methods in my program and get these lines. Is this necessary? I am asking for removing this lines. If it is possible.
Comment 3 Javen O'Neal 2017-03-01 08:09:49 UTC
The logging code did exactly what it was intended to do--notify the user that the current code will not work in a future version of POI.

https://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/util/CellUtil.java?revision=1760630&view=markup#l519

I added these INFO-level warnings to the POI logger to let users know that CellUtil will switch to using enums in the future. See bug 59836 if you're curious. Enums are safer, faster (checked at compile time instead of runtime--if checked at all), require less code, and give more informative error messages (enum name instead of integer code), and easier to use. They also make the POI API more flexible since users are unable to hard-code integer literals in place of enums.
Finally, it makes the method signatures easier to read.

If you have code that is tripping these warnings that is originating from POI code, post it here so we can fix it (it may not be possible without breaking backwards compatibility, in which case we'll defer those changes).

If the code that is tripping these warnings comes from your code, consider upgrading that code to use enums.

You could also choose to ignore the POI log, change the logger level (log.check), or have your logger write to a different destination if it's causing you problems. Suppressing the problem now will make it more difficult to update down the road. Your call, but not a call that I would want to make for all users. Maybe someone else wants those warnings written to the log.
Comment 4 kamile.demirel 2017-03-02 07:23:28 UTC
Ah I see, there is a new version poi3.16-beta2. But there are the lines, too.
I think you may have misunterstood me.

At line 525 in CellUtil.class there is 
this line --> System.out.println("BorderStyle short usage");

This is nothing about the log level. The attachment, which I added, shows the functions with the lines. Please look at this. You will agree with me.
Comment 5 Javen O'Neal 2017-03-02 18:43:26 UTC
I missed the println. You're correct, we shouldn't be writing to stdout here.
Comment 6 Javen O'Neal 2017-03-02 18:48:24 UTC
Fixed in r1785185.

Will be included in POI 3.16 beta 3.

Thanks for finding this.