fixed compilation for jdk 1.5

git-svn-id: https://svn.apache.org/repos/asf/poi/branches/gsoc2012@1368670 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Evgeniy Berlog 2012-08-02 19:52:47 +00:00
parent 08650c8eea
commit 49a07a11e3
3 changed files with 13 additions and 7 deletions

View File

@ -553,7 +553,9 @@ public final class EscherAggregate extends AbstractEscherHolderRecord {
drawing.setData(buf); drawing.setData(buf);
temp += drawing.serialize(pos + temp, data); temp += drawing.serialize(pos + temp, data);
} else { } else {
ContinueRecord drawing = new ContinueRecord(Arrays.copyOfRange(drawingData, j, Math.min(j + RecordInputStream.MAX_RECORD_DATA_SIZE, drawingData.length))); byte[] buf = new byte[Math.min(RecordInputStream.MAX_RECORD_DATA_SIZE, drawingData.length - j)];
System.arraycopy(drawingData, j, buf, 0, Math.min(RecordInputStream.MAX_RECORD_DATA_SIZE, drawingData.length - j));
ContinueRecord drawing = new ContinueRecord(buf);
temp += drawing.serialize(pos + temp, data); temp += drawing.serialize(pos + temp, data);
} }
} }
@ -708,7 +710,8 @@ public final class EscherAggregate extends AbstractEscherHolderRecord {
public void setMainSpRecordId(int shapeId) { public void setMainSpRecordId(int shapeId) {
EscherContainerRecord dgContainer = getEscherContainer(); EscherContainerRecord dgContainer = getEscherContainer();
EscherContainerRecord spContainer = (EscherContainerRecord) dgContainer.getChildById(EscherContainerRecord.SPGR_CONTAINER).getChild(0); EscherContainerRecord spgrConatiner = (EscherContainerRecord) dgContainer.getChildById(EscherContainerRecord.SPGR_CONTAINER);
EscherContainerRecord spContainer = (EscherContainerRecord) spgrConatiner.getChild(0);
EscherSpRecord sp = (EscherSpRecord) spContainer.getChildById(EscherSpRecord.RECORD_ID); EscherSpRecord sp = (EscherSpRecord) spContainer.getChildById(EscherSpRecord.RECORD_ID);
sp.setShapeId(shapeId); sp.setShapeId(shapeId);
} }

View File

@ -346,7 +346,8 @@ public class HSSFShapeGroup extends HSSFShape implements HSSFShapeContainer {
spgrContainer.setRecordId(EscherContainerRecord.SPGR_CONTAINER); spgrContainer.setRecordId(EscherContainerRecord.SPGR_CONTAINER);
spgrContainer.setOptions((short) 0x000F); spgrContainer.setOptions((short) 0x000F);
EscherContainerRecord spContainer = new EscherContainerRecord(); EscherContainerRecord spContainer = new EscherContainerRecord();
byte [] inSp = getEscherContainer().getChildById(EscherContainerRecord.SP_CONTAINER).serialize(); EscherContainerRecord cont = getEscherContainer().getChildById(EscherContainerRecord.SP_CONTAINER);
byte [] inSp = cont.serialize();
spContainer.fillFields(inSp, 0, new DefaultEscherRecordFactory()); spContainer.fillFields(inSp, 0, new DefaultEscherRecordFactory());
spgrContainer.addChildRecord(spContainer); spgrContainer.addChildRecord(spContainer);

View File

@ -351,13 +351,15 @@ public class TestDrawingShapes extends TestCase {
String opt1Str = opt.toXml(); String opt1Str = opt.toXml();
textbox.setFillColor(textbox.getFillColor()); textbox.setFillColor(textbox.getFillColor());
assertEquals(opt1Str, HSSFTestHelper.getEscherContainer(textbox).getChildById(EscherOptRecord.RECORD_ID).toXml()); EscherContainerRecord container = HSSFTestHelper.getEscherContainer(textbox);
EscherOptRecord optRecord = container.getChildById(EscherOptRecord.RECORD_ID);
assertEquals(opt1Str, optRecord.toXml());
textbox.setLineStyle(textbox.getLineStyle()); textbox.setLineStyle(textbox.getLineStyle());
assertEquals(opt1Str, HSSFTestHelper.getEscherContainer(textbox).getChildById(EscherOptRecord.RECORD_ID).toXml()); assertEquals(opt1Str, optRecord.toXml());
textbox.setLineWidth(textbox.getLineWidth()); textbox.setLineWidth(textbox.getLineWidth());
assertEquals(opt1Str, HSSFTestHelper.getEscherContainer(textbox).getChildById(EscherOptRecord.RECORD_ID).toXml()); assertEquals(opt1Str, optRecord.toXml());
textbox.setLineStyleColor(textbox.getLineStyleColor()); textbox.setLineStyleColor(textbox.getLineStyleColor());
assertEquals(opt1Str, HSSFTestHelper.getEscherContainer(textbox).getChildById(EscherOptRecord.RECORD_ID).toXml()); assertEquals(opt1Str, optRecord.toXml());
} }
public void testDgRecordNumShapes(){ public void testDgRecordNumShapes(){