You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2015/10/12 22:43:42 UTC

svn commit: r1708236 [1/3] - in /poi: site/src/documentation/content/xdocs/ trunk/src/examples/src/org/apache/poi/ss/examples/html/ trunk/src/java/org/apache/poi/hssf/usermodel/ trunk/src/java/org/apache/poi/ss/usermodel/ trunk/src/ooxml/java/org/apach...

Author: kiwiwings
Date: Mon Oct 12 20:43:42 2015
New Revision: 1708236

URL: http://svn.apache.org/viewvc?rev=1708236&view=rev
Log:
- removed deprecated and confusing methods in XSSFColor
- sonar fixes

Modified:
    poi/site/src/documentation/content/xdocs/status.xml
    poi/trunk/src/examples/src/org/apache/poi/ss/examples/html/ToHtml.java
    poi/trunk/src/examples/src/org/apache/poi/ss/examples/html/XSSFHtmlHelper.java
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/DummyGraphics2d.java
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/StaticFontMetrics.java
    poi/trunk/src/java/org/apache/poi/ss/usermodel/FractionFormat.java
    poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/exceptions/InvalidFormatException.java
    poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/exceptions/OpenXML4JException.java
    poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFColor.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFCellStyle.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFColor.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/extensions/TestXSSFCellFill.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/extractor/Word6Extractor.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestEscherGraphics2d.java
    poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java

Modified: poi/site/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/site/src/documentation/content/xdocs/status.xml?rev=1708236&r1=1708235&r2=1708236&view=diff
==============================================================================
--- poi/site/src/documentation/content/xdocs/status.xml (original)
+++ poi/site/src/documentation/content/xdocs/status.xml Mon Oct 12 20:43:42 2015
@@ -39,6 +39,7 @@
     </devs>
 
     <release version="3.14-beta1" date="2015-11-??">
+        <action dev="PD" type="fix">Removed deprecated mixed case getter/setter in XSSFColor</action>
         <action dev="PD" type="fix" fixes-bug="55032">Fix handling missing option values in financial functions PV, FV, NPER and PMT</action>
         <action dev="PD" type="fix" fixes-bug="50319">Make row groups which include row 0 work</action>
         <action dev="PD" type="fix">Removed deprecated HDF API</action>

Modified: poi/trunk/src/examples/src/org/apache/poi/ss/examples/html/ToHtml.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/ss/examples/html/ToHtml.java?rev=1708236&r1=1708235&r2=1708236&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/ss/examples/html/ToHtml.java (original)
+++ poi/trunk/src/examples/src/org/apache/poi/ss/examples/html/ToHtml.java Mon Oct 12 20:43:42 2015
@@ -149,7 +149,7 @@ public class ToHtml {
         if (wb instanceof HSSFWorkbook)
             helper = new HSSFHtmlHelper((HSSFWorkbook) wb);
         else if (wb instanceof XSSFWorkbook)
-            helper = new XSSFHtmlHelper((XSSFWorkbook) wb);
+            helper = new XSSFHtmlHelper();
         else
             throw new IllegalArgumentException(
                     "unknown workbook type: " + wb.getClass().getSimpleName());

Modified: poi/trunk/src/examples/src/org/apache/poi/ss/examples/html/XSSFHtmlHelper.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/ss/examples/html/XSSFHtmlHelper.java?rev=1708236&r1=1708235&r2=1708236&view=diff
==============================================================================
--- poi/trunk/src/examples/src/org/apache/poi/ss/examples/html/XSSFHtmlHelper.java (original)
+++ poi/trunk/src/examples/src/org/apache/poi/ss/examples/html/XSSFHtmlHelper.java Mon Oct 12 20:43:42 2015
@@ -17,13 +17,10 @@
 package org.apache.poi.ss.examples.html;
 
 import java.util.Formatter;
-import java.util.Map;
 
-import org.apache.poi.hssf.util.HSSFColor;
 import org.apache.poi.ss.usermodel.CellStyle;
 import org.apache.poi.xssf.usermodel.XSSFCellStyle;
 import org.apache.poi.xssf.usermodel.XSSFColor;
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 
 /**
  * Implementation of {@link HtmlHelper} for XSSF files.
@@ -31,14 +28,6 @@ import org.apache.poi.xssf.usermodel.XSS
  * @author Ken Arnold, Industrious Media LLC
  */
 public class XSSFHtmlHelper implements HtmlHelper {
-    private final XSSFWorkbook wb;
-
-    private static final Map<Integer,HSSFColor> colors = HSSFColor.getIndexHash();
-
-    public XSSFHtmlHelper(XSSFWorkbook wb) {
-        this.wb = wb;
-    }
-
     public void colorStyles(CellStyle style, Formatter out) {
         XSSFCellStyle cs = (XSSFCellStyle) style;
         styleColor(out, "background-color", cs.getFillForegroundXSSFColor());
@@ -46,10 +35,11 @@ public class XSSFHtmlHelper implements H
     }
 
     private void styleColor(Formatter out, String attr, XSSFColor color) {
-        if (color == null || color.isAuto())
+        if (color == null || color.isAuto()) {
             return;
+        }
 
-        byte[] rgb = color.getRgb();
+        byte[] rgb = color.getRGB();
         if (rgb == null) {
             return;
         }
@@ -58,7 +48,7 @@ public class XSSFHtmlHelper implements H
         // support it will ignore the rgba specification and stick with the
         // solid color, which is declared first
         out.format("  %s: #%02x%02x%02x;%n", attr, rgb[0], rgb[1], rgb[2]);
-        byte[] argb = color.getARgb();
+        byte[] argb = color.getARGB();
         if (argb == null) {
             return;
         }

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/DummyGraphics2d.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/DummyGraphics2d.java?rev=1708236&r1=1708235&r2=1708236&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/DummyGraphics2d.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/DummyGraphics2d.java Mon Oct 12 20:43:42 2015
@@ -18,7 +18,21 @@
 
 package org.apache.poi.hssf.usermodel;
 
-import java.awt.*;
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Composite;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.GraphicsConfiguration;
+import java.awt.Image;
+import java.awt.Paint;
+import java.awt.Polygon;
+import java.awt.Rectangle;
+import java.awt.RenderingHints;
+import java.awt.Shape;
+import java.awt.Stroke;
 import java.awt.font.FontRenderContext;
 import java.awt.font.GlyphVector;
 import java.awt.geom.AffineTransform;
@@ -27,775 +41,785 @@ import java.awt.image.BufferedImageOp;
 import java.awt.image.ImageObserver;
 import java.awt.image.RenderedImage;
 import java.awt.image.renderable.RenderableImage;
+import java.io.PrintStream;
 import java.text.AttributedCharacterIterator;
 import java.util.Arrays;
 import java.util.Map;
 
-public class DummyGraphics2d
-        extends Graphics2D
-{
+public class DummyGraphics2d extends Graphics2D {
     private BufferedImage bufimg;
-    private Graphics2D g2D;
+    private final Graphics2D g2D;
+    private final PrintStream log;
 
-    public DummyGraphics2d()
-    {
+    public DummyGraphics2d() {
+        this(System.out);
+    }
+    
+    public DummyGraphics2d(PrintStream log) {
         bufimg = new BufferedImage(1000, 1000, 2);
         g2D = (Graphics2D)bufimg.getGraphics();
+        this.log = log;
+    }
+    
+    public DummyGraphics2d(PrintStream log, Graphics2D g2D) {
+        this.g2D = g2D;
+        this.log = log;
     }
 
-    public void addRenderingHints(Map<?,?> hints)
-    {
-        System.out.println( "addRenderingHinds(Map):" );
-        System.out.println( "  hints = " + hints );
+    public void addRenderingHints(Map<?,?> hints) {
+        String l =
+            "addRenderingHinds(Map):" +
+            "\n  hints = " + hints;
+        log.println( l );
         g2D.addRenderingHints( hints );
     }
 
-    public void clip(Shape s)
-    {
-        System.out.println( "clip(Shape):" );
-        System.out.println( "  s = " + s );
+    public void clip(Shape s) {
+        String l =
+            "clip(Shape):" +
+            "\n  s = " + s;
+        log.println( l );
         g2D.clip( s );
     }
 
-    public void draw(Shape s)
-    {
-        System.out.println( "draw(Shape):" );
-        System.out.println( "s = " + s );
+    public void draw(Shape s) {
+        String l =
+            "draw(Shape):" + 
+            "\n  s = " + s;
+        log.println( l );
         g2D.draw( s );
     }
 
-    public void drawGlyphVector(GlyphVector g, float x, float y)
-    {
-        System.out.println( "drawGlyphVector(GlyphVector, float, float):" );
-        System.out.println( "g = " + g );
-        System.out.println( "x = " + x );
-        System.out.println( "y = " + y );
+    public void drawGlyphVector(GlyphVector g, float x, float y) {
+        String l =
+            "drawGlyphVector(GlyphVector, float, float):" +
+            "\n  g = " + g +
+            "\n  x = " + x +
+            "\n  y = " + y;
+        log.println( l );
         g2D.drawGlyphVector( g, x, y );
     }
 
-    public void drawImage(BufferedImage img,
-				   BufferedImageOp op,
-				   int x,
-				   int y)
-    {
-        System.out.println( "drawImage(BufferedImage, BufferedImageOp, x, y):" );
-        System.out.println( "img = " + img );
-        System.out.println( "op = " + op );
-        System.out.println( "x = " + x );
-        System.out.println( "y = " + y );
+    public void drawImage(BufferedImage img, BufferedImageOp op, int x, int y) {
+        String l =
+            "drawImage(BufferedImage, BufferedImageOp, x, y):" +
+            "\n  img = " + img +
+            "\n  op = " + op +
+            "\n  x = " + x +
+            "\n  y = " + y;
+        log.println( l );
         g2D.drawImage( img, op, x, y );
     }
 
-    public boolean drawImage(Image img,
-                                      AffineTransform xform,
-                                      ImageObserver obs)
-    {
-        System.out.println( "drawImage(Image,AfflineTransform,ImageObserver):" );
-        System.out.println( "img = " + img );
-        System.out.println( "xform = " + xform );
-        System.out.println( "obs = " + obs );
+    public boolean drawImage(Image img, AffineTransform xform, ImageObserver obs) {
+        String l =
+            "drawImage(Image,AfflineTransform,ImageObserver):" +
+            "\n  img = " + img +
+            "\n  xform = " + xform +
+            "\n  obs = " + obs;
+        log.println( l );
         return g2D.drawImage( img, xform, obs );
     }
 
-    public void drawRenderableImage(RenderableImage img,
-                                             AffineTransform xform)
-    {
-        System.out.println( "drawRenderableImage(RenderableImage, AfflineTransform):" );
-        System.out.println( "img = " + img );
-        System.out.println( "xform = " + xform );
+    public void drawRenderableImage(RenderableImage img, AffineTransform xform) {
+        String l =
+            "drawRenderableImage(RenderableImage, AfflineTransform):" +
+            "\n  img = " + img +
+            "\n  xform = " + xform;
+        log.println( l );
         g2D.drawRenderableImage( img, xform );
     }
 
-    public void drawRenderedImage(RenderedImage img,
-                                           AffineTransform xform)
-    {
-        System.out.println( "drawRenderedImage(RenderedImage, AffineTransform):" );
-        System.out.println( "img = " + img );
-        System.out.println( "xform = " + xform );
+    public void drawRenderedImage(RenderedImage img, AffineTransform xform) {
+        String l =
+            "drawRenderedImage(RenderedImage, AffineTransform):" +
+            "\n  img = " + img +
+            "\n  xform = " + xform;
+        log.println( l );
         g2D.drawRenderedImage( img, xform );
     }
 
-    public void drawString(AttributedCharacterIterator iterator,
-                                    float x, float y)
-    {
-        System.out.println( "drawString(AttributedCharacterIterator):" );
-        System.out.println( "iterator = " + iterator );
-        System.out.println( "x = " + x );
-        System.out.println( "y = " + y );
+    public void drawString(AttributedCharacterIterator iterator, float x, float y) {
+        String l =
+            "drawString(AttributedCharacterIterator):" +
+            "\n  iterator = " + iterator +
+            "\n  x = " + x +
+            "\n  y = " + y;
+        log.println( l );
         g2D.drawString( iterator, x, y );
     }
 
-//    public void drawString(AttributedCharacterIterator iterator,
-//                                    int x, int y)
-//    {
-//        g2D.drawString( iterator, x, y );
-//    }
-
-    public void drawString(String s, float x, float y)
-    {
-        System.out.println( "drawString(s,x,y):" );
-        System.out.println( "s = " + s );
-        System.out.println( "x = " + x );
-        System.out.println( "y = " + y );
+    public void drawString(String s, float x, float y) {
+        String l =
+            "drawString(s,x,y):" +
+            "\n  s = " + s +
+            "\n  x = " + x +
+            "\n  y = " + y;
+        log.println( l );
         g2D.drawString( s, x, y );
     }
 
-//    public void drawString(String str, int x, int y)
-//    {
-//        g2D.drawString( str, x, y );
-//    }
-
-    public void fill(Shape s)
-    {
-        System.out.println( "fill(Shape):" );
-        System.out.println( "s = " + s );
+    public void fill(Shape s) {
+        String l =
+            "fill(Shape):" +
+            "\n  s = " + s;
+        log.println( l );
         g2D.fill( s );
     }
 
-//    public void fill3DRect(int x, int y, int width, int height,
-//			   boolean raised) {
-//        g2D.fill3DRect( x, y, width, height, raised );
-//    }
-
-    public Color getBackground()
-    {
-        System.out.println( "getBackground():" );
+    public Color getBackground() {
+        log.println( "getBackground():" );
         return g2D.getBackground();
     }
 
-    public Composite getComposite()
-    {
-        System.out.println( "getComposite():" );
+    public Composite getComposite() {
+        log.println( "getComposite():" );
         return g2D.getComposite();
     }
 
-    public GraphicsConfiguration getDeviceConfiguration()
-    {
-        System.out.println( "getDeviceConfiguration():" );
+    public GraphicsConfiguration getDeviceConfiguration() {
+        log.println( "getDeviceConfiguration():" );
         return g2D.getDeviceConfiguration();
     }
 
-    public FontRenderContext getFontRenderContext()
-    {
-        System.out.println( "getFontRenderContext():" );
+    public FontRenderContext getFontRenderContext() {
+        log.println( "getFontRenderContext():" );
         return g2D.getFontRenderContext();
     }
 
-    public Paint getPaint()
-    {
-        System.out.println( "getPaint():" );
+    public Paint getPaint() {
+        log.println( "getPaint():" );
         return g2D.getPaint();
     }
 
-    public Object getRenderingHint(RenderingHints.Key hintKey)
-    {
-        System.out.println( "getRenderingHint(RenderingHints.Key):" );
-        System.out.println( "hintKey = " + hintKey );
+    public Object getRenderingHint(RenderingHints.Key hintKey) {
+        String l =
+            "getRenderingHint(RenderingHints.Key):" +
+            "\n  hintKey = " + hintKey;
+        log.println( l );
         return g2D.getRenderingHint( hintKey );
     }
 
-    public RenderingHints getRenderingHints()
-    {
-        System.out.println( "getRenderingHints():" );
+    public RenderingHints getRenderingHints() {
+        log.println( "getRenderingHints():" );
         return g2D.getRenderingHints();
     }
 
-    public Stroke getStroke()
-    {
-        System.out.println( "getStroke():" );
+    public Stroke getStroke() {
+        log.println( "getStroke():" );
         return g2D.getStroke();
     }
 
-    public AffineTransform getTransform()
-    {
-        System.out.println( "getTransform():" );
+    public AffineTransform getTransform() {
+        log.println( "getTransform():" );
         return g2D.getTransform();
     }
 
-    public boolean hit(Rectangle rect,
-				Shape s,
-				boolean onStroke)
-    {
-        System.out.println( "hit(Rectangle, Shape, onStroke):" );
-        System.out.println( "rect = " + rect );
-        System.out.println( "s = " + s );
-        System.out.println( "onStroke = " + onStroke );
+    public boolean hit(Rectangle rect, Shape s, boolean onStroke) {
+        String l =
+            "hit(Rectangle, Shape, onStroke):" +
+            "\n  rect = " + rect +
+            "\n  s = " + s +
+            "\n  onStroke = " + onStroke;
+        log.println( l );
         return g2D.hit( rect, s, onStroke );
     }
 
-    public void rotate(double theta)
-    {
-        System.out.println( "rotate(theta):" );
-        System.out.println( "theta = " + theta );
+    public void rotate(double theta) {
+        String l =
+            "rotate(theta):" +
+            "\n  theta = " + theta;
+        log.println( l );
         g2D.rotate( theta );
     }
 
-    public void rotate(double theta, double x, double y)
-    {
-        System.out.println( "rotate(double,double,double):" );
-        System.out.println( "theta = " + theta );
-        System.out.println( "x = " + x );
-        System.out.println( "y = " + y );
+    public void rotate(double theta, double x, double y) {
+        String l =
+            "rotate(double,double,double):" +
+            "\n  theta = " + theta +
+            "\n  x = " + x +
+            "\n  y = " + y;
+        log.println( l );
         g2D.rotate( theta, x, y );
     }
 
-    public void scale(double sx, double sy)
-    {
-        System.out.println( "scale(double,double):" );
-        System.out.println( "sx = " + sx );
-        System.out.println( "sy" );
+    public void scale(double sx, double sy) {
+        String l =
+            "scale(double,double):" +
+            "\n  sx = " + sx +
+            "\n  sy";
+        log.println( l );
         g2D.scale( sx, sy );
     }
 
-    public void setBackground(Color color)
-    {
-        System.out.println( "setBackground(Color):" );
-        System.out.println( "color = " + color );
+    public void setBackground(Color color) {
+        String l =
+            "setBackground(Color):" +
+            "\n  color = " + color;
+        log.println( l );
         g2D.setBackground( color );
     }
 
-    public void setComposite(Composite comp)
-    {
-        System.out.println( "setComposite(Composite):" );
-        System.out.println( "comp = " + comp );
+    public void setComposite(Composite comp) {
+        String l =
+            "setComposite(Composite):" +
+            "\n  comp = " + comp;
+        log.println( l );
         g2D.setComposite( comp );
     }
 
-    public void setPaint( Paint paint )
-    {
-        System.out.println( "setPaint(Paint):" );
-        System.out.println( "paint = " + paint );
+    public void setPaint( Paint paint ) {
+        String l =
+            "setPaint(Paint):" +
+            "\n  paint = " + paint;
+        log.println( l );
         g2D.setPaint( paint );
     }
 
-    public void setRenderingHint(RenderingHints.Key hintKey, Object hintValue)
-    {
-        System.out.println( "setRenderingHint(RenderingHints.Key, Object):" );
-        System.out.println( "hintKey = " + hintKey );
-        System.out.println( "hintValue = " + hintValue );
+    public void setRenderingHint(RenderingHints.Key hintKey, Object hintValue) {
+        String l =
+            "setRenderingHint(RenderingHints.Key, Object):" +
+            "\n  hintKey = " + hintKey +
+            "\n  hintValue = " + hintValue;
+        log.println( l );
         g2D.setRenderingHint( hintKey, hintValue );
     }
 
-    public void setRenderingHints(Map<?,?> hints)
-    {
-        System.out.println( "setRenderingHints(Map):" );
-        System.out.println( "hints = " + hints );
+    public void setRenderingHints(Map<?,?> hints) {
+        String l =
+            "setRenderingHints(Map):" +
+            "\n  hints = " + hints;
+        log.println( l );
         g2D.setRenderingHints( hints );
     }
 
-    public void setStroke(Stroke s)
-    {
-        System.out.println( "setStroke(Stoke):" );
+    public void setStroke(Stroke s) {
+        String l;
         if (s instanceof BasicStroke) {
             BasicStroke bs = (BasicStroke)s;
-            StringBuilder str = new StringBuilder("s = BasicStroke(");
-            str.append("dash[]: "+Arrays.toString(bs.getDashArray())+", ");
-            str.append("dashPhase: "+bs.getDashPhase()+", ");
-            str.append("endCap: "+bs.getEndCap()+", ");
-            str.append("lineJoin: "+bs.getLineJoin()+", ");
-            str.append("width: "+bs.getLineWidth()+", ");
-            str.append("miterLimit: "+bs.getMiterLimit()+")");
-            System.out.println(str.toString());
+            l = "setStroke(Stoke):" +
+                "\n  s = BasicStroke(" +
+                "\n    dash[]: "+Arrays.toString(bs.getDashArray()) +
+                "\n    dashPhase: "+bs.getDashPhase() +
+                "\n    endCap: "+bs.getEndCap() +
+                "\n    lineJoin: "+bs.getLineJoin() +
+                "\n    width: "+bs.getLineWidth() +
+                "\n    miterLimit: "+bs.getMiterLimit() +
+                "\n  )";
         } else {
-            System.out.println( "s = " + s );
+            l = "setStroke(Stoke):" +
+                "\n  s = " + s;
         }
+        log.println( l );
         g2D.setStroke( s );
     }
 
-    public void setTransform(AffineTransform Tx)
-    {
-        System.out.println( "setTransform():" );
-        System.out.println( "Tx = " + Tx );
+    public void setTransform(AffineTransform Tx) {
+        String l =
+            "setTransform():" +
+            "\n  Tx = " + Tx;
+        log.println( l );
         g2D.setTransform( Tx );
     }
 
-    public void shear(double shx, double shy)
-    {
-        System.out.println( "shear(shx, dhy):" );
-        System.out.println( "shx = " + shx );
-        System.out.println( "shy = " + shy );
+    public void shear(double shx, double shy) {
+        String l =
+            "shear(shx, dhy):" +
+            "\n  shx = " + shx +
+            "\n  shy = " + shy;
+        log.println( l );
         g2D.shear( shx, shy );
     }
 
-    public void transform(AffineTransform Tx)
-    {
-        System.out.println( "transform(AffineTransform):" );
-        System.out.println( "Tx = " + Tx );
+    public void transform(AffineTransform Tx) {
+        String l =
+            "transform(AffineTransform):" +
+            "\n  Tx = " + Tx;
+        log.println( l );
         g2D.transform( Tx );
     }
 
-    public void translate(double tx, double ty)
-    {
-        System.out.println( "translate(double, double):" );
-        System.out.println( "tx = " + tx );
-        System.out.println( "ty = " + ty );
+    public void translate(double tx, double ty) {
+        String l =
+            "translate(double, double):" +
+            "\n  tx = " + tx +
+            "\n  ty = " + ty;
+        log.println( l );
         g2D.translate( tx, ty );
     }
 
-//    public void translate(int x, int y)
-//    {
-//        g2D.translate( x, y );
-//    }
-
-    public void clearRect(int x, int y, int width, int height)
-    {
-        System.out.println( "clearRect(int,int,int,int):" );
-        System.out.println( "x = " + x );
-        System.out.println( "y = " + y );
-        System.out.println( "width = " + width );
-        System.out.println( "height = " + height );
+    public void clearRect(int x, int y, int width, int height) {
+        String l =
+            "clearRect(int,int,int,int):" +
+            "\n  x = " + x +
+            "\n  y = " + y +
+            "\n  width = " + width +
+            "\n  height = " + height;
+        log.println( l );
         g2D.clearRect( x, y, width, height );
     }
 
-    public void clipRect(int x, int y, int width, int height)
-    {
-        System.out.println( "clipRect(int, int, int, int):" );
-        System.out.println( "x = " + x );
-        System.out.println( "y = " + y );
-        System.out.println( "width = " + width );
-        System.out.println( "height = " + height );
+    public void clipRect(int x, int y, int width, int height) {
+        String l =
+            "clipRect(int, int, int, int):" +
+            "\n  x = " + x +
+            "\n  y = " + y +
+            "\n  width = " + width +
+            "height = " + height;
+        log.println( l );
         g2D.clipRect( x, y, width, height );
     }
 
-    public void copyArea(int x, int y, int width, int height,
-				  int dx, int dy)
-    {
-        System.out.println( "copyArea(int,int,int,int):" );
-        System.out.println( "x = " + x );
-        System.out.println( "y = " + y );
-        System.out.println( "width = " + width );
-        System.out.println( "height = " + height );
+    public void copyArea(int x, int y, int width, int height, int dx, int dy) {
+        String l =
+            "copyArea(int,int,int,int):" +
+            "\n  x = " + x +
+            "\n  y = " + y +
+            "\n  width = " + width +
+            "\n  height = " + height;
+        log.println( l );
         g2D.copyArea( x, y, width, height, dx, dy );
     }
 
-    public Graphics create()
-    {
-        System.out.println( "create():" );
+    public Graphics create() {
+        log.println( "create():" );
         return g2D.create();
     }
 
     public Graphics create(int x, int y, int width, int height) {
-        System.out.println( "create(int,int,int,int):" );
-        System.out.println( "x = " + x );
-        System.out.println( "y = " + y );
-        System.out.println( "width = " + width );
-        System.out.println( "height = " + height );
+        String l =
+            "create(int,int,int,int):" +
+            "\n  x = " + x +
+            "\n  y = " + y +
+            "\n  width = " + width +
+            "\n  height = " + height;
+        log.println( l );
         return g2D.create( x, y, width, height );
     }
 
-    public void dispose()
-    {
-        System.out.println( "dispose():" );
+    public void dispose() {
+        log.println( "dispose():" );
         g2D.dispose();
     }
 
-    public void draw3DRect(int x, int y, int width, int height,
-			   boolean raised) {
-        System.out.println( "draw3DRect(int,int,int,int,boolean):" );
-        System.out.println( "x = " + x );
-        System.out.println( "y = " + y );
-        System.out.println( "width = " + width );
-        System.out.println( "height = " + height );
-        System.out.println( "raised = " + raised );
+    public void draw3DRect(int x, int y, int width, int height, boolean raised) {
+        String l =
+            "draw3DRect(int,int,int,int,boolean):" +
+            "\n  x = " + x +
+            "\n  y = " + y +
+            "\n  width = " + width +
+            "\n  height = " + height +
+            "\n  raised = " + raised;
+        log.println( l );
         g2D.draw3DRect( x, y, width, height, raised );
     }
 
-    public void drawArc(int x, int y, int width, int height,
-				 int startAngle, int arcAngle)
-    {
-        System.out.println( "drawArc(int,int,int,int,int,int):" );
-        System.out.println( "x = " + x );
-        System.out.println( "y = " + y );
-        System.out.println( "width = " + width );
-        System.out.println( "height = " + height );
-        System.out.println( "startAngle = " + startAngle );
-        System.out.println( "arcAngle = " + arcAngle );
+    public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) {
+        String l =
+            "drawArc(int,int,int,int,int,int):" +
+            "\n  x = " + x +
+            "\n  y = " + y +
+            "\n  width = " + width +
+            "\n  height = " + height +
+            "\n  startAngle = " + startAngle +
+            "\n  arcAngle = " + arcAngle;
+        log.println( l );
         g2D.drawArc( x, y, width, height, startAngle, arcAngle );
     }
 
     public void drawBytes(byte data[], int offset, int length, int x, int y) {
-        System.out.println( "drawBytes(byte[],int,int,int,int):" );
-        System.out.println( "data = " + Arrays.toString(data) );
-        System.out.println( "offset = " + offset );
-        System.out.println( "length = " + length );
-        System.out.println( "x = " + x );
-        System.out.println( "y = " + y );
+        String l =
+            "drawBytes(byte[],int,int,int,int):" +
+            "\n  data = " + Arrays.toString(data) +
+            "\n  offset = " + offset +
+            "\n  length = " + length +
+            "\n  x = " + x +
+            "\n  y = " + y;
+        log.println( l );
         g2D.drawBytes( data, offset, length, x, y );
     }
 
     public void drawChars(char data[], int offset, int length, int x, int y) {
-        System.out.println( "drawChars(data,int,int,int,int):" );
-        System.out.println( "data = " + Arrays.toString(data) );
-        System.out.println( "offset = " + offset );
-        System.out.println( "length = " + length );
-        System.out.println( "x = " + x );
-        System.out.println( "y = " + y );
+        String l =
+            "drawChars(data,int,int,int,int):" +
+            "\n  data = " + Arrays.toString(data) +
+            "\n  offset = " + offset +
+            "\n  length = " + length +
+            "\n  x = " + x +
+            "\n  y = " + y;
+        log.println( l );
         g2D.drawChars( data, offset, length, x, y );
     }
 
-    public boolean drawImage(Image img,
-				      int dx1, int dy1, int dx2, int dy2,
-				      int sx1, int sy1, int sx2, int sy2,
-				      ImageObserver observer)
-    {
-        System.out.println( "drawImage(Image,int,int,int,int,int,int,int,int,ImageObserver):" );
-        System.out.println( "img = " + img );
-        System.out.println( "dx1 = " + dx1 );
-        System.out.println( "dy1 = " + dy1 );
-        System.out.println( "dx2 = " + dx2 );
-        System.out.println( "dy2 = " + dy2 );
-        System.out.println( "sx1 = " + sx1 );
-        System.out.println( "sy1 = " + sy1 );
-        System.out.println( "sx2 = " + sx2 );
-        System.out.println( "sy2 = " + sy2 );
-        System.out.println( "observer = " + observer );
+    public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver observer) {
+        String l =
+            "drawImage(Image,int,int,int,int,int,int,int,int,ImageObserver):" +
+            "\n  img = " + img +
+            "\n  dx1 = " + dx1 +
+            "\n  dy1 = " + dy1 +
+            "\n  dx2 = " + dx2 +
+            "\n  dy2 = " + dy2 +
+            "\n  sx1 = " + sx1 +
+            "\n  sy1 = " + sy1 +
+            "\n  sx2 = " + sx2 +
+            "\n  sy2 = " + sy2 +
+            "\n  observer = " + observer;
+        log.println( l );
         return g2D.drawImage( img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, observer );
     }
 
-    public boolean drawImage(Image img,
-				      int dx1, int dy1, int dx2, int dy2,
-				      int sx1, int sy1, int sx2, int sy2,
-				      Color bgcolor,
-				      ImageObserver observer)
-    {
-        System.out.println( "drawImage(Image,int,int,int,int,int,int,int,int,Color,ImageObserver):" );
-        System.out.println( "img = " + img );
-        System.out.println( "dx1 = " + dx1 );
-        System.out.println( "dy1 = " + dy1 );
-        System.out.println( "dx2 = " + dx2 );
-        System.out.println( "dy2 = " + dy2 );
-        System.out.println( "sx1 = " + sx1 );
-        System.out.println( "sy1 = " + sy1 );
-        System.out.println( "sx2 = " + sx2 );
-        System.out.println( "sy2 = " + sy2 );
-        System.out.println( "bgcolor = " + bgcolor );
-        System.out.println( "observer = " + observer );
+    public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer) {
+        String l =
+            "drawImage(Image,int,int,int,int,int,int,int,int,Color,ImageObserver):" +
+            "\n  img = " + img +
+            "\n  dx1 = " + dx1 +
+            "\n  dy1 = " + dy1 +
+            "\n  dx2 = " + dx2 +
+            "\n  dy2 = " + dy2 +
+            "\n  sx1 = " + sx1 +
+            "\n  sy1 = " + sy1 +
+            "\n  sx2 = " + sx2 +
+            "\n  sy2 = " + sy2 +
+            "\n  bgcolor = " + bgcolor +
+            "\n  observer = " + observer;
+        log.println( l );
         return g2D.drawImage( img, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, bgcolor, observer );
     }
 
-    public boolean drawImage(Image img, int x, int y,
-				      Color bgcolor,
-				      ImageObserver observer)
-    {
-        System.out.println( "drawImage(Image,int,int,Color,ImageObserver):" );
-        System.out.println( "img = " + img );
-        System.out.println( "x = " + x );
-        System.out.println( "y = " + y );
-        System.out.println( "bgcolor = " + bgcolor );
-        System.out.println( "observer = " + observer );
+    public boolean drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer) {
+        String l =
+            "drawImage(Image,int,int,Color,ImageObserver):" +
+            "\n  img = " + img +
+            "\n  x = " + x +
+            "\n  y = " + y +
+            "\n  bgcolor = " + bgcolor +
+            "\n  observer = " + observer;
+        log.println( l );
         return g2D.drawImage( img, x, y, bgcolor, observer );
     }
 
-    public boolean drawImage(Image img, int x, int y,
-				      ImageObserver observer)
-    {
-        System.out.println( "drawImage(Image,int,int,observer):" );
-        System.out.println( "img = " + img );
-        System.out.println( "x = " + x );
-        System.out.println( "y = " + y );
-        System.out.println( "observer = " + observer );
+    public boolean drawImage(Image img, int x, int y, ImageObserver observer) {
+        String l =
+            "drawImage(Image,int,int,observer):" +
+            "\n  img = " + img +
+            "\n  x = " + x +
+            "\n  y = " + y +
+            "\n  observer = " + observer;
+        log.println( l );
         return g2D.drawImage( img, x, y, observer );
     }
 
-    public boolean drawImage(Image img, int x, int y,
-				      int width, int height,
-				      Color bgcolor,
-				      ImageObserver observer)
-    {
-        System.out.println( "drawImage(Image,int,int,int,int,Color,ImageObserver):" );
-        System.out.println( "img = " + img );
-        System.out.println( "x = " + x );
-        System.out.println( "y = " + y );
-        System.out.println( "width = " + width );
-        System.out.println( "height = " + height );
-        System.out.println( "bgcolor = " + bgcolor );
-        System.out.println( "observer = " + observer );
+    public boolean drawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer) {
+        String l =
+            "drawImage(Image,int,int,int,int,Color,ImageObserver):" +
+            "\n  img = " + img +
+            "\n  x = " + x +
+            "\n  y = " + y +
+            "\n  width = " + width +
+            "\n  height = " + height +
+            "\n  bgcolor = " + bgcolor +
+            "\n  observer = " + observer;
+        log.println( l );
         return g2D.drawImage( img, x, y, width, height, bgcolor, observer );
     }
 
-    public boolean drawImage(Image img, int x, int y,
-				      int width, int height,
-				      ImageObserver observer)
-    {
-        System.out.println( "drawImage(Image,int,int,width,height,observer):" );
-        System.out.println( "img = " + img );
-        System.out.println( "x = " + x );
-        System.out.println( "y = " + y );
-        System.out.println( "width = " + width );
-        System.out.println( "height = " + height );
-        System.out.println( "observer = " + observer );
+    public boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer) {
+        String l =
+            "drawImage(Image,int,int,width,height,observer):" +
+            "\n  img = " + img +
+            "\n  x = " + x +
+            "\n  y = " + y +
+            "\n  width = " + width +
+            "\n  height = " + height +
+            "\n  observer = " + observer;
+        log.println( l );
         return g2D.drawImage( img, x, y, width, height, observer );
     }
 
-    public void drawLine(int x1, int y1, int x2, int y2)
-    {
-        System.out.println( "drawLine(int,int,int,int):" );
-        System.out.println( "x1 = " + x1 );
-        System.out.println( "y1 = " + y1 );
-        System.out.println( "x2 = " + x2 );
-        System.out.println( "y2 = " + y2 );
+    public void drawLine(int x1, int y1, int x2, int y2) {
+        String l =
+            "drawLine(int,int,int,int):" +
+            "\n  x1 = " + x1 +
+            "\n  y1 = " + y1 +
+            "\n  x2 = " + x2 +
+            "\n  y2 = " + y2;
+        log.println( l );
         g2D.drawLine( x1, y1, x2, y2 );
     }
 
-    public void drawOval(int x, int y, int width, int height)
-    {
-        System.out.println( "drawOval(int,int,int,int):" );
-        System.out.println( "x = " + x );
-        System.out.println( "y = " + y );
-        System.out.println( "width = " + width );
-        System.out.println( "height = " + height );
+    public void drawOval(int x, int y, int width, int height) {
+        String l =
+            "drawOval(int,int,int,int):" +
+            "\n  x = " + x +
+            "\n  y = " + y +
+            "\n  width = " + width +
+            "\n  height = " + height;
+        log.println( l );
         g2D.drawOval( x, y, width, height );
     }
 
     public void drawPolygon(Polygon p) {
-        System.out.println( "drawPolygon(Polygon):" );
-        System.out.println( "p = " + p );
+        String l =
+            "drawPolygon(Polygon):" +
+            "\n  p = " + p;
+        log.println( l );
         g2D.drawPolygon( p );
     }
 
-    public void drawPolygon(int xPoints[], int yPoints[],
-				     int nPoints)
-    {
-        System.out.println( "drawPolygon(int[],int[],int):" );
-        System.out.println( "xPoints = " + Arrays.toString(xPoints) );
-        System.out.println( "yPoints = " + Arrays.toString(yPoints) );
-        System.out.println( "nPoints = " + nPoints );
+    public void drawPolygon(int xPoints[], int yPoints[], int nPoints) {
+        String l =
+            "drawPolygon(int[],int[],int):" +
+            "\n  xPoints = " + Arrays.toString(xPoints) +
+            "\n  yPoints = " + Arrays.toString(yPoints) +
+            "\n  nPoints = " + nPoints;
+        log.println( l );
         g2D.drawPolygon( xPoints, yPoints, nPoints );
     }
 
-    public void drawPolyline(int xPoints[], int yPoints[],
-				      int nPoints)
-    {
-        System.out.println( "drawPolyline(int[],int[],int):" );
-        System.out.println( "xPoints = " + Arrays.toString(xPoints) );
-        System.out.println( "yPoints = " + Arrays.toString(yPoints) );
-        System.out.println( "nPoints = " + nPoints );
+    public void drawPolyline(int xPoints[], int yPoints[], int nPoints) {
+        String l =
+            "drawPolyline(int[],int[],int):" +
+            "\n  xPoints = " + Arrays.toString(xPoints) +
+            "\n  yPoints = " + Arrays.toString(yPoints) +
+            "\n  nPoints = " + nPoints;
+        log.println( l );
         g2D.drawPolyline( xPoints, yPoints, nPoints );
     }
 
     public void drawRect(int x, int y, int width, int height) {
-        System.out.println( "drawRect(int,int,int,int):" );
-        System.out.println( "x = " + x );
-        System.out.println( "y = " + y );
-        System.out.println( "width = " + width );
-        System.out.println( "height = " + height );
+        String l =
+            "drawRect(int,int,int,int):" +
+            "\n  x = " + x +
+            "\n  y = " + y +
+            "\n  width = " + width +
+            "\n  height = " + height;
+        log.println( l );
         g2D.drawRect( x, y, width, height );
     }
 
-    public void drawRoundRect(int x, int y, int width, int height,
-				       int arcWidth, int arcHeight)
-    {
-        System.out.println( "drawRoundRect(int,int,int,int,int,int):" );
-        System.out.println( "x = " + x );
-        System.out.println( "y = " + y );
-        System.out.println( "width = " + width );
-        System.out.println( "height = " + height );
-        System.out.println( "arcWidth = " + arcWidth );
-        System.out.println( "arcHeight = " + arcHeight );
+    public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) {
+        String l =
+            "drawRoundRect(int,int,int,int,int,int):" +
+            "\n  x = " + x +
+            "\n  y = " + y +
+            "\n  width = " + width +
+            "\n  height = " + height +
+            "\n  arcWidth = " + arcWidth +
+            "\n  arcHeight = " + arcHeight;
+        log.println( l );
         g2D.drawRoundRect( x, y, width, height, arcWidth, arcHeight );
     }
 
-    public void drawString(AttributedCharacterIterator iterator,
-                                    int x, int y)
-    {
-        System.out.println( "drawString(AttributedCharacterIterator,int,int):" );
-        System.out.println( "iterator = " + iterator );
-        System.out.println( "x = " + x );
-        System.out.println( "y = " + y );
+    public void drawString(AttributedCharacterIterator iterator, int x, int y) {
+        String l =
+            "drawString(AttributedCharacterIterator,int,int):" +
+            "\n  iterator = " + iterator +
+            "\n  x = " + x +
+            "\n  y = " + y;
+        log.println( l );
         g2D.drawString( iterator, x, y );
     }
 
-    public void drawString(String str, int x, int y)
-    {
-        System.out.println( "drawString(str,int,int):" );
-        System.out.println( "str = " + str );
-        System.out.println( "x = " + x );
-        System.out.println( "y = " + y );
+    public void drawString(String str, int x, int y) {
+        String l =
+            "drawString(str,int,int):" +
+            "\n  str = " + str +
+            "\n  x = " + x +
+            "\n  y = " + y;
+        log.println( l );
         g2D.drawString( str, x, y );
     }
 
-    public void fill3DRect(int x, int y, int width, int height,
-			   boolean raised) {
-        System.out.println( "fill3DRect(int,int,int,int,boolean):" );
-        System.out.println( "x = " + x );
-        System.out.println( "y = " + y );
-        System.out.println( "width = " + width );
-        System.out.println( "height = " + height );
-        System.out.println( "raised = " + raised );
+    public void fill3DRect(int x, int y, int width, int height, boolean raised) {
+        String l =
+            "fill3DRect(int,int,int,int,boolean):" +
+            "\n  x = " + x +
+            "\n  y = " + y +
+            "\n  width = " + width +
+            "\n  height = " + height +
+            "\n  raised = " + raised;
+        log.println( l );
         g2D.fill3DRect( x, y, width, height, raised );
     }
 
-    public void fillArc(int x, int y, int width, int height,
-				 int startAngle, int arcAngle)
-    {
-        System.out.println( "fillArc(int,int,int,int,int,int):" );
-        System.out.println( "x = " + x );
-        System.out.println( "y = " + y );
-        System.out.println( "width = " + width );
-        System.out.println( "height = " + height );
-        System.out.println( "startAngle = " + startAngle );
-        System.out.println( "arcAngle = " + arcAngle );
+    public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle) {
+        String l =
+            "fillArc(int,int,int,int,int,int):" +
+            "\n  x = " + x +
+            "\n  y = " + y +
+            "\n  width = " + width +
+            "\n  height = " + height +
+            "\n  startAngle = " + startAngle +
+            "\n  arcAngle = " + arcAngle;
+        log.println( l );
         g2D.fillArc( x, y, width, height, startAngle, arcAngle );
     }
 
-    public void fillOval(int x, int y, int width, int height)
-    {
-        System.out.println( "fillOval(int,int,int,int):" );
-        System.out.println( "x = " + x );
-        System.out.println( "y = " + y );
-        System.out.println( "width = " + width );
-        System.out.println( "height = " + height );
+    public void fillOval(int x, int y, int width, int height) {
+        String l =
+            "fillOval(int,int,int,int):" +
+            "\n  x = " + x +
+            "\n  y = " + y +
+            "\n  width = " + width +
+            "\n  height = " + height;
+        log.println( l );
         g2D.fillOval( x, y, width, height );
     }
 
     public void fillPolygon(Polygon p) {
-        System.out.println( "fillPolygon(Polygon):" );
-        System.out.println( "p = " + p );
+        String l =
+            "fillPolygon(Polygon):" +
+            "\n  p = " + p;
+        log.println( l );
         g2D.fillPolygon( p );
     }
 
-    public void fillPolygon(int xPoints[], int yPoints[],
-				     int nPoints)
-    {
-        System.out.println( "fillPolygon(int[],int[],int):" );
-        System.out.println( "xPoints = " + Arrays.toString(xPoints) );
-        System.out.println( "yPoints = " + Arrays.toString(yPoints) );
-        System.out.println( "nPoints = " + nPoints );
+    public void fillPolygon(int xPoints[], int yPoints[], int nPoints) {
+        String l =
+            "fillPolygon(int[],int[],int):" +
+            "\n  xPoints = " + Arrays.toString(xPoints) +
+            "\n  yPoints = " + Arrays.toString(yPoints) +
+            "\n  nPoints = " + nPoints;
+        log.println( l );
         g2D.fillPolygon( xPoints, yPoints, nPoints );
     }
 
-    public void fillRect(int x, int y, int width, int height)
-    {
-        System.out.println( "fillRect(int,int,int,int):" );
-        System.out.println( "x = " + x );
-        System.out.println( "y = " + y );
-        System.out.println( "width = " + width );
-        System.out.println( "height = " + height );
+    public void fillRect(int x, int y, int width, int height) {
+        String l =
+            "fillRect(int,int,int,int):" +
+            "\n  x = " + x +
+            "\n  y = " + y +
+            "\n  width = " + width +
+            "\n  height = " + height;
+        log.println( l );
         g2D.fillRect( x, y, width, height );
     }
 
-    public void fillRoundRect(int x, int y, int width, int height,
-				       int arcWidth, int arcHeight)
-    {
-        System.out.println( "fillRoundRect(int,int,int,int,int,int):" );
-        System.out.println( "x = " + x );
-        System.out.println( "y = " + y );
-        System.out.println( "width = " + width );
-        System.out.println( "height = " + height );
+    public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) {
+        String l =
+            "fillRoundRect(int,int,int,int,int,int):" +
+            "\n  x = " + x +
+            "\n  y = " + y +
+            "\n  width = " + width +
+            "\n  height = " + height;
+        log.println( l );
         g2D.fillRoundRect( x, y, width, height, arcWidth, arcHeight );
     }
 
     public void finalize() {
-        System.out.println( "finalize():" );
-        g2D.finalize();
-
+        log.println( "finalize():" );
+        g2D.finalize(); // NOSOLAR
         super.finalize();
     }
 
-    public Shape getClip()
-    {
-        System.out.println( "getClip():" );
+    public Shape getClip() {
+        log.println( "getClip():" );
         return g2D.getClip();
     }
 
-    public Rectangle getClipBounds()
-    {
-        System.out.println( "getClipBounds():" );
+    public Rectangle getClipBounds() {
+        log.println( "getClipBounds():" );
         return g2D.getClipBounds();
     }
 
     public Rectangle getClipBounds(Rectangle r) {
-        System.out.println( "getClipBounds(Rectangle):" );
-        System.out.println( "r = " + r );
+        String l =
+            "getClipBounds(Rectangle):" +
+            "\n  r = " + r;
+        log.println( l );
         return g2D.getClipBounds( r );
     }
 
-    public Color getColor()
-    {
-        System.out.println( "getColor():" );
+    public Color getColor() {
+        log.println( "getColor():" );
         return g2D.getColor();
     }
 
-    public Font getFont()
-    {
-        System.out.println( "getFont():" );
+    public Font getFont() {
+        log.println( "getFont():" );
         return g2D.getFont();
     }
 
     public FontMetrics getFontMetrics() {
-        System.out.println( "getFontMetrics():" );
+        log.println( "getFontMetrics():" );
         return g2D.getFontMetrics();
     }
 
-    public FontMetrics getFontMetrics(Font f)
-    {
-        System.out.println( "getFontMetrics():" );
+    public FontMetrics getFontMetrics(Font f) {
+        log.println( "getFontMetrics():" );
         return g2D.getFontMetrics( f );
     }
 
     public boolean hitClip(int x, int y, int width, int height) {
-        System.out.println( "hitClip(int,int,int,int):" );
-        System.out.println( "x = " + x );
-        System.out.println( "y = " + y );
-        System.out.println( "width = " + width );
-        System.out.println( "height = " + height );
+        String l =
+            "hitClip(int,int,int,int):" +
+            "\n  x = " + x +
+            "\n  y = " + y +
+            "\n  width = " + width +
+            "\n  height = " + height;
+        log.println( l );
         return g2D.hitClip( x, y, width, height );
     }
 
-    public void setClip(Shape clip)
-    {
-        System.out.println( "setClip(Shape):" );
-        System.out.println( "clip = " + clip );
+    public void setClip(Shape clip) {
+        String l =
+            "setClip(Shape):" +
+            "\n  clip = " + clip;
+        log.println( l );
         g2D.setClip( clip );
     }
 
-    public void setClip(int x, int y, int width, int height)
-    {
-        System.out.println( "setClip(int,int,int,int):" );
-        System.out.println( "x = " + x );
-        System.out.println( "y = " + y );
-        System.out.println( "width = " + width );
-        System.out.println( "height = " + height );
+    public void setClip(int x, int y, int width, int height) {
+        String l =
+            "setClip(int,int,int,int):" +
+            "\n  x = " + x +
+            "\n  y = " + y +
+            "\n  width = " + width +
+            "\n  height = " + height;
+        log.println( l );
         g2D.setClip( x, y, width, height );
     }
 
-    public void setColor(Color c)
-    {
-        System.out.println( "setColor():" );
-        System.out.println( "c = " + c );
+    public void setColor(Color c) {
+        String l =
+            "setColor():" +
+            "\n  c = " + c;
+        log.println( l );
         g2D.setColor( c );
     }
 
-    public void setFont(Font font)
-    {
-        System.out.println( "setFont(Font):" );
-        System.out.println( "font = " + font );
+    public void setFont(Font font) {
+        String l =
+            "setFont(Font):" +
+            "\n  font = " + font;
+        log.println( l );
         g2D.setFont( font );
     }
 
-    public void setPaintMode()
-    {
-        System.out.println( "setPaintMode():" );
+    public void setPaintMode() {
+        log.println( "setPaintMode():" );
         g2D.setPaintMode();
     }
 
-    public void setXORMode(Color c1)
-    {
-        System.out.println( "setXORMode(Color):" );
-        System.out.println( "c1 = " + c1 );
+    public void setXORMode(Color c1) {
+        String l =
+            "setXORMode(Color):" +
+            "\n  c1 = " + c1;
+        log.println( l );
         g2D.setXORMode( c1 );
     }
 
     public String toString() {
-        System.out.println( "toString():" );
+        log.println( "toString():" );
         return g2D.toString();
     }
 
-    public void translate(int x, int y)
-    {
-        System.out.println( "translate(int,int):" );
-        System.out.println( "x = " + x );
-        System.out.println( "y = " + y );
+    public void translate(int x, int y) {
+        String l =
+            "translate(int,int):" +
+            "\n  x = " + x +
+            "\n  y = " + y;
+        log.println( l );
         g2D.translate( x, y );
     }
 }

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/StaticFontMetrics.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/StaticFontMetrics.java?rev=1708236&r1=1708235&r2=1708236&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/StaticFontMetrics.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/StaticFontMetrics.java Mon Oct 12 20:43:42 2015
@@ -20,13 +20,15 @@ package org.apache.poi.hssf.usermodel;
 import java.awt.Font;
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
 
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
+
 /**
  * Allows the user to lookup the font metrics for a particular font without
  * actually having the font on the system. The font details are loaded as a
@@ -35,11 +37,14 @@ import java.util.Properties;
  * font. Use a multiplier for other sizes.
  */
 final class StaticFontMetrics {
+    private static final POILogger LOGGER = POILogFactory.getLogger(StaticFontMetrics.class);
 	/** The font metrics property file we're using */
 	private static Properties fontMetricsProps;
 	/** Our cache of font details we've already looked up */
-	private static Map<String, FontDetails> fontDetailsMap = new HashMap<String, FontDetails>();
+	private static final Map<String, FontDetails> fontDetailsMap = new HashMap<String, FontDetails>();
 
+	private StaticFontMetrics() {}
+	
 	/**
 	 * Retrieves the fake font details for a given font.
 	 *
@@ -47,47 +52,15 @@ final class StaticFontMetrics {
 	 *            the font to lookup.
 	 * @return the fake font.
 	 */
-	public static FontDetails getFontDetails(Font font) {
+	public static synchronized FontDetails getFontDetails(Font font) {
 		// If we haven't already identified out font metrics file,
 		// figure out which one to use and load it
 		if (fontMetricsProps == null) {
-			InputStream metricsIn = null;
-			try {
-				fontMetricsProps = new Properties();
-
-				// Check to see if the font metric file was specified
-				// as a system property
-				String propFileName = null;
-				try {
-					propFileName = System.getProperty("font.metrics.filename");
-				} catch (SecurityException e) {
-				}
-
-				if (propFileName != null) {
-					File file = new File(propFileName);
-					if (!file.exists())
-						throw new FileNotFoundException(
-								"font_metrics.properties not found at path "
-										+ file.getAbsolutePath());
-					metricsIn = new FileInputStream(file);
-				} else {
-					// Use the built-in font metrics file off the classpath
-					metricsIn = FontDetails.class.getResourceAsStream("/font_metrics.properties");
-					if (metricsIn == null)
-						throw new FileNotFoundException(
-								"font_metrics.properties not found in classpath");
-				}
-				fontMetricsProps.load(metricsIn);
-			} catch (IOException e) {
-				throw new RuntimeException("Could not load font metrics: " + e.getMessage());
-			} finally {
-				if (metricsIn != null) {
-					try {
-						metricsIn.close();
-					} catch (IOException ignore) {
-					}
-				}
-			}
+		    try {
+		        fontMetricsProps = loadMetrics();
+		    } catch (IOException e) {
+		        throw new RuntimeException("Could not load font metrics", e);
+		    }
 		}
 
 		// Grab the base name of the font they've asked about
@@ -97,28 +70,73 @@ final class StaticFontMetrics {
 		// Others have different font instances for bold etc
 		// (eg font.dialog.plain.* vs font.Californian FB Bold.*)
 		String fontStyle = "";
-		if (font.isPlain())
+		if (font.isPlain()) {
 			fontStyle += "plain";
-		if (font.isBold())
+		}
+		if (font.isBold()) {
 			fontStyle += "bold";
-		if (font.isItalic())
+		}
+		if (font.isItalic()) {
 			fontStyle += "italic";
+		}
 
 		// Do we have a definition for this font with just the name?
 		// If not, check with the font style added
-		if (fontMetricsProps.get(FontDetails.buildFontHeightProperty(fontName)) == null
-				&& fontMetricsProps.get(FontDetails.buildFontHeightProperty(fontName + "."
-						+ fontStyle)) != null) {
+		String fontHeight = FontDetails.buildFontHeightProperty(fontName);
+		String styleHeight = FontDetails.buildFontHeightProperty(fontName + "." + fontStyle);
+		
+		if (fontMetricsProps.get(fontHeight) == null
+			&& fontMetricsProps.get(styleHeight) != null) {
 			// Need to add on the style to the font name
 			fontName += "." + fontStyle;
 		}
 
 		// Get the details on this font
-		if (fontDetailsMap.get(fontName) == null) {
-			FontDetails fontDetails = FontDetails.create(fontName, fontMetricsProps);
+		FontDetails fontDetails = fontDetailsMap.get(fontName);
+		if (fontDetails == null) {
+			fontDetails = FontDetails.create(fontName, fontMetricsProps);
 			fontDetailsMap.put(fontName, fontDetails);
-			return fontDetails;
 		}
-		return fontDetailsMap.get(fontName);
+        return fontDetails;
+	}
+	
+	private static Properties loadMetrics() throws IOException {
+        // Check to see if the font metric file was specified
+        // as a system property
+        File propFile = null;
+        try {
+            String propFileName = System.getProperty("font.metrics.filename");
+            if (propFileName != null) {
+                propFile = new File(propFileName);
+                if (!propFile.exists()) {
+                    LOGGER.log(POILogger.WARN, "font_metrics.properties not found at path "+propFile.getAbsolutePath());
+                    propFile = null;
+                }
+            }
+        } catch (SecurityException e) {
+            LOGGER.log(POILogger.WARN, "Can't access font.metrics.filename system property", e);
+        }
+
+        InputStream metricsIn = null;
+        try {
+            if (propFile != null) {
+                metricsIn = new FileInputStream(propFile);
+            } else {
+                // Use the built-in font metrics file off the classpath
+                metricsIn =  FontDetails.class.getResourceAsStream("/font_metrics.properties");
+                if (metricsIn == null) {
+                    String err = "font_metrics.properties not found in classpath";
+                    throw new IOException(err);
+                }
+            }
+
+            Properties props = new Properties();
+            props.load(metricsIn);
+            return props;
+        } finally {
+            if (metricsIn != null) {
+                metricsIn.close();
+            }
+        }
 	}
 }

Modified: poi/trunk/src/java/org/apache/poi/ss/usermodel/FractionFormat.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ss/usermodel/FractionFormat.java?rev=1708236&r1=1708235&r2=1708236&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ss/usermodel/FractionFormat.java (original)
+++ poi/trunk/src/java/org/apache/poi/ss/usermodel/FractionFormat.java Mon Oct 12 20:43:42 2015
@@ -99,31 +99,33 @@ public class FractionFormat extends Form
 
     public String format(Number num) {
 
-        double doubleValue = num.doubleValue();
+        final double doubleValue = num.doubleValue();
         
-        boolean isNeg = (doubleValue < 0.0f) ? true : false;
-        double absDoubleValue = Math.abs(doubleValue);
+        final boolean isNeg = (doubleValue < 0.0f) ? true : false;
+        final double absDoubleValue = Math.abs(doubleValue);
         
-        double wholePart = Math.floor(absDoubleValue);
-        double decPart = absDoubleValue - wholePart;
+        final double wholePart = Math.floor(absDoubleValue);
+        final double decPart = absDoubleValue - wholePart;
         if (wholePart + decPart == 0) {
             return "0";
         }
         
-        //if the absolute value is smaller than 1 over the exact or maxDenom
-        //you can stop here and return "0"
-        if (absDoubleValue < (1/Math.max(exactDenom,  maxDenom))){
-            return "0";
-        }
+        // if the absolute value is smaller than 1 over the exact or maxDenom
+        // you can stop here and return "0"
+        // reciprocal is result of an int devision ... and so it's nearly always 0
+        // double reciprocal = 1/Math.max(exactDenom,  maxDenom);
+        // if (absDoubleValue < reciprocal) {
+        //    return "0";
+        // }
         
         //this is necessary to prevent overflow in the maxDenom calculation
-        if (wholePart+(int)decPart == wholePart+decPart){
+        if (Double.compare(decPart, 0) == 0){
             
             StringBuilder sb = new StringBuilder();
             if (isNeg){
                 sb.append("-");
             }
-            sb.append(Integer.toString((int)wholePart));
+            sb.append((int)wholePart);
             return sb.toString();
         }
         

Modified: poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/exceptions/InvalidFormatException.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/exceptions/InvalidFormatException.java?rev=1708236&r1=1708235&r2=1708236&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/exceptions/InvalidFormatException.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/exceptions/InvalidFormatException.java Mon Oct 12 20:43:42 2015
@@ -23,4 +23,8 @@ public final class InvalidFormatExceptio
 	public InvalidFormatException(String message){
 		super(message);
 	}
+
+    public InvalidFormatException(String message, Throwable cause){
+        super(message,cause);
+    }
 }

Modified: poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/exceptions/OpenXML4JException.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/exceptions/OpenXML4JException.java?rev=1708236&r1=1708235&r2=1708236&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/exceptions/OpenXML4JException.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/exceptions/OpenXML4JException.java Mon Oct 12 20:43:42 2015
@@ -31,4 +31,8 @@ public class OpenXML4JException extends
 	public OpenXML4JException(String msg) {
 		super(msg);
 	}
+
+    public OpenXML4JException(String msg, Throwable cause) {
+        super(msg, cause);
+    }
 }

Modified: poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java?rev=1708236&r1=1708235&r2=1708236&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java Mon Oct 12 20:43:42 2015
@@ -21,7 +21,6 @@ import java.io.ByteArrayOutputStream;
 import java.io.Closeable;
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -33,6 +32,7 @@ import java.util.Collections;
 import java.util.Date;
 import java.util.Hashtable;
 import java.util.List;
+import java.util.Map;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -92,7 +92,7 @@ public abstract class OPCPackage impleme
 	/**
 	 * Part marshallers by content type.
 	 */
-	protected Hashtable<ContentType, PartMarshaller> partMarshallers;
+	protected Map<ContentType, PartMarshaller> partMarshallers;
 
 	/**
 	 * Default part marshaller.
@@ -102,7 +102,7 @@ public abstract class OPCPackage impleme
 	/**
 	 * Part unmarshallers by content type.
 	 */
-	protected Hashtable<ContentType, PartUnmarshaller> partUnmarshallers;
+	protected Map<ContentType, PartUnmarshaller> partUnmarshallers;
 
 	/**
 	 * Core package properties.
@@ -167,7 +167,8 @@ public abstract class OPCPackage impleme
 			throw new OpenXML4JRuntimeException(
 					"Package.init() : this exception should never happen, " +
 					"if you read this message please send a mail to the developers team. : " +
-					e.getMessage()
+					e.getMessage(),
+					e
 			);
 		}
 	}
@@ -215,12 +216,14 @@ public abstract class OPCPackage impleme
 	 */
 	public static OPCPackage open(String path, PackageAccess access)
 			throws InvalidFormatException {
-		if (path == null || "".equals(path.trim()))
+		if (path == null || "".equals(path.trim())) {
 			throw new IllegalArgumentException("'path' must be given");
+		}
 		
 		File file = new File(path);
-		if (file.exists() && file.isDirectory())
+		if (file.exists() && file.isDirectory()) {
 			throw new IllegalArgumentException("path must not be a directory");
+		}
 
 		OPCPackage pack = new ZipPackage(path, access);
 		if (pack.partList == null && access != PackageAccess.WRITE) {
@@ -318,8 +321,9 @@ public abstract class OPCPackage impleme
 	 * @return A newly created PackageBase ready to use.
 	 */
 	public static OPCPackage create(File file) {
-		if (file == null || (file.exists() && file.isDirectory()))
+		if (file == null || (file.exists() && file.isDirectory())) {
 			throw new IllegalArgumentException("file");
+		}
 
 		if (file.exists()) {
 			throw new InvalidOperationException(
@@ -457,8 +461,9 @@ public abstract class OPCPackage impleme
 	 */
 	public void addThumbnail(String path) throws IOException {
 		// Check parameter
-		if ("".equals(path))
+		if ("".equals(path)) {
 			throw new IllegalArgumentException("path");
+		}
 
 		// Get the filename from the path
 		String filename = path
@@ -478,7 +483,7 @@ public abstract class OPCPackage impleme
 								+ path.substring(path.lastIndexOf(".") + 1));
 			} catch (InvalidFormatException e2) {
 				throw new InvalidOperationException(
-						"Can't add a thumbnail file named '" + filename + "'");
+						"Can't add a thumbnail file named '" + filename + "'", e2);
 			}
 		}
 
@@ -511,9 +516,10 @@ public abstract class OPCPackage impleme
 	 * @see org.apache.poi.openxml4j.opc.PackageAccess
 	 */
 	void throwExceptionIfReadOnly() throws InvalidOperationException {
-		if (packageAccess == PackageAccess.READ)
+		if (packageAccess == PackageAccess.READ) {
 			throw new InvalidOperationException(
 					"Operation not allowed, document open in read only mode!");
+		}
 	}
 
 	/**
@@ -526,9 +532,10 @@ public abstract class OPCPackage impleme
 	 * @see org.apache.poi.openxml4j.opc.PackageAccess
 	 */
 	void throwExceptionIfWriteOnly() throws InvalidOperationException {
-		if (packageAccess == PackageAccess.WRITE)
+		if (packageAccess == PackageAccess.WRITE) {
 			throw new InvalidOperationException(
 					"Operation not allowed, document open in write only mode!");
+		}
 	}
 
 	/**
@@ -557,8 +564,9 @@ public abstract class OPCPackage impleme
 	public PackagePart getPart(PackagePartName partName) {
 		throwExceptionIfWriteOnly();
 
-		if (partName == null)
+		if (partName == null) {
 			throw new IllegalArgumentException("partName");
+		}
 
 		// If the partlist is null, then we parse the package.
 		if (partList == null) {
@@ -581,8 +589,9 @@ public abstract class OPCPackage impleme
 	public ArrayList<PackagePart> getPartsByContentType(String contentType) {
 		ArrayList<PackagePart> retArr = new ArrayList<PackagePart>();
 		for (PackagePart part : partList.values()) {
-			if (part.getContentType().equals(contentType))
+			if (part.getContentType().equals(contentType)) {
 				retArr.add(part);
+			}
 		}
 		Collections.sort(retArr);
 		return retArr;
@@ -599,8 +608,9 @@ public abstract class OPCPackage impleme
 	 */
 	public ArrayList<PackagePart> getPartsByRelationshipType(
 			String relationshipType) {
-		if (relationshipType == null)
+		if (relationshipType == null) {
 			throw new IllegalArgumentException("relationshipType");
+		}
 		ArrayList<PackagePart> retArr = new ArrayList<PackagePart>();
 		for (PackageRelationship rel : getRelationshipsByType(relationshipType)) {
 			PackagePart part = getPart(rel);
@@ -686,13 +696,14 @@ public abstract class OPCPackage impleme
 			PackagePart[] parts = this.getPartsImpl();
 			this.partList = new PackagePartCollection();
 			for (PackagePart part : parts) {
-				if (partList.containsKey(part._partName))
+				if (partList.containsKey(part._partName)) {
 					throw new InvalidFormatException(
 							"A part with the name '" +
 							part._partName +
 						        "' already exist : Packages shall not contain equivalent " +
 						        "part names and package implementers shall neither create " +
 					        	"nor recognize packages with equivalent part names. [M1.12]");
+				}
 
 				// Check OPC compliance rule M4.1
 				if (part.getContentType().equals(
@@ -729,13 +740,13 @@ public abstract class OPCPackage impleme
 								+ part._partName);
 						continue;
 					} catch (InvalidOperationException invoe) {
-						throw new InvalidFormatException(invoe.getMessage());
+						throw new InvalidFormatException(invoe.getMessage(), invoe);
 					}
 				} else {
 					try {
 						partList.put(part._partName, part);
 					} catch (InvalidOperationException e) {
-						throw new InvalidFormatException(e.getMessage());
+						throw new InvalidFormatException(e.getMessage(), e);
 					}
 				}
 			}
@@ -813,9 +824,10 @@ public abstract class OPCPackage impleme
 		// Note - POI will read files with more than one Core Properties, which
 		//  Office sometimes produces, but is strict on generation
 		if (contentType.equals(ContentTypes.CORE_PROPERTIES_PART)) {
-			if (this.packageProperties != null)
+			if (this.packageProperties != null) {
 				throw new InvalidOperationException(
 						"OPC Compliance error [M4.1]: you try to add more than one core properties relationship in the package !");
+			}
 		}
 
 		/* End check OPC compliance */
@@ -929,8 +941,9 @@ public abstract class OPCPackage impleme
 	 */
 	public void removePart(PackagePartName partName) {
 		throwExceptionIfReadOnly();
-		if (partName == null || !this.containPart(partName))
+		if (partName == null || !this.containPart(partName)) {
 			throw new IllegalArgumentException("partName");
+		}
 
 		// Delete the specified part from the package.
 		if (this.partList.containsKey(partName)) {
@@ -964,8 +977,9 @@ public abstract class OPCPackage impleme
 				clearRelationships();
 			} else if (containPart(sourcePartName)) {
 				PackagePart part = getPart(sourcePartName);
-				if (part != null)
+				if (part != null) {
 					part.clearRelationships();
+				}
 			}
 		}
 
@@ -1019,8 +1033,9 @@ public abstract class OPCPackage impleme
 	 *            Name of the part to delete
 	 */
 	public void deletePart(PackagePartName partName) {
-		if (partName == null)
+		if (partName == null) {
 			throw new IllegalArgumentException("partName");
+		}
 
 		// Remove the part
 		this.removePart(partName);
@@ -1039,8 +1054,9 @@ public abstract class OPCPackage impleme
 	 *            Name of the part to delete
 	 */
 	public void deletePartRecursive(PackagePartName partName) {
-		if (partName == null || !this.containPart(partName))
+		if (partName == null || !this.containPart(partName)) {
 			throw new IllegalArgumentException("partName");
+		}
 
 		PackagePart partToDelete = this.getPart(partName);
 		// Remove the part
@@ -1064,8 +1080,9 @@ public abstract class OPCPackage impleme
 		// Remove the relationships part
 		PackagePartName relationshipPartName = PackagingURIHelper
 				.getRelationshipPartName(partName);
-		if (relationshipPartName != null && containPart(relationshipPartName))
+		if (relationshipPartName != null && containPart(relationshipPartName)) {
 			this.removePart(relationshipPartName);
+		}
 	}
 
 	/**
@@ -1115,9 +1132,10 @@ public abstract class OPCPackage impleme
 		// relationship for a package to be an error. If present, the
 		// relationship shall target the Core Properties part.
 		if (relationshipType.equals(PackageRelationshipTypes.CORE_PROPERTIES)
-				&& this.packageProperties != null)
+				&& this.packageProperties != null) {
 			throw new InvalidOperationException(
 					"OPC Compliance error [M4.1]: can't add another core properties part ! Use the built-in package method instead.");
+		}
 
 		/*
 		 * Check rule M1.25: The Relationships part shall not have relationships
@@ -1311,8 +1329,9 @@ public abstract class OPCPackage impleme
 	 */
 	public boolean isRelationshipExists(PackageRelationship rel) {
         for (PackageRelationship r : this.getRelationships()) {
-            if (r == rel)
+            if (r == rel) {
                 return true;
+            }
         }
         return false;
 	}
@@ -1360,7 +1379,11 @@ public abstract class OPCPackage impleme
 	 *            The content type associated with the marshaller to remove.
 	 */
 	public void removeMarshaller(String contentType) {
-		partMarshallers.remove(contentType);
+		try {
+            partMarshallers.remove(new ContentType(contentType));
+        } catch (InvalidFormatException e) {
+            throw new RuntimeException(e);
+        }
 	}
 
 	/**
@@ -1370,7 +1393,11 @@ public abstract class OPCPackage impleme
 	 *            The content type associated with the unmarshaller to remove.
 	 */
 	public void removeUnmarshaller(String contentType) {
-		partUnmarshallers.remove(contentType);
+        try {
+            partUnmarshallers.remove(new ContentType(contentType));
+        } catch (InvalidFormatException e) {
+            throw new RuntimeException(e);
+        }
 	}
 
 	/* Accesseurs */
@@ -1403,8 +1430,9 @@ public abstract class OPCPackage impleme
 	 * @see #save(OutputStream)
 	 */
 	public void save(File targetFile) throws IOException {
-		if (targetFile == null)
+		if (targetFile == null) {
 			throw new IllegalArgumentException("targetFile");
+		}
 
 		this.throwExceptionIfReadOnly();
 		
@@ -1421,13 +1449,9 @@ public abstract class OPCPackage impleme
 		FileOutputStream fos = null;
 		try {
 			fos = new FileOutputStream(targetFile);
-		} catch (FileNotFoundException e) {
-			throw new IOException(e.getLocalizedMessage());
-		}
-		try {
 			this.save(fos);
 		} finally {
-			fos.close();
+			if (fos != null) fos.close();
 		}
 	}
 

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFColor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFColor.java?rev=1708236&r1=1708235&r2=1708236&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFColor.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFColor.java Mon Oct 12 20:43:42 2015
@@ -93,13 +93,16 @@ public class XSSFColor extends ExtendedC
      * A boolean value indicating if the ctColor has a tint or not
      */
     public boolean hasTint() {
-        if (! ctColor.isSetRgb()) return false;
+        if (! ctColor.isSetRgb()) {
+            return false;
+        }
         return ctColor.getRgb().length == 4;
     }
 
     /**
      * Indexed ctColor value. Only used for backwards compatibility. References a ctColor in indexedColors.
      */
+    @Override
     public short getIndex() {
         return (short)ctColor.getIndexed();
     }
@@ -121,9 +124,12 @@ public class XSSFColor extends ExtendedC
     * Standard Red Green Blue ctColor value (RGB).
     * If there was an A (Alpha) value, it will be stripped.
     */
+   @Override
    public byte[] getRGB() {
       byte[] rgb = getRGBOrARGB();
-      if(rgb == null) return null;
+      if(rgb == null) {
+          return null;
+      }
 
       if(rgb.length == 4) {
          // Need to trim off the alpha
@@ -134,19 +140,16 @@ public class XSSFColor extends ExtendedC
          return rgb;
       }
    }
-   /**
-    * @deprecated use {@link #getRGB()}
-    */
-   public byte[] getRgb() {
-       return getRGB();
-   }
 
    /**
     * Standard Alpha Red Green Blue ctColor value (ARGB).
     */
+   @Override
    public byte[] getARGB() {
       byte[] rgb = getRGBOrARGB();
-      if(rgb == null) return null;
+      if(rgb == null) {
+          return null;
+      }
 
       if(rgb.length == 3) {
          // Pad with the default Alpha
@@ -158,34 +161,16 @@ public class XSSFColor extends ExtendedC
          return rgb;
       }
    }
-   /**
-    * @deprecated Use {@link #getARGB()}
-    */
-   public byte[] getARgb() {
-       return getARGB();
-   }
 
+   @Override
    protected byte[] getStoredRBG() {
        return ctColor.getRgb();
    }
 
     /**
-     * Standard Red Green Blue ctColor value (RGB) with applied tint.
-     * Alpha values are ignored.
-     */
-    public byte[] getRgbWithTint() {
-        return getRGBWithTint();
-    }
-
-    /**
-     * Standard Alpha Red Green Blue ctColor value (ARGB).
-     */
-    public void setRgb(byte[] rgb) {
-       setRGB(rgb);
-    }
-    /**
      * Standard Alpha Red Green Blue ctColor value (ARGB).
      */
+   @Override
     public void setRGB(byte[] rgb) {
        ctColor.setRgb(rgb);
     }
@@ -194,6 +179,7 @@ public class XSSFColor extends ExtendedC
      * Index into the <clrScheme> collection, referencing a particular <sysClr> or
      *  <srgbClr> value expressed in the Theme part.
      */
+   @Override
    public int getTheme() {
       return (int)ctColor.getTheme();
     }
@@ -247,6 +233,7 @@ public class XSSFColor extends ExtendedC
      *
      * @return the tint value
      */
+    @Override
     public double getTint() {
         return ctColor.getTint();
     }
@@ -292,6 +279,7 @@ public class XSSFColor extends ExtendedC
      *
      * @param tint the tint value
      */
+    @Override
     public void setTint(double tint) {
         ctColor.setTint(tint);
     }
@@ -313,12 +301,16 @@ public class XSSFColor extends ExtendedC
         return (XSSFColor)color;
     }
     
+    @Override
     public int hashCode(){
         return ctColor.toString().hashCode();
     }
 
+    @Override
     public boolean equals(Object o){
-        if(o == null || !(o instanceof XSSFColor)) return false;
+        if(!(o instanceof XSSFColor)) {
+            return false;
+        }
 
         XSSFColor cf = (XSSFColor)o;
         return ctColor.toString().equals(cf.getCTColor().toString());



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org