Return-Path: Delivered-To: apmail-jakarta-turbine-user-archive@apache.org Received: (qmail 49437 invoked from network); 1 Feb 2003 17:45:54 -0000 Received: from exchange.sun.com (192.18.33.10) by daedalus.apache.org with SMTP; 1 Feb 2003 17:45:54 -0000 Received: (qmail 2031 invoked by uid 97); 1 Feb 2003 17:47:24 -0000 Delivered-To: qmlist-jakarta-archive-turbine-user@nagoya.betaversion.org Received: (qmail 2024 invoked from network); 1 Feb 2003 17:47:23 -0000 Received: from daedalus.apache.org (HELO apache.org) (208.185.179.12) by nagoya.betaversion.org with SMTP; 1 Feb 2003 17:47:23 -0000 Received: (qmail 43365 invoked by uid 500); 1 Feb 2003 17:44:44 -0000 Mailing-List: contact turbine-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Turbine Users List" Reply-To: "Turbine Users List" Delivered-To: mailing list turbine-user@jakarta.apache.org Received: (qmail 43270 invoked from network); 1 Feb 2003 17:44:43 -0000 Received: from tiger.rnn.cc (65.212.180.132) by daedalus.apache.org with SMTP; 1 Feb 2003 17:44:43 -0000 Received: from [10.0.0.131] (lilmon [198.145.80.2]) by tiger.rnn.cc (8.12.4/8.12.1) with ESMTP id h11HvU7V008102 for ; Sat, 1 Feb 2003 09:57:30 -0800 Mime-Version: 1.0 Message-Id: Date: Sat, 1 Feb 2003 09:41:12 -0800 To: "Turbine Users List" From: Johnny Quazar Subject: Re: migrating to 2.2 - trouble with extended user Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Just thought I'd follow up in case somebody else stumbles here. I was getting the following error trying to add a new user: Error rendering Velocity template: screens/user/FluxUserForm.vm: Invocation of method 'getUserId' in class cc.rnn.nh.om.NhUser threw exception class java.lang.NullPointerException : null This would not have happened if I'd used Integer instead of int for my user key. The extend user howto says, in TurbineUserAdapter: /** * Gets the userId of the user. This is also the primary key * of the TURBINE_USER table. The return type of Integer is * valid only if the javaType for the ExtendedUser table * is "object". If it is "primative", the return type * should be changed to int. * @return the user id */ public Integer getUserId() { return new Integer(((NumberKey)getPrimaryKey()).intValue()); } So when I got to this point, I just slammed in some code: public int getUserId() { return ((NumberKey)getPrimaryKey()).intValue(); } Of course, this fails miserably if getPrimaryKey returns null, as the error above indicates. I am not happy with my current code but it does work to address this case: { NumberKey n = new NumberKey( (NumberKey) getPrimaryKey() ); try { String willExceptIfNull = n.toString(); return n.intValue(); } catch (java.lang.NullPointerException j) { return -1; } } I found testing (n == null) wasn't working for some reason. I don't know, the whole thing will be moot when my primary key is an object and not a primitive. Anyway that's what's up with that error, hope this helps if somebody else gets caught with this issue. --------------------------------------------------------------------- To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: turbine-user-help@jakarta.apache.org