You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2021/01/16 07:37:17 UTC
[Bug 65084] New: A same message is attached to different exceptions
https://bz.apache.org/bugzilla/show_bug.cgi?id=65084
Bug ID: 65084
Summary: A same message is attached to different exceptions
Product: POI
Version: unspecified
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: OPC
Assignee: dev@poi.apache.org
Reporter: zhonghao@pku.org.cn
Target Milestone: ---
The message is " Packages shall not contain equivalent part names and package
implementers shall neither create nor recognize packages with equivalent part
names". It is attached to three different exceptions.
1. OPCPackage#addPackagePart throws InvalidOperationException:
protected PackagePart addPackagePart(PackagePart part) {
...
if (partList.containsKey(part._partName)) {
if (!partList.get(part._partName).isDeleted()) {
throw new InvalidOperationException(
"A part with the name '"
+
part._partName.getName()
+ "' already
exists : Packages shall not contain equivalent part names and package
implementers shall neither create nor recognize packages with equivalent part
names. [M1.12]");
}
// If the specified partis flagged as deleted, we make
it
// available
part.setDeleted(false);
// and delete the old part to replace it thereafeter
this.partList.remove(part._partName);
}
}
2. ZipPackage.EntryTriple#register throws InvalidFormatException:
private class EntryTriple implements Comparable<EntryTriple> {
...
if (partList.containsKey(partName)) {
throw new InvalidFormatException(
"A part with the name '"+partName+"' already exist :
Packages shall not contain equivalent part names " +
"and package implementers shall neither create nor
recognize packages with equivalent part names. [M1.12]");
}
}
3. OPCPackage#createPart throws PartAlreadyExistsException:
PackagePart createPart(PackagePartName partName, String contentType,
boolean loadRelationships) {
...
if (partList.containsKey(partName)
&& !partList.get(partName).isDeleted()) {
throw new PartAlreadyExistsException(
"A part with the name '" +
partName.getName() + "'" +
" already exists : Packages shall not
contain equivalent part names and package" +
" implementers shall neither create nor
recognize packages with equivalent part names. [M1.12]");
}
...
}
It is strange to find the same type of errors is attached to three different
exceptions. InvalidOperationException looks better than the other two, as far
as the message is concerned. Maybe, the messages themselves shall be revised?
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 65084] A same message is attached to different exceptions
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65084
Dominik Stadler <do...@gmx.at> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
OS| |All
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org