ASF Bugzilla – Attachment 34015 Details for
Bug 59806
CTBarChart org.apache.poi.openxml4j.exceptions.OpenXML4JRuntimeException
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
simplified unit test
bug59806.patch (text/plain), 4.91 KB, created by
Javen O'Neal
on 2016-07-06 10:30:43 UTC
(
hide
)
Description:
simplified unit test
Filename:
MIME Type:
Creator:
Javen O'Neal
Created:
2016-07-06 10:30:43 UTC
Size:
4.91 KB
patch
obsolete
>Index: src/ooxml/testcases/org/apache/poi/xslf/TestXSLFBugs.java >=================================================================== >--- src/ooxml/testcases/org/apache/poi/xslf/TestXSLFBugs.java (revision 1751647) >+++ src/ooxml/testcases/org/apache/poi/xslf/TestXSLFBugs.java (working copy) >@@ -30,10 +30,16 @@ > import java.awt.geom.AffineTransform; > import java.awt.geom.Rectangle2D; > import java.awt.image.BufferedImage; >+import java.io.ByteArrayOutputStream; > import java.io.File; >+import java.io.FileInputStream; > import java.io.IOException; >+import java.io.InputStream; >+import java.io.OutputStream; > import java.net.URI; > import java.util.Collection; >+import java.util.HashMap; >+import java.util.Map; > > import javax.imageio.ImageIO; > >@@ -47,10 +53,13 @@ > import org.apache.poi.sl.usermodel.PictureData.PictureType; > import org.apache.poi.sl.usermodel.ShapeType; > import org.apache.poi.sl.usermodel.VerticalAlignment; >+import org.apache.poi.ss.util.CellRangeAddress; >+import org.apache.poi.ss.util.CellReference; > import org.apache.poi.xslf.usermodel.DrawingParagraph; > import org.apache.poi.xslf.usermodel.DrawingTextBody; > import org.apache.poi.xslf.usermodel.XMLSlideShow; > import org.apache.poi.xslf.usermodel.XSLFAutoShape; >+import org.apache.poi.xslf.usermodel.XSLFChart; > import org.apache.poi.xslf.usermodel.XSLFHyperlink; > import org.apache.poi.xslf.usermodel.XSLFPictureData; > import org.apache.poi.xslf.usermodel.XSLFPictureShape; >@@ -60,8 +69,26 @@ > import org.apache.poi.xslf.usermodel.XSLFSlideLayout; > import org.apache.poi.xslf.usermodel.XSLFSlideMaster; > import org.apache.poi.xslf.usermodel.XSLFTextRun; >+import org.apache.poi.xssf.usermodel.XSSFRow; >+import org.apache.poi.xssf.usermodel.XSSFSheet; >+import org.apache.poi.xssf.usermodel.XSSFWorkbook; > import org.junit.Ignore; > import org.junit.Test; >+import org.openxmlformats.schemas.drawingml.x2006.chart.CTAxDataSource; >+import org.openxmlformats.schemas.drawingml.x2006.chart.CTBarChart; >+import org.openxmlformats.schemas.drawingml.x2006.chart.CTBarSer; >+import org.openxmlformats.schemas.drawingml.x2006.chart.CTChart; >+import org.openxmlformats.schemas.drawingml.x2006.chart.CTNumData; >+import org.openxmlformats.schemas.drawingml.x2006.chart.CTNumDataSource; >+import org.openxmlformats.schemas.drawingml.x2006.chart.CTNumVal; >+import org.openxmlformats.schemas.drawingml.x2006.chart.CTPlotArea; >+import org.openxmlformats.schemas.drawingml.x2006.chart.CTSerTx; >+import org.openxmlformats.schemas.drawingml.x2006.chart.CTStrData; >+import org.openxmlformats.schemas.drawingml.x2006.chart.CTStrVal; >+import org.openxmlformats.schemas.drawingml.x2006.chart.CTTitle; >+import org.openxmlformats.schemas.drawingml.x2006.chart.CTTx; >+import org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody; >+import org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraph; > > > public class TestXSLFBugs { >@@ -479,6 +506,42 @@ > > ppt2.close(); > } >+ >+ @Test >+ public void bug59806() throws IOException { >+ String inputPath = "59806.pptx"; >+ XMLSlideShow pptx = null; >+ try { >+ XSLFChart chart = bug59806_getChartFromTitle(inputPath); >+ // embedded Excel workbook that holds the chart data >+ POIXMLDocumentPart xlsPart = chart.getRelations().get(0); >+ >+ // updated the embedded workbook with the data >+ // This is where the exception is thrown >+ OutputStream xlsOut = xlsPart.getPackagePart().getOutputStream(); >+ >+ } finally { >+ if (pptx != null) pptx.close(); >+ } >+ } >+ >+ private static XSLFChart bug59806_getChartFromTitle(String inputPath) throws IOException { >+ InputStream stream = POIDataSamples.getSlideShowInstance().openResourceAsStream(inputPath); >+ XMLSlideShow pptx = new XMLSlideShow(stream); >+ try { >+ XSLFSlide slide = pptx.getSlides().get(0); >+ // find chart in the slide >+ for (POIXMLDocumentPart part : slide.getRelations()) { >+ if (part instanceof XSLFChart) { >+ return (XSLFChart) part; >+ } >+ } >+ return null; >+ } finally { >+ // This is the source of the Rule M2.4 exception >+ if (pptx != null) pptx.close(); >+ } >+ } > > @Test > public void bug58217() throws IOException { >Index: test-data/slideshow/59806.pptx >=================================================================== >Cannot display: file marked as a binary type. >svn:mime-type = application/octet-stream >Index: test-data/slideshow/59806.pptx >=================================================================== >--- test-data/slideshow/59806.pptx (revision 0) >+++ test-data/slideshow/59806.pptx (working copy) > >Property changes on: test-data/slideshow/59806.pptx >___________________________________________________________________ >Added: svn:mime-type >## -0,0 +1 ## >+application/octet-stream >\ No newline at end of property
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 59806
:
34014
|
34015
|
34016