mirror of https://github.com/apache/poi.git
try to handle case where checksum is null
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1884278 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e1bb2cca33
commit
da146d3399
|
@ -124,7 +124,7 @@ public class XWPFPictureData extends POIXMLDocumentPart {
|
||||||
/**
|
/**
|
||||||
* Return an integer constant that specifies type of this picture
|
* Return an integer constant that specifies type of this picture
|
||||||
*
|
*
|
||||||
* @return an integer constant that specifies type of this picture
|
* @return an integer constant that specifies type of this picture, returns 0 if an unknown type
|
||||||
* @see org.apache.poi.xwpf.usermodel.Document#PICTURE_TYPE_EMF
|
* @see org.apache.poi.xwpf.usermodel.Document#PICTURE_TYPE_EMF
|
||||||
* @see org.apache.poi.xwpf.usermodel.Document#PICTURE_TYPE_WMF
|
* @see org.apache.poi.xwpf.usermodel.Document#PICTURE_TYPE_WMF
|
||||||
* @see org.apache.poi.xwpf.usermodel.Document#PICTURE_TYPE_PICT
|
* @see org.apache.poi.xwpf.usermodel.Document#PICTURE_TYPE_PICT
|
||||||
|
@ -217,15 +217,22 @@ public class XWPFPictureData extends POIXMLDocumentPart {
|
||||||
Long foreignChecksum = picData.getChecksum();
|
Long foreignChecksum = picData.getChecksum();
|
||||||
Long localChecksum = getChecksum();
|
Long localChecksum = getChecksum();
|
||||||
|
|
||||||
if (!(localChecksum.equals(foreignChecksum))) {
|
if (localChecksum == null) {
|
||||||
return false;
|
if (foreignChecksum != null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!(localChecksum.equals(foreignChecksum))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return Arrays.equals(this.getData(), picData.getData());
|
return Arrays.equals(this.getData(), picData.getData());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return getChecksum().hashCode();
|
Long checksum = getChecksum();
|
||||||
|
return checksum == null ? super.hashCode() : checksum.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue