From ac1490264cc87dd67fb71fb21e14f2945d645882 Mon Sep 17 00:00:00 2001 From: Yegor Kozlov Date: Sun, 24 Jan 2010 13:11:46 +0000 Subject: [PATCH] always copy all declared inner classes and interfaces when generating poi-ooxml-schemas, see Bugzilla 48572 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@902563 13f79535-47bb-0310-9956-ffa450edef68 --- src/documentation/content/xdocs/status.xml | 1 + .../java/org/apache/poi/util/OOXMLLite.java | 22 +++++++------------ 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index a0462404a2..cea8287434 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ + 48572 - always copy all declared inner classes and interfaces when generating poi-ooxml-schemas Low Level record support for the ExtRst (phonetic text) part of Unicode Strings. No usermodel access to it as yet though. record.UnicodeString has moved to record.common.UnicodeString, to live with the other record-part classes, as it isn't a full record. Avoid creating temporary files when opening OPC packages from input stream diff --git a/src/ooxml/java/org/apache/poi/util/OOXMLLite.java b/src/ooxml/java/org/apache/poi/util/OOXMLLite.java index e533373ba3..b0e7b26dc4 100755 --- a/src/ooxml/java/org/apache/poi/util/OOXMLLite.java +++ b/src/ooxml/java/org/apache/poi/util/OOXMLLite.java @@ -109,23 +109,17 @@ public final class OOXMLLite { String className = cls.getName(); String classRef = className.replace('.', '/') + ".class"; File destFile = new File(_destDest, classRef); - //System.out.println(classRef + " --> " + destFile); copyFile(cls.getResourceAsStream('/' + classRef), destFile); if(cls.isInterface()){ - //always copy Factory that accompanies every ooxml schema object - String factoryClass = className + "$Factory"; - if(!classes.containsKey(factoryClass)){ - try { - Class fc = Class.forName(factoryClass); - className = fc.getName(); - classRef = className.replace('.', '/') + ".class"; - destFile = new File(_destDest, classRef); - //System.out.println(classRef + " --> " + destFile); - copyFile(fc.getResourceAsStream('/' + classRef), destFile); - } catch(ClassNotFoundException e) { - e.printStackTrace(); - } + /** + * Copy classes and interfaces declared as members of this class + */ + for(Class fc : cls.getDeclaredClasses()){ + className = fc.getName(); + classRef = className.replace('.', '/') + ".class"; + destFile = new File(_destDest, classRef); + copyFile(fc.getResourceAsStream('/' + classRef), destFile); } } } -- 2.39.5