From commits-return-6437-apmail-poi-commits-archive=poi.apache.org@poi.apache.org Tue Sep 1 20:57:58 2015 Return-Path: X-Original-To: apmail-poi-commits-archive@minotaur.apache.org Delivered-To: apmail-poi-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BEAA41883F for ; Tue, 1 Sep 2015 20:57:58 +0000 (UTC) Received: (qmail 60543 invoked by uid 500); 1 Sep 2015 20:57:58 -0000 Delivered-To: apmail-poi-commits-archive@poi.apache.org Received: (qmail 60508 invoked by uid 500); 1 Sep 2015 20:57:58 -0000 Mailing-List: contact commits-help@poi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@poi.apache.org Delivered-To: mailing list commits@poi.apache.org Received: (qmail 60499 invoked by uid 99); 1 Sep 2015 20:57:58 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Sep 2015 20:57:58 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id 5BECFAC003E for ; Tue, 1 Sep 2015 20:57:58 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1700669 - /poi/trunk/src/java/org/apache/poi/hpsf/wellknown/SectionIDMap.java Date: Tue, 01 Sep 2015 20:57:58 -0000 To: commits@poi.apache.org From: nick@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150901205758.5BECFAC003E@hades.apache.org> Author: nick Date: Tue Sep 1 20:57:57 2015 New Revision: 1700669 URL: http://svn.apache.org/r1700669 Log: Fix some Forbidden APIs errors Modified: poi/trunk/src/java/org/apache/poi/hpsf/wellknown/SectionIDMap.java Modified: poi/trunk/src/java/org/apache/poi/hpsf/wellknown/SectionIDMap.java URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hpsf/wellknown/SectionIDMap.java?rev=1700669&r1=1700668&r2=1700669&view=diff ============================================================================== --- poi/trunk/src/java/org/apache/poi/hpsf/wellknown/SectionIDMap.java (original) +++ poi/trunk/src/java/org/apache/poi/hpsf/wellknown/SectionIDMap.java Tue Sep 1 20:57:57 2015 @@ -19,6 +19,8 @@ package org.apache.poi.hpsf.wellknown; import java.util.HashMap; +import org.apache.poi.util.StringUtil; + /** *

Maps section format IDs to {@link PropertyIDMap}s. It is * initialized with two well-known section format IDs: those of the @@ -33,11 +35,9 @@ import java.util.HashMap; *

This {@link java.util.Map} expects the byte arrays of section format IDs * as keys. A key maps to a {@link PropertyIDMap} describing the * property IDs in sections with the specified section format ID.

- * - * @author Rainer Klute (klute@rainer-klute.de) */ +@SuppressWarnings({"rawtypes","unchecked"}) // Java Generics have issues on this style of class... public class SectionIDMap extends HashMap { - /** *

The SummaryInformation's section's format ID.

*/ @@ -141,11 +141,9 @@ public class SectionIDMap extends HashMa */ public PropertyIDMap get(final byte[] sectionFormatID) { - return (PropertyIDMap) super.get(new String(sectionFormatID)); + return (PropertyIDMap)super.get(new String(sectionFormatID, StringUtil.UTF8)); } - - /** *

Returns the {@link PropertyIDMap} for a given section format * ID.

@@ -154,13 +152,11 @@ public class SectionIDMap extends HashMa * @deprecated Use {@link #get(byte[])} instead! * @return the property ID map */ - public Object get(final Object sectionFormatID) + public PropertyIDMap get(final Object sectionFormatID) { return get((byte[]) sectionFormatID); } - - /** *

Associates a section format ID with a {@link * PropertyIDMap}.

@@ -169,13 +165,19 @@ public class SectionIDMap extends HashMa * @param propertyIDMap the property ID map * @return as defined by {@link java.util.Map#put} */ - public Object put(final byte[] sectionFormatID, - final PropertyIDMap propertyIDMap) + public PropertyIDMap put(final byte[] sectionFormatID, + final PropertyIDMap propertyIDMap) { - return super.put(new String(sectionFormatID), propertyIDMap); + return (PropertyIDMap)super.put(new String(sectionFormatID, StringUtil.UTF8), propertyIDMap); } - + /** + * Associates the string representation of a section + * format ID with a {@link PropertyIDMap} + */ + protected PropertyIDMap put(String key, PropertyIDMap value) { + return (PropertyIDMap)super.put(key, value); + } /** * @deprecated Use {@link #put(byte[], PropertyIDMap)} instead! @@ -189,9 +191,10 @@ public class SectionIDMap extends HashMa * @return The return value remains undocumented since the method is * deprecated. */ - public Object put(final Object key, final Object value) + public PropertyIDMap put(final Object key, final Object value) { + if (key instanceof String) + return put((String)key, (PropertyIDMap) value); return put((byte[]) key, (PropertyIDMap) value); } - } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org For additional commands, e-mail: commits-help@poi.apache.org