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