Return-Path: Delivered-To: apmail-cxf-issues-archive@www.apache.org Received: (qmail 67288 invoked from network); 21 May 2009 18:40:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 21 May 2009 18:40:57 -0000 Received: (qmail 2532 invoked by uid 500); 21 May 2009 18:41:10 -0000 Delivered-To: apmail-cxf-issues-archive@cxf.apache.org Received: (qmail 2504 invoked by uid 500); 21 May 2009 18:41:10 -0000 Mailing-List: contact issues-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 issues@cxf.apache.org Received: (qmail 2494 invoked by uid 99); 21 May 2009 18:41:10 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 May 2009 18:41:10 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 May 2009 18:41:07 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 161D8234C044 for ; Thu, 21 May 2009 11:40:46 -0700 (PDT) Message-ID: <1846421666.1242931246089.JavaMail.jira@brutus> Date: Thu, 21 May 2009 11:40:46 -0700 (PDT) From: "Daniel Kulp (JIRA)" To: issues@cxf.apache.org Subject: [jira] Resolved: (CXF-2229) thread safe issue caused by XMLOutputFactoryImpl In-Reply-To: <2029454461.1242896625886.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/CXF-2229?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Daniel Kulp resolved CXF-2229. ------------------------------ Resolution: Fixed Fix Version/s: 2.2.2 2.1.6 Assignee: Daniel Kulp > thread safe issue caused by XMLOutputFactoryImpl > ------------------------------------------------ > > Key: CXF-2229 > URL: https://issues.apache.org/jira/browse/CXF-2229 > Project: CXF > Issue Type: Bug > Components: WS-* Components > Affects Versions: 2.1.3 > Reporter: leon wu > Assignee: Daniel Kulp > Fix For: 2.1.6, 2.2.2 > > > Currently CXF calls StaxUtils.getXMLOutputFactory() to get the cached instance of XMLOutputFactoryImpl. But XMLOutputFactoryImpl.createXMLStreamWriter is not thread-safe. See below. > javax.xml.stream.XMLStreamWriter createXMLStreamWriter(javax.xml.transform.stream.StreamResult sr, String encoding) throws javax.xml.stream.XMLStreamException { > try{ > if(fReuseInstance && fStreamWriter != null && fStreamWriter.canReuse() && !fPropertyChanged){ > fStreamWriter.reset(); > fStreamWriter.setOutput(sr, encoding); > if(DEBUG)System.out.println("reusing instance, object id : " + fStreamWriter); > return fStreamWriter; > } > return fStreamWriter = new XMLStreamWriterImpl(sr, encoding, new PropertyManager(fPropertyManager)); -- this is not thread safe, since the new instance is assigned to the field fStreamWriter first, then it is possible that different threads get the same XMLStreamWriterImpl when they call this method at the same time. > }catch(java.io.IOException io){ > throw new XMLStreamException(io); > } > } > The solution might be, StaxUtils.getXMLOutputFactory() method creates a new instance of XMLOutputFactory every time, don't cache it. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.