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/02/19 20:50:21 UTC

svn commit: r745976 - in /poi/trunk/src: java/org/apache/poi/ddf/ java/org/apache/poi/hssf/record/formula/eval/ ooxml/java/org/apache/poi/xssf/usermodel/ ooxml/java/org/apache/poi/xssf/util/ ooxml/testcases/org/apache/poi/xssf/usermodel/ scratchpad/src...

Author: josh
Date: Thu Feb 19 19:50:20 2009
New Revision: 745976

URL: http://svn.apache.org/viewvc?rev=745976&view=rev
Log:
Added Apache License text to files where it was missing. Also fixed some compiler warnings in those files.

Removed:
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/util/CTFontWrapper.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/util/Charset.java
Modified:
    poi/trunk/src/java/org/apache/poi/ddf/EscherContainerRecord.java
    poi/trunk/src/java/org/apache/poi/ddf/EscherRecord.java
    poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/RefEvalBase.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFActiveXData.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFFont.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/ActiveXShape.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Comment.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/MovieShape.java
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/EscherRecordHolder.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestLinkTable.java
    poi/trunk/src/testcases/org/apache/poi/poifs/property/AllPOIFSPropertyTests.java

Modified: poi/trunk/src/java/org/apache/poi/ddf/EscherContainerRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ddf/EscherContainerRecord.java?rev=745976&r1=745975&r2=745976&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ddf/EscherContainerRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/ddf/EscherContainerRecord.java Thu Feb 19 19:50:20 2009
@@ -43,7 +43,7 @@
     public static final short SP_CONTAINER     = (short)0xF004;
     public static final short SOLVER_CONTAINER = (short)0xF005;
 
