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 2009/02/26 03:03:09 UTC
DO NOT REPLY [Bug 46768] New: CustomProperties.containsKey(key)
https://issues.apache.org/bugzilla/show_bug.cgi?id=46768
Summary: CustomProperties.containsKey(key)
Product: POI
Version: unspecified
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: normal
Priority: P2
Component: POIFS
AssignedTo: dev@poi.apache.org
ReportedBy: daniel.treacy@abs.gov.au
CustomProperties.containsKey(key) does not function for me.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 46768] CustomProperties.containsKey(key)
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46768
Rainer Klute <kl...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|POIFS |HPFS
--- Comment #4 from Rainer Klute <kl...@apache.org> 2009-02-25 23:47:50 PST ---
Could you please try an unconditional
Object value = customProperties.get("key");
and after doing the get() check whether the result is null (value not in
properties) or not null (you retrieved the value successfully)?
If the custom properties indeed do not contain your value the question is
whether your key/value pair
a) entered the custom properties successfully
b) had been deleted by your application or
c) had been deleted by a HPSF failure.
In case c) we'd need a sample program demonstrating the error. Ideally it would
be in the form of a JUnit test case, but this is not required.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 46768] CustomProperties.containsKey(key)
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46768
--- Comment #3 from Daniel Treacy <da...@abs.gov.au> 2009-02-25 22:43:38 PST ---
Hi,
Sorry for not providing more information. I have since worked around th
potential issue that I found. The jar I am using version 3.0.2 final.
The example code that I was trying (Not like this, but this is the same sort of
thing):
CustomProperties customProperties = documentSummaryInformation
.getCustomProperties();
customProperties.put("key", "value");
\* Extraction of data by a diff class, from a different event *\
if(customProperties.containsKey("key")) {
String value = (String) customProperties.get("key");
}
The condition returns false resulting in the value not being extracted.
I'm probably missing something.
I wrote the following method as a temp work around: (I'm not a programming or
java expert, dont be too harsh on me :-))
private static boolean isCustomProperty(CustomProperties customProperties,
String property) {
if (logger.isDebugEnabled()) {
logger.debug("isCustomProperty(CustomProperties, String) - start");
}
try {
Set<Map.Entry<?, CustomProperty>> set =
customProperties.entrySet();
for (Map.Entry<?, CustomProperty> me : set) {
CustomProperty cP = (CustomProperty) me.getValue();
String key = cP.getName();
if (key.contains(property)) {
if (logger.isDebugEnabled()) {
logger
.debug("isCustomProperty(CustomProperties,
String) - end");
}
return true;
}
}
} catch (Exception e) {
logger.error("isCustomProperty(CustomProperties, String)", e);
}
Thanks for your assistance.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 46768] CustomProperties.containsKey(key)
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46768
--- Comment #2 from David Fisher <df...@jmlafferty.com> 2009-02-25 18:41:21 PST ---
Please provide details about how this fails for you.
Which version of POI are you using?
Do you have a simple test file and/or a code fragment that shows your trouble?
Without such we cannot know how to respond.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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
DO NOT REPLY [Bug 46768] CustomProperties.containsKey(key)
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=46768
--- Comment #1 from David Fisher <df...@jmlafferty.com> 2009-02-25 18:37:39 PST ---
*** Bug 46769 has been marked as a duplicate of this bug. ***
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- 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