git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1793727 13f79535-47bb-0310-9956-ffa450edef68tags/REL_3_17_BETA1
@@ -401,11 +401,11 @@ public class CopyCompare | |||
final String name, | |||
final DocumentInputStream stream) | |||
throws IOException { | |||
final DirectoryEntry de = getPath(poiFs, path); | |||
if (stream == null && name == null) { | |||
if (stream == null || name == null) { | |||
// Empty directory | |||
return; | |||
} | |||
final DirectoryEntry de = getPath(poiFs, path); | |||
final ByteArrayOutputStream out = new ByteArrayOutputStream(); | |||
int c; | |||
while ((c = stream.read()) != -1) { |
@@ -47,7 +47,7 @@ public final class EscherArrayProperty extends EscherComplexProperty implements | |||
public EscherArrayProperty(short id, byte[] complexData) { | |||
super(id, checkComplexData(complexData)); | |||
emptyComplexPart = complexData.length == 0; | |||
emptyComplexPart = (complexData == null || complexData.length == 0); | |||
} | |||
public EscherArrayProperty(short propertyNumber, boolean isBlipId, byte[] complexData) { |
@@ -128,27 +128,29 @@ public final class ActiveXShape extends HSLFPictureShape { | |||
*/ | |||
public ExControl getExControl(){ | |||
int idx = getControlIndex(); | |||
ExControl ctrl = null; | |||
Document doc = getSheet().getSlideShow().getDocumentRecord(); | |||
ExObjList lst = (ExObjList)doc.findFirstOfType(RecordTypes.ExObjList.typeID); | |||
if(lst != null){ | |||
Record[] ch = lst.getChildRecords(); | |||
for (int i = 0; i < ch.length; i++) { | |||
if(ch[i] instanceof ExControl){ | |||
ExControl c = (ExControl)ch[i]; | |||
if(c.getExOleObjAtom().getObjID() == idx){ | |||
ctrl = c; | |||
break; | |||
} | |||
if (lst == null) { | |||
return null; | |||
} | |||
for (Record ch : lst.getChildRecords()) { | |||
if(ch instanceof ExControl){ | |||
ExControl c = (ExControl)ch; | |||
if(c.getExOleObjAtom().getObjID() == idx){ | |||
return c; | |||
} | |||
} | |||
} | |||
return ctrl; | |||
return null; | |||
} | |||
@Override | |||
protected void afterInsert(HSLFSheet sheet){ | |||
ExControl ctrl = getExControl(); | |||
if (ctrl == null) { | |||
throw new NullPointerException("ExControl is not defined"); | |||
} | |||
ctrl.getExControlAtom().setSlideId(sheet._getSheetNumber()); | |||
String name = ctrl.getProgId() + "-" + getControlIndex() + '\u0000'; |
@@ -185,7 +185,8 @@ public final class OLEShape extends HSLFPictureShape { | |||
* @return the instance name of the embedded object | |||
*/ | |||
public String getInstanceName(){ | |||
return getExEmbed().getMenuName(); | |||
ExEmbed ee = getExEmbed(); | |||
return (ee == null) ? null : ee.getMenuName(); | |||
} | |||
/** | |||
@@ -195,7 +196,8 @@ public final class OLEShape extends HSLFPictureShape { | |||
* @return the full name of the embedded object | |||
*/ | |||
public String getFullName(){ | |||
return getExEmbed().getClipboardName(); | |||
ExEmbed ee = getExEmbed(); | |||
return (ee == null) ? null : ee.getClipboardName(); | |||
} | |||
/** | |||
@@ -206,6 +208,7 @@ public final class OLEShape extends HSLFPictureShape { | |||
* @return the ProgID | |||
*/ | |||
public String getProgID(){ | |||
return getExEmbed().getProgId(); | |||
ExEmbed ee = getExEmbed(); | |||
return (ee == null) ? null : ee.getProgId(); | |||
} | |||
} |
@@ -360,13 +360,16 @@ public final class PPDrawing extends RecordAtom { | |||
* @return EscherDgRecord | |||
*/ | |||
public EscherDgRecord getEscherDgRecord(){ | |||
if(dg == null){ | |||
for(EscherRecord r : getDgContainer().getChildRecords()){ | |||
if(r instanceof EscherDgRecord){ | |||
dg = (EscherDgRecord)r; | |||
break; | |||
} | |||
} | |||
if (dg == null) { | |||
EscherContainerRecord dgr = getDgContainer(); | |||
if (dgr != null) { | |||
for(EscherRecord r : dgr.getChildRecords()){ | |||
if(r instanceof EscherDgRecord){ | |||
dg = (EscherDgRecord)r; | |||
break; | |||
} | |||
} | |||
} | |||
} | |||
return dg; | |||
} |
@@ -372,7 +372,9 @@ public final class HSLFFill { | |||
if(p != null) { | |||
int idx = p.getPropertyValue(); | |||
EscherBSERecord bse = getEscherBSERecord(idx); | |||
bse.setRef(bse.getRef() + 1); | |||
if (bse != null) { | |||
bse.setRef(bse.getRef() + 1); | |||
} | |||
} | |||
} | |||
@@ -521,7 +523,9 @@ public final class HSLFFill { | |||
HSLFShape.setEscherProperty(opt, (short)(EscherProperties.FILL__PATTERNTEXTURE + 0x4000), (data == null ? 0 : data.getIndex())); | |||
if(data != null && shape.getSheet() != null) { | |||
EscherBSERecord bse = getEscherBSERecord(data.getIndex()); | |||
bse.setRef(bse.getRef() + 1); | |||
if (bse != null) { | |||
bse.setRef(bse.getRef() + 1); | |||
} | |||
} | |||
} | |||