https://bz.apache.org/bugzilla/show_bug.cgi?id=58917
scull.sa...@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEEDINFO |NEW --- Comment #2 from scull.sa...@gmail.com --- I replaced the existing method... public void addContentType(PackagePartName partName, String contentType) { boolean defaultCTExists = this.defaultContentType.containsValue(contentType); String extension = partName.getExtension().toLowerCase(Locale.ROOT); if ((extension.length() == 0) || (this.defaultContentType.containsKey(extension) && !defaultCTExists)) this.addOverrideContentType(partName, contentType); else if (!defaultCTExists) this.addDefaultContentType(extension, contentType); } with... public void addContentType(final PackagePartName partName, final String contentType) { final String extension = partName.getExtension().toLowerCase(Locale.ROOT); if (extension.length() == 0) { this.addOverrideContentType(partName, contentType); } else { final String defaultContentType = this.defaultContentType.get(extension); if(defaultContentType == null) { this.addDefaultContentType(extension, contentType); } else { if(!defaultContentType.equals(contentType)) { this.addOverrideContentType(partName, contentType); } } } } I built from the release distribution so no svn and ant -f patch.xml does not work. The problem with the original logic is where a default type exists but the extensions differ, as in: if ((extension.length() == 0) || this.defaultContentType.containsKey(extension) && !defaultCTExists)) I think the logic is now simpler in the modified version... IF there is no extension add an override type ELSE IF there is no default type for the extension add one ELSE IF default content type differs from the supplied value add an override You might feel the need to tidy the nested ifs... depends what you feel looks clearer. -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org