#67 System.err, System.out, and printStackTrace

open
nobody
None
5
2009-08-24
2009-08-24
Dave Jarvis
No

The following classes use standard error:

$ find . -type f -exec grep -Hlsi "System.err" {} \;
./visual/VisualGraph.java
./render/ImageFactory.java
./action/layout/graph/FruchtermanReingoldLayout.java
./controls/ZoomControl.java
./data/io/TreeMLReader.java
./util/collections/AbstractTreeMap.java
./util/StringLib.java
./util/ui/BrowserLauncher.java

The following classes use standard out:

$ find . -type f -exec grep -Hlsi "System.out" {} \;
./action/layout/graph/ForceDirectedLayout.java
./action/layout/AxisLabelLayout.java
./data/expression/parser/ExpressionParserTokenManager.java
./data/expression/parser/ExpressionParser.java
./util/force/CircularWallForce.java
./util/display/ExportDisplayAction.java

It would be nice to see, at least, the standard error lines removed. A library should not use either, but throw exceptions instead. Similarly, the following classes print stack traces:

$ find . -type f -exec grep -Hlsi "printStackTrace" {} \;
./visual/VisualGraph.java
./render/ImageFactory.java
./Display.java
./data/search/LuceneSearcher.java
./util/io/IOLib.java
./util/ArrayLib.java
./util/StringLib.java
./util/force/NBodyForce.java
./util/display/BackgroundPainter.java
./util/ui/UILib.java
./util/TimeLib.java
./util/PrefuseConfig.java

Applications should have full control over what gets displayed to the user.

Discussion