From 73266f9c24c4e0fe0b432b5599fea6c30052b1e6 Mon Sep 17 00:00:00 2001 From: Dustin Spicuzza Date: Mon, 19 Oct 2015 06:55:06 +0000 Subject: [PATCH] XDGF: fix jenkins build errors git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1709363 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/xdgf/extractor/XDGFVisioExtractor.java | 16 ++++++++++++++++ .../xdgf/usermodel/section/CombinedIterable.java | 14 +++++++++++++- .../xdgf/usermodel/shape/ShapeTextVisitor.java | 16 ++++++++++++++++ .../apache/poi/xdgf/util/HierarchyPrinter.java | 7 ++++--- .../xdgf/extractor/TestXDGFVisioExtractor.java | 16 ++++++++++++++++ 5 files changed, 65 insertions(+), 4 deletions(-) diff --git a/src/ooxml/java/org/apache/poi/xdgf/extractor/XDGFVisioExtractor.java b/src/ooxml/java/org/apache/poi/xdgf/extractor/XDGFVisioExtractor.java index c49c2121dc..5f474fc739 100644 --- a/src/ooxml/java/org/apache/poi/xdgf/extractor/XDGFVisioExtractor.java +++ b/src/ooxml/java/org/apache/poi/xdgf/extractor/XDGFVisioExtractor.java @@ -1,3 +1,19 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ package org.apache.poi.xdgf.extractor; import java.io.IOException; diff --git a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/CombinedIterable.java b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/CombinedIterable.java index c42bc34d59..a659a8bcef 100644 --- a/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/CombinedIterable.java +++ b/src/ooxml/java/org/apache/poi/xdgf/usermodel/section/CombinedIterable.java @@ -32,6 +32,18 @@ public class CombinedIterable implements Iterable { final SortedMap _baseItems; final SortedMap _masterItems; + + private static final class EmptyIterator implements Iterator { + + public boolean hasNext() { + return false; + } + + public T next() { + return null; + } + + } public CombinedIterable(SortedMap baseItems, SortedMap masterItems) { @@ -47,7 +59,7 @@ public class CombinedIterable implements Iterable { if (_masterItems != null) vmasterI = _masterItems.entrySet().iterator(); else - vmasterI = Collections.emptyIterator(); + vmasterI = new EmptyIterator>(); return new Iterator() { diff --git a/src/ooxml/java/org/apache/poi/xdgf/usermodel/shape/ShapeTextVisitor.java b/src/ooxml/java/org/apache/poi/xdgf/usermodel/shape/ShapeTextVisitor.java index 4589bc8ad7..9a0f28cf54 100644 --- a/src/ooxml/java/org/apache/poi/xdgf/usermodel/shape/ShapeTextVisitor.java +++ b/src/ooxml/java/org/apache/poi/xdgf/usermodel/shape/ShapeTextVisitor.java @@ -1,3 +1,19 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ package org.apache.poi.xdgf.usermodel.shape; import java.awt.geom.AffineTransform; diff --git a/src/ooxml/java/org/apache/poi/xdgf/util/HierarchyPrinter.java b/src/ooxml/java/org/apache/poi/xdgf/util/HierarchyPrinter.java index 6b3a9a5a5f..eb9aa9796d 100644 --- a/src/ooxml/java/org/apache/poi/xdgf/util/HierarchyPrinter.java +++ b/src/ooxml/java/org/apache/poi/xdgf/util/HierarchyPrinter.java @@ -24,6 +24,7 @@ import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.OutputStream; import java.io.PrintStream; +import java.io.UnsupportedEncodingException; import org.apache.poi.xdgf.usermodel.XDGFPage; import org.apache.poi.xdgf.usermodel.XDGFShape; @@ -37,13 +38,13 @@ import org.apache.poi.xdgf.usermodel.shape.ShapeVisitor; public class HierarchyPrinter { public static void printHierarchy(XDGFPage page, File outDir) - throws FileNotFoundException { + throws FileNotFoundException, UnsupportedEncodingException { File pageFile = new File(outDir, "page" + page.getPageNumber() + "-" + Util.sanitizeFilename(page.getName()) + ".txt"); OutputStream os = new FileOutputStream(pageFile); - PrintStream pos = new PrintStream(os); + PrintStream pos = new PrintStream(os, false, "utf-8"); printHierarchy(page, pos); @@ -70,7 +71,7 @@ public class HierarchyPrinter { } public static void printHierarchy(XmlVisioDocument document, - String outDirname) throws FileNotFoundException { + String outDirname) throws FileNotFoundException, UnsupportedEncodingException { File outDir = new File(outDirname); diff --git a/src/ooxml/testcases/org/apache/poi/xdgf/extractor/TestXDGFVisioExtractor.java b/src/ooxml/testcases/org/apache/poi/xdgf/extractor/TestXDGFVisioExtractor.java index 4c7459518e..57957fa298 100644 --- a/src/ooxml/testcases/org/apache/poi/xdgf/extractor/TestXDGFVisioExtractor.java +++ b/src/ooxml/testcases/org/apache/poi/xdgf/extractor/TestXDGFVisioExtractor.java @@ -1,3 +1,19 @@ +/* ==================================================================== + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +==================================================================== */ package org.apache.poi.xdgf.extractor; import java.io.IOException; -- 2.39.5