[Bug 65084] New: A same message is attached to different exceptions

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug 65084] New: A same message is attached to different exceptions

Bugzilla from bugzilla@apache.org
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: [hidden email]
          Reporter: [hidden email]
  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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 65084] A same message is attached to different exceptions

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=65084

Dominik Stadler <[hidden email]> 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: [hidden email]
For additional commands, e-mail: [hidden email]