-    private List childRecords = new ArrayList();
+    private final List<EscherRecord> _childRecords = new ArrayList<EscherRecord>();
 
     public int fillFields( byte[] data, int offset, EscherRecordFactory recordFactory )
     {
@@ -110,7 +110,7 @@
         {
             EscherRecord r = (EscherRecord) iterator.next();
             if(r.getRecordId() == recordId) {
-            	return true;
+                return true;
             }
         }
         return false;
@@ -120,9 +120,8 @@
      * Returns a list of all the child (escher) records
      *  of the container.
      */
-    public List getChildRecords()
-    {
-        return childRecords;
+    public List<EscherRecord> getChildRecords() {
+        return _childRecords;
     }
     
     /**
@@ -131,7 +130,7 @@
      *   2 or 3)
      */
     public List getChildContainers() {
-    	List containers = new ArrayList();
+        List containers = new ArrayList();
         for ( Iterator iterator = getChildRecords().iterator(); iterator.hasNext(); )
         {
             EscherRecord r = (EscherRecord) iterator.next();
@@ -142,15 +141,13 @@
         return containers;
     }
 
-    public void setChildRecords( List childRecords )
-    {
-        this.childRecords = childRecords;
+    public void setChildRecords(List<EscherRecord> childRecords) {
+        _childRecords.clear();
+        _childRecords.addAll(childRecords);
     }
 
-    public String getRecordName()
-    {
-        switch ((short)getRecordId())
-        {
+    public String getRecordName() {
+        switch (getRecordId()) {
             case DGG_CONTAINER:
                 return "DggContainer";
             case BSTORE_CONTAINER:
@@ -171,16 +168,15 @@
     public void display( PrintWriter w, int indent )
     {
         super.display( w, indent );
-        for ( Iterator iterator = childRecords.iterator(); iterator.hasNext(); )
+        for (Iterator iterator = _childRecords.iterator(); iterator.hasNext();)
         {
             EscherRecord escherRecord = (EscherRecord) iterator.next();
             escherRecord.display( w, indent + 1 );
         }
     }
 
-    public void addChildRecord( EscherRecord record )
-    {
-        this.childRecords.add( record );
+    public void addChildRecord(EscherRecord record) {
+        _childRecords.add( record );
     }
 
     public String toString()
@@ -226,7 +222,7 @@
 
     public EscherSpRecord getChildById( short recordId )
     {
-        for ( Iterator iterator = childRecords.iterator(); iterator.hasNext(); )
+        for ( Iterator iterator = _childRecords.iterator(); iterator.hasNext(); )
         {
             EscherRecord escherRecord = (EscherRecord) iterator.next();
             if (escherRecord.getRecordId() == recordId)
@@ -241,7 +237,7 @@
      * @param out - list to store found records
      */
     public void getRecordsById(short recordId, List out){
-        for(Iterator it = childRecords.iterator(); it.hasNext();) {
+        for(Iterator it = _childRecords.iterator(); it.hasNext();) {
             Object er = it.next();
             EscherRecord r = (EscherRecord)er;
             if(r instanceof EscherContainerRecord) {

Modified: poi/trunk/src/java/org/apache/poi/ddf/EscherRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/ddf/EscherRecord.java?rev=745976&r1=745975&r2=745976&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/ddf/EscherRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/ddf/EscherRecord.java Thu Feb 19 19:50:20 2009
@@ -30,16 +30,15 @@
  *
  * @author Glen Stampoultzis
  */
-abstract public class EscherRecord
-{
-    private short options;
-    private short recordId;
+public abstract class EscherRecord {
+    private short _options;
+    private short _recordId;
 
     /**
      * Create a new instance
      */
-    public EscherRecord()
-    {
+    public EscherRecord() {
+        // fields uninitialised
     }
 
     /**
@@ -73,11 +72,10 @@
      * @return          the number of bytes remaining in this record.  This
      *                  may include the children if this is a container.
      */
-    protected int readHeader( byte[] data, int offset )
-    {
+    protected int readHeader( byte[] data, int offset ) {
         EscherRecordHeader header = EscherRecordHeader.readHeader(data, offset);
-        options = header.getOptions();
-        recordId = header.getRecordId();
+        _options = header.getOptions();
+        _recordId = header.getRecordId();
         return header.getRemainingBytes();
     }
 
@@ -86,26 +84,23 @@
      * field.
      * @return  true is this is a container field.
      */
-    public boolean isContainerRecord()
-    {
-        return (options & (short)0x000f) == (short)0x000f;
+    public boolean isContainerRecord() {
+        return (_options & (short)0x000f) == (short)0x000f;
     }
 
     /**
      * @return The options field for this record.  All records have one.
      */
-    public short getOptions()
-    {
-        return options;
+    public short getOptions() {
+        return _options;
     }
 
     /**
      * Set the options this this record.  Container records should have the
      * last nibble set to 0xF.
      */
-    public void setOptions( short options )
-    {
-        this.options = options;
+    public void setOptions( short options ) {
+        _options = options;
     }
 
     /**
@@ -164,17 +159,15 @@
      *
      * @return  The 16 bit record id.
      */
-    public short getRecordId()
-    {
-        return recordId;
+    public short getRecordId() {
+        return _recordId;
     }
 
     /**
      * Sets the record id for this record.
      */
-    public void setRecordId( short recordId )
-    {
-        this.recordId = recordId;
+    public void setRecordId( short recordId ) {
+        _recordId = recordId;
     }
 
     /**
@@ -184,7 +177,7 @@
      *
      * @see EscherContainerRecord
      */
-    public List getChildRecords() { return Collections.EMPTY_LIST; }
+    public List<EscherRecord> getChildRecords() { return Collections.emptyList(); }
 
     /**
      * Sets the child records for this record.  By default this will throw
@@ -192,7 +185,9 @@
      *
      * @param childRecords  Not used in base implementation.
      */
-    public void setChildRecords( List childRecords ) { throw new IllegalArgumentException("This record does not support child records."); }
+    public void setChildRecords(List<EscherRecord> childRecords) {
+        throw new UnsupportedOperationException("This record does not support child records.");
+    }
 
     /**
      * Escher records may need to be clonable in the future.
@@ -205,9 +200,8 @@
     /**
      * Returns the indexed child record.
      */
-    public EscherRecord getChild( int index )
-    {
-        return (EscherRecord) getChildRecords().get(index);
+    public EscherRecord getChild( int index ) {
+        return getChildRecords().get(index);
     }
 
     /**
@@ -233,9 +227,8 @@
      *
      * @return The instance part of the record
      */
-    public short getInstance()
-    {
-        return (short) ( options >> 4 );
+    public short getInstance() {
+        return (short) ( _options >> 4 );
     }
 
     /**
@@ -247,8 +240,8 @@
         private short recordId;
         private int remainingBytes;
 
-        private EscherRecordHeader()
-        {
+        private EscherRecordHeader() {
+            // fields uninitialised
         }
 
         public static EscherRecordHeader readHeader( byte[] data, int offset )
@@ -284,8 +277,5 @@
                     ", remainingBytes=" + remainingBytes +
                     "}";
         }
-
-
     }
-
 }

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/RefEvalBase.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/RefEvalBase.java?rev=745976&r1=745975&r2=745976&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/RefEvalBase.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/eval/RefEvalBase.java Thu Feb 19 19:50:20 2009
@@ -1,5 +1,27 @@
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+
 package org.apache.poi.hssf.record.formula.eval;
 
+/**
+ * Common base class for implementors of {@link RefEval}
+ *
+ * @author Josh Micich
+ */
 public abstract class RefEvalBase implements RefEval {
 
 	private final int _rowIndex;

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFActiveXData.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFActiveXData.java?rev=745976&r1=745975&r2=745976&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFActiveXData.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFActiveXData.java Thu Feb 19 19:50:20 2009
@@ -1,3 +1,20 @@
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+
 package org.apache.poi.xssf.usermodel;
 
 import java.io.IOException;
@@ -9,43 +26,47 @@
 import org.apache.poi.POIXMLException;
 import org.apache.poi.openxml4j.opc.PackagePart;
 
-public class XSSFActiveXData implements PictureData, XSSFWritableModel {
+/**
+ * 
+ * @author Nick Burch
+ */
+public final class XSSFActiveXData implements PictureData, XSSFWritableModel {
+
+	private final PackagePart _packagePart;
+	private final String _originalId;
+
+	public XSSFActiveXData(PackagePart packagePart, String originalId) {
+		_packagePart = packagePart;
+		_originalId = originalId;
+	}
+
+	public XSSFActiveXData(PackagePart packagePart) {
+		this(packagePart, null);
+	}
+
+	public String getOriginalId() {
+		return _originalId;
+	}
 
-    private PackagePart packagePart;
-    private String originalId;
+	public PackagePart getPart() {
+		return _packagePart;
+	}
 
-    public XSSFActiveXData(PackagePart packagePart, String originalId) {
-        this(packagePart);
-        this.originalId = originalId;
-    }
-    
-    public XSSFActiveXData(PackagePart packagePart) {
-        this.packagePart = packagePart;
-    }
-
-    public String getOriginalId() {
-    	return originalId;
-    }
-    
-    public PackagePart getPart() {
-    	return packagePart;
-    }
-    
 	public void writeTo(OutputStream out) throws IOException {
-		IOUtils.copy(packagePart.getInputStream(), out);
+		IOUtils.copy(_packagePart.getInputStream(), out);
 	}
 
-    public byte[] getData() {
-    	// TODO - is this right?
-    	// Are there headers etc?
-    	try {
-    		return IOUtils.toByteArray(packagePart.getInputStream());
-    	} catch(IOException e) {
-    		throw new POIXMLException(e);
-    	}
-    }
-
-    public String suggestFileExtension() {
-    	return packagePart.getPartName().getExtension();
-    }
+	public byte[] getData() {
+		// TODO - is this right?
+		// Are there headers etc?
+		try {
+			return IOUtils.toByteArray(_packagePart.getInputStream());
+		} catch(IOException e) {
+			throw new POIXMLException(e);
+		}
+	}
+
+	public String suggestFileExtension() {
+		return _packagePart.getPartName().getExtension();
+	}
 }

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFFont.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFFont.java?rev=745976&r1=745975&r2=745976&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFFont.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFFont.java Thu Feb 19 19:50:20 2009
@@ -1,3 +1,20 @@
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+
 package org.apache.poi.xssf.usermodel;
 
 import junit.framework.TestCase;
@@ -105,7 +122,7 @@
 		assertEquals(11,xssfFont.getFontHeight());
 
 		xssfFont.setFontHeight((short)20);
-		assertEquals(new Double(20).doubleValue(),ctFont.getSzArray(0).getVal());
+		assertEquals(20.0, ctFont.getSzArray(0).getVal(), 0.0);
 	}
 
 	public void testFontHeightInPoint() {
@@ -118,7 +135,7 @@
 		assertEquals(14,xssfFont.getFontHeightInPoints());
 
 		xssfFont.setFontHeightInPoints((short)20);
-		assertEquals(new Double(20).doubleValue(),ctFont.getSzArray(0).getVal());
+		assertEquals(20.0, ctFont.getSzArray(0).getVal(), 0.0);
 	}
 
 	public void testUnderline() {
@@ -353,8 +370,8 @@
         XSSFSheet s = wb.createSheet();
         s.createRow(0);
         s.createRow(1);
-        XSSFCell c1 = s.getRow(0).createCell(0);
-        XSSFCell c2 = s.getRow(1).createCell(0);
+        s.getRow(0).createCell(0);
+        s.getRow(1).createCell(0);
 
         assertEquals(1, wb.getNumberOfFonts());
 
@@ -364,10 +381,7 @@
         // Check that asking for the same font
         //  multiple times gives you the same thing.
         // Otherwise, our tests wouldn't work!
-        assertEquals(
-                wb.getFontAt((short)0),
-                wb.getFontAt((short)0)
-        );
+        assertEquals(wb.getFontAt((short)0), wb.getFontAt((short)0));
 
         // Look for a new font we have
         //  yet to add
@@ -396,15 +410,8 @@
         assertEquals(2, wb.getNumberOfFonts());
         assertEquals(nf, wb.getFontAt((short)1));
 
-        assertEquals(
-                wb.getFontAt((short)1),
-                wb.getFontAt((short)1)
-        );
-        assertTrue(
-                wb.getFontAt((short)0)
-                !=
-                wb.getFontAt((short)1)
-        );
+        assertEquals(wb.getFontAt((short)1), wb.getFontAt((short)1));
+        assertTrue(wb.getFontAt((short)0) != wb.getFontAt((short)1));
 
         // Find it now
         assertNotNull(

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/ActiveXShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/ActiveXShape.java?rev=745976&r1=745975&r2=745976&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/ActiveXShape.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/ActiveXShape.java Thu Feb 19 19:50:20 2009
@@ -1,3 +1,20 @@
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+
 package org.apache.poi.hslf.model;
 
 import org.apache.poi.ddf.*;
@@ -15,7 +32,7 @@
  * TODO: finish
  * @author Yegor Kozlov
  */
-public class ActiveXShape extends Picture {
+public final class ActiveXShape extends Picture {
     public static final int DEFAULT_ACTIVEX_THUMBNAIL = -1;
 
     /**
@@ -83,8 +100,8 @@
      */
     public void setActiveXIndex(int idx){
         EscherContainerRecord spContainer = getSpContainer();
-        for (Iterator it = spContainer.getChildRecords().iterator(); it.hasNext();) {
-            EscherRecord obj = (EscherRecord) it.next();
+        for (Iterator<EscherRecord> it = spContainer.getChildRecords().iterator(); it.hasNext();) {
+            EscherRecord obj = it.next();
             if (obj.getRecordId() == EscherClientDataRecord.RECORD_ID) {
                 EscherClientDataRecord clientRecord = (EscherClientDataRecord)obj;
                 byte[] recdata = clientRecord.getRemainingData();

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Comment.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Comment.java?rev=745976&r1=745975&r2=745976&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Comment.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Comment.java Thu Feb 19 19:50:20 2009
@@ -1,54 +1,75 @@
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+
 package org.apache.poi.hslf.model;
 
 import org.apache.poi.hslf.record.Comment2000;
 
-public class Comment {
-	private Comment2000 comment2000;
-	
+/**
+ * 
+ * @author Nick Burch
+ */
+public final class Comment {
+	private Comment2000 _comment2000;
+
 	public Comment(Comment2000 comment2000) {
-		this.comment2000 = comment2000;
+		_comment2000 = comment2000;
 	}
-	
+
 	protected Comment2000 getComment2000() {
-		return comment2000;
+		return _comment2000;
 	}
-	
+
 	/**
 	 * Get the Author of this comment
 	 */
 	public String getAuthor() {
-		return comment2000.getAuthor();
+		return _comment2000.getAuthor();
 	}
 	/**
 	 * Set the Author of this comment
 	 */
 	public void setAuthor(String author) {
-		comment2000.setAuthor(author);
+		_comment2000.setAuthor(author);
 	}
 
 	/**
 	 * Get the Author's Initials of this comment
 	 */
 	public String getAuthorInitials() {
-		return comment2000.getAuthorInitials();
+		return _comment2000.getAuthorInitials();
 	}
 	/**
 	 * Set the Author's Initials of this comment
 	 */
 	public void setAuthorInitials(String initials) {
-		comment2000.setAuthorInitials(initials);
+		_comment2000.setAuthorInitials(initials);
 	}
 
 	/**
 	 * Get the text of this comment
 	 */
 	public String getText() {
-		return comment2000.getText();
+		return _comment2000.getText();
 	}
 	/**
 	 * Set the text of this comment
 	 */
 	public void setText(String text) {
-		comment2000.setText(text);
+		_comment2000.setText(text);
 	}
 }

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/MovieShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/MovieShape.java?rev=745976&r1=745975&r2=745976&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/MovieShape.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/MovieShape.java Thu Feb 19 19:50:20 2009
@@ -1,20 +1,37 @@
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+
 package org.apache.poi.hslf.model;
 
-import org.apache.poi.ddf.*;
-import org.apache.poi.hslf.record.*;
+import java.io.ByteArrayOutputStream;
+
+import org.apache.poi.ddf.EscherClientDataRecord;
+import org.apache.poi.ddf.EscherContainerRecord;
+import org.apache.poi.ddf.EscherProperties;
 import org.apache.poi.hslf.exceptions.HSLFException;
+import org.apache.poi.hslf.record.*;
 import org.apache.poi.hslf.usermodel.SlideShow;
-import org.apache.poi.util.LittleEndian;
-
-import java.io.ByteArrayOutputStream;
-import java.util.Iterator;
 
 /**
  * Represents a movie in a PowerPoint document.
  *
  * @author Yegor Kozlov
  */
-public class MovieShape extends Picture {
+public final class MovieShape extends Picture {
     public static final int DEFAULT_MOVIE_THUMBNAIL = -1;
 
     public static final int MOVIE_MPEG = 1;

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/EscherRecordHolder.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/EscherRecordHolder.java?rev=745976&r1=745975&r2=745976&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/EscherRecordHolder.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/EscherRecordHolder.java Thu Feb 19 19:50:20 2009
@@ -1,7 +1,19 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
 
 package org.apache.poi.hwpf.model;
 
@@ -14,103 +26,97 @@
 import org.apache.poi.ddf.EscherRecordFactory;
 
 /**
- * Based on AbstractEscherRecordHolder fomr HSSF.
+ * Based on AbstractEscherRecordHolder from HSSF.
  * 
  * @author Squeeself
  */
-public class EscherRecordHolder 
-{
-    protected ArrayList escherRecords = new ArrayList();
-    
-    public EscherRecordHolder()
-    {
-        
-    }
-    
-    public EscherRecordHolder(byte[] data, int offset, int size)
-    {
-        fillEscherRecords(data, offset, size);
-    }
-    
-    private void fillEscherRecords(byte[] data, int offset, int size)
-    {
-        EscherRecordFactory recordFactory = new DefaultEscherRecordFactory();
-        int pos = offset;
-        while ( pos < offset + size)
-        {
-            EscherRecord r = recordFactory.createRecord(data, pos);
-            escherRecords.add(r);
-            int bytesRead = r.fillFields(data, pos, recordFactory);
-            pos += bytesRead + 1; // There is an empty byte between each top-level record in a Word doc
-        }
-    }
-    
-    public List getEscherRecords()
-    {
-        return escherRecords;
-    }
-    
-    public String toString()
-    {
-        StringBuffer buffer = new StringBuffer();
-
-        final String nl = System.getProperty("line.separator");
-        if (escherRecords.size() == 0)
-            buffer.append("No Escher Records Decoded" + nl);
-        for ( Iterator iterator = escherRecords.iterator(); iterator.hasNext(); )
-        {
-            EscherRecord r = (EscherRecord) iterator.next();
-            buffer.append(r.toString());
-        }
-
-        return buffer.toString();
-    }
-    
-    /**
-     * If we have a EscherContainerRecord as one of our
-     *  children (and most top level escher holders do),
-     *  then return that.
-     */
-    public EscherContainerRecord getEscherContainer() {
-    	for(Iterator it = escherRecords.iterator(); it.hasNext();) {
-    		Object er = it.next();
-    		if(er instanceof EscherContainerRecord) {
-    			return (EscherContainerRecord)er;
-    		}
-    	}
-    	return null;
-    }
-
-    /**
-     * Descends into all our children, returning the
-     *  first EscherRecord with the given id, or null
-     *  if none found
-     */
-    public EscherRecord findFirstWithId(short id) {
-    	return findFirstWithId(id, getEscherRecords());
-    }
-    private EscherRecord findFirstWithId(short id, List records) {
-    	// Check at our level
-    	for(Iterator it = records.iterator(); it.hasNext();) {
-    		EscherRecord r = (EscherRecord)it.next();
-    		if(r.getRecordId() == id) {
-    			return r;
-    		}
-    	}
-    	
-    	// Then check our children in turn
-    	for(Iterator it = records.iterator(); it.hasNext();) {
-    		EscherRecord r = (EscherRecord)it.next();
-    		if(r.isContainerRecord()) {
-    			EscherRecord found =
-    				findFirstWithId(id, r.getChildRecords());
-    			if(found != null) {
-    				return found;
-    			}
-    		}
-    	}
-    	
-    	// Not found in this lot
-    	return null;
-    }
+public final class EscherRecordHolder {
+	private final ArrayList<EscherRecord> escherRecords;
+	
+	public EscherRecordHolder() {
+		escherRecords = new ArrayList<EscherRecord>();
+	}
+	
+	public EscherRecordHolder(byte[] data, int offset, int size) {
+		this();
+		fillEscherRecords(data, offset, size);
+	}
+	
+	private void fillEscherRecords(byte[] data, int offset, int size)
+	{
+		EscherRecordFactory recordFactory = new DefaultEscherRecordFactory();
+		int pos = offset;
+		while ( pos < offset + size)
+		{
+			EscherRecord r = recordFactory.createRecord(data, pos);
+			escherRecords.add(r);
+			int bytesRead = r.fillFields(data, pos, recordFactory);
+			pos += bytesRead + 1; // There is an empty byte between each top-level record in a Word doc
+		}
+	}
+	
+	public List<EscherRecord> getEscherRecords() {
+		return escherRecords;
+	}
+	
+	public String toString() {
+		StringBuffer buffer = new StringBuffer();
+
+		if (escherRecords.size() == 0) {
+			buffer.append("No Escher Records Decoded").append("\n");
+		}
+		Iterator<EscherRecord> iterator = escherRecords.iterator();
+		while (iterator.hasNext()) {
+			EscherRecord r = iterator.next();
+			buffer.append(r.toString());
+		}
+		return buffer.toString();
+	}
+	
+	/**
+	 * If we have a EscherContainerRecord as one of our
+	 *  children (and most top level escher holders do),
+	 *  then return that.
+	 */
+	public EscherContainerRecord getEscherContainer() {
+		for(Iterator<EscherRecord> it = escherRecords.iterator(); it.hasNext();) {
+			Object er = it.next();
+			if(er instanceof EscherContainerRecord) {
+				return (EscherContainerRecord)er;
+			}
+		}
+		return null;
+	}
+
+	/**
+	 * Descends into all our children, returning the
+	 *  first EscherRecord with the given id, or null
+	 *  if none found
+	 */
+	public EscherRecord findFirstWithId(short id) {
+		return findFirstWithId(id, getEscherRecords());
+	}
+	private static EscherRecord findFirstWithId(short id, List<EscherRecord> records) {
+		// Check at our level
+		for(Iterator<EscherRecord> it = records.iterator(); it.hasNext();) {
+			EscherRecord r = it.next();
+			if(r.getRecordId() == id) {
+				return r;
+			}
+		}
+		
+		// Then check our children in turn
+		for(Iterator<EscherRecord> it = records.iterator(); it.hasNext();) {
+			EscherRecord r = it.next();
+			if(r.isContainerRecord()) {
+				EscherRecord found = findFirstWithId(id, r.getChildRecords());
+				if(found != null) {
+					return found;
+				}
+			}
+		}
+		
+		// Not found in this lot
+		return null;
+	}
 }

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestLinkTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestLinkTable.java?rev=745976&r1=745975&r2=745976&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestLinkTable.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestLinkTable.java Thu Feb 19 19:50:20 2009
@@ -1,3 +1,20 @@
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+
 package org.apache.poi.hssf.usermodel;
 
 import junit.framework.AssertionFailedError;
@@ -5,7 +22,7 @@
 
 import org.apache.poi.hssf.HSSFTestDataSamples;
 /**
- * Tests for LinkTable
+ * Tests for {@link LinkTable}
  *
  * @author Josh Micich
  */

Modified: poi/trunk/src/testcases/org/apache/poi/poifs/property/AllPOIFSPropertyTests.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/property/AllPOIFSPropertyTests.java?rev=745976&r1=745975&r2=745976&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/property/AllPOIFSPropertyTests.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/property/AllPOIFSPropertyTests.java Thu Feb 19 19:50:20 2009
@@ -1,3 +1,20 @@
+/* ====================================================================
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+==================================================================== */
+
 package org.apache.poi.poifs.property;
 
 import junit.framework.Test;
@@ -11,7 +28,7 @@
 public final class AllPOIFSPropertyTests {
 
     public static Test suite() {
-        TestSuite result = new TestSuite("Tests for org.apache.poi.poifs.property");
+        TestSuite result = new TestSuite(AllPOIFSPropertyTests.class.getName());
         result.addTestSuite(TestDirectoryProperty.class);
         result.addTestSuite(TestDocumentProperty.class);
         result.addTestSuite(TestPropertyFactory.class);



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