You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by jo...@apache.org on 2009/08/18 07:29:55 UTC
svn commit: r805284 [2/8] - in /poi/trunk/src:
examples/src/org/apache/poi/hssf/usermodel/examples/
java/org/apache/poi/hpsf/ java/org/apache/poi/hssf/eventmodel/
java/org/apache/poi/hssf/model/ java/org/apache/poi/hssf/record/
java/org/apache/poi/hssf...
Modified: poi/trunk/src/java/org/apache/poi/util/BinaryTree.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/util/BinaryTree.java?rev=805284&r1=805283&r2=805284&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/util/BinaryTree.java (original)
+++ poi/trunk/src/java/org/apache/poi/util/BinaryTree.java Tue Aug 18 05:29:53 2009
@@ -1,4 +1,3 @@
-
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -15,7 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
package org.apache.poi.util;
@@ -89,34 +87,20 @@
*
* @author Marc Johnson (mjohnson at apache dot org)
*/
-public final class BinaryTree // final for performance
-
- extends AbstractMap
-{
- private Node[] _root = new Node[]
- {
- null, null
- };
- private int _size = 0;
- private int _modifications = 0;
- private Set[] _key_set = new Set[]
- {
- null, null
- };
- private Set[] _entry_set = new Set[]
- {
- null, null
- };
- private Collection[] _value_collection = new Collection[]
- {
- null, null
- };
- private static final int _KEY = 0;
- private static final int _VALUE = 1;
- private static final int _INDEX_SUM = _KEY + _VALUE;
- private static final int _MINIMUM_INDEX = 0;
- private static final int _INDEX_COUNT = 2;
- private static final String[] _data_name = new String[]
+//for performance
+public class BinaryTree extends AbstractMap {
+ final Node[] _root;
+ int _size = 0;
+ int _modifications = 0;
+ private final Set[] _key_set = new Set[] { null, null };
+ private final Set[] _entry_set = new Set[] { null, null };
+ private final Collection[] _value_collection = new Collection[] { null, null };
+ static int _KEY = 0;
+ static int _VALUE = 1;
+ private static int _INDEX_SUM = _KEY + _VALUE;
+ private static int _MINIMUM_INDEX = 0;
+ private static int _INDEX_COUNT = 2;
+ private static String[] _data_name = new String[]
{
"key", "value"
};
@@ -124,9 +108,8 @@
/**
* Construct a new BinaryTree
*/
-
- public BinaryTree()
- {
+ public BinaryTree() {
+ _root = new Node[]{ null, null, };
}
/**
@@ -146,11 +129,11 @@
* or duplicate values in the
* map
*/
-
- public BinaryTree(final Map map)
+ public BinaryTree(Map map)
throws ClassCastException, NullPointerException,
IllegalArgumentException
{
+ this();
putAll(map);
}
@@ -167,8 +150,7 @@
* inappropriate type for this map.
* @exception NullPointerException if the value is null
*/
-
- public Object getKeyForValue(final Object value)
+ public Object getKeyForValue(Object value)
throws ClassCastException, NullPointerException
{
return doGet(( Comparable ) value, _VALUE);
@@ -182,8 +164,7 @@
* @return previous key associated with specified value, or null
* if there was no mapping for value.
*/
-
- public Object removeValue(final Object value)
+ public Object removeValue(Object value)
{
return doRemove(( Comparable ) value, _VALUE);
}
@@ -207,7 +188,6 @@
*
* @return a set view of the mappings contained in this map.
*/
-
public Set entrySetByValue()
{
if (_entry_set[ _VALUE ] == null)
@@ -423,8 +403,7 @@
* key. null if the specified key or value could not be
* found
*/
-
- private Object doRemove(final Comparable o, final int index)
+ private Object doRemove(Comparable o, int index)
{
Node node = lookup(o, index);
Object rval = null;
@@ -447,8 +426,7 @@
* key was mapped); null if we couldn't find the specified
* object
*/
-
- private Object doGet(final Comparable o, final int index)
+ private Object doGet(Comparable o, int index)
{
checkNonNullComparable(o, index);
Node node = lookup(o, index);
@@ -464,8 +442,7 @@
*
* @return _VALUE (if _KEY was specified), else _KEY
*/
-
- private int oppositeIndex(final int index)
+ private int oppositeIndex(int index)
{
// old trick ... to find the opposite of a value, m or n,
@@ -483,8 +460,7 @@
* @return the desired Node, or null if there is no mapping of the
* specified data
*/
-
- private Node lookup(final Comparable data, final int index)
+ public Node lookup(Comparable data, int index)
{
Node rval = null;
Node node = _root[ index ];
@@ -498,11 +474,8 @@
rval = node;
break;
}
- else
- {
- node = (cmp < 0) ? node.getLeft(index)
- : node.getRight(index);
- }
+ node = (cmp < 0) ? node.getLeft(index)
+ : node.getRight(index);
}
return rval;
}
@@ -516,10 +489,9 @@
* @return negative value if o1 < o2; 0 if o1 == o2; positive
* value if o1 > o2
*/
-
- private static int compare(final Comparable o1, final Comparable o2)
+ private static int compare(Comparable o1, Comparable o2)
{
- return (( Comparable ) o1).compareTo(o2);
+ return o1.compareTo(o2);
}
/**
@@ -532,8 +504,7 @@
* @return the smallest node, from the specified node, in the
* specified mapping
*/
-
- private static Node leastNode(final Node node, final int index)
+ static Node leastNode(Node node, int index)
{
Node rval = node;
@@ -555,8 +526,7 @@
*
* @return the specified node
*/
-
- private Node nextGreater(final Node node, final int index)
+ static Node nextGreater(Node node, int index)
{
Node rval = null;
@@ -601,9 +571,7 @@
* @param to the node whose color we're changing; may be null
* @param index _KEY or _VALUE
*/
-
- private static void copyColor(final Node from, final Node to,
- final int index)
+ private static void copyColor(Node from, Node to, int index)
{
if (to != null)
{
@@ -627,11 +595,9 @@
* @param node the node (may be null) in question
* @param index _KEY or _VALUE
*/
-
- private static boolean isRed(final Node node, final int index)
+ private static boolean isRed(Node node, int index)
{
- return ((node == null) ? false
- : node.isRed(index));
+ return node == null ? false : node.isRed(index);
}
/**
@@ -641,11 +607,9 @@
* @param node the node (may be null) in question
* @param index _KEY or _VALUE
*/
-
- private static boolean isBlack(final Node node, final int index)
+ private static boolean isBlack(Node node, int index)
{
- return ((node == null) ? true
- : node.isBlack(index));
+ return node == null ? true : node.isBlack(index);
}
/**
@@ -654,8 +618,7 @@
* @param node the node (may be null) in question
* @param index _KEY or _VALUE
*/
-
- private static void makeRed(final Node node, final int index)
+ private static void makeRed(Node node, int index)
{
if (node != null)
{
@@ -669,8 +632,7 @@
* @param node the node (may be null) in question
* @param index _KEY or _VALUE
*/
-
- private static void makeBlack(final Node node, final int index)
+ private static void makeBlack(Node node, int index)
{
if (node != null)
{
@@ -685,8 +647,7 @@
* @param node the node (may be null) in question
* @param index _KEY or _VALUE
*/
-
- private static Node getGrandParent(final Node node, final int index)
+ private static Node getGrandParent(Node node, int index)
{
return getParent(getParent(node, index), index);
}
@@ -698,8 +659,7 @@
* @param node the node (may be null) in question
* @param index _KEY or _VALUE
*/
-
- private static Node getParent(final Node node, final int index)
+ private static Node getParent(Node node, int index)
{
return ((node == null) ? null
: node.getParent(index));
@@ -712,8 +672,7 @@
* @param node the node (may be null) in question
* @param index _KEY or _VALUE
*/
-
- private static Node getRightChild(final Node node, final int index)
+ private static Node getRightChild(Node node, int index)
{
return (node == null) ? null
: node.getRight(index);
@@ -726,8 +685,7 @@
* @param node the node (may be null) in question
* @param index _KEY or _VALUE
*/
-
- private static Node getLeftChild(final Node node, final int index)
+ private static Node getLeftChild(Node node, int index)
{
return (node == null) ? null
: node.getLeft(index);
@@ -744,15 +702,14 @@
* @param node the node (may be null) in question
* @param index _KEY or _VALUE
*/
-
- private static boolean isLeftChild(final Node node, final int index)
- {
- return (node == null) ? true
- : ((node.getParent(index) == null) ? false
- : (node
- == node.getParent(
- index).getLeft(
- index)));
+ private static boolean isLeftChild(Node node, int index) {
+ if (node == null) {
+ return true;
+ }
+ if (node.getParent(index) == null) {
+ return false;
+ }
+ return node == node.getParent(index).getLeft(index);
}
/**
@@ -766,15 +723,15 @@
* @param node the node (may be null) in question
* @param index _KEY or _VALUE
*/
-
- private static boolean isRightChild(final Node node, final int index)
+ private static boolean isRightChild(Node node, int index)
{
- return (node == null) ? true
- : ((node.getParent(index) == null) ? false
- : (node
- == node.getParent(
- index).getRight(
- index)));
+ if (node == null) {
+ return true;
+ }
+ if (node.getParent(index) == null) {
+ return false;
+ }
+ return node == node.getParent(index).getRight(index);
}
/**
@@ -783,8 +740,7 @@
* @param node the node to be rotated
* @param index _KEY or _VALUE
*/
-
- private void rotateLeft(final Node node, final int index)
+ private void rotateLeft(Node node, int index)
{
Node right_child = node.getRight(index);
@@ -818,8 +774,7 @@
* @param node the node to be rotated
* @param index _KEY or _VALUE
*/
-
- private void rotateRight(final Node node, final int index)
+ private void rotateRight(Node node, int index)
{
Node left_child = node.getLeft(index);
@@ -854,8 +809,7 @@
* @param inserted_node the node to be inserted
* @param index _KEY or _VALUE
*/
-
- private void doRedBlackInsert(final Node inserted_node, final int index)
+ private void doRedBlackInsert(Node inserted_node, int index)
{
Node current_node = inserted_node;
@@ -931,8 +885,7 @@
*
* @param deleted_node the node to be deleted
*/
-
- private void doRedBlackDelete(final Node deleted_node)
+ void doRedBlackDelete(Node deleted_node)
{
for (int index = _MINIMUM_INDEX; index < _INDEX_COUNT; index++)
{
@@ -1023,9 +976,8 @@
* @param replacement_node the node being replaced
* @param index _KEY or _VALUE
*/
-
- private void doRedBlackDeleteFixup(final Node replacement_node,
- final int index)
+ private void doRedBlackDeleteFixup(Node replacement_node,
+ int index)
{
Node current_node = replacement_node;
@@ -1121,8 +1073,7 @@
* @param y another node
* @param index _KEY or _VALUE
*/
-
- private void swapPosition(final Node x, final Node y, final int index)
+ private void swapPosition(Node x, Node y, int index)
{
// Save initial values.
@@ -1244,9 +1195,8 @@
* @exception NullPointerException if o is null
* @exception ClassCastException if o is not Comparable
*/
-
- private static void checkNonNullComparable(final Object o,
- final int index)
+ private static void checkNonNullComparable(Object o,
+ int index)
{
if (o == null)
{
@@ -1268,8 +1218,7 @@
* @exception NullPointerException if key is null
* @exception ClassCastException if key is not Comparable
*/
-
- private static void checkKey(final Object key)
+ private static void checkKey(Object key)
{
checkNonNullComparable(key, _KEY);
}
@@ -1282,8 +1231,7 @@
* @exception NullPointerException if value is null
* @exception ClassCastException if value is not Comparable
*/
-
- private static void checkValue(final Object value)
+ private static void checkValue(Object value)
{
checkNonNullComparable(value, _VALUE);
}
@@ -1298,8 +1246,7 @@
* @exception NullPointerException if key or value is null
* @exception ClassCastException if key or value is not Comparable
*/
-
- private static void checkKeyAndValue(final Object key, final Object value)
+ private static void checkKeyAndValue(Object key, Object value)
{
checkKey(key);
checkValue(value);
@@ -1310,7 +1257,6 @@
* concurrent modification of the map through the map and through
* an Iterator from one of its Set or Collection views
*/
-
private void modify()
{
_modifications++;
@@ -1319,7 +1265,6 @@
/**
* bump up the size and note that the map has changed
*/
-
private void grow()
{
modify();
@@ -1329,7 +1274,6 @@
/**
* decrement the size and note that the map has changed
*/
-
private void shrink()
{
modify();
@@ -1344,8 +1288,7 @@
* @exception IllegalArgumentException if the node already exists
* in the value mapping
*/
-
- private void insertValue(final Node newNode)
+ private void insertValue(Node newNode)
throws IllegalArgumentException
{
Node node = _root[ _VALUE ];
@@ -1400,7 +1343,6 @@
*
* @return the number of key-value mappings in this map.
*/
-
public int size()
{
return _size;
@@ -1419,8 +1361,7 @@
* type for this map.
* @exception NullPointerException if the key is null
*/
-
- public boolean containsKey(final Object key)
+ public boolean containsKey(Object key)
throws ClassCastException, NullPointerException
{
checkKey(key);
@@ -1436,8 +1377,7 @@
* @return true if this map maps one or more keys to the specified
* value.
*/
-
- public boolean containsValue(final Object value)
+ public boolean containsValue(Object value)
{
checkValue(value);
return lookup(( Comparable ) value, _VALUE) != null;
@@ -1456,8 +1396,7 @@
* type for this map.
* @exception NullPointerException if the key is null
*/
-
- public Object get(final Object key)
+ public Object get(Object key)
throws ClassCastException, NullPointerException
{
return doGet(( Comparable ) key, _KEY);
@@ -1483,8 +1422,7 @@
* value duplicates an
* existing value
*/
-
- public Object put(final Object key, final Object value)
+ public Object put(Object key, Object value)
throws ClassCastException, NullPointerException,
IllegalArgumentException
{
@@ -1562,8 +1500,7 @@
* @return previous value associated with specified key, or null
* if there was no mapping for key.
*/
-
- public Object remove(final Object key)
+ public Object remove(Object key)
{
return doRemove(( Comparable ) key, _KEY);
}
@@ -1571,7 +1508,6 @@
/**
* Removes all mappings from this map
*/
-
public void clear()
{
modify();
@@ -1592,7 +1528,6 @@
*
* @return a set view of the keys contained in this map.
*/
-
public Set keySet()
{
if (_key_set[ _KEY ] == null)
@@ -1650,7 +1585,6 @@
*
* @return a collection view of the values contained in this map.
*/
-
public Collection values()
{
if (_value_collection[ _KEY ] == null)
@@ -1723,7 +1657,6 @@
*
* @return a set view of the mappings contained in this map.
*/
-
public Set entrySet()
{
if (_entry_set[ _KEY ] == null)
@@ -1803,8 +1736,7 @@
*
* @param type
*/
-
- BinaryTreeIterator(final int type)
+ BinaryTreeIterator(int type)
{
_type = type;
_expected_modifications = BinaryTree.this._modifications;
@@ -1825,7 +1757,7 @@
* @return true if the iterator has more elements.
*/
- public final boolean hasNext()
+ public boolean hasNext()
{
return _next_node != null;
}
@@ -1842,7 +1774,7 @@
* back
*/
- public final Object next()
+ public Object next()
throws NoSuchElementException, ConcurrentModificationException
{
if (_next_node == null)
@@ -1878,7 +1810,7 @@
* back
*/
- public final void remove()
+ public void remove()
throws IllegalStateException, ConcurrentModificationException
{
if (_last_returned_node == null)
@@ -1897,7 +1829,7 @@
/* ********** END implementation of Iterator ********** */
} // end private abstract class BinaryTreeIterator
- // final for performance
+ // for performance
private static final class Node
implements Map.Entry
{
@@ -1917,7 +1849,7 @@
* @param value
*/
- Node(final Comparable key, final Comparable value)
+ Node(Comparable key, Comparable value)
{
_data = new Comparable[]
{
@@ -1949,8 +1881,7 @@
*
* @return the key or value
*/
-
- private Comparable getData(final int index)
+ public Comparable getData(int index)
{
return _data[ index ];
}
@@ -1961,8 +1892,7 @@
* @param node the new left node
* @param index _KEY or _VALUE
*/
-
- private void setLeft(final Node node, final int index)
+ public void setLeft(Node node, int index)
{
_left[ index ] = node;
}
@@ -1975,7 +1905,7 @@
* @return the left node -- may be null
*/
- private Node getLeft(final int index)
+ public Node getLeft(int index)
{
return _left[ index ];
}
@@ -1986,8 +1916,7 @@
* @param node the new right node
* @param index _KEY or _VALUE
*/
-
- private void setRight(final Node node, final int index)
+ public void setRight(Node node, int index)
{
_right[ index ] = node;
}
@@ -2000,7 +1929,7 @@
* @return the right node -- may be null
*/
- private Node getRight(final int index)
+ public Node getRight(int index)
{
return _right[ index ];
}
@@ -2011,8 +1940,7 @@
* @param node the new parent node
* @param index _KEY or _VALUE
*/
-
- private void setParent(final Node node, final int index)
+ public void setParent(Node node, int index)
{
_parent[ index ] = node;
}
@@ -2024,8 +1952,7 @@
*
* @return the parent node -- may be null
*/
-
- private Node getParent(final int index)
+ public Node getParent(int index)
{
return _parent[ index ];
}
@@ -2036,8 +1963,7 @@
* @param node the node to swap with
* @param index _KEY or _VALUE
*/
-
- private void swapColors(final Node node, final int index)
+ public void swapColors(Node node, int index)
{
// Swap colors -- old hacker's trick
@@ -2053,8 +1979,7 @@
*
* @return true if black (which is represented as a true boolean)
*/
-
- private boolean isBlack(final int index)
+ public boolean isBlack(int index)
{
return _black[ index ];
}
@@ -2066,8 +1991,7 @@
*
* @return true if non-black
*/
-
- private boolean isRed(final int index)
+ public boolean isRed(int index)
{
return !_black[ index ];
}
@@ -2077,8 +2001,7 @@
*
* @param index _KEY or _VALUE
*/
-
- private void setBlack(final int index)
+ public void setBlack(int index)
{
_black[ index ] = true;
}
@@ -2088,8 +2011,7 @@
*
* @param index _KEY or _VALUE
*/
-
- private void setRed(final int index)
+ public void setRed(int index)
{
_black[ index ] = false;
}
@@ -2100,8 +2022,7 @@
* @param node the node whose color we're adopting
* @param index _KEY or _VALUE
*/
-
- private void copyColor(final Node node, final int index)
+ public void copyColor(Node node, int index)
{
_black[ index ] = node._black[ index ];
}
@@ -2111,7 +2032,6 @@
/**
* @return the key corresponding to this entry.
*/
-
public Object getKey()
{
return _data[ _KEY ];
@@ -2120,7 +2040,6 @@
/**
* @return the value corresponding to this entry.
*/
-
public Object getValue()
{
return _data[ _VALUE ];
@@ -2133,10 +2052,7 @@
* @param ignored
*
* @return does not return
- *
- * @exception UnsupportedOperationException
*/
-
public Object setValue(Object ignored)
throws UnsupportedOperationException
{
@@ -2154,7 +2070,6 @@
* @return true if the specified object is equal to this map
* entry.
*/
-
public boolean equals(Object o)
{
if (this == o)
@@ -2188,5 +2103,4 @@
/* ********** END implementation of Map.Entry ********** */
}
-} // end public class BinaryTree
-
+}
Modified: poi/trunk/src/java/org/apache/poi/util/POILogger.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/util/POILogger.java?rev=805284&r1=805283&r2=805284&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/util/POILogger.java (original)
+++ poi/trunk/src/java/org/apache/poi/util/POILogger.java Tue Aug 18 05:29:53 2009
@@ -1,4 +1,3 @@
-
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
@@ -15,7 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
-
package org.apache.poi.util;
@@ -31,34 +29,32 @@
* @author Glen Stampoultzis (glens at apache.org)
* @author Nicola Ken Barozzi (nicolaken at apache.org)
*/
+public abstract class POILogger {
-public abstract class POILogger
-{
-
- public static final int DEBUG = 1;
- public static final int INFO = 3;
- public static final int WARN = 5;
- public static final int ERROR = 7;
- public static final int FATAL = 9;
+ public static int DEBUG = 1;
+ public static int INFO = 3;
+ public static int WARN = 5;
+ public static int ERROR = 7;
+ public static int FATAL = 9;
/**
* package scope so it cannot be instantiated outside of the util
* package. You need a POILogger? Go to the POILogFactory for one
- *
*/
- POILogger()
- {}
-
- abstract public void initialize(final String cat);
-
+ POILogger() {
+ // no fields to initialise
+ }
+
+ abstract public void initialize(String cat);
+
/**
* Log a message
*
* @param level One of DEBUG, INFO, WARN, ERROR, FATAL
* @param obj1 The object to log. This is converted to a string.
*/
- abstract public void log(final int level, final Object obj1);
-
+ abstract public void log(int level, Object obj1);
+
/**
* Log a message
*
@@ -66,7 +62,7 @@
* @param obj1 The object to log. This is converted to a string.
* @param exception An exception to be logged
*/
- abstract public void log(final int level, final Object obj1,
+ abstract public void log(int level, Object obj1,
final Throwable exception);
@@ -75,15 +71,7 @@
*
* @param level One of DEBUG, INFO, WARN, ERROR, FATAL
*/
- abstract public boolean check(final int level);
-
- /**
- * Log a message. Lazily appends Object parameters together.
- *
- * @param level One of DEBUG, INFO, WARN, ERROR, FATAL
- * @param obj1 first object to place in the message
- * @param obj2 second object to place in the message
- */
+ abstract public boolean check(int level);
/**
* Log a message. Lazily appends Object parameters together.
@@ -92,8 +80,7 @@
* @param obj1 first object to place in the message
* @param obj2 second object to place in the message
*/
-
- public void log(final int level, final Object obj1, final Object obj2)
+ public void log(int level, Object obj1, Object obj2)
{
if (check(level))
{
@@ -109,11 +96,10 @@
* @param obj2 second Object to place in the message
* @param obj3 third Object to place in the message
*/
-
- public void log(final int level, final Object obj1, final Object obj2,
- final Object obj3)
+ public void log(int level, Object obj1, Object obj2,
+ Object obj3)
{
-
+
if (check(level))
{
@@ -132,11 +118,10 @@
* @param obj3 third Object to place in the message
* @param obj4 fourth Object to place in the message
*/
-
- public void log(final int level, final Object obj1, final Object obj2,
- final Object obj3, final Object obj4)
+ public void log(int level, Object obj1, Object obj2,
+ Object obj3, Object obj4)
{
-
+
if (check(level))
{
@@ -156,11 +141,10 @@
* @param obj4 fourth Object to place in the message
* @param obj5 fifth Object to place in the message
*/
-
- public void log(final int level, final Object obj1, final Object obj2,
- final Object obj3, final Object obj4, final Object obj5)
+ public void log(int level, Object obj1, Object obj2,
+ Object obj3, Object obj4, Object obj5)
{
-
+
if (check(level))
{
@@ -181,12 +165,11 @@
* @param obj5 fifth Object to place in the message
* @param obj6 sixth Object to place in the message
*/
-
- public void log(final int level, final Object obj1, final Object obj2,
- final Object obj3, final Object obj4, final Object obj5,
- final Object obj6)
+ public void log(int level, Object obj1, Object obj2,
+ Object obj3, Object obj4, Object obj5,
+ Object obj6)
{
-
+
if (check(level))
{
@@ -208,12 +191,11 @@
* @param obj6 sixth Object to place in the message
* @param obj7 seventh Object to place in the message
*/
-
- public void log(final int level, final Object obj1, final Object obj2,
- final Object obj3, final Object obj4, final Object obj5,
- final Object obj6, final Object obj7)
+ public void log(int level, Object obj1, Object obj2,
+ Object obj3, Object obj4, Object obj5,
+ Object obj6, Object obj7)
{
-
+
if (check(level))
{
@@ -237,12 +219,11 @@
* @param obj7 seventh Object to place in the message
* @param obj8 eighth Object to place in the message
*/
-
- public void log(final int level, final Object obj1, final Object obj2,
- final Object obj3, final Object obj4, final Object obj5,
- final Object obj6, final Object obj7, final Object obj8)
+ public void log(int level, Object obj1, Object obj2,
+ Object obj3, Object obj4, Object obj5,
+ Object obj6, Object obj7, Object obj8)
{
-
+
if (check(level))
{
@@ -259,8 +240,7 @@
* @param level One of DEBUG, INFO, WARN, ERROR, FATAL
* @param exception An exception to be logged
*/
-
- public void log(final int level, final Throwable exception)
+ public void log(int level, final Throwable exception)
{
log(level, null, exception);
}
@@ -273,11 +253,10 @@
* @param obj2 second Object to place in the message
* @param exception An exception to be logged
*/
-
- public void log(final int level, final Object obj1, final Object obj2,
+ public void log(int level, Object obj1, Object obj2,
final Throwable exception)
{
-
+
if (check(level))
{
@@ -295,11 +274,10 @@
* @param obj3 third object to place in the message
* @param exception An error message to be logged
*/
-
- public void log(final int level, final Object obj1, final Object obj2,
- final Object obj3, final Throwable exception)
+ public void log(int level, Object obj1, Object obj2,
+ Object obj3, final Throwable exception)
{
-
+
if (check(level))
{
@@ -318,12 +296,11 @@
* @param obj4 fourth object to place in the message
* @param exception An exception to be logged
*/
-
- public void log(final int level, final Object obj1, final Object obj2,
- final Object obj3, final Object obj4,
+ public void log(int level, Object obj1, Object obj2,
+ Object obj3, Object obj4,
final Throwable exception)
{
-
+
if (check(level))
{
@@ -343,12 +320,11 @@
* @param obj5 fifth object to place in the message
* @param exception An exception to be logged
*/
-
- public void log(final int level, final Object obj1, final Object obj2,
- final Object obj3, final Object obj4, final Object obj5,
+ public void log(int level, Object obj1, Object obj2,
+ Object obj3, Object obj4, Object obj5,
final Throwable exception)
{
-
+
if (check(level))
{
@@ -369,12 +345,11 @@
* @param obj6 sixth object to place in the message
* @param exception An exception to be logged
*/
-
- public void log(final int level, final Object obj1, final Object obj2,
- final Object obj3, final Object obj4, final Object obj5,
- final Object obj6, final Throwable exception)
+ public void log(int level, Object obj1, Object obj2,
+ Object obj3, Object obj4, Object obj5,
+ Object obj6, final Throwable exception)
{
-
+
if (check(level))
{
@@ -397,13 +372,12 @@
* @param obj7 seventh object to place in the message
* @param exception An exception to be logged
*/
-
- public void log(final int level, final Object obj1, final Object obj2,
- final Object obj3, final Object obj4, final Object obj5,
- final Object obj6, final Object obj7,
+ public void log(int level, Object obj1, Object obj2,
+ Object obj3, Object obj4, Object obj5,
+ Object obj6, Object obj7,
final Throwable exception)
{
-
+
if (check(level))
{
@@ -427,13 +401,12 @@
* @param obj8 eighth object to place in the message
* @param exception An exception to be logged
*/
-
- public void log(final int level, final Object obj1, final Object obj2,
- final Object obj3, final Object obj4, final Object obj5,
- final Object obj6, final Object obj7, final Object obj8,
+ public void log(int level, Object obj1, Object obj2,
+ Object obj3, Object obj4, Object obj5,
+ Object obj6, Object obj7, Object obj8,
final Throwable exception)
{
-
+
if (check(level))
{
@@ -467,9 +440,8 @@
* @param message The message to log.
* @param obj1 The first object to match against.
*/
-
- public void logFormatted(final int level, final String message,
- final Object obj1)
+ public void logFormatted(int level, String message,
+ Object obj1)
{
commonLogFormatted(level, message, new Object[]
{
@@ -502,9 +474,8 @@
* @param obj1 The first object to match against.
* @param obj2 The second object to match against.
*/
-
- public void logFormatted(final int level, final String message,
- final Object obj1, final Object obj2)
+ public void logFormatted(int level, String message,
+ Object obj1, Object obj2)
{
commonLogFormatted(level, message, new Object[]
{
@@ -538,10 +509,9 @@
* @param obj2 The second object to match against.
* @param obj3 The third object to match against.
*/
-
- public void logFormatted(final int level, final String message,
- final Object obj1, final Object obj2,
- final Object obj3)
+ public void logFormatted(int level, String message,
+ Object obj1, Object obj2,
+ Object obj3)
{
commonLogFormatted(level, message, new Object[]
{
@@ -576,21 +546,20 @@
* @param obj3 The third object to match against.
* @param obj4 The forth object to match against.
*/
-
- public void logFormatted(final int level, final String message,
- final Object obj1, final Object obj2,
- final Object obj3, final Object obj4)
+ public void logFormatted(int level, String message,
+ Object obj1, Object obj2,
+ Object obj3, Object obj4)
{
commonLogFormatted(level, message, new Object[]
{
obj1, obj2, obj3, obj4
});
- }
+ }
- private void commonLogFormatted(final int level, final String message,
- final Object [] unflatParams)
+ private void commonLogFormatted(int level, String message,
+ Object [] unflatParams)
{
-
+
if (check(level))
{
@@ -611,21 +580,20 @@
/**
* Flattens any contained objects. Only tranverses one level deep.
*/
-
- private Object [] flattenArrays(final Object [] objects)
+ private Object [] flattenArrays(Object [] objects)
{
- List results = new ArrayList();
+ List<Object> results = new ArrayList<Object>();
for (int i = 0; i < objects.length; i++)
{
results.addAll(objectToObjectArray(objects[ i ]));
}
- return ( Object [] ) results.toArray(new Object[ results.size() ]);
+ return results.toArray(new Object[ results.size() ]);
}
- private List objectToObjectArray(Object object)
+ private List<Object> objectToObjectArray(Object object)
{
- List results = new ArrayList();
+ List<Object> results = new ArrayList<Object>();
if (object instanceof byte [])
{
@@ -705,6 +673,4 @@
}
return results;
}
-
-} // end package scope abstract class POILogger
-
+}
Modified: poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java?rev=805284&r1=805283&r2=805284&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/OPCPackage.java Tue Aug 18 05:29:53 2009
@@ -52,7 +52,7 @@
/**
* Represents a container that can store multiple data objects.
- *
+ *
* @author Julien Chable, CDubet
* @version 0.1
*/
@@ -125,7 +125,7 @@
/**
* Constructor.
- *
+ *
* @param access
* Package access.
*/
@@ -166,7 +166,7 @@
/**
* Open a package with read/write permission.
- *
+ *
* @param path
* The document path.
* @return A Package object, else <b>null</b>.
@@ -180,7 +180,7 @@
/**
* Open a package.
- *
+ *
* @param path
* The document path.
* @param access
@@ -206,11 +206,11 @@
/**
* Open a package.
- *
+ *
* Note - uses quite a bit more memory than {@link #open(String)}, which
* doesn't need to hold the whole zip file in memory, and can take advantage
* of native methods
- *
+ *
* @param in
* The InputStream to read the package from
* @return A PackageBase object
@@ -226,7 +226,7 @@
/**
* Opens a package if it exists, else it creates one.
- *
+ *
* @param file
* The file to open or to create.
* @return A newly created package if the specified file does not exist,
@@ -246,7 +246,7 @@
/**
* Creates a new package.
- *
+ *
* @param path
* Path of the document.
* @return A newly created PackageBase ready to use.
@@ -257,7 +257,7 @@
/**
* Creates a new package.
- *
+ *
* @param file
* Path of the document.
* @return A newly created PackageBase ready to use.
@@ -292,7 +292,7 @@
/**
* Configure the package.
- *
+ *
* @param pkg
*/
private static void configurePackage(OPCPackage pkg) {
@@ -324,7 +324,7 @@
/**
* Flush the package : save all.
- *
+ *
* @see #close()
*/
public void flush() {
@@ -339,7 +339,7 @@
/**
* Close the package and save its content.
- *
+ *
* @throws IOException
* If an IO exception occur during the saving process.
*/
@@ -391,7 +391,7 @@
* Add a thumbnail to the package. This method is provided to make easier
* the addition of a thumbnail in a package. You can do the same work by
* using the traditionnal relationship and part mechanism.
- *
+ *
* @param path
* The full path to the image file.
*/
@@ -443,7 +443,7 @@
/**
* Throws an exception if the package access mode is in read only mode
* (PackageAccess.Read).
- *
+ *
* @throws InvalidOperationException
* Throws if a writing operation is done on a read only package.
* @see org.apache.poi.openxml4j.opc.PackageAccess
@@ -458,7 +458,7 @@
* Throws an exception if the package access mode is in write only mode
* (PackageAccess.Write). This method is call when other methods need write
* right.
- *
+ *
* @throws InvalidOperationException
* Throws if a read operation is done on a write only package.
* @see org.apache.poi.openxml4j.opc.PackageAccess
@@ -471,7 +471,7 @@
/**
* Retrieves or creates if none exists, core package property part.
- *
+ *
* @return The PackageProperties part of this package.
*/
public PackageProperties getPackageProperties()
@@ -487,7 +487,7 @@
/**
* Retrieve a part identified by its name.
- *
+ *
* @param partName
* Part name of the part to retrieve.
* @return The part with the specified name, else <code>null</code>.
@@ -511,7 +511,7 @@
/**
* Retrieve parts by content type.
- *
+ *
* @param contentType
* The content type criteria.
* @return All part associated to the specified content type.
@@ -527,7 +527,7 @@
/**
* Retrieve parts by relationship type.
- *
+ *
* @param relationshipType
* Relationship type.
* @return All parts which are the target of a relationship with the
@@ -547,7 +547,7 @@
/**
* Get the target part from the specified relationship.
- *
+ *
* @param partRel
* The part relationship uses to retrieve the part.
*/
@@ -571,7 +571,7 @@
/**
* Load the parts of the archive if it has not been done yet The
* relationships of each part are not loaded
- *
+ *
* @return All this package's parts.
*/
public ArrayList<PackagePart> getParts() throws InvalidFormatException {
@@ -588,10 +588,10 @@
PackagePart[] parts = this.getPartsImpl();
this.partList = new PackagePartCollection();
for (PackagePart part : parts) {
- if (partList.containsKey(part.partName))
+ if (partList.containsKey(part._partName))
throw new InvalidFormatException(
"A part with the name '"
- + part.partName
+ + part._partName
+ "' already exist : Packages shall not contain equivalent part names and package implementers shall neither create nor recognize packages with equivalent part names. [M1.12]");
// Check OPC compliance rule M4.1
@@ -605,29 +605,29 @@
}
PartUnmarshaller partUnmarshaller = partUnmarshallers
- .get(part.contentType);
+ .get(part._contentType);
if (partUnmarshaller != null) {
UnmarshallContext context = new UnmarshallContext(this,
- part.partName);
+ part._partName);
try {
PackagePart unmarshallPart = partUnmarshaller
.unmarshall(context, part.getInputStream());
- partList.put(unmarshallPart.partName, unmarshallPart);
+ partList.put(unmarshallPart._partName, unmarshallPart);
// Core properties case
if (unmarshallPart instanceof PackagePropertiesPart)
this.packageProperties = (PackagePropertiesPart) unmarshallPart;
} catch (IOException ioe) {
logger.log(POILogger.WARN, "Unmarshall operation : IOException for "
- + part.partName);
+ + part._partName);
continue;
} catch (InvalidOperationException invoe) {
throw new InvalidFormatException(invoe.getMessage());
}
} else {
try {
- partList.put(part.partName, part);
+ partList.put(part._partName, part);
} catch (InvalidOperationException e) {
throw new InvalidFormatException(e.getMessage());
}
@@ -640,7 +640,7 @@
/**
* Create and add a part, with the specified name and content type, to the
* package.
- *
+ *
* @param partName
* Part name.
* @param contentType
@@ -650,7 +650,7 @@
* If rule M1.12 is not verified : Packages shall not contain
* equivalent part names and package implementers shall neither
* create nor recognize packages with equivalent part names.
- * @see #createPartImpl(PackagePartName, String, boolean)
+ * @see #createPartImpl(PackagePartName, String, boolean)
*/
public PackagePart createPart(PackagePartName partName, String contentType) {
return this.createPart(partName, contentType, true);
@@ -660,7 +660,7 @@
* Create and add a part, with the specified name and content type, to the
* package. For general purpose, prefer the overload version of this method
* without the 'loadRelationships' parameter.
- *
+ *
* @param partName
* Part name.
* @param contentType
@@ -721,7 +721,7 @@
/**
* Add a part to the package.
- *
+ *
* @param partName
* Part name of the part to create.
* @param contentType
@@ -730,7 +730,7 @@
* the contents to add. In order to have faster operation in
* document merge, the data are stored in memory not on a hard
* disk
- *
+ *
* @return The new part.
* @see #createPart(PackagePartName, String)
*/
@@ -764,7 +764,7 @@
* Add the specified part to the package. If a part already exists in the
* package with the same name as the one specified, then we replace the old
* part by the specified part.
- *
+ *
* @param part
* The part to add (or replace).
* @return The part added to the package, the same as the one specified.
@@ -779,20 +779,20 @@
throw new IllegalArgumentException("part");
}
- if (partList.containsKey(part.partName)) {
- if (!partList.get(part.partName).isDeleted()) {
+ if (partList.containsKey(part._partName)) {
+ if (!partList.get(part._partName).isDeleted()) {
throw new InvalidOperationException(
"A part with the name '"
- + part.partName.getName()
+ + part._partName.getName()
+ "' already exists : Packages shall not contain equivalent part names and package implementers shall neither create nor recognize packages with equivalent part names. [M1.12]");
}
// If the specified partis flagged as deleted, we make it
// available
part.setDeleted(false);
// and delete the old part to replace it thereafeter
- this.partList.remove(part.partName);
+ this.partList.remove(part._partName);
}
- this.partList.put(part.partName, part);
+ this.partList.put(part._partName, part);
this.isDirty = true;
return part;
}
@@ -800,7 +800,7 @@
/**
* Remove the specified part in this package. If this part is relationship
* part, then delete all relationships in the source part.
- *
+ *
* @param part
* The part to remove. If <code>null</code>, skip the action.
* @see #removePart(PackagePartName)
@@ -814,7 +814,7 @@
/**
* Remove a part in this package. If this part is relationship part, then
* delete all relationships in the source part.
- *
+ *
* @param partName
* The part name of the part to remove.
*/
@@ -867,7 +867,7 @@
* Remove a part from this package as well as its relationship part, if one
* exists, and all parts listed in the relationship part. Be aware that this
* do not delete relationships which target the specified part.
- *
+ *
* @param partName
* The name of the part to delete.
* @throws InvalidFormatException
@@ -893,11 +893,11 @@
}
// Finally delete its relationship part if one exists
- this.removePart(relPart.partName);
+ this.removePart(relPart._partName);
}
// Delete the specified part
- this.removePart(partToRemove.partName);
+ this.removePart(partToRemove._partName);
}
/**
@@ -905,7 +905,7 @@
* part if one exists. Prefer the use of this method to delete a part in the
* package, compare to the remove() methods that don't remove associated
* relationships part.
- *
+ *
* @param partName
* Name of the part to delete
*/
@@ -925,7 +925,7 @@
* apply to all parts in the relationships part of the specified part.
* Prefer the use of this method to delete a part in the package, compare to
* the remove() methods that don't remove associated relationships part.
- *
+ *
* @param partName
* Name of the part to delete
*/
@@ -961,7 +961,7 @@
/**
* Check if a part already exists in this package from its name.
- *
+ *
* @param partName
* Part name to check.
* @return <i>true</i> if the part is logically added to this package, else
@@ -973,18 +973,18 @@
/**
* Add a relationship to the package (except relationships part).
- *
+ *
* Check rule M4.1 : The format designer shall specify and the format
* producer shall create at most one core properties relationship for a
* package. A format consumer shall consider more than one core properties
* relationship for a package to be an error. If present, the relationship
* shall target the Core Properties part.
- *
+ *
* Check rule M1.25: The Relationships part shall not have relationships to
* any other part. Package implementers shall enforce this requirement upon
* the attempt to create such a relationship and shall treat any such
* relationship as invalid.
- *
+ *
* @param targetPartName
* Target part name.
* @param targetMode
@@ -1032,7 +1032,7 @@
/**
* Add a package relationship.
- *
+ *
* @param targetPartName
* Target part name.
* @param targetMode
@@ -1049,11 +1049,11 @@
/**
* Adds an external relationship to a part (except relationships part).
- *
+ *
* The targets of external relationships are not subject to the same
* validity checks that internal ones are, as the contents is potentially
* any file, URL or similar.
- *
+ *
* @param target
* External target of the relationship
* @param relationshipType
@@ -1069,11 +1069,11 @@
/**
* Adds an external relationship to a part (except relationships part).
- *
+ *
* The targets of external relationships are not subject to the same
* validity checks that internal ones are, as the contents is potentially
* any file, URL or similar.
- *
+ *
* @param target
* External target of the relationship
* @param relationshipType
@@ -1109,7 +1109,7 @@
/**
* Delete a relationship from this package.
- *
+ *
* @param id
* Id of the relationship to delete.
*/
@@ -1122,7 +1122,7 @@
/**
* Retrieves all package relationships.
- *
+ *
* @return All package relationships of this package.
* @throws OpenXML4JException
* @see #getRelationshipsHelper(String)
@@ -1133,7 +1133,7 @@
/**
* Retrieves all relationships with the specified type.
- *
+ *
* @param relationshipType
* The filter specifying the relationship type.
* @return All relationships with the specified relationship type.
@@ -1150,7 +1150,7 @@
/**
* Retrieves all relationships with specified id (normally just ine because
* a relationship id is supposed to be unique).
- *
+ *
* @param id
* Id of the wanted relationship.
*/
@@ -1214,7 +1214,7 @@
/**
* Add a marshaller.
- *
+ *
* @param contentType
* The content type to bind to the specified marshaller.
* @param marshaller
@@ -1231,7 +1231,7 @@
/**
* Add an unmarshaller.
- *
+ *
* @param contentType
* The content type to bind to the specified unmarshaller.
* @param unmarshaller
@@ -1250,7 +1250,7 @@
/**
* Remove a marshaller by its content type.
- *
+ *
* @param contentType
* The content type associated with the marshaller to remove.
*/
@@ -1260,7 +1260,7 @@
/**
* Remove an unmarshaller by its content type.
- *
+ *
* @param contentType
* The content type associated with the unmarshaller to remove.
*/
@@ -1272,7 +1272,7 @@
/**
* Get the package access mode.
- *
+ *
* @return the packageAccess The current package access.
*/
public PackageAccess getPackageAccess() {
@@ -1281,7 +1281,7 @@
/**
* Validates the package compliance with the OPC specifications.
- *
+ *
* @return <b>true</b> if the package is valid else <b>false</b>
*/
public boolean validatePackage(OPCPackage pkg) throws InvalidFormatException {
@@ -1290,7 +1290,7 @@
/**
* Save the document in the specified file.
- *
+ *
* @param targetFile
* Destination file.
* @throws IOException
@@ -1313,7 +1313,7 @@
/**
* Save the document in the specified output stream.
- *
+ *
* @param outputStream
* The stream to save the package.
* @see #saveImpl(OutputStream)
@@ -1326,7 +1326,7 @@
/**
* Core method to create a package part. This method must be implemented by
* the subclass.
- *
+ *
* @param partName
* URI of the part to create.
* @param contentType
@@ -1339,7 +1339,7 @@
/**
* Core method to delete a package part. This method must be implemented by
* the subclass.
- *
+ *
* @param partName
* The URI of the part to delete.
*/
@@ -1352,7 +1352,7 @@
/**
* Close the package and cause a save of the package.
- *
+ *
*/
protected abstract void closeImpl() throws IOException;
@@ -1364,7 +1364,7 @@
/**
* Save the package into the specified output stream.
- *
+ *
* @param outputStream
* The output stream use to save this package.
*/
@@ -1373,7 +1373,7 @@
/**
* Get the package part mapped to the specified URI.
- *
+ *
* @param partName
* The URI of the part to retrieve.
* @return The package part located by the specified URI, else <b>null</b>.
@@ -1382,7 +1382,7 @@
/**
* Get all parts link to the package.
- *
+ *
* @return A list of the part owned by the package.
*/
protected abstract PackagePart[] getPartsImpl()
Modified: poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackagePart.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackagePart.java?rev=805284&r1=805283&r2=805284&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackagePart.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackagePart.java Tue Aug 18 05:29:53 2009
@@ -30,7 +30,7 @@
/**
* Provides a base class for parts stored in a Package.
- *
+ *
* @author Julien Chable
* @version 0.9
*/
@@ -39,36 +39,36 @@
/**
* This part's container.
*/
- protected OPCPackage container;
+ protected OPCPackage _container;
/**
* The part name. (required by the specification [M1.1])
*/
- protected PackagePartName partName;
+ protected PackagePartName _partName;
/**
* The type of content of this part. (required by the specification [M1.2])
*/
- protected ContentType contentType;
+ protected ContentType _contentType;
/**
* Flag to know if this part is a relationship.
*/
- private boolean isRelationshipPart;
+ private boolean _isRelationshipPart;
/**
* Flag to know if this part has been logically deleted.
*/
- private boolean isDeleted;
+ private boolean _isDeleted;
/**
* This part's relationships.
*/
- private PackageRelationshipCollection relationships;
+ private PackageRelationshipCollection _relationships;
/**
* Constructor.
- *
+ *
* @param pack
* Parent package.
* @param partName
@@ -85,7 +85,7 @@
/**
* Constructor.
- *
+ *
* @param pack
* Parent package.
* @param partName
@@ -100,12 +100,12 @@
protected PackagePart(OPCPackage pack, PackagePartName partName,
ContentType contentType, boolean loadRelationships)
throws InvalidFormatException {
- this.partName = partName;
- this.contentType = contentType;
- this.container = (ZipPackage) pack; // TODO - enforcing ZipPackage here - perhaps should change constructor signature
+ _partName = partName;
+ _contentType = contentType;
+ _container = pack;
// Check if this part is a relationship part
- isRelationshipPart = this.partName.isRelationshipPartURI();
+ _isRelationshipPart = this._partName.isRelationshipPartURI();
// Load relationships if any
if (loadRelationships)
@@ -114,7 +114,7 @@
/**
* Constructor.
- *
+ *
* @param pack
* Parent package.
* @param partName
@@ -130,11 +130,11 @@
/**
* Adds an external relationship to a part (except relationships part).
- *
+ *
* The targets of external relationships are not subject to the same
* validity checks that internal ones are, as the contents is potentially
* any file, URL or similar.
- *
+ *
* @param target
* External target of the relationship
* @param relationshipType
@@ -150,11 +150,11 @@
/**
* Adds an external relationship to a part (except relationships part).
- *
+ *
* The targets of external relationships are not subject to the same
* validity checks that internal ones are, as the contents is potentially
* any file, URL or similar.
- *
+ *
* @param target
* External target of the relationship
* @param relationshipType
@@ -174,8 +174,8 @@
throw new IllegalArgumentException("relationshipType");
}
- if (relationships == null) {
- relationships = new PackageRelationshipCollection();
+ if (_relationships == null) {
+ _relationships = new PackageRelationshipCollection();
}
URI targetURI;
@@ -185,13 +185,13 @@
throw new IllegalArgumentException("Invalid target - " + e);
}
- return relationships.addRelationship(targetURI, TargetMode.EXTERNAL,
+ return _relationships.addRelationship(targetURI, TargetMode.EXTERNAL,
relationshipType, id);
}
/**
* Add a relationship to a part (except relationships part).
- *
+ *
* @param targetPartName
* Name of the target part. This one must be relative to the
* source root directory of the part.
@@ -227,7 +227,7 @@
* @param id
* Relationship unique id.
* @return The newly created and added relationship
- *
+ *
* @throws InvalidFormatException
* If the URI point to a relationship part URI.
* @see org.apache.poi.openxml4j.opc.RelationshipSource#addRelationship(org.apache.poi.openxml4j.opc.PackagePartName,
@@ -235,7 +235,7 @@
*/
public PackageRelationship addRelationship(PackagePartName targetPartName,
TargetMode targetMode, String relationshipType, String id) {
- container.throwExceptionIfReadOnly();
+ _container.throwExceptionIfReadOnly();
if (targetPartName == null) {
throw new IllegalArgumentException("targetPartName");
@@ -247,22 +247,22 @@
throw new IllegalArgumentException("relationshipType");
}
- if (this.isRelationshipPart || targetPartName.isRelationshipPartURI()) {
+ if (this._isRelationshipPart || targetPartName.isRelationshipPartURI()) {
throw new InvalidOperationException(
"Rule M1.25: The Relationships part shall not have relationships to any other part.");
}
- if (relationships == null) {
- relationships = new PackageRelationshipCollection();
+ if (_relationships == null) {
+ _relationships = new PackageRelationshipCollection();
}
- return relationships.addRelationship(targetPartName.getURI(),
+ return _relationships.addRelationship(targetPartName.getURI(),
targetMode, relationshipType, id);
}
/**
* Add a relationship to a part (except relationships part).
- *
+ *
* @param targetURI
* URI the target part. Must be relative to the source root
* directory of the part.
@@ -297,7 +297,7 @@
* @param id
* Relationship unique id.
* @return The newly created and added relationship
- *
+ *
* @throws InvalidFormatException
* If the URI point to a relationship part URI.
* @see org.apache.poi.openxml4j.opc.RelationshipSource#addRelationship(org.apache.poi.openxml4j.opc.PackagePartName,
@@ -305,7 +305,7 @@
*/
public PackageRelationship addRelationship(URI targetURI,
TargetMode targetMode, String relationshipType, String id) {
- container.throwExceptionIfReadOnly();
+ _container.throwExceptionIfReadOnly();
if (targetURI == null) {
throw new IllegalArgumentException("targetPartName");
@@ -319,17 +319,17 @@
// Try to retrieve the target part
- if (this.isRelationshipPart
+ if (this._isRelationshipPart
|| PackagingURIHelper.isRelationshipPartURI(targetURI)) {
throw new InvalidOperationException(
"Rule M1.25: The Relationships part shall not have relationships to any other part.");
}
- if (relationships == null) {
- relationships = new PackageRelationshipCollection();
+ if (_relationships == null) {
+ _relationships = new PackageRelationshipCollection();
}
- return relationships.addRelationship(targetURI,
+ return _relationships.addRelationship(targetURI,
targetMode, relationshipType, id);
}
@@ -337,27 +337,27 @@
* @see org.apache.poi.openxml4j.opc.RelationshipSource#clearRelationships()
*/
public void clearRelationships() {
- if (relationships != null) {
- relationships.clear();
+ if (_relationships != null) {
+ _relationships.clear();
}
}
/**
* Delete the relationship specified by its id.
- *
+ *
* @param id
* The ID identified the part to delete.
* @see org.apache.poi.openxml4j.opc.RelationshipSource#removeRelationship(java.lang.String)
*/
public void removeRelationship(String id) {
- this.container.throwExceptionIfReadOnly();
- if (this.relationships != null)
- this.relationships.removeRelationship(id);
+ this._container.throwExceptionIfReadOnly();
+ if (this._relationships != null)
+ this._relationships.removeRelationship(id);
}
/**
* Retrieve all the relationships attached to this part.
- *
+ *
* @return This part's relationships.
* @throws OpenXML4JException
* @see org.apache.poi.openxml4j.opc.RelationshipSource#getRelationships()
@@ -369,20 +369,20 @@
/**
* Retrieves a package relationship from its id.
- *
+ *
* @param id
* ID of the package relationship to retrieve.
* @return The package relationship
* @see org.apache.poi.openxml4j.opc.RelationshipSource#getRelationship(java.lang.String)
*/
public PackageRelationship getRelationship(String id) {
- return this.relationships.getRelationshipByID(id);
+ return this._relationships.getRelationshipByID(id);
}
/**
* Retrieve all relationships attached to this part which have the specified
* type.
- *
+ *
* @param relationshipType
* Relationship type filter.
* @return All relationships from this part that have the specified type.
@@ -394,14 +394,14 @@
*/
public PackageRelationshipCollection getRelationshipsByType(
String relationshipType) throws InvalidFormatException {
- container.throwExceptionIfWriteOnly();
+ _container.throwExceptionIfWriteOnly();
return getRelationshipsCore(relationshipType);
}
/**
* Implementation of the getRelationships method().
- *
+ *
* @param filter
* Relationship type filter. If <i>null</i> then the filter is
* disabled and return all the relationships.
@@ -415,29 +415,29 @@
*/
private PackageRelationshipCollection getRelationshipsCore(String filter)
throws InvalidFormatException {
- this.container.throwExceptionIfWriteOnly();
- if (relationships == null) {
+ this._container.throwExceptionIfWriteOnly();
+ if (_relationships == null) {
this.throwExceptionIfRelationship();
- relationships = new PackageRelationshipCollection(this);
+ _relationships = new PackageRelationshipCollection(this);
}
- return new PackageRelationshipCollection(relationships, filter);
+ return new PackageRelationshipCollection(_relationships, filter);
}
/**
* Knows if the part have any relationships.
- *
+ *
* @return <b>true</b> if the part have at least one relationship else
* <b>false</b>.
* @see org.apache.poi.openxml4j.opc.RelationshipSource#hasRelationships()
*/
public boolean hasRelationships() {
- return (!this.isRelationshipPart && (relationships != null && relationships
+ return (!this._isRelationshipPart && (_relationships != null && _relationships
.size() > 0));
}
/**
* Checks if the specified relationship is part of this package part.
- *
+ *
* @param rel
* The relationship to check.
* @return <b>true</b> if the specified relationship exists in this part,
@@ -458,7 +458,7 @@
/**
* Get the input stream of this part to read its content.
- *
+ *
* @return The input stream of the content of this part, else
* <code>null</code>.
*/
@@ -466,9 +466,9 @@
InputStream inStream = this.getInputStreamImpl();
if (inStream == null) {
throw new IOException("Can't obtain the input stream from "
- + partName.getName());
- } else
- return inStream;
+ + _partName.getName());
+ }
+ return inStream;
}
/**
@@ -476,7 +476,7 @@
* Zip package, it'll be transform intot a <i>MemoryPackagePart</i> in
* order to write inside (the standard Java API doesn't allow to write in
* the file)
- *
+ *
* @see org.apache.poi.openxml4j.opc.internal.MemoryPackagePart
*/
public OutputStream getOutputStream() {
@@ -485,12 +485,12 @@
// this part into a MemoryPackagePart instance for write purpose.
if (this instanceof ZipPackagePart) {
// Delete logically this part
- this.container.removePart(this.partName);
+ _container.removePart(this._partName);
// Create a memory part
- PackagePart part = container.createPart(this.partName,
- this.contentType.toString(), false);
- part.relationships = this.relationships;
+ PackagePart part = _container.createPart(this._partName,
+ this._contentType.toString(), false);
+ part._relationships = this._relationships;
if (part == null) {
throw new InvalidOperationException(
"Can't create a temporary part !");
@@ -504,27 +504,27 @@
/**
* Throws an exception if this package part is a relationship part.
- *
+ *
* @throws InvalidOperationException
* If this part is a relationship part.
*/
private void throwExceptionIfRelationship()
throws InvalidOperationException {
- if (this.isRelationshipPart)
+ if (this._isRelationshipPart)
throw new InvalidOperationException(
"Can do this operation on a relationship part !");
}
/**
* Ensure the package relationships collection instance is built.
- *
+ *
* @throws InvalidFormatException
* Throws if
*/
private void loadRelationships() throws InvalidFormatException {
- if (this.relationships == null && !this.isRelationshipPart) {
+ if (this._relationships == null && !this._isRelationshipPart) {
this.throwExceptionIfRelationship();
- relationships = new PackageRelationshipCollection(this);
+ _relationships = new PackageRelationshipCollection(this);
}
}
@@ -536,22 +536,22 @@
* @return the uri
*/
public PackagePartName getPartName() {
- return partName;
+ return _partName;
}
/**
* @return the contentType
*/
public String getContentType() {
- return contentType.toString();
+ return _contentType.toString();
}
/**
* Set the content type.
- *
+ *
* @param contentType
* the contentType to set
- *
+ *
* @throws InvalidFormatException
* Throws if the content type is not valid.
* @throws InvalidOperationException
@@ -560,29 +560,29 @@
*/
public void setContentType(String contentType)
throws InvalidFormatException {
- if (container == null)
- this.contentType = new ContentType(contentType);
+ if (_container == null)
+ this._contentType = new ContentType(contentType);
else
throw new InvalidOperationException(
"You can't change the content type of a part.");
}
public OPCPackage getPackage() {
- return container;
+ return _container;
}
/**
* @return true if this part is a relationship
*/
public boolean isRelationshipPart() {
- return this.isRelationshipPart;
+ return this._isRelationshipPart;
}
/**
* @return true if this part has been logically deleted
*/
public boolean isDeleted() {
- return isDeleted;
+ return _isDeleted;
}
/**
@@ -590,20 +590,20 @@
* the isDeleted to set
*/
public void setDeleted(boolean isDeleted) {
- this.isDeleted = isDeleted;
+ this._isDeleted = isDeleted;
}
@Override
public String toString() {
- return "Name: " + this.partName + " - Content Type: "
- + this.contentType.toString();
+ return "Name: " + this._partName + " - Content Type: "
+ + this._contentType.toString();
}
/*-------------- Abstract methods ------------- */
/**
* Abtract method that get the input stream of this part.
- *
+ *
* @exception IOException
* Throws if an IO Exception occur in the implementation
* method.
@@ -619,7 +619,7 @@
* Save the content of this part and the associated relationships part (if
* this part own at least one relationship) into the specified output
* stream.
- *
+ *
* @param zos
* Output stream to save this part.
* @throws OpenXML4JException
@@ -629,7 +629,7 @@
/**
* Load the content of this part.
- *
+ *
* @param ios
* The input stream of the content to load.
* @return <b>true</b> if the content has been successfully loaded, else
Modified: poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationship.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationship.java?rev=805284&r1=805283&r2=805284&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationship.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationship.java Tue Aug 18 05:29:53 2009
@@ -22,7 +22,7 @@
/**
* A part relationship.
- *
+ *
* @author Julien Chable
* @version 1.0
*/
@@ -86,7 +86,7 @@
/**
* Constructor.
- *
+ *
* @param pkg
* @param sourcePart
* @param targetUri
@@ -171,19 +171,19 @@
}
/**
- *
+ *
* @return URL of the source part of this relationship
*/
public URI getSourceURI() {
if (source == null) {
return PackagingURIHelper.PACKAGE_ROOT_URI;
}
- return source.partName.getURI();
+ return source._partName.getURI();
}
/**
* public URI getSourceUri(){ }
- *
+ *
* @return the targetMode
*/
public TargetMode getTargetMode() {
@@ -199,7 +199,7 @@
if(targetMode == TargetMode.EXTERNAL) {
return targetUri;
}
-
+
// Internal target
// If it isn't absolute, resolve it relative
// to ourselves
Modified: poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationshipCollection.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationshipCollection.java?rev=805284&r1=805283&r2=805284&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationshipCollection.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/PackageRelationshipCollection.java Tue Aug 18 05:29:53 2009
@@ -34,7 +34,7 @@
/**
* Represents a collection of PackageRelationship elements that are owned by a
* given PackagePart or the Package.
- *
+ *
* @author Julien Chable, CDubettier
* @version 0.1
*/
@@ -83,11 +83,11 @@
/**
* Copy constructor.
- *
+ *
* This collection will contain only elements from the specified collection
* for which the type is compatible with the specified relationship type
* filter.
- *
+ *
* @param coll
* Collection to import.
* @param filter
@@ -112,21 +112,21 @@
/**
* Constructor.
- *
+ *
* @throws InvalidFormatException
* Throws if the format of the content part is invalid.
- *
+ *
* @throws InvalidOperationException
* Throws if the specified part is a relationship part.
*/
public PackageRelationshipCollection(PackagePart part)
throws InvalidFormatException {
- this(part.container, part);
+ this(part._container, part);
}
/**
* Constructor. Parse the existing package relationship part if one exists.
- *
+ *
* @param container
* The parent package.
* @param part
@@ -159,7 +159,7 @@
/**
* Get the relationship part name of the specified part.
- *
+ *
* @param part
* The part .
* @return The relationship part name of the specified part. Be careful,
@@ -181,7 +181,7 @@
/**
* Add the specified relationship to the collection.
- *
+ *
* @param relPart
* The relationship to add.
*/
@@ -192,7 +192,7 @@
/**
* Add a relationship to the collection.
- *
+ *
* @param targetUri
* Target URI.
* @param targetMode
@@ -224,7 +224,7 @@
/**
* Remove a relationship by its ID.
- *
+ *
* @param id
* The relationship ID to remove.
*/
@@ -240,7 +240,7 @@
/**
* Remove a relationship by its reference.
- *
+ *
* @param rel
* The relationship to delete.
*/
@@ -254,7 +254,7 @@
/**
* Retrieves a relationship by its index in the collection.
- *
+ *
* @param index
* Must be a value between [0-relationships_count-1]
*/
@@ -273,7 +273,7 @@
/**
* Retrieves a package relationship based on its id.
- *
+ *
* @param id
* ID of the package relationship to retrieve.
* @return The package relationship identified by the specified id.
@@ -291,7 +291,7 @@
/**
* Parse the relationship part and add all relationship in this collection.
- *
+ *
* @param relPart
* The package part to parse.
* @throws InvalidFormatException
@@ -376,7 +376,7 @@
/**
* Retrieves all relations with the specified type.
- *
+ *
* @param typeFilter
* Relationship type filter. If <b>null</b> then all
* relationships are returned.
@@ -398,7 +398,7 @@
/**
* Get an iterator of a collection with all relationship with the specified
* type.
- *
+ *
* @param typeFilter
* Type filter.
* @return An iterator to a collection containing all relationships with the
@@ -429,15 +429,15 @@
} else {
str = relationshipsByID.size() + " relationship(s) = [";
}
- if ((relationshipPart != null) && (relationshipPart.partName != null)) {
- str = str + "," + relationshipPart.partName;
+ if ((relationshipPart != null) && (relationshipPart._partName != null)) {
+ str = str + "," + relationshipPart._partName;
} else {
str = str + ",relationshipPart=null";
}
// Source of this relationship
- if ((sourcePart != null) && (sourcePart.partName != null)) {
- str = str + "," + sourcePart.partName;
+ if ((sourcePart != null) && (sourcePart._partName != null)) {
+ str = str + "," + sourcePart._partName;
} else {
str = str + ",sourcePart=null";
}
Modified: poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/RelationshipSource.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/RelationshipSource.java?rev=805284&r1=805283&r2=805284&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/RelationshipSource.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/RelationshipSource.java Tue Aug 18 05:29:53 2009
@@ -24,7 +24,7 @@
/**
* Add a relationship to a part (except relationships part).
- *
+ *
* @param targetPartName
* Name of the target part. This one must be relative to the
* source root directory of the part.
@@ -56,7 +56,7 @@
* @param id
* Relationship unique id.
* @return The newly created and added relationship
- *
+ *
* @throws InvalidFormatException
* If the URI point to a relationship part URI.
*/
@@ -67,28 +67,28 @@
/**
* Adds an external relationship to a part
* (except relationships part).
- *
+ *
* The targets of external relationships are not
* subject to the same validity checks that internal
* ones are, as the contents is potentially
* any file, URL or similar.
- *
+ *
* @param target External target of the relationship
* @param relationshipType Type of relationship.
* @return The newly created and added relationship
* @see org.apache.poi.openxml4j.opc.RelationshipSource#addExternalRelationship(java.lang.String, java.lang.String)
*/
public PackageRelationship addExternalRelationship(String target, String relationshipType);
-
+
/**
* Adds an external relationship to a part
* (except relationships part).
- *
+ *
* The targets of external relationships are not
* subject to the same validity checks that internal
* ones are, as the contents is potentially
* any file, URL or similar.
- *
+ *
* @param target External target of the relationship
* @param relationshipType Type of relationship.
* @param id Relationship unique id.
@@ -96,7 +96,7 @@
* @see org.apache.poi.openxml4j.opc.RelationshipSource#addExternalRelationship(java.lang.String, java.lang.String)
*/
public PackageRelationship addExternalRelationship(String target, String relationshipType, String id);
-
+
/**
* Delete all the relationships attached to this.
*/
@@ -104,7 +104,7 @@
/**
* Delete the relationship specified by its id.
- *
+ *
* @param id
* The ID identified the part to delete.
*/
@@ -112,7 +112,7 @@
/**
* Retrieve all the relationships attached to this.
- *
+ *
* @return This part's relationships.
* @throws OpenXML4JException
*/
@@ -121,7 +121,7 @@
/**
* Retrieves a package relationship from its id.
- *
+ *
* @param id
* ID of the package relationship to retrieve.
* @return The package relationship
@@ -131,7 +131,7 @@
/**
* Retrieve all relationships attached to this part which have the specified
* type.
- *
+ *
* @param relationshipType
* Relationship type filter.
* @return All relationships from this part that have the specified type.
@@ -141,12 +141,12 @@
* If the package is open in write only mode.
*/
public abstract PackageRelationshipCollection getRelationshipsByType(
- String relationshipType) throws InvalidFormatException,
+ String relationshipType) throws InvalidFormatException,
IllegalArgumentException, OpenXML4JException;
/**
* Knows if the part have any relationships.
- *
+ *
* @return <b>true</b> if the part have at least one relationship else
* <b>false</b>.
*/
@@ -154,13 +154,12 @@
/**
* Checks if the specified relationship is part of this package part.
- *
+ *
* @param rel
* The relationship to check.
* @return <b>true</b> if the specified relationship exists in this part,
* else returns <b>false</b>
*/
- @SuppressWarnings("finally")
public abstract boolean isRelationshipExists(PackageRelationship rel);
}
Modified: poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/ZipPackage.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/ZipPackage.java?rev=805284&r1=805283&r2=805284&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/ZipPackage.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/ZipPackage.java Tue Aug 18 05:29:53 2009
@@ -423,7 +423,7 @@
+ ZipHelper.getZipItemNameFromOPCName(part
.getPartName().getName()) + "'");
PartMarshaller marshaller = partMarshallers
- .get(part.contentType);
+ .get(part._contentType);
if (marshaller != null) {
if (!marshaller.marshall(part, zos)) {
throw new OpenXML4JException(
Modified: poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/ZipPackagePart.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/ZipPackagePart.java?rev=805284&r1=805283&r2=805284&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/ZipPackagePart.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/ZipPackagePart.java Tue Aug 18 05:29:53 2009
@@ -29,7 +29,7 @@
/**
* Zip implementation of a PackagePart.
- *
+ *
* @author Julien Chable
* @version 1.0
* @see PackagePart
@@ -43,7 +43,7 @@
/**
* Constructor.
- *
+ *
* @param container
* The container package.
* @param partName
@@ -60,7 +60,7 @@
/**
* Constructor.
- *
+ *
* @param container
* The container package.
* @param zipEntry
@@ -81,7 +81,7 @@
/**
* Get the zip entry of this part.
- *
+ *
* @return The zip entry in the zip structure coresponding to this part.
*/
public ZipEntry getZipArchive() {
@@ -91,21 +91,21 @@
/**
* Implementation of the getInputStream() which return the inputStream of
* this part zip entry.
- *
+ *
* @return Input stream of this part zip entry.
*/
@Override
protected InputStream getInputStreamImpl() throws IOException {
// We use the getInputStream() method from java.util.zip.ZipFile
// class which return an InputStream to this part zip entry.
- return ((ZipPackage) container).getZipArchive()
+ return ((ZipPackage) _container).getZipArchive()
.getInputStream(zipEntry);
}
/**
* Implementation of the getOutputStream(). Return <b>null</b>. Normally
* will never be called since the MemoryPackage is use instead.
- *
+ *
* @return <b>null</b>
*/
@Override
@@ -119,7 +119,7 @@
}
@Override
- public boolean load(InputStream ios) throws InvalidFormatException {
+ public boolean load(InputStream ios) {
throw new InvalidOperationException("Method not implemented !");
}
Modified: poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentTypeManager.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentTypeManager.java?rev=805284&r1=805283&r2=805284&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentTypeManager.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/ContentTypeManager.java Tue Aug 18 05:29:53 2009
@@ -43,9 +43,8 @@
/**
* Manage package content types ([Content_Types].xml part).
- *
+ *
* @author Julien Chable
- * @version 1.0
*/
public abstract class ContentTypeManager {
@@ -90,7 +89,7 @@
/**
* Constructor. Parses the content of the specified input stream.
- *
+ *
* @param in
* If different of <i>null</i> then the content types part is
* retrieve and parse.
@@ -161,7 +160,7 @@
/**
* Add an override content type for a specific part.
- *
+ *
* @param partName
* Name of the part.
* @param contentType
@@ -176,7 +175,7 @@
/**
* Add a content type associated with the specified extension.
- *
+ *
* @param extension
* The part name extension to bind to a content type.
* @param contentType
@@ -267,7 +266,7 @@
/**
* Check if the specified content type is already register.
- *
+ *
* @param contentType
* The content type to check.
* @return <code>true</code> if the specified content type is already
@@ -315,7 +314,7 @@
* @return The content type associated with the URI (in case of an override
* content type) or the extension (in case of default content type),
* else <code>null</code>.
- *
+ *
* @exception OpenXML4JRuntimeException
* Throws if the content type manager is not able to find the
* content from an existing part.
@@ -342,9 +341,8 @@
if (this.container != null && this.container.getPart(partName) != null) {
throw new OpenXML4JRuntimeException(
"Rule M2.4 exception : this error should NEVER happen, if so please send a mail to the developers team, thanks !");
- } else {
- return null;
}
+ return null;
}
/**
@@ -358,7 +356,7 @@
/**
* Clear all override content types.
- *
+ *
*/
public void clearOverrideContentTypes() {
if (this.overrideContentType != null)
@@ -367,7 +365,7 @@
/**
* Parse the content types part.
- *
+ *
* @throws InvalidFormatException
* Throws if the content type doesn't exist or the XML format is
* invalid.
@@ -414,7 +412,7 @@
/**
* Save the contents type part.
- *
+ *
* @param outStream
* The output stream use to save the XML content of the content
* types part.
@@ -448,7 +446,7 @@
/**
* Use to append specific type XML elements, use by the save() method.
- *
+ *
* @param root
* XML parent element use to append this override type element.
* @param entry
@@ -459,13 +457,13 @@
Entry<PackagePartName, String> entry) {
root.addElement(OVERRIDE_TAG_NAME).addAttribute(
PART_NAME_ATTRIBUTE_NAME,
- ((PackagePartName) entry.getKey()).getName()).addAttribute(
- CONTENT_TYPE_ATTRIBUTE_NAME, (String) entry.getValue());
+ entry.getKey().getName()).addAttribute(
+ CONTENT_TYPE_ATTRIBUTE_NAME, entry.getValue());
}
/**
* Use to append default types XML elements, use by the save() metid.
- *
+ *
* @param root
* XML parent element use to append this default type element.
* @param entry
@@ -474,16 +472,16 @@
*/
private void appendDefaultType(Element root, Entry<String, String> entry) {
root.addElement(DEFAULT_TAG_NAME).addAttribute(
- EXTENSION_ATTRIBUTE_NAME, (String) entry.getKey())
+ EXTENSION_ATTRIBUTE_NAME, entry.getKey())
.addAttribute(CONTENT_TYPE_ATTRIBUTE_NAME,
- (String) entry.getValue());
+ entry.getValue());
}
/**
* Specific implementation of the save method. Call by the save() method,
* call before exiting.
- *
+ *
* @param out
* The output stream use to write the content type XML.
*/
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org