poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r696839 - in /poi/branches/ooxml: ./ src/java/org/apache/poi/hssf/record/formula/functions/ src/java/org/apache/poi/hssf/usermodel/ src/scratchpad/src/org/apache/poi/hslf/record/ src/scratchpad/testcases/org/apache/poi/hslf/record/ src/test...
Date Thu, 18 Sep 2008 22:40:03 GMT
Author: josh
Date: Thu Sep 18 15:40:03 2008
New Revision: 696839

URL: http://svn.apache.org/viewvc?rev=696839&view=rev
Log:
Merged revisions 696622-696623,696627 via svnmerge from 
https://svn.apache.org/repos/asf/poi/trunk

........
  r696622 | yegor | 2008-09-18 03:28:24 -0700 (Thu, 18 Sep 2008) | 1 line
  
  fixed bug #45829: HSSFPicture.getImageDimension() fails when DPI of image is zero
........
  r696623 | yegor | 2008-09-18 03:45:00 -0700 (Thu, 18 Sep 2008) | 1 line
  
  fixed bug 45815: bit mask values inStyleTextPropAtom are not preserved across read-write
........
  r696627 | yegor | 2008-09-18 03:58:39 -0700 (Thu, 18 Sep 2008) | 1 line
  
  patch from bug #45814: Specify RecordType for slide show Handout 
........

Added:
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/data/45829.png
      - copied unchanged from r696627, poi/trunk/src/testcases/org/apache/poi/hssf/data/45829.png
Modified:
    poi/branches/ooxml/   (props changed)
    poi/branches/ooxml/src/java/org/apache/poi/hssf/record/formula/functions/DateFunc.java
  (props changed)
    poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFPicture.java
    poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/LazyAreaEval.java   (props changed)
    poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/LazyRefEval.java   (props changed)
    poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hslf/record/RecordTypes.java
    poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hslf/record/StyleTextPropAtom.java
    poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hslf/record/TestStyleTextPropAtom.java
    poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPicture.java

Propchange: poi/branches/ooxml/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Sep 18 15:40:03 2008
@@ -1 +1 @@
-/poi/trunk:693591-694881,695264-695420,695621,695649-696111,696501
+/poi/trunk:693591-694881,695264-695420,695621,695649-696627

Propchange: poi/branches/ooxml/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Sep 18 15:40:03 2008
@@ -1 +1 @@
-/poi/trunk:1-638784,638786-639486,639488-639601,639603-640056,640058-642562,642564-642566,642568-642574,642576-642736,642739-650914,650916-696111,696501
+/poi/trunk:1-638784,638786-639486,639488-639601,639603-640056,640058-642562,642564-642566,642568-642574,642576-642736,642739-650914,650916-696627

Propchange: poi/branches/ooxml/src/java/org/apache/poi/hssf/record/formula/functions/DateFunc.java
            ('svn:mergeinfo' removed)

Modified: poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFPicture.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFPicture.java?rev=696839&r1=696838&r2=696839&view=diff
==============================================================================
--- poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFPicture.java (original)
+++ poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/HSSFPicture.java Thu Sep 18
15:40:03 2008
@@ -235,6 +235,12 @@
                     BufferedImage img = r.read(0);
 
                     int[] dpi = getResolution(r);
+
+                    //if DPI is zero then assume standard 96 DPI
+                    //since cannot divide by zero
+                    if (dpi[0] == 0) dpi[0] = 96;
+                    if (dpi[1] == 0) dpi[1] = 96;
+                    
                     size.width = img.getWidth()*96/dpi[0];
                     size.height = img.getHeight()*96/dpi[1];
 

Propchange: poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/LazyAreaEval.java
            ('svn:mergeinfo' removed)

Propchange: poi/branches/ooxml/src/java/org/apache/poi/hssf/usermodel/LazyRefEval.java
            ('svn:mergeinfo' removed)

Modified: poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hslf/record/RecordTypes.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hslf/record/RecordTypes.java?rev=696839&r1=696838&r2=696839&view=diff
==============================================================================
--- poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hslf/record/RecordTypes.java (original)
+++ poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hslf/record/RecordTypes.java Thu
Sep 18 15:40:03 2008
@@ -101,7 +101,7 @@
     public static final Type MetaFile = new Type(4033,null);
     public static final Type ExOleObjAtom = new Type(4035,ExOleObjAtom.class);
     public static final Type SrKinsoku = new Type(4040,null);
-    public static final Type HandOut = new Type(4041,null);
+    public static final Type HandOut = new Type(4041,DummyPositionSensitiveRecordWithChildren.class);
     public static final Type ExEmbed = new Type(4044,ExEmbed.class);
     public static final Type ExEmbedAtom = new Type(4045,ExEmbedAtom.class);
     public static final Type ExLink = new Type(4046,null);

Modified: poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hslf/record/StyleTextPropAtom.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hslf/record/StyleTextPropAtom.java?rev=696839&r1=696838&r2=696839&view=diff
==============================================================================
--- poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hslf/record/StyleTextPropAtom.java
(original)
+++ poi/branches/ooxml/src/scratchpad/src/org/apache/poi/hslf/record/StyleTextPropAtom.java
Thu Sep 18 15:40:03 2008
@@ -157,6 +157,12 @@
                 new TextProp(0, 0x80, "kumi"),
                 new TextProp(0, 0x100, "unused3"),
                 new TextProp(0, 0x200, "emboss"),
+                new TextProp(0, 0x400, "nibble1"),
+                new TextProp(0, 0x800, "nibble2"),
+                new TextProp(0, 0x1000, "nibble3"),
+                new TextProp(0, 0x2000, "nibble4"),
+                new TextProp(0, 0x4000, "unused4"),
+                new TextProp(0, 0x8000, "unused5"),
                 new CharFlagsTextProp(),
 				new TextProp(2, 0x10000, "font.index"),
                 new TextProp(0, 0x100000, "pp10ext"),

Modified: poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hslf/record/TestStyleTextPropAtom.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hslf/record/TestStyleTextPropAtom.java?rev=696839&r1=696838&r2=696839&view=diff
==============================================================================
--- poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hslf/record/TestStyleTextPropAtom.java
(original)
+++ poi/branches/ooxml/src/scratchpad/testcases/org/apache/poi/hslf/record/TestStyleTextPropAtom.java
Thu Sep 18 15:40:03 2008
@@ -738,4 +738,35 @@
         doReadWrite(data, length);
 
     }
+
+    /**
+     *  Bug 45815: bit mask values are not preserved on read-write
+     *
+     * From the test file attached to the bug:
+     *
+     * <StyleTextPropAtom info="0" type="4001" size="94" offset="114782" header="00 00
A1 0F 5E 00 00 00 ">
+     *   14 00 00 00 00 00 41 00 0A 00 06 00 50 00 07 00 01 00 00 00 00 00 00 00 02
+     *   00 00 00 01 04 00 00 01 04 01 00 00 00 01 08 00 00 01 08 0C 00 00 00 01 0C
+     *   00 00 01 0C 01 00 00 00 01 10 00 00 01 10 01 00 00 00 01 14 00 00 01 14 01
+     *   00 00 00 01 18 00 00 01 18 01 00 00 00 01 1C 00 00 01 1C
+     * </StyleTextPropAtom>
+     */
+    public void test45815() throws Exception {
+        int length = 19;
+        byte[] data = {
+                0x00, 0x00, (byte)0xA1, 0x0F, 0x5E, 0x00, 0x00, 0x00, 0x14, 0x00,
+                0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x0A, 0x00, 0x06, 0x00,
+                0x50, 0x00, 0x07, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
+                0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00,
+                0x01, 0x04, 0x01, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, 0x00,
+                0x01, 0x08, 0x0C, 0x00, 0x00, 0x00, 0x01, 0x0C, 0x00, 0x00, 
+                0x01, 0x0C, 0x01, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x00,
+                0x01, 0x10, 0x01, 0x00, 0x00, 0x00, 0x01, 0x14, 0x00, 0x00,
+                0x01, 0x14, 0x01, 0x00, 0x00, 0x00, 0x01, 0x18, 0x00, 0x00,
+                0x01, 0x18, 0x01, 0x00, 0x00, 0x00, 0x01, 0x1C, 0x00, 0x00,
+                0x01, 0x1C
+        };
+        doReadWrite(data, length);
+    }
+
 }

Modified: poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPicture.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPicture.java?rev=696839&r1=696838&r2=696839&view=diff
==============================================================================
--- poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPicture.java (original)
+++ poi/branches/ooxml/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPicture.java Thu
Sep 18 15:40:03 2008
@@ -47,4 +47,18 @@
         assertEquals(848, anchor1.getDx2());
         assertEquals(240, anchor1.getDy2());
     }
+
+    /**
+     * Bug # 45829 reported ArithmeticException (/ by zero) when resizing png with zero DPI.
+     */
+    public void test45829() {
+        HSSFWorkbook wb = new HSSFWorkbook();
+        HSSFSheet sh1 = wb.createSheet();
+        HSSFPatriarch p1 = sh1.createDrawingPatriarch();
+
+        byte[] pictureData = HSSFTestDataSamples.getTestDataFileContent("45829.png");
+        int idx1 = wb.addPicture( pictureData, HSSFWorkbook.PICTURE_TYPE_PNG );
+        HSSFPicture pic = p1.createPicture(new HSSFClientAnchor(), idx1);
+        pic.resize();
+    }
 }



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


Mime
View raw message