You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by fa...@apache.org on 2021/05/22 20:22:17 UTC

svn commit: r1890119 [4/10] - in /poi/trunk/poi-ooxml/src: main/java/org/apache/poi/ooxml/extractor/ main/java/org/apache/poi/ooxml/util/ main/java/org/apache/poi/openxml4j/exceptions/ main/java/org/apache/poi/openxml4j/opc/ main/java/org/apache/poi/op...

Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/ContentType.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/ContentType.java?rev=1890119&r1=1890118&r2=1890119&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/ContentType.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/ContentType.java Sat May 22 20:22:16 2021
@@ -51,25 +51,25 @@ import org.apache.poi.openxml4j.exceptio
  */
 public final class ContentType {
 
-	/**
-	 * Type in Type/Subtype.
-	 */
-	private final String type;
-
-	/**
-	 * Subtype
-	 */
-	private final String subType;
-
-	/**
-	 * Parameters
-	 */
-	private final Map<String, String> parameters;
-
-	/**
-	 * Media type compiled pattern, without parameters
-	 */
-	private static final Pattern patternTypeSubType;
+    /**
+     * Type in Type/Subtype.
+     */
+    private final String type;
+
+    /**
+     * Subtype
+     */
+    private final String subType;
+
+    /**
+     * Parameters
+     */
+    private final Map<String, String> parameters;
+
+    /**
+     * Media type compiled pattern, without parameters
+     */
+    private static final Pattern patternTypeSubType;
     /**
      * Media type compiled pattern, with parameters.
      */
@@ -80,184 +80,184 @@ public final class ContentType {
      */
     private static final Pattern patternParams;
 
-	static {
-		/*
-		 * token = 1*<any CHAR except CTLs or separators>
-		 *
-		 * separators = "(" | ")" | "<" | ">" | "@" | "," | ";" | ":" | "\" |
-		 * <"> | "/" | "[" | "]" | "?" | "=" | "{" | "}" | SP | HT
-		 *
-		 * CTL = <any US-ASCII control character (octets 0 - 31) and DEL (127)>
-		 *
-		 * CHAR = <any US-ASCII character (octets 0 - 127)>
-		 */
-		String token = "[\\x21-\\x7E&&[^()<>@,;:\\\\/\"\\[\\]?={}\\x20\\x09]]";
-
-		/*
-		 * parameter = attribute "=" value
-		 *
-		 * attribute = token
-		 *
-		 * value = token | quoted-string
-		 */
-		String parameter = "(" + token + "+)=(\"?" + token + "+\"?)";
-		/*
-		 * Pattern for media type.
-		 *
-		 * Don't allow comment, rule M1.15: The package implementer shall
-		 * require a content type that does not include comments and the format
-		 * designer shall specify such a content type.
-		 *
-		 * comment = "(" *( ctext | quoted-pair | comment ) ")"
-		 *
-		 * ctext = <any TEXT excluding "(" and ")">
-		 *
-		 * TEXT = <any OCTET except CTLs, but including LWS>
-		 *
-		 * LWS = [CRLF] 1*( SP | HT )
-		 *
-		 * CR = <US-ASCII CR, carriage return (13)>
-		 *
-		 * LF = <US-ASCII LF, linefeed (10)>
-		 *
-		 * SP = <US-ASCII SP, space (32)>
-		 *
-		 * HT = <US-ASCII HT, horizontal-tab (9)>
-		 *
-		 * quoted-pair = "\" CHAR
-		 */
-
-		patternTypeSubType       = Pattern.compile("^(" + token + "+)/(" +
-		                                           token + "+)$");
-		patternTypeSubTypeParams = Pattern.compile("^(" + token + "+)/(" +
-		                                           token + "+)(;" + parameter + ")*$");
-		patternParams            = Pattern.compile(";" + parameter);
-	}
-
-	/**
-	 * Constructor. Check the input with the RFC 2616 grammar.
-	 *
-	 * @param contentType
-	 *            The content type to store.
-	 * @throws InvalidFormatException
-	 *             If the specified content type is not valid with RFC 2616.
-	 */
-	public ContentType(String contentType) throws InvalidFormatException {
-		Matcher mMediaType = patternTypeSubType.matcher(contentType);
-		if (!mMediaType.matches()) {
-			// How about with parameters?
-			mMediaType = patternTypeSubTypeParams.matcher(contentType);
-		}
-		if (!mMediaType.matches()) {
-			throw new InvalidFormatException(
-					"The specified content type '"
-					+ contentType
-					+ "' is not compliant with RFC 2616: malformed content type.");
-		}
-
-		// Type/subtype
-		if (mMediaType.groupCount() >= 2) {
-			this.type = mMediaType.group(1);
-			this.subType = mMediaType.group(2);
-
-			// Parameters
-			this.parameters = new HashMap<>();
-			// Java RegExps are unhelpful, and won't do multiple group captures
-			// See http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html#cg
-			if (mMediaType.groupCount() >= 5) {
-				Matcher mParams = patternParams.matcher(contentType.substring(mMediaType.end(2)));
-				while (mParams.find()) {
-					this.parameters.put(mParams.group(1), mParams.group(2));
-				}
-			}
-		} else {
-			// missing media type and subtype
-			this.type = "";
-			this.subType = "";
-			this.parameters = Collections.emptyMap();
-		}
-	}
+    static {
+        /*
+         * token = 1*<any CHAR except CTLs or separators>
+         *
+         * separators = "(" | ")" | "<" | ">" | "@" | "," | ";" | ":" | "\" |
+         * <"> | "/" | "[" | "]" | "?" | "=" | "{" | "}" | SP | HT
+         *
+         * CTL = <any US-ASCII control character (octets 0 - 31) and DEL (127)>
+         *
+         * CHAR = <any US-ASCII character (octets 0 - 127)>
+         */
+        String token = "[\\x21-\\x7E&&[^()<>@,;:\\\\/\"\\[\\]?={}\\x20\\x09]]";
+
+        /*
+         * parameter = attribute "=" value
+         *
+         * attribute = token
+         *
+         * value = token | quoted-string
+         */
+        String parameter = "(" + token + "+)=(\"?" + token + "+\"?)";
+        /*
+         * Pattern for media type.
+         *
+         * Don't allow comment, rule M1.15: The package implementer shall
+         * require a content type that does not include comments and the format
+         * designer shall specify such a content type.
+         *
+         * comment = "(" *( ctext | quoted-pair | comment ) ")"
+         *
+         * ctext = <any TEXT excluding "(" and ")">
+         *
+         * TEXT = <any OCTET except CTLs, but including LWS>
+         *
+         * LWS = [CRLF] 1*( SP | HT )
+         *
+         * CR = <US-ASCII CR, carriage return (13)>
+         *
+         * LF = <US-ASCII LF, linefeed (10)>
+         *
+         * SP = <US-ASCII SP, space (32)>
+         *
+         * HT = <US-ASCII HT, horizontal-tab (9)>
+         *
+         * quoted-pair = "\" CHAR
+         */
+
+        patternTypeSubType       = Pattern.compile("^(" + token + "+)/(" +
+                                                   token + "+)$");
+        patternTypeSubTypeParams = Pattern.compile("^(" + token + "+)/(" +
+                                                   token + "+)(;" + parameter + ")*$");
+        patternParams            = Pattern.compile(";" + parameter);
+    }
+
+    /**
+     * Constructor. Check the input with the RFC 2616 grammar.
+     *
+     * @param contentType
+     *            The content type to store.
+     * @throws InvalidFormatException
+     *             If the specified content type is not valid with RFC 2616.
+     */
+    public ContentType(String contentType) throws InvalidFormatException {
+        Matcher mMediaType = patternTypeSubType.matcher(contentType);
+        if (!mMediaType.matches()) {
+            // How about with parameters?
+            mMediaType = patternTypeSubTypeParams.matcher(contentType);
+        }
+        if (!mMediaType.matches()) {
+            throw new InvalidFormatException(
+                    "The specified content type '"
+                    + contentType
+                    + "' is not compliant with RFC 2616: malformed content type.");
+        }
+
+        // Type/subtype
+        if (mMediaType.groupCount() >= 2) {
+            this.type = mMediaType.group(1);
+            this.subType = mMediaType.group(2);
+
+            // Parameters
+            this.parameters = new HashMap<>();
+            // Java RegExps are unhelpful, and won't do multiple group captures
+            // See http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html#cg
+            if (mMediaType.groupCount() >= 5) {
+                Matcher mParams = patternParams.matcher(contentType.substring(mMediaType.end(2)));
+                while (mParams.find()) {
+                    this.parameters.put(mParams.group(1), mParams.group(2));
+                }
+            }
+        } else {
+            // missing media type and subtype
+            this.type = "";
+            this.subType = "";
+            this.parameters = Collections.emptyMap();
+        }
+    }
 
     /**
      * Returns the content type as a string, including parameters
      */
-	@Override
-	public final String toString() {
-	    return toString(true);
-	}
-
-	public final String toString(boolean withParameters) {
-		StringBuilder retVal = new StringBuilder(64);
-	    retVal.append(this.getType());
-	    retVal.append('/');
-	    retVal.append(this.getSubType());
-
-	    if (withParameters) {
-	        for (Entry<String, String> me : parameters.entrySet()) {
-	            retVal.append(';');
-	            retVal.append(me.getKey());
-	            retVal.append('=');
-	            retVal.append(me.getValue());
-	        }
-	    }
-	    return retVal.toString();
-	}
-
-	@Override
-	public boolean equals(Object obj) {
-		return (!(obj instanceof ContentType))
-				|| (this.toString().equalsIgnoreCase(obj.toString()));
-	}
-
-	@Override
-	public int hashCode() {
-		return Objects.hash(type,subType,parameters);
-	}
-
-	/* Getters */
-
-	/**
-	 * Get the subtype.
-	 *
-	 * @return The subtype of this content type.
-	 */
-	public String getSubType() {
-		return this.subType;
-	}
-
-	/**
-	 * Get the type.
-	 *
-	 * @return The type of this content type.
-	 */
-	public String getType() {
-		return this.type;
-	}
-
-	/**
-	 * Does this content type have any parameters associated with it?
-	 */
-	public boolean hasParameters() {
-	    return (parameters != null) && !parameters.isEmpty();
-	}
-
-	/**
-	 * Return the parameter keys
-	 */
-	public String[] getParameterKeys() {
-	    if (parameters == null)
-	        return new String[0];
-	    return parameters.keySet().toArray(new String[0]);
-	}
-
-	/**
-	 * Gets the value associated to the specified key.
-	 *
-	 * @param key
-	 *            The key of the key/value pair.
-	 * @return The value associated to the specified key.
-	 */
-	public String getParameter(String key) {
-		return parameters.get(key);
-	}
+    @Override
+    public final String toString() {
+        return toString(true);
+    }
+
+    public final String toString(boolean withParameters) {
+        StringBuilder retVal = new StringBuilder(64);
+        retVal.append(this.getType());
+        retVal.append('/');
+        retVal.append(this.getSubType());
+
+        if (withParameters) {
+            for (Entry<String, String> me : parameters.entrySet()) {
+                retVal.append(';');
+                retVal.append(me.getKey());
+                retVal.append('=');
+                retVal.append(me.getValue());
+            }
+        }
+        return retVal.toString();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        return (!(obj instanceof ContentType))
+                || (this.toString().equalsIgnoreCase(obj.toString()));
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(type,subType,parameters);
+    }
+
+    /* Getters */
+
+    /**
+     * Get the subtype.
+     *
+     * @return The subtype of this content type.
+     */
+    public String getSubType() {
+        return this.subType;
+    }
+
+    /**
+     * Get the type.
+     *
+     * @return The type of this content type.
+     */
+    public String getType() {
+        return this.type;
+    }
+
+    /**
+     * Does this content type have any parameters associated with it?
+     */
+    public boolean hasParameters() {
+        return (parameters != null) && !parameters.isEmpty();
+    }
+
+    /**
+     * Return the parameter keys
+     */
+    public String[] getParameterKeys() {
+        if (parameters == null)
+            return new String[0];
+        return parameters.keySet().toArray(new String[0]);
+    }
+
+    /**
+     * Gets the value associated to the specified key.
+     *
+     * @param key
+     *            The key of the key/value pair.
+     * @return The value associated to the specified key.
+     */
+    public String getParameter(String key) {
+        return parameters.get(key);
+    }
 }

Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/MemoryPackagePart.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/MemoryPackagePart.java?rev=1890119&r1=1890118&r2=1890119&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/MemoryPackagePart.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/MemoryPackagePart.java Sat May 22 20:22:16 2021
@@ -38,101 +38,101 @@ import org.apache.poi.util.IOUtils;
  */
 public final class MemoryPackagePart extends PackagePart {
 
-	/**
-	 * Storage for the part data.
-	 */
-	protected byte[] data;
-
-	/**
-	 * Constructor.
-	 *
-	 * @param pack
-	 *            The owner package.
-	 * @param partName
-	 *            The part name.
-	 * @param contentType
-	 *            The content type.
-	 * @throws InvalidFormatException
-	 *             If the specified URI is not OPC compliant.
-	 */
-	public MemoryPackagePart(OPCPackage pack, PackagePartName partName,
-			String contentType) throws InvalidFormatException {
-		super(pack, partName, contentType);
-	}
-
-	/**
-	 * Constructor.
-	 *
-	 * @param pack
-	 *            The owner package.
-	 * @param partName
-	 *            The part name.
-	 * @param contentType
-	 *            The content type.
-	 * @param loadRelationships
-	 *            Specify if the relationships will be loaded.
-	 * @throws InvalidFormatException
-	 *             If the specified URI is not OPC compliant.
-	 */
-	public MemoryPackagePart(OPCPackage pack, PackagePartName partName,
-			String contentType, boolean loadRelationships)
-			throws InvalidFormatException {
-		super(pack, partName, new ContentType(contentType), loadRelationships);
-	}
-
-	@Override
-	protected InputStream getInputStreamImpl() {
-		// If this part has been created from scratch and/or the data buffer is
-		// not
-		// initialize, so we do it now.
-		if (data == null) {
-			data = new byte[0];
-		}
-		return new ByteArrayInputStream(data);
-	}
-
-	@Override
-	protected OutputStream getOutputStreamImpl() {
-		return new MemoryPackagePartOutputStream(this);
-	}
-
-	@Override
-	public long getSize() {
-		return data == null ? 0 : data.length;
-	}
+    /**
+     * Storage for the part data.
+     */
+    protected byte[] data;
+
+    /**
+     * Constructor.
+     *
+     * @param pack
+     *            The owner package.
+     * @param partName
+     *            The part name.
+     * @param contentType
+     *            The content type.
+     * @throws InvalidFormatException
+     *             If the specified URI is not OPC compliant.
+     */
+    public MemoryPackagePart(OPCPackage pack, PackagePartName partName,
+            String contentType) throws InvalidFormatException {
+        super(pack, partName, contentType);
+    }
+
+    /**
+     * Constructor.
+     *
+     * @param pack
+     *            The owner package.
+     * @param partName
+     *            The part name.
+     * @param contentType
+     *            The content type.
+     * @param loadRelationships
+     *            Specify if the relationships will be loaded.
+     * @throws InvalidFormatException
+     *             If the specified URI is not OPC compliant.
+     */
+    public MemoryPackagePart(OPCPackage pack, PackagePartName partName,
+            String contentType, boolean loadRelationships)
+            throws InvalidFormatException {
+        super(pack, partName, new ContentType(contentType), loadRelationships);
+    }
+
+    @Override
+    protected InputStream getInputStreamImpl() {
+        // If this part has been created from scratch and/or the data buffer is
+        // not
+        // initialize, so we do it now.
+        if (data == null) {
+            data = new byte[0];
+        }
+        return new ByteArrayInputStream(data);
+    }
+
+    @Override
+    protected OutputStream getOutputStreamImpl() {
+        return new MemoryPackagePartOutputStream(this);
+    }
+
+    @Override
+    public long getSize() {
+        return data == null ? 0 : data.length;
+    }
 
     @Override
     public void clear() {
-		data = null;
-	}
+        data = null;
+    }
 
-	@Override
-	public boolean save(OutputStream os) throws OpenXML4JException {
-		return new ZipPartMarshaller().marshall(this, os);
-	}
-
-	@Override
-	public boolean load(InputStream ios) throws InvalidFormatException {
-	   try (UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream()) {
-		   // Grab the data
-	      IOUtils.copy(ios, baos);
-		   // Save it
-		   data = baos.toByteArray();
-	   } catch(IOException e) {
-	      throw new InvalidFormatException(e.getMessage());
-	   }
-
-	   // All done
-	   return true;
-	}
-
-	@Override
-	public void close() {
-		// Do nothing
-	}
-
-	@Override
-	public void flush() {
-		// Do nothing
-	}
+    @Override
+    public boolean save(OutputStream os) throws OpenXML4JException {
+        return new ZipPartMarshaller().marshall(this, os);
+    }
+
+    @Override
+    public boolean load(InputStream ios) throws InvalidFormatException {
+       try (UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream()) {
+           // Grab the data
+          IOUtils.copy(ios, baos);
+           // Save it
+           data = baos.toByteArray();
+       } catch(IOException e) {
+          throw new InvalidFormatException(e.getMessage());
+       }
+
+       // All done
+       return true;
+    }
+
+    @Override
+    public void close() {
+        // Do nothing
+    }
+
+    @Override
+    public void flush() {
+        // Do nothing
+    }
 }

Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/MemoryPackagePartOutputStream.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/MemoryPackagePartOutputStream.java?rev=1890119&r1=1890118&r2=1890119&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/MemoryPackagePartOutputStream.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/MemoryPackagePartOutputStream.java Sat May 22 20:22:16 2021
@@ -27,68 +27,68 @@ import org.apache.commons.io.output.Unsy
  */
 public final class MemoryPackagePartOutputStream extends OutputStream {
 
-	private final MemoryPackagePart _part;
+    private final MemoryPackagePart _part;
 
-	private final UnsynchronizedByteArrayOutputStream _buff;
+    private final UnsynchronizedByteArrayOutputStream _buff;
 
-	public MemoryPackagePartOutputStream(MemoryPackagePart part) {
-		this._part = part;
-		_buff = new UnsynchronizedByteArrayOutputStream();
-	}
-
-	@Override
-	public void write(int b) {
-		_buff.write(b);
-	}
-
-	/**
-	 * Close this stream and flush the content.
-	 * @see #flush()
-	 */
-	@Override
-	public void close() throws IOException {
-		this.flush();
-	}
-
-	/**
-	 * Flush this output stream. This method is called by the close() method.
-	 * Warning : don't call this method for output consistency.
-	 * @see #close()
-	 */
-	@Override
-	public void flush() throws IOException {
-		_buff.flush();
-		if (_part.data != null) {
-			byte[] newArray = new byte[_part.data.length + _buff.size()];
-			// copy the previous contents of part.data in newArray
-			System.arraycopy(_part.data, 0, newArray, 0, _part.data.length);
-
-			// append the newly added data
-			byte[] buffArr = _buff.toByteArray();
-			System.arraycopy(buffArr, 0, newArray, _part.data.length,
-					buffArr.length);
-
-			// save the result as new data
-			_part.data = newArray;
-		} else {
-			// was empty, just fill it
-			_part.data = _buff.toByteArray();
-		}
-
-		/*
-		 * Clear this streams buffer, in case flush() is called a second time
-		 * Fix bug 1921637 - provided by Rainer Schwarze
-		 */
-		_buff.reset();
-	}
-
-	@Override
-	public void write(byte[] b, int off, int len) {
-		_buff.write(b, off, len);
-	}
-
-	@Override
-	public void write(byte[] b) throws IOException {
-		_buff.write(b);
-	}
+    public MemoryPackagePartOutputStream(MemoryPackagePart part) {
+        this._part = part;
+        _buff = new UnsynchronizedByteArrayOutputStream();
+    }
+
+    @Override
+    public void write(int b) {
+        _buff.write(b);
+    }
+
+    /**
+     * Close this stream and flush the content.
+     * @see #flush()
+     */
+    @Override
+    public void close() throws IOException {
+        this.flush();
+    }
+
+    /**
+     * Flush this output stream. This method is called by the close() method.
+     * Warning : don't call this method for output consistency.
+     * @see #close()
+     */
+    @Override
+    public void flush() throws IOException {
+        _buff.flush();
+        if (_part.data != null) {
+            byte[] newArray = new byte[_part.data.length + _buff.size()];
+            // copy the previous contents of part.data in newArray
+            System.arraycopy(_part.data, 0, newArray, 0, _part.data.length);
+
+            // append the newly added data
+            byte[] buffArr = _buff.toByteArray();
+            System.arraycopy(buffArr, 0, newArray, _part.data.length,
+                    buffArr.length);
+
+            // save the result as new data
+            _part.data = newArray;
+        } else {
+            // was empty, just fill it
+            _part.data = _buff.toByteArray();
+        }
+
+        /*
+         * Clear this streams buffer, in case flush() is called a second time
+         * Fix bug 1921637 - provided by Rainer Schwarze
+         */
+        _buff.reset();
+    }
+
+    @Override
+    public void write(byte[] b, int off, int len) {
+        _buff.write(b, off, len);
+    }
+
+    @Override
+    public void write(byte[] b) throws IOException {
+        _buff.write(b);
+    }
 }

Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/PartMarshaller.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/PartMarshaller.java?rev=1890119&r1=1890118&r2=1890119&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/PartMarshaller.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/PartMarshaller.java Sat May 22 20:22:16 2021
@@ -31,18 +31,18 @@ import org.apache.poi.openxml4j.opc.Pack
  */
 public interface PartMarshaller {
 
-	/**
-	 * Save the content of the package in the stream
-	 *
-	 * @param part
-	 *            Part to marshall.
-	 * @param out
-	 *            The output stream into which the part will be marshall.
-	 * @return <b>false</b> if any marshall error occurs, else <b>true</b>
-	 * @throws OpenXML4JException
-	 *             Throws only if any other exceptions are thrown by inner
-	 *             methods.
-	 */
-	public boolean marshall(PackagePart part, OutputStream out)
-			throws OpenXML4JException;
+    /**
+     * Save the content of the package in the stream
+     *
+     * @param part
+     *            Part to marshall.
+     * @param out
+     *            The output stream into which the part will be marshall.
+     * @return <b>false</b> if any marshall error occurs, else <b>true</b>
+     * @throws OpenXML4JException
+     *             Throws only if any other exceptions are thrown by inner
+     *             methods.
+     */
+    public boolean marshall(PackagePart part, OutputStream out)
+            throws OpenXML4JException;
 }

Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/PartUnmarshaller.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/PartUnmarshaller.java?rev=1890119&r1=1890118&r2=1890119&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/PartUnmarshaller.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/PartUnmarshaller.java Sat May 22 20:22:16 2021
@@ -32,14 +32,14 @@ import org.apache.poi.openxml4j.opc.inte
  */
 public interface PartUnmarshaller {
 
-	/**
-	 * Save the content of the package in the stream
-	 *
-	 * @param in The input stream from which the part will be read.
-	 * @return The part freshly read from the input stream.
-	 * @throws InvalidFormatException If the data can not be interpreted correctly
-	 * @throws IOException if reading from the stream fails
-	 */
-	public PackagePart unmarshall(UnmarshallContext context, InputStream in)
-			throws InvalidFormatException, IOException;
+    /**
+     * Save the content of the package in the stream
+     *
+     * @param in The input stream from which the part will be read.
+     * @return The part freshly read from the input stream.
+     * @throws InvalidFormatException If the data can not be interpreted correctly
+     * @throws IOException if reading from the stream fails
+     */
+    public PackagePart unmarshall(UnmarshallContext context, InputStream in)
+            throws InvalidFormatException, IOException;
 }

Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/ZipContentTypeManager.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/ZipContentTypeManager.java?rev=1890119&r1=1890118&r2=1890119&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/ZipContentTypeManager.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/ZipContentTypeManager.java Sat May 22 20:22:16 2021
@@ -39,39 +39,39 @@ import org.w3c.dom.Document;
 public class ZipContentTypeManager extends ContentTypeManager {
     private static final Logger LOG = LogManager.getLogger(ZipContentTypeManager.class);
 
-	/**
-	 * Delegate constructor to the super constructor.
-	 *
-	 * @param in
-	 *            The input stream to parse to fill internal content type
-	 *            collections.
-	 * @throws InvalidFormatException
-	 *             If the content types part content is not valid.
-	 */
-	public ZipContentTypeManager(InputStream in, OPCPackage pkg)
-			throws InvalidFormatException {
-		super(in, pkg);
-	}
+    /**
+     * Delegate constructor to the super constructor.
+     *
+     * @param in
+     *            The input stream to parse to fill internal content type
+     *            collections.
+     * @throws InvalidFormatException
+     *             If the content types part content is not valid.
+     */
+    public ZipContentTypeManager(InputStream in, OPCPackage pkg)
+            throws InvalidFormatException {
+        super(in, pkg);
+    }
 
-	@SuppressWarnings("resource")
+    @SuppressWarnings("resource")
     @Override
-	public boolean saveImpl(Document content, OutputStream out) {
-		final ZipArchiveOutputStream zos = (out instanceof ZipArchiveOutputStream)
-				? (ZipArchiveOutputStream) out : new ZipArchiveOutputStream(out);
+    public boolean saveImpl(Document content, OutputStream out) {
+        final ZipArchiveOutputStream zos = (out instanceof ZipArchiveOutputStream)
+                ? (ZipArchiveOutputStream) out : new ZipArchiveOutputStream(out);
 
-		ZipArchiveEntry partEntry = new ZipArchiveEntry(CONTENT_TYPES_PART_NAME);
-		try {
-			// Referenced in ZIP
-			zos.putArchiveEntry(partEntry);
-			try {
-				// Saving data in the ZIP file
-				return StreamHelper.saveXmlInStream(content, zos);
-			} finally {
-				zos.closeArchiveEntry();
-			}
-		} catch (IOException ioe) {
-			LOG.atError().withThrowable(ioe).log("Cannot write: " + CONTENT_TYPES_PART_NAME + " in Zip !");
-			return false;
-		}
-	}
+        ZipArchiveEntry partEntry = new ZipArchiveEntry(CONTENT_TYPES_PART_NAME);
+        try {
+            // Referenced in ZIP
+            zos.putArchiveEntry(partEntry);
+            try {
+                // Saving data in the ZIP file
+                return StreamHelper.saveXmlInStream(content, zos);
+            } finally {
+                zos.closeArchiveEntry();
+            }
+        } catch (IOException ioe) {
+            LOG.atError().withThrowable(ioe).log("Cannot write: " + CONTENT_TYPES_PART_NAME + " in Zip !");
+            return false;
+        }
+    }
 }

Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/marshallers/DefaultMarshaller.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/marshallers/DefaultMarshaller.java?rev=1890119&r1=1890118&r2=1890119&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/marshallers/DefaultMarshaller.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/marshallers/DefaultMarshaller.java Sat May 22 20:22:16 2021
@@ -31,18 +31,18 @@ import org.apache.poi.openxml4j.opc.inte
  */
 public final class DefaultMarshaller implements PartMarshaller {
 
-	/**
-	 * Save the given part in the output stream by using the save() method of the part.
-	 *
-	 * @param part The {@link PackagePart} to store.
-	 * @param out Output stream to save this part.
-	 * @return true if the content has been successfully stored, false otherwise.
-	 *         More information about errors may be logged via Log4j 2.
-	 * @throws OpenXML4JException
-	 *             If any error occur.
-	 */
-	public boolean marshall(PackagePart part, OutputStream out)
-			throws OpenXML4JException {
-		return part.save(out);
-	}
+    /**
+     * Save the given part in the output stream by using the save() method of the part.
+     *
+     * @param part The {@link PackagePart} to store.
+     * @param out Output stream to save this part.
+     * @return true if the content has been successfully stored, false otherwise.
+     *         More information about errors may be logged via Log4j 2.
+     * @throws OpenXML4JException
+     *             If any error occur.
+     */
+    public boolean marshall(PackagePart part, OutputStream out)
+            throws OpenXML4JException {
+        return part.save(out);
+    }
 }

Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/marshallers/ZipPackagePropertiesMarshaller.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/marshallers/ZipPackagePropertiesMarshaller.java?rev=1890119&r1=1890118&r2=1890119&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/marshallers/ZipPackagePropertiesMarshaller.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/marshallers/ZipPackagePropertiesMarshaller.java Sat May 22 20:22:16 2021
@@ -32,30 +32,30 @@ import org.apache.poi.openxml4j.opc.inte
  */
 public final class ZipPackagePropertiesMarshaller extends PackagePropertiesMarshaller {
 
-	@Override
-	public boolean marshall(PackagePart part, OutputStream out)
-			throws OpenXML4JException {
-		if (!(out instanceof ZipArchiveOutputStream)) {
-			throw new IllegalArgumentException("ZipOutputStream expected!");
-		}
-		ZipArchiveOutputStream zos = (ZipArchiveOutputStream) out;
+    @Override
+    public boolean marshall(PackagePart part, OutputStream out)
+            throws OpenXML4JException {
+        if (!(out instanceof ZipArchiveOutputStream)) {
+            throw new IllegalArgumentException("ZipOutputStream expected!");
+        }
+        ZipArchiveOutputStream zos = (ZipArchiveOutputStream) out;
 
-		// Saving the part in the zip file
-		ZipArchiveEntry ctEntry = new ZipArchiveEntry(ZipHelper
-				.getZipItemNameFromOPCName(part.getPartName().getURI()
-						.toString()));
-		try {
-			// Save in ZIP
-			zos.putArchiveEntry(ctEntry); // Add entry in ZIP
-			try {
-				super.marshall(part, out); // Marshall the properties inside a XML
-				// Document
-				return StreamHelper.saveXmlInStream(xmlDoc, out);
-			} finally {
-				zos.closeArchiveEntry();
-			}
-		} catch (IOException e) {
-			throw new OpenXML4JException(e.getLocalizedMessage(), e);
-		}
-	}
+        // Saving the part in the zip file
+        ZipArchiveEntry ctEntry = new ZipArchiveEntry(ZipHelper
+                .getZipItemNameFromOPCName(part.getPartName().getURI()
+                        .toString()));
+        try {
+            // Save in ZIP
+            zos.putArchiveEntry(ctEntry); // Add entry in ZIP
+            try {
+                super.marshall(part, out); // Marshall the properties inside a XML
+                // Document
+                return StreamHelper.saveXmlInStream(xmlDoc, out);
+            } finally {
+                zos.closeArchiveEntry();
+            }
+        } catch (IOException e) {
+            throw new OpenXML4JException(e.getLocalizedMessage(), e);
+        }
+    }
 }

Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/marshallers/ZipPartMarshaller.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/marshallers/ZipPartMarshaller.java?rev=1890119&r1=1890118&r2=1890119&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/marshallers/ZipPartMarshaller.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/marshallers/ZipPartMarshaller.java Sat May 22 20:22:16 2021
@@ -47,146 +47,146 @@ import org.w3c.dom.Element;
  * Zip part marshaller. This marshaller is use to save any part in a zip stream.
  */
 public final class ZipPartMarshaller implements PartMarshaller {
-	private static final Logger LOG = LogManager.getLogger(ZipPartMarshaller.class);
+    private static final Logger LOG = LogManager.getLogger(ZipPartMarshaller.class);
 
-	/**
-	 * Save the specified part to the given stream.
-	 *
-	 * @param part The {@link PackagePart} to save
-	 * @param os The stream to write the data to
-	 * @return true if saving was successful or there was nothing to save,
-	 * 		false if an error occurred.
-	 * 		In case of errors, logging via Log4j 2 is used to provide more information.
-	 * @throws OpenXML4JException
-	 *      Throws if the stream cannot be written to or an internal exception is thrown.
-	 */
-	@Override
-	public boolean marshall(PackagePart part, OutputStream os)
-			throws OpenXML4JException {
-		if (!(os instanceof ZipArchiveOutputStream)) {
-			LOG.atError().log("Unexpected class {}", os.getClass().getName());
-			throw new OpenXML4JException("ZipOutputStream expected !");
-			// Normally should happen only in development phase, so just throw
-			// exception
-		}
-
-		// check if there is anything to save for some parts. We don't do this for all parts as some code
-		// might depend on empty parts being saved, e.g. some unit tests verify this currently.
-		if(part.getSize() == 0 && part.getPartName().getName().equals(XSSFRelation.SHARED_STRINGS.getDefaultFileName())) {
-		    return true;
-		}
-
-		ZipArchiveOutputStream zos = (ZipArchiveOutputStream) os;
-		ZipArchiveEntry partEntry = new ZipArchiveEntry(ZipHelper
-				.getZipItemNameFromOPCName(part.getPartName().getURI()
-						.getPath()));
-		try {
-			// Create next zip entry
-			zos.putArchiveEntry(partEntry);
-
-			// Saving data in the ZIP file
-			try (final InputStream ins = part.getInputStream()) {
-				IOUtils.copy(ins, zos);
-			} finally {
-				zos.closeArchiveEntry();
-			}
-		} catch (IOException ioe) {
-			LOG.atError().withThrowable(ioe).log("Cannot write: {}: in ZIP", part.getPartName());
-			return false;
-		}
-
-		// Saving relationship part
-		if (part.hasRelationships()) {
-			PackagePartName relationshipPartName = PackagingURIHelper
-					.getRelationshipPartName(part.getPartName());
-
-			marshallRelationshipPart(part.getRelationships(),
-					relationshipPartName, zos);
-		}
-
-		return true;
-	}
-
-	/**
-	 * Save relationships into the part.
-	 *
-	 * @param rels
-	 *            The relationships collection to marshall.
-	 * @param relPartName
-	 *            Part name of the relationship part to marshall.
-	 * @param zos
-	 *            Zip output stream in which to save the XML content of the
-	 *            relationships serialization.
-	 * @return true if saving was successful,
-	 * 		false if an error occurred.
-	 * 		In case of errors, logging via Log4j 2 is used to provide more information.
-	 */
-	public static boolean marshallRelationshipPart(
-			PackageRelationshipCollection rels, PackagePartName relPartName,
-			ZipArchiveOutputStream zos) {
-		// Building xml
-		Document xmlOutDoc = DocumentHelper.createDocument();
-		// make something like <Relationships
-		// xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
-		Element root = xmlOutDoc.createElementNS(PackageNamespaces.RELATIONSHIPS, PackageRelationship.RELATIONSHIPS_TAG_NAME);
+    /**
+     * Save the specified part to the given stream.
+     *
+     * @param part The {@link PackagePart} to save
+     * @param os The stream to write the data to
+     * @return true if saving was successful or there was nothing to save,
+     *      false if an error occurred.
+     *      In case of errors, logging via Log4j 2 is used to provide more information.
+     * @throws OpenXML4JException
+     *      Throws if the stream cannot be written to or an internal exception is thrown.
+     */
+    @Override
+    public boolean marshall(PackagePart part, OutputStream os)
+            throws OpenXML4JException {
+        if (!(os instanceof ZipArchiveOutputStream)) {
+            LOG.atError().log("Unexpected class {}", os.getClass().getName());
+            throw new OpenXML4JException("ZipOutputStream expected !");
+            // Normally should happen only in development phase, so just throw
+            // exception
+        }
+
+        // check if there is anything to save for some parts. We don't do this for all parts as some code
+        // might depend on empty parts being saved, e.g. some unit tests verify this currently.
+        if(part.getSize() == 0 && part.getPartName().getName().equals(XSSFRelation.SHARED_STRINGS.getDefaultFileName())) {
+            return true;
+        }
+
+        ZipArchiveOutputStream zos = (ZipArchiveOutputStream) os;
+        ZipArchiveEntry partEntry = new ZipArchiveEntry(ZipHelper
+                .getZipItemNameFromOPCName(part.getPartName().getURI()
+                        .getPath()));
+        try {
+            // Create next zip entry
+            zos.putArchiveEntry(partEntry);
+
+            // Saving data in the ZIP file
+            try (final InputStream ins = part.getInputStream()) {
+                IOUtils.copy(ins, zos);
+            } finally {
+                zos.closeArchiveEntry();
+            }
+        } catch (IOException ioe) {
+            LOG.atError().withThrowable(ioe).log("Cannot write: {}: in ZIP", part.getPartName());
+            return false;
+        }
+
+        // Saving relationship part
+        if (part.hasRelationships()) {
+            PackagePartName relationshipPartName = PackagingURIHelper
+                    .getRelationshipPartName(part.getPartName());
+
+            marshallRelationshipPart(part.getRelationships(),
+                    relationshipPartName, zos);
+        }
+
+        return true;
+    }
+
+    /**
+     * Save relationships into the part.
+     *
+     * @param rels
+     *            The relationships collection to marshall.
+     * @param relPartName
+     *            Part name of the relationship part to marshall.
+     * @param zos
+     *            Zip output stream in which to save the XML content of the
+     *            relationships serialization.
+     * @return true if saving was successful,
+     *      false if an error occurred.
+     *      In case of errors, logging via Log4j 2 is used to provide more information.
+     */
+    public static boolean marshallRelationshipPart(
+            PackageRelationshipCollection rels, PackagePartName relPartName,
+            ZipArchiveOutputStream zos) {
+        // Building xml
+        Document xmlOutDoc = DocumentHelper.createDocument();
+        // make something like <Relationships
+        // xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
+        Element root = xmlOutDoc.createElementNS(PackageNamespaces.RELATIONSHIPS, PackageRelationship.RELATIONSHIPS_TAG_NAME);
         xmlOutDoc.appendChild(root);
 
-		// <Relationship
-		// TargetMode="External"
-		// Id="rIdx"
-		// Target="http://www.custom.com/images/pic1.jpg"
-		// Type="http://www.custom.com/external-resource"/>
+        // <Relationship
+        // TargetMode="External"
+        // Id="rIdx"
+        // Target="http://www.custom.com/images/pic1.jpg"
+        // Type="http://www.custom.com/external-resource"/>
 
-		URI sourcePartURI = PackagingURIHelper
-				.getSourcePartUriFromRelationshipPartUri(relPartName.getURI());
+        URI sourcePartURI = PackagingURIHelper
+                .getSourcePartUriFromRelationshipPartUri(relPartName.getURI());
 
-		for (PackageRelationship rel : rels) {
-			// the relationship element
+        for (PackageRelationship rel : rels) {
+            // the relationship element
             Element relElem = xmlOutDoc.createElementNS(PackageNamespaces.RELATIONSHIPS, PackageRelationship.RELATIONSHIP_TAG_NAME);
             root.appendChild(relElem);
 
-			// the relationship ID
-			relElem.setAttribute(PackageRelationship.ID_ATTRIBUTE_NAME, rel.getId());
+            // the relationship ID
+            relElem.setAttribute(PackageRelationship.ID_ATTRIBUTE_NAME, rel.getId());
 
-			// the relationship Type
-			relElem.setAttribute(PackageRelationship.TYPE_ATTRIBUTE_NAME, rel.getRelationshipType());
+            // the relationship Type
+            relElem.setAttribute(PackageRelationship.TYPE_ATTRIBUTE_NAME, rel.getRelationshipType());
 
-			// the relationship Target
-			String targetValue;
-			URI uri = rel.getTargetURI();
-			if (rel.getTargetMode() == TargetMode.EXTERNAL) {
-				// Save the target as-is - we don't need to validate it,
-				//  alter it etc
-				targetValue = uri.toString();
-
-				// add TargetMode attribute (as it is external link external)
-				relElem.setAttribute(PackageRelationship.TARGET_MODE_ATTRIBUTE_NAME, "External");
-			} else {
+            // the relationship Target
+            String targetValue;
+            URI uri = rel.getTargetURI();
+            if (rel.getTargetMode() == TargetMode.EXTERNAL) {
+                // Save the target as-is - we don't need to validate it,
+                //  alter it etc
+                targetValue = uri.toString();
+
+                // add TargetMode attribute (as it is external link external)
+                relElem.setAttribute(PackageRelationship.TARGET_MODE_ATTRIBUTE_NAME, "External");
+            } else {
                 URI targetURI = rel.getTargetURI();
                 targetValue = PackagingURIHelper.relativizeURI(
-						sourcePartURI, targetURI, true).toString();
-			}
-			relElem.setAttribute(PackageRelationship.TARGET_ATTRIBUTE_NAME, targetValue);
-		}
-
-		xmlOutDoc.normalize();
-
-		// String schemaFilename = Configuration.getPathForXmlSchema()+
-		// File.separator + "opc-relationships.xsd";
-
-		// Save part in zip
-		ZipArchiveEntry ctEntry = new ZipArchiveEntry(ZipHelper.getZipURIFromOPCName(
-				relPartName.getURI().toASCIIString()).getPath());
-		try {
-			zos.putArchiveEntry(ctEntry);
-			try {
-				return StreamHelper.saveXmlInStream(xmlOutDoc, zos);
-			} finally {
-				zos.closeArchiveEntry();
-			}
-		} catch (IOException e) {
-			LOG.atError().withThrowable(e).log("Cannot create zip entry {}", relPartName);
-			return false;
-		}
-	}
+                        sourcePartURI, targetURI, true).toString();
+            }
+            relElem.setAttribute(PackageRelationship.TARGET_ATTRIBUTE_NAME, targetValue);
+        }
+
+        xmlOutDoc.normalize();
+
+        // String schemaFilename = Configuration.getPathForXmlSchema()+
+        // File.separator + "opc-relationships.xsd";
+
+        // Save part in zip
+        ZipArchiveEntry ctEntry = new ZipArchiveEntry(ZipHelper.getZipURIFromOPCName(
+                relPartName.getURI().toASCIIString()).getPath());
+        try {
+            zos.putArchiveEntry(ctEntry);
+            try {
+                return StreamHelper.saveXmlInStream(xmlOutDoc, zos);
+            } finally {
+                zos.closeArchiveEntry();
+            }
+        } catch (IOException e) {
+            LOG.atError().withThrowable(e).log("Cannot create zip entry {}", relPartName);
+            return false;
+        }
+    }
 }

Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/unmarshallers/PackagePropertiesUnmarshaller.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/unmarshallers/PackagePropertiesUnmarshaller.java?rev=1890119&r1=1890118&r2=1890119&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/unmarshallers/PackagePropertiesUnmarshaller.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/unmarshallers/PackagePropertiesUnmarshaller.java Sat May 22 20:22:16 2021
@@ -44,97 +44,97 @@ import org.xml.sax.SAXException;
  */
 public final class PackagePropertiesUnmarshaller implements PartUnmarshaller {
 
-	protected static final String KEYWORD_CATEGORY = "category";
+    protected static final String KEYWORD_CATEGORY = "category";
 
-	protected static final String KEYWORD_CONTENT_STATUS = "contentStatus";
+    protected static final String KEYWORD_CONTENT_STATUS = "contentStatus";
 
-	protected static final String KEYWORD_CONTENT_TYPE = "contentType";
+    protected static final String KEYWORD_CONTENT_TYPE = "contentType";
 
-	protected static final String KEYWORD_CREATED = "created";
+    protected static final String KEYWORD_CREATED = "created";
 
-	protected static final String KEYWORD_CREATOR = "creator";
+    protected static final String KEYWORD_CREATOR = "creator";
 
-	protected static final String KEYWORD_DESCRIPTION = "description";
+    protected static final String KEYWORD_DESCRIPTION = "description";
 
-	protected static final String KEYWORD_IDENTIFIER = "identifier";
+    protected static final String KEYWORD_IDENTIFIER = "identifier";
 
-	protected static final String KEYWORD_KEYWORDS = "keywords";
+    protected static final String KEYWORD_KEYWORDS = "keywords";
 
-	protected static final String KEYWORD_LANGUAGE = "language";
+    protected static final String KEYWORD_LANGUAGE = "language";
 
-	protected static final String KEYWORD_LAST_MODIFIED_BY = "lastModifiedBy";
+    protected static final String KEYWORD_LAST_MODIFIED_BY = "lastModifiedBy";
 
-	protected static final String KEYWORD_LAST_PRINTED = "lastPrinted";
+    protected static final String KEYWORD_LAST_PRINTED = "lastPrinted";
 
-	protected static final String KEYWORD_MODIFIED = "modified";
+    protected static final String KEYWORD_MODIFIED = "modified";
 
-	protected static final String KEYWORD_REVISION = "revision";
+    protected static final String KEYWORD_REVISION = "revision";
 
-	protected static final String KEYWORD_SUBJECT = "subject";
+    protected static final String KEYWORD_SUBJECT = "subject";
 
-	protected static final String KEYWORD_TITLE = "title";
+    protected static final String KEYWORD_TITLE = "title";
 
-	protected static final String KEYWORD_VERSION = "version";
+    protected static final String KEYWORD_VERSION = "version";
 
-	// TODO Load element with XMLBeans or dynamic table
-	// TODO Check every element/namespace for compliance
-	public PackagePart unmarshall(UnmarshallContext context, InputStream in)
-			throws InvalidFormatException, IOException {
-		PackagePropertiesPart coreProps = new PackagePropertiesPart(context
-				.getPackage(), context.getPartName());
+    // TODO Load element with XMLBeans or dynamic table
+    // TODO Check every element/namespace for compliance
+    public PackagePart unmarshall(UnmarshallContext context, InputStream in)
+            throws InvalidFormatException, IOException {
+        PackagePropertiesPart coreProps = new PackagePropertiesPart(context
+                .getPackage(), context.getPartName());
 
-		// If the input stream is null then we try to get it from the
-		// package.
-		if (in == null) {
-			if (context.getZipEntry() != null) {
-				in = ((ZipPackage) context.getPackage()).getZipArchive()
-						.getInputStream(context.getZipEntry());
-			} else if (context.getPackage() != null) {
-				// Try to retrieve the part inputstream from the URI
-				ZipArchiveEntry zipEntry = ZipHelper
-						.getCorePropertiesZipEntry((ZipPackage) context
-								.getPackage());
-				in = ((ZipPackage) context.getPackage()).getZipArchive()
-						.getInputStream(zipEntry);
-			} else
-				throw new IOException(
-						"Error while trying to get the part input stream.");
-		}
+        // If the input stream is null then we try to get it from the
+        // package.
+        if (in == null) {
+            if (context.getZipEntry() != null) {
+                in = ((ZipPackage) context.getPackage()).getZipArchive()
+                        .getInputStream(context.getZipEntry());
+            } else if (context.getPackage() != null) {
+                // Try to retrieve the part inputstream from the URI
+                ZipArchiveEntry zipEntry = ZipHelper
+                        .getCorePropertiesZipEntry((ZipPackage) context
+                                .getPackage());
+                in = ((ZipPackage) context.getPackage()).getZipArchive()
+                        .getInputStream(zipEntry);
+            } else
+                throw new IOException(
+                        "Error while trying to get the part input stream.");
+        }
 
-		Document xmlDoc;
-		try {
-			xmlDoc = DocumentHelper.readDocument(in);
+        Document xmlDoc;
+        try {
+            xmlDoc = DocumentHelper.readDocument(in);
 
-			/* Check OPC compliance */
+            /* Check OPC compliance */
 
-			// Rule M4.2, M4.3, M4.4 and M4.5/
-			checkElementForOPCCompliance(xmlDoc.getDocumentElement());
+            // Rule M4.2, M4.3, M4.4 and M4.5/
+            checkElementForOPCCompliance(xmlDoc.getDocumentElement());
 
-			/* End OPC compliance */
+            /* End OPC compliance */
 
         } catch (SAXException e) {
             throw new IOException(e.getMessage());
         }
 
         coreProps.setCategoryProperty(loadCategory(xmlDoc));
-		coreProps.setContentStatusProperty(loadContentStatus(xmlDoc));
-		coreProps.setContentTypeProperty(loadContentType(xmlDoc));
-		coreProps.setCreatedProperty(loadCreated(xmlDoc));
-		coreProps.setCreatorProperty(loadCreator(xmlDoc));
-		coreProps.setDescriptionProperty(loadDescription(xmlDoc));
-		coreProps.setIdentifierProperty(loadIdentifier(xmlDoc));
-		coreProps.setKeywordsProperty(loadKeywords(xmlDoc));
-		coreProps.setLanguageProperty(loadLanguage(xmlDoc));
-		coreProps.setLastModifiedByProperty(loadLastModifiedBy(xmlDoc));
-		coreProps.setLastPrintedProperty(loadLastPrinted(xmlDoc));
-		coreProps.setModifiedProperty(loadModified(xmlDoc));
-		coreProps.setRevisionProperty(loadRevision(xmlDoc));
-		coreProps.setSubjectProperty(loadSubject(xmlDoc));
-		coreProps.setTitleProperty(loadTitle(xmlDoc));
-		coreProps.setVersionProperty(loadVersion(xmlDoc));
+        coreProps.setContentStatusProperty(loadContentStatus(xmlDoc));
+        coreProps.setContentTypeProperty(loadContentType(xmlDoc));
+        coreProps.setCreatedProperty(loadCreated(xmlDoc));
+        coreProps.setCreatorProperty(loadCreator(xmlDoc));
+        coreProps.setDescriptionProperty(loadDescription(xmlDoc));
+        coreProps.setIdentifierProperty(loadIdentifier(xmlDoc));
+        coreProps.setKeywordsProperty(loadKeywords(xmlDoc));
+        coreProps.setLanguageProperty(loadLanguage(xmlDoc));
+        coreProps.setLastModifiedByProperty(loadLastModifiedBy(xmlDoc));
+        coreProps.setLastPrintedProperty(loadLastPrinted(xmlDoc));
+        coreProps.setModifiedProperty(loadModified(xmlDoc));
+        coreProps.setRevisionProperty(loadRevision(xmlDoc));
+        coreProps.setSubjectProperty(loadSubject(xmlDoc));
+        coreProps.setTitleProperty(loadTitle(xmlDoc));
+        coreProps.setVersionProperty(loadVersion(xmlDoc));
 
-		return coreProps;
-	}
+        return coreProps;
+    }
 
     private String readElement(Document xmlDoc, String localName, String namespaceURI) {
         Element el = (Element)xmlDoc.getDocumentElement().getElementsByTagNameNS(namespaceURI, localName).item(0);
@@ -144,97 +144,97 @@ public final class PackagePropertiesUnma
         return el.getTextContent();
     }
 
-	private String loadCategory(Document xmlDoc) {
+    private String loadCategory(Document xmlDoc) {
         return readElement(xmlDoc, KEYWORD_CATEGORY, PackageNamespaces.CORE_PROPERTIES);
-	}
+    }
 
     private String loadContentStatus(Document xmlDoc) {
         return readElement(xmlDoc, KEYWORD_CONTENT_STATUS, PackageNamespaces.CORE_PROPERTIES);
-	}
+    }
 
-	private String loadContentType(Document xmlDoc) {
+    private String loadContentType(Document xmlDoc) {
         return readElement(xmlDoc, KEYWORD_CONTENT_TYPE, PackageNamespaces.CORE_PROPERTIES);
-	}
+    }
 
-	private String loadCreated(Document xmlDoc) {
+    private String loadCreated(Document xmlDoc) {
         return readElement(xmlDoc, KEYWORD_CREATED, PackageProperties.NAMESPACE_DCTERMS);
-	}
+    }
 
-	private String loadCreator(Document xmlDoc) {
+    private String loadCreator(Document xmlDoc) {
         return readElement(xmlDoc, KEYWORD_CREATOR, PackageProperties.NAMESPACE_DC);
-	}
+    }
 
-	private String loadDescription(Document xmlDoc) {
+    private String loadDescription(Document xmlDoc) {
         return readElement(xmlDoc, KEYWORD_DESCRIPTION, PackageProperties.NAMESPACE_DC);
-	}
+    }
 
-	private String loadIdentifier(Document xmlDoc) {
+    private String loadIdentifier(Document xmlDoc) {
         return readElement(xmlDoc, KEYWORD_IDENTIFIER, PackageProperties.NAMESPACE_DC);
-	}
+    }
 
-	private String loadKeywords(Document xmlDoc) {
+    private String loadKeywords(Document xmlDoc) {
         return readElement(xmlDoc, KEYWORD_KEYWORDS, PackageNamespaces.CORE_PROPERTIES);
-	}
+    }
 
-	private String loadLanguage(Document xmlDoc) {
+    private String loadLanguage(Document xmlDoc) {
         return readElement(xmlDoc, KEYWORD_LANGUAGE, PackageProperties.NAMESPACE_DC);
-	}
+    }
 
-	private String loadLastModifiedBy(Document xmlDoc) {
+    private String loadLastModifiedBy(Document xmlDoc) {
         return readElement(xmlDoc, KEYWORD_LAST_MODIFIED_BY, PackageNamespaces.CORE_PROPERTIES);
-	}
+    }
 
-	private String loadLastPrinted(Document xmlDoc) {
+    private String loadLastPrinted(Document xmlDoc) {
         return readElement(xmlDoc, KEYWORD_LAST_PRINTED, PackageNamespaces.CORE_PROPERTIES);
-	}
+    }
 
-	private String loadModified(Document xmlDoc) {
+    private String loadModified(Document xmlDoc) {
         return readElement(xmlDoc, KEYWORD_MODIFIED, PackageProperties.NAMESPACE_DCTERMS);
-	}
+    }
 
-	private String loadRevision(Document xmlDoc) {
+    private String loadRevision(Document xmlDoc) {
         return readElement(xmlDoc, KEYWORD_REVISION, PackageNamespaces.CORE_PROPERTIES);
-	}
+    }
 
-	private String loadSubject(Document xmlDoc) {
+    private String loadSubject(Document xmlDoc) {
         return readElement(xmlDoc, KEYWORD_SUBJECT, PackageProperties.NAMESPACE_DC);
-	}
+    }
 
-	private String loadTitle(Document xmlDoc) {
+    private String loadTitle(Document xmlDoc) {
         return readElement(xmlDoc, KEYWORD_TITLE, PackageProperties.NAMESPACE_DC);
-	}
+    }
 
-	private String loadVersion(Document xmlDoc) {
+    private String loadVersion(Document xmlDoc) {
         return readElement(xmlDoc, KEYWORD_VERSION, PackageNamespaces.CORE_PROPERTIES);
-	}
+    }
 
-	/* OPC Compliance methods */
+    /* OPC Compliance methods */
 
-	/**
-	 * Check the element for the following OPC compliance rules:
-	 * <p>
-	 * Rule M4.2: A format consumer shall consider the use of the Markup
-	 * Compatibility namespace to be an error.
-	 * <p>
-	 * Rule M4.3: Producers shall not create a document element that contains
-	 * refinements to the Dublin Core elements, except for the two specified in
-	 * the schema: &lt;dcterms:created&gt; and &lt;dcterms:modified&gt; Consumers shall
-	 * consider a document element that violates this constraint to be an error.
-	 * <p>
-	 * Rule M4.4: Producers shall not create a document element that contains
-	 * the xml:lang attribute. Consumers shall consider a document element that
-	 * violates this constraint to be an error.
-	 * <p>
-	 * Rule M4.5: Producers shall not create a document element that contains
-	 * the xsi:type attribute, except for a &lt;dcterms:created&gt; or
-	 * &lt;dcterms:modified&gt; element where the xsi:type attribute shall be present
-	 * and shall hold the value dcterms:W3CDTF, where dcterms is the namespace
-	 * prefix of the Dublin Core namespace. Consumers shall consider a document
-	 * element that violates this constraint to be an error.
-	 */
-	public void checkElementForOPCCompliance(Element el)
-			throws InvalidFormatException {
-		// Check the current element
+    /**
+     * Check the element for the following OPC compliance rules:
+     * <p>
+     * Rule M4.2: A format consumer shall consider the use of the Markup
+     * Compatibility namespace to be an error.
+     * <p>
+     * Rule M4.3: Producers shall not create a document element that contains
+     * refinements to the Dublin Core elements, except for the two specified in
+     * the schema: &lt;dcterms:created&gt; and &lt;dcterms:modified&gt; Consumers shall
+     * consider a document element that violates this constraint to be an error.
+     * <p>
+     * Rule M4.4: Producers shall not create a document element that contains
+     * the xml:lang attribute. Consumers shall consider a document element that
+     * violates this constraint to be an error.
+     * <p>
+     * Rule M4.5: Producers shall not create a document element that contains
+     * the xsi:type attribute, except for a &lt;dcterms:created&gt; or
+     * &lt;dcterms:modified&gt; element where the xsi:type attribute shall be present
+     * and shall hold the value dcterms:W3CDTF, where dcterms is the namespace
+     * prefix of the Dublin Core namespace. Consumers shall consider a document
+     * element that violates this constraint to be an error.
+     */
+    public void checkElementForOPCCompliance(Element el)
+            throws InvalidFormatException {
+        // Check the current element
         NamedNodeMap namedNodeMap = el.getAttributes();
         int namedNodeCount = namedNodeMap.getLength();
         for (int i = 0; i < namedNodeCount; i++) {
@@ -249,42 +249,42 @@ public final class PackagePropertiesUnma
             }
         }
 
-		// Rule M4.3
+        // Rule M4.3
         String elName = el.getLocalName();
         if (el.getNamespaceURI().equals(PackageProperties.NAMESPACE_DCTERMS))
             if (!(elName.equals(KEYWORD_CREATED) || elName.equals(KEYWORD_MODIFIED)))
                 throw new InvalidFormatException(
                         "OPC Compliance error [M4.3]: Producers shall not create a document element that contains refinements to the Dublin Core elements, except for the two specified in the schema: <dcterms:created> and <dcterms:modified> Consumers shall consider a document element that violates this constraint to be an error.");
 
-		// Rule M4.4
-		if (el.getAttributeNodeNS(XMLConstants.XML_NS_URI, "lang") != null)
-			throw new InvalidFormatException(
-					"OPC Compliance error [M4.4]: Producers shall not create a document element that contains the xml:lang attribute. Consumers shall consider a document element that violates this constraint to be an error.");
-
-		// Rule M4.5
-		if (el.getNamespaceURI().equals(PackageProperties.NAMESPACE_DCTERMS)) {
-			// DCTerms namespace only use with 'created' and 'modified' elements
-			if (!(elName.equals(KEYWORD_CREATED) || elName.equals(KEYWORD_MODIFIED)))
-				throw new InvalidFormatException("Namespace error : " + elName
-						+ " shouldn't have the following naemspace -> "
-						+ PackageProperties.NAMESPACE_DCTERMS);
-
-			// Check for the 'xsi:type' attribute
-			Attr typeAtt = el.getAttributeNodeNS(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "type");
-			if (typeAtt == null)
-				throw new InvalidFormatException("The element '" + elName
-						+ "' must have the 'xsi:type' attribute present !");
-
-			// Check for the attribute value => 'dcterms:W3CDTF'
-			if (!typeAtt.getValue().equals(el.getPrefix() + ":W3CDTF"))
-				throw new InvalidFormatException("The element '" + elName
-						+ "' must have the 'xsi:type' attribute with the value '" + el.getPrefix() + ":W3CDTF', but had '" + typeAtt.getValue() + "' !");
-		}
+        // Rule M4.4
+        if (el.getAttributeNodeNS(XMLConstants.XML_NS_URI, "lang") != null)
+            throw new InvalidFormatException(
+                    "OPC Compliance error [M4.4]: Producers shall not create a document element that contains the xml:lang attribute. Consumers shall consider a document element that violates this constraint to be an error.");
+
+        // Rule M4.5
+        if (el.getNamespaceURI().equals(PackageProperties.NAMESPACE_DCTERMS)) {
+            // DCTerms namespace only use with 'created' and 'modified' elements
+            if (!(elName.equals(KEYWORD_CREATED) || elName.equals(KEYWORD_MODIFIED)))
+                throw new InvalidFormatException("Namespace error : " + elName
+                        + " shouldn't have the following naemspace -> "
+                        + PackageProperties.NAMESPACE_DCTERMS);
+
+            // Check for the 'xsi:type' attribute
+            Attr typeAtt = el.getAttributeNodeNS(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "type");
+            if (typeAtt == null)
+                throw new InvalidFormatException("The element '" + elName
+                        + "' must have the 'xsi:type' attribute present !");
+
+            // Check for the attribute value => 'dcterms:W3CDTF'
+            if (!typeAtt.getValue().equals(el.getPrefix() + ":W3CDTF"))
+                throw new InvalidFormatException("The element '" + elName
+                        + "' must have the 'xsi:type' attribute with the value '" + el.getPrefix() + ":W3CDTF', but had '" + typeAtt.getValue() + "' !");
+        }
 
-		// Check its children
+        // Check its children
         NodeList childElements = el.getElementsByTagName("*");
         int childElementCount = childElements.getLength();
         for (int i = 0; i < childElementCount; i++)
             checkElementForOPCCompliance((Element)childElements.item(i));
-	}
+    }
 }

Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/unmarshallers/UnmarshallContext.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/unmarshallers/UnmarshallContext.java?rev=1890119&r1=1890118&r2=1890119&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/unmarshallers/UnmarshallContext.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/unmarshallers/UnmarshallContext.java Sat May 22 20:22:16 2021
@@ -28,67 +28,67 @@ import org.apache.poi.openxml4j.opc.Pack
  */
 public final class UnmarshallContext {
 
-	private OPCPackage _package;
+    private OPCPackage _package;
 
-	private PackagePartName partName;
+    private PackagePartName partName;
 
-	private ZipArchiveEntry zipEntry;
+    private ZipArchiveEntry zipEntry;
 
-	/**
-	 * Constructor.
-	 *
-	 * @param targetPackage
-	 *            Container.
-	 * @param partName
-	 *            Name of the part to unmarshall.
-	 */
-	public UnmarshallContext(OPCPackage targetPackage, PackagePartName partName) {
-		this._package = targetPackage;
-		this.partName = partName;
-	}
-
-	/**
-	 * @return the container
-	 */
-	OPCPackage getPackage() {
-		return _package;
-	}
-
-	/**
-	 * @param container
-	 *            the container to set
-	 */
-	public void setPackage(OPCPackage container) {
-		this._package = container;
-	}
-
-	/**
-	 * @return the partName
-	 */
-	PackagePartName getPartName() {
-		return partName;
-	}
-
-	/**
-	 * @param partName
-	 *            the partName to set
-	 */
-	public void setPartName(PackagePartName partName) {
-		this.partName = partName;
-	}
-
-	/**
-	 * @return the zipEntry
-	 */
-	ZipArchiveEntry getZipEntry() {
-		return zipEntry;
-	}
-
-	/**
-	 * @param zipEntry
-	 *            the zipEntry to set
-	 */
-	public void setZipEntry(ZipArchiveEntry zipEntry) {
-		this.zipEntry = zipEntry;
-	}
+    /**
+     * Constructor.
+     *
+     * @param targetPackage
+     *            Container.
+     * @param partName
+     *            Name of the part to unmarshall.
+     */
+    public UnmarshallContext(OPCPackage targetPackage, PackagePartName partName) {
+        this._package = targetPackage;
+        this.partName = partName;
+    }
+
+    /**
+     * @return the container
+     */
+    OPCPackage getPackage() {
+        return _package;
+    }
+
+    /**
+     * @param container
+     *            the container to set
+     */
+    public void setPackage(OPCPackage container) {
+        this._package = container;
+    }
+
+    /**
+     * @return the partName
+     */
+    PackagePartName getPartName() {
+        return partName;
+    }
+
+    /**
+     * @param partName
+     *            the partName to set
+     */
+    public void setPartName(PackagePartName partName) {
+        this.partName = partName;
+    }
+
+    /**
+     * @return the zipEntry
+     */
+    ZipArchiveEntry getZipEntry() {
+        return zipEntry;
+    }
+
+    /**
+     * @param zipEntry
+     *            the zipEntry to set
+     */
+    public void setZipEntry(ZipArchiveEntry zipEntry) {
+        this.zipEntry = zipEntry;
+    }
 }

Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/util/ZipEntrySource.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/util/ZipEntrySource.java?rev=1890119&r1=1890118&r2=1890119&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/util/ZipEntrySource.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/util/ZipEntrySource.java Sat May 22 20:22:16 2021
@@ -31,35 +31,35 @@ import org.apache.commons.compress.archi
  *  being annoyingly very different.
  */
 public interface ZipEntrySource extends Closeable {
-	/**
-	 * Returns an Enumeration of all the Entries
-	 */
-	Enumeration<? extends ZipArchiveEntry> getEntries();
+    /**
+     * Returns an Enumeration of all the Entries
+     */
+    Enumeration<? extends ZipArchiveEntry> getEntries();
 
-	/**
-	 * Return an entry by its path
-	 * @param path the path in unix-notation
-	 * @return the entry or {@code null} if not found
-	 *
-	 * @since POI 4.0.0
-	 */
-	ZipArchiveEntry getEntry(String path);
+    /**
+     * Return an entry by its path
+     * @param path the path in unix-notation
+     * @return the entry or {@code null} if not found
+     *
+     * @since POI 4.0.0
+     */
+    ZipArchiveEntry getEntry(String path);
 
-	/**
-	 * Returns an InputStream of the decompressed 
-	 *  data that makes up the entry
-	 */
-	InputStream getInputStream(ZipArchiveEntry entry) throws IOException;
-	
-	/**
-	 * Indicates we are done with reading, and 
-	 *  resources may be freed
-	 */
-	@Override
-	void close() throws IOException;
-	
-	/**
-	 * Has close been called already?
-	 */
-	boolean isClosed();
+    /**
+     * Returns an InputStream of the decompressed 
+     *  data that makes up the entry
+     */
+    InputStream getInputStream(ZipArchiveEntry entry) throws IOException;
+    
+    /**
+     * Indicates we are done with reading, and 
+     *  resources may be freed
+     */
+    @Override
+    void close() throws IOException;
+    
+    /**
+     * Has close been called already?
+     */
+    boolean isClosed();
 }

Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/util/ZipInputStreamZipEntrySource.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/util/ZipInputStreamZipEntrySource.java?rev=1890119&r1=1890118&r2=1890119&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/util/ZipInputStreamZipEntrySource.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/openxml4j/util/ZipInputStreamZipEntrySource.java Sat May 22 20:22:16 2021
@@ -34,66 +34,66 @@ import org.apache.commons.compress.archi
  *  done, to free up that memory!
  */
 public class ZipInputStreamZipEntrySource implements ZipEntrySource {
-	private final Map<String, ZipArchiveFakeEntry> zipEntries = new HashMap<>();
+    private final Map<String, ZipArchiveFakeEntry> zipEntries = new HashMap<>();
 
-	private InputStream streamToClose;
+    private InputStream streamToClose;
 
-	/**
-	 * Reads all the entries from the ZipInputStream 
-	 *  into memory, and don't close (since POI 4.0.1) the source stream.
-	 * We'll then eat lots of memory, but be able to
-	 *  work with the entries at-will.
-	 */
-	public ZipInputStreamZipEntrySource(ZipArchiveThresholdInputStream inp) throws IOException {
-		for (;;) {
-			final ZipArchiveEntry zipEntry = inp.getNextEntry();
-			if (zipEntry == null) {
-				break;
-			}
-			zipEntries.put(zipEntry.getName(), new ZipArchiveFakeEntry(zipEntry, inp));
-		}
-
-		streamToClose = inp;
-	}
-
-	@Override
-	public Enumeration<? extends ZipArchiveEntry> getEntries() {
-		return Collections.enumeration(zipEntries.values());
-	}
-
-	@Override
-	public InputStream getInputStream(ZipArchiveEntry zipEntry) {
-	    assert (zipEntry instanceof ZipArchiveFakeEntry);
-		return ((ZipArchiveFakeEntry)zipEntry).getInputStream();
-	}
-
-	@Override
-	public void close() throws IOException {
-		// Free the memory
-		zipEntries.clear();
-
-		streamToClose.close();
-	}
-
-	@Override
-	public boolean isClosed() {
-	    return zipEntries.isEmpty();
-	}
-
-	@Override
-	public ZipArchiveEntry getEntry(final String path) {
-		final String normalizedPath = path.replace('\\', '/');
-		final ZipArchiveEntry ze = zipEntries.get(normalizedPath);
-		if (ze != null) {
-			return ze;
-		}
-
-		for (final Map.Entry<String, ZipArchiveFakeEntry> fze : zipEntries.entrySet()) {
-			if (normalizedPath.equalsIgnoreCase(fze.getKey())) {
-				return fze.getValue();
-			}
-		}
+    /**
+     * Reads all the entries from the ZipInputStream 
+     *  into memory, and don't close (since POI 4.0.1) the source stream.
+     * We'll then eat lots of memory, but be able to
+     *  work with the entries at-will.
+     */
+    public ZipInputStreamZipEntrySource(ZipArchiveThresholdInputStream inp) throws IOException {
+        for (;;) {
+            final ZipArchiveEntry zipEntry = inp.getNextEntry();
+            if (zipEntry == null) {
+                break;
+            }
+            zipEntries.put(zipEntry.getName(), new ZipArchiveFakeEntry(zipEntry, inp));
+        }
+
+        streamToClose = inp;
+    }
+
+    @Override
+    public Enumeration<? extends ZipArchiveEntry> getEntries() {
+        return Collections.enumeration(zipEntries.values());
+    }
+
+    @Override
+    public InputStream getInputStream(ZipArchiveEntry zipEntry) {
+        assert (zipEntry instanceof ZipArchiveFakeEntry);
+        return ((ZipArchiveFakeEntry)zipEntry).getInputStream();
+    }
+
+    @Override
+    public void close() throws IOException {
+        // Free the memory
+        zipEntries.clear();
+
+        streamToClose.close();
+    }
+
+    @Override
+    public boolean isClosed() {
+        return zipEntries.isEmpty();
+    }
+
+    @Override
+    public ZipArchiveEntry getEntry(final String path) {
+        final String normalizedPath = path.replace('\\', '/');
+        final ZipArchiveEntry ze = zipEntries.get(normalizedPath);
+        if (ze != null) {
+            return ze;
+        }
+
+        for (final Map.Entry<String, ZipArchiveFakeEntry> fze : zipEntries.entrySet()) {
+            if (normalizedPath.equalsIgnoreCase(fze.getKey())) {
+                return fze.getValue();
+            }
+        }
 
-		return null;
-	}
+        return null;
+    }
 }

Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xddf/usermodel/chart/XDDFManualLayout.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xddf/usermodel/chart/XDDFManualLayout.java?rev=1890119&r1=1890118&r2=1890119&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xddf/usermodel/chart/XDDFManualLayout.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xddf/usermodel/chart/XDDFManualLayout.java Sat May 22 20:22:16 2021
@@ -1,10 +1,10 @@
 /* ====================================================================
    Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.	See the NOTICE file distributed with
+   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
+   the License.  You may obtain a copy of the License at
 
    http://www.apache.org/licenses/LICENSE-2.0
 

Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFComment.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFComment.java?rev=1890119&r1=1890118&r2=1890119&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFComment.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFComment.java Sat May 22 20:22:16 2021
@@ -68,7 +68,7 @@ public class XSLFComment implements Comm
         final CTCommentAuthor newAuthor = list.addNewCmAuthor();
         newAuthor.setName(author);
         newAuthor.setId(maxId+1);
-        newAuthor.setInitials(author.replaceAll(	"\\s*(\\w)\\S*", "$1").toUpperCase(LocaleUtil.getUserLocale()));
+        newAuthor.setInitials(author.replaceAll(    "\\s*(\\w)\\S*", "$1").toUpperCase(LocaleUtil.getUserLocale()));
         comment.setAuthorId(maxId+1);
     }
 

Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFGraphicFrame.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFGraphicFrame.java?rev=1890119&r1=1890118&r2=1890119&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFGraphicFrame.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFGraphicFrame.java Sat May 22 20:22:16 2021
@@ -122,7 +122,7 @@ public class XSLFGraphicFrame extends XS
      */
     @Override
     public void setRotation(double theta){
-    	throw new IllegalArgumentException("Operation not supported");
+        throw new IllegalArgumentException("Operation not supported");
     }
 
     /**
@@ -135,18 +135,18 @@ public class XSLFGraphicFrame extends XS
      * @return rotation angle in degrees
      */
     @Override
-	public double getRotation(){
-    	return 0;
+    public double getRotation(){
+        return 0;
     }
 
     @Override
-	public void setFlipHorizontal(boolean flip){
-    	throw new IllegalArgumentException("Operation not supported");
+    public void setFlipHorizontal(boolean flip){
+        throw new IllegalArgumentException("Operation not supported");
     }
 
     @Override
-	public void setFlipVertical(boolean flip){
-    	throw new IllegalArgumentException("Operation not supported");
+    public void setFlipVertical(boolean flip){
+        throw new IllegalArgumentException("Operation not supported");
     }
 
     /**
@@ -155,13 +155,13 @@ public class XSLFGraphicFrame extends XS
      * @return whether the shape is horizontally flipped
      */
     @Override
-	public boolean getFlipHorizontal(){
-    	return false;
+    public boolean getFlipHorizontal(){
+        return false;
     }
 
     @Override
-	public boolean getFlipVertical(){
-    	return false;
+    public boolean getFlipVertical(){
+        return false;
     }
 
     public boolean hasChart() {
@@ -203,7 +203,7 @@ public class XSLFGraphicFrame extends XS
         if(uri.equals("http://schemas.openxmlformats.org/drawingml/2006/diagram")){
             copyDiagram(data, (XSLFGraphicFrame)sh);
         } if(uri.equals(DRAWINGML_CHART_URI)){
-        	copyChart(data, (XSLFGraphicFrame)sh);
+            copyChart(data, (XSLFGraphicFrame)sh);
         } else {
             // TODO  support other types of objects
 

Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFNotes.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFNotes.java?rev=1890119&r1=1890118&r2=1890119&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFNotes.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFNotes.java Sat May 22 20:22:16 2021
@@ -80,7 +80,7 @@ implements Notes<XSLFShape,XSLFTextParag
     @Override
     public XSLFTheme getTheme(){
         final XSLFNotesMaster m = getMasterSheet();
-    	return (m != null) ? m.getTheme() : null;
+        return (m != null) ? m.getTheme() : null;
     }
 
     @Override

Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFNotesMaster.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFNotesMaster.java?rev=1890119&r1=1890118&r2=1890119&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFNotesMaster.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFNotesMaster.java Sat May 22 20:22:16 2021
@@ -46,7 +46,7 @@ import org.openxmlformats.schemas.presen
 @Beta
  public class XSLFNotesMaster extends XSLFSheet
      implements MasterSheet<XSLFShape,XSLFTextParagraph> {
-	 private CTNotesMaster _slide;
+     private CTNotesMaster _slide;
 
     XSLFNotesMaster() {
         super();

Modified: poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFSlideMaster.java
URL: http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFSlideMaster.java?rev=1890119&r1=1890118&r2=1890119&view=diff
==============================================================================
--- poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFSlideMaster.java (original)
+++ poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XSLFSlideMaster.java Sat May 22 20:22:16 2021
@@ -53,7 +53,7 @@ import org.openxmlformats.schemas.presen
 @Beta
  public class XSLFSlideMaster extends XSLFSheet
  implements MasterSheet<XSLFShape,XSLFTextParagraph> {
-	private CTSlideMaster _slide;
+    private CTSlideMaster _slide;
     private Map<String, XSLFSlideLayout> _layouts;
 
     /**
@@ -67,9 +67,9 @@ import org.openxmlformats.schemas.presen
     }
 
     @Override
-	public CTSlideMaster getXmlObject() {
-		return _slide;
-	}
+    public CTSlideMaster getXmlObject() {
+        return _slide;
+    }
 
     @Override
     protected String getRootElementName(){



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