diff --git a/src/java/org/apache/poi/ddf/EscherContainerRecord.java b/src/java/org/apache/poi/ddf/EscherContainerRecord.java index a79ebeccf6..4aa9567a2a 100644 --- a/src/java/org/apache/poi/ddf/EscherContainerRecord.java +++ b/src/java/org/apache/poi/ddf/EscherContainerRecord.java @@ -254,12 +254,16 @@ public final class EscherContainerRecord extends EscherRecord { + children.toString(); } - public EscherSpRecord getChildById(short recordId) { - Iterator iterator = _childRecords.iterator(); - while (iterator.hasNext()) { - EscherRecord r = iterator.next(); - if (r.getRecordId() == recordId) - return (EscherSpRecord) r; + public T getChildById( short recordId ) + { + for ( EscherRecord childRecord : _childRecords ) + { + if ( childRecord.getRecordId() == recordId ) + { + @SuppressWarnings( "unchecked" ) + final T result = (T) childRecord; + return result; + } } return null; } diff --git a/src/java/org/apache/poi/ddf/EscherOptRecord.java b/src/java/org/apache/poi/ddf/EscherOptRecord.java index d833d86504..c2c0c78dd3 100644 --- a/src/java/org/apache/poi/ddf/EscherOptRecord.java +++ b/src/java/org/apache/poi/ddf/EscherOptRecord.java @@ -160,12 +160,16 @@ public class EscherOptRecord } ); } - public EscherProperty lookup(int propId) + public T lookup( int propId ) { - for (EscherProperty prop : properties) + for ( EscherProperty prop : properties ) { - if (prop.getPropertyNumber() == propId) - return prop; + if ( prop.getPropertyNumber() == propId ) + { + @SuppressWarnings( "unchecked" ) + final T result = (T) prop; + return result; + } } return null; }