ClassCastException
Graham J Lee <[email protected]> Tue, 11 Jul 2006 15:41:38 +0100
| Newsgroups | gmane.comp.web.webobjects.newbies |
|---|---|
| Message-ID | <[email protected]> |
Hi all,
I hold up as evidence a logbook which shows that it's been six months
since I last had a chance to properly sit down with WO.
I have a component with a WOConditional bound to this key in Session:
> public boolean userIsAdmin()
> {
> String theStatus=loginPerson().statusString();
> return theStatus.equals("admin");
> }
However, it's causing the following exception:
> Error:
> java.lang.ClassCastException: java.lang.Boolean
> Reason:
> java.lang.Boolean
> Stack trace:
> File
> Line#
> Method
> Package
>
>
> PciPerson.java
> 71
> status
> PciPerson
> PciPerson.java
> 80
> statusString
> PciPerson
> Session.java
> 34
> userIsAdmin
[...]
where "status" is actually stored as an integer in the database
(which is served from OpenBase), so I'm having trouble understanding
where else a Boolean is coming in to play. Status is (or ought to
be) mapped between number and string using the index of a static
String[]. The remaining two methods in the backtrace are implemented
as:
> public String statusString() {
> int stat=status().intValue();
> return statusStrings[stat];
> }
> public Number status() {
> return (Number)storedValueForKey("status");
> }
So what is WO failing to cast to/from a boolean here?
Cheers,
Graham.
--
Graham Lee GPG Key ID: 01D5B9D8
UNIX Systems Manager,
Oxford Physics Practical Course
http://users.ox.ac.uk/~wadh1342 01865 273450
smime.p7s
(application/pkcs7-signature, 2.4 KB) - not displayed