Return-Path: Delivered-To: apmail-cxf-dev-archive@www.apache.org Received: (qmail 3313 invoked from network); 21 May 2009 20:31:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 21 May 2009 20:31:20 -0000 Received: (qmail 46008 invoked by uid 500); 21 May 2009 20:31:33 -0000 Delivered-To: apmail-cxf-dev-archive@cxf.apache.org Received: (qmail 45912 invoked by uid 500); 21 May 2009 20:31:32 -0000 Mailing-List: contact dev-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list dev@cxf.apache.org Received: (qmail 45902 invoked by uid 99); 21 May 2009 20:31:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 May 2009 20:31:32 +0000 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [66.207.172.168] (HELO server.dankulp.com) (66.207.172.168) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 May 2009 20:31:22 +0000 Received: by server.dankulp.com (Postfix, from userid 5000) id DAD1050704B0; Thu, 21 May 2009 16:31:00 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.2.1-gr1 (2007-05-02) on server.dankulp.com X-Spam-Level: X-Msg-File: /tmp/mailfilter.e2Y2npvej4 Received: from dilbert.localnet (c-24-91-141-225.hsd1.ma.comcast.net [24.91.141.225]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by server.dankulp.com (Postfix) with ESMTPSA id 0561550704AA; Thu, 21 May 2009 16:30:57 -0400 (EDT) From: Daniel Kulp To: dev@cxf.apache.org Subject: Re: Possible Issue in org.apache.cxf.jaxws.interceptors.SwAOutInterceptor Date: Thu, 21 May 2009 16:30:58 -0400 User-Agent: KMail/1.11.3 (Linux/2.6.29-gentoo; KDE/4.2.3; x86_64; ; ) Cc: "Ault, Matt" References: <74FC5E5EFE88994CBE00BAEDEB2BE9FA3247236858@ATLMAIL.nova.prv> In-Reply-To: <74FC5E5EFE88994CBE00BAEDEB2BE9FA3247236858@ATLMAIL.nova.prv> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200905211630.58919.dkulp@apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Status: No, score=-3.0 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.1-gr1 Interesting. Didn't know that ConcurrentHashMaps couldn't have null values. Definitely different than normal HashMaps. Learn something new every day. :-0 Yea. It's an issue. Committed fix to trunk for 2.2.2. Dan On Thu May 21 2009 4:04:03 pm Ault, Matt wrote: > I believe I have found a possible issue in the > org.apache.cxf.jaxws.interceptors.SwAOutInterceptor. The functionality > appears to have changed between 2.1.3 and 2.2.1. I'm not sure which is the > correct functionality so I thought I'd post here first. > > This problem occurs when you have a JAXBContextImplementation that does not > have a hasSwaRef method. I found this issue when moving a service from > Tomcat to WebSphere. IBM uses a different implementation of JAXBContext by > default and IBM's version doesn't have a hasSwaRef method on it. > > In 2.2.1 this results in a NullPointerException in this block of code: > > 1 private boolean callSWARefMethod(JAXBContext ctx) { > 2 Method m = SWA_REF_METHOD.get(ctx.getClass().getName()); > 3 if (m == null && > !SWA_REF_METHOD.containsKey(ctx.getClass().getName())) { 4 try { > 5 m = ctx.getClass().getMethod("hasSwaRef", new Class[0]); > 6 } catch (Exception e) { > 7 //ignore > 8 } > 9 SWA_REF_METHOD.put(ctx.getClass().getName(), m); > 10 } > 11 try { > 12 return (Boolean)m.invoke(ctx); > 13 } catch (Exception e) { > 14 return false; > 15 } > 16 } > > This throws the NPE at line 9 SWA_REF_METHOD.put(ctx.getClass().getName(), > m); because m is null. In JDK 1.6.07 ConcurrentHashMap.put() throws a > NullPointerException when the value is null. This causes a SOAPFault to be > returned to the client. > > I believe that this code should just return false if the hasSwaRef method > doesn't exist (which is how this operates in 2.1.3). If the put() wasn't > called when m is null, then this code should return true if the method > exists and false if it doesn't. > > Fortunately, I can work around this by setting the > javax.xml.bind.JAXBContext system property to the Sun version > (com.sun.xml.bind.v2.ContextFactory) which returns a JAXBContext that > implements hasSwaRef(). > > Let me know if you need any more information from me regarding this issue, > I didn't post it to JIRA since I wasn't sure if the code was performing > correctly yet. > > > Matt Ault > Systems and Technology > Elavon > > ----------------------------------------- Note: The information > contained in this e-mail and in any attachments is intended only > for the person or entity to which it is addressed and may contain > confidential and/or privileged material. Any review, > retransmission, dissemination or other use of, or taking of any > action in reliance upon, this information by persons or entities > other than the intended recipient is prohibited. The recipient > should check this e-mail and any attachments for the presence of > viruses. Sender accepts no liability for any damages caused by any > virus transmitted by this e-mail. If you have received this e-mail > in error, please notify us immediately by replying to the message > and delete the e-mail from your computer. Elavon (formerly NOVA > Information Systems) -- Daniel Kulp dkulp@apache.org http://www.dankulp.com/blog