Return-Path: X-Original-To: apmail-axis-java-dev-archive@www.apache.org Delivered-To: apmail-axis-java-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4EE1B18864 for ; Mon, 18 Apr 2016 22:36:26 +0000 (UTC) Received: (qmail 77426 invoked by uid 500); 18 Apr 2016 22:36:25 -0000 Delivered-To: apmail-axis-java-dev-archive@axis.apache.org Received: (qmail 77277 invoked by uid 500); 18 Apr 2016 22:36:25 -0000 Mailing-List: contact java-dev-help@axis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@axis.apache.org Delivered-To: mailing list java-dev@axis.apache.org Received: (qmail 77170 invoked by uid 99); 18 Apr 2016 22:36:25 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 Apr 2016 22:36:25 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 902772C1F6A for ; Mon, 18 Apr 2016 22:36:25 +0000 (UTC) Date: Mon, 18 Apr 2016 22:36:25 +0000 (UTC) From: "Hudson (JIRA)" To: java-dev@axis.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (AXIS2-5751) Databinding- BeanUtil.getPullParser() throws NullPointerException MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/AXIS2-5751?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15246703#comment-15246703 ] Hudson commented on AXIS2-5751: ------------------------------- SUCCESS: Integrated in axis2-1.7 #50 (See [https://builds.apache.org/job/axis2-1.7/50/]) AXIS2-5751: Merge r1739815 to the 1.7 branch. (veithen: rev 1739825) * axis2 * axis2/modules/adb/pom.xml * axis2/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java * axis2/modules/adb/test/org/apache/axis2/databinding/utils/BeanUtilTest.java * axis2/modules/adb/test/org/apache/axis2/databinding/utils/ComplexTypeWithAnyTypeElement.java > Databinding- BeanUtil.getPullParser() throws NullPointerException > ----------------------------------------------------------------- > > Key: AXIS2-5751 > URL: https://issues.apache.org/jira/browse/AXIS2-5751 > Project: Axis2 > Issue Type: Bug > Components: adb > Affects Versions: 1.7.1 > Reporter: Vasile Bucur > Attachments: AXIS2-5751-ServiceTest.7z, stacktrace.txt, stacktrace_array_tc2.txt > > > Test Case 1 (stacktrace.txt): > My service operation returns an Response Object, having a header and content. In Header i have in CustomError (see code below) object that describes application errors and in content i have the payload. > In my specific case i'm calling the service operation which returns an Response object having in header a custom error without details. This causes the operation to fail because the pull parser wants to instantiate the result of the getter method witch is a null java.lang.Object. > Test code: > {code:java} > public class CustomError { > private Error code; > private Object detail; > // constructors > // getters and setters > } > .. > new CustomError(code41); // detail is null > {code} > in adb: > {code:title=BeanUtil.java} > Object value; > if (readMethod != null) { > readMethod.setAccessible(true); > value = readMethod.invoke(beanObject); // value is null > } else { > throw new AxisFault("Property '" + propertyName + "' in bean class '" > + beanClass.getName() + "'is not readable."); > } > ...... > ...... > }else { > addTypeQname(elemntNameSpace, propertyQnameValueList, property, > beanName, processingDocLitBare); > if (Object.class.equals(ptype)) { > //this is required to match this element prefix as > //root element's prefix. > QName qNamefortheType = (QName) typeTable > .getComplexSchemaMap().get( > getClassName(beanClass)); > OMFactory fac = OMAbstractFactory.getOMFactory(); > QName elementName; > OMElement element; > if (elemntNameSpace != null) { > elementName = new QName( > elemntNameSpace.getNamespaceURI(), > property.getName(), > qNamefortheType.getPrefix()); > } else { > elementName = new QName(property.getName()); > } > > if(SimpleTypeMapper.isSimpleType(value)){ > element = fac.createOMElement(elementName); > element.addChild(fac.createOMText(SimpleTypeMapper > .getStringValue(value))); > }else{ > // value is null !!! > XMLStreamReader xr = BeanUtil.getPullParser(value, > elementName, typeTable, qualified, false); > {code} > {code:title=BeanUtil.java} > public static XMLStreamReader getPullParser(Object beanObject, > QName beanName, > TypeTable typeTable, > boolean qualified, > boolean processingDocLitBare) { > Class beanClass = beanObject.getClass(); // NullPointerException > .............. > {code} > Testcase 2 (stacktrace_array_tc2.txt) > return of the operation is also a complex structure but now inside the returned object at a deeper level there is a Array List of String arrays. Here another problem because the BeanUtil tries to get the package of the *class [Ljava.lang.Object;* meaning the arrays of object which is NULL resulting to NullPointerException! > {code:title=BeanUtil.java} > if (typeTable != null && qualified) { > QName qNamefortheType = typeTable.getQNamefortheType(beanClass.getName()); > if (qNamefortheType == null) { > // beanClass.getPackage() is null for class [Ljava.lang.Object; (Object[].class) > qNamefortheType = typeTable.getQNamefortheType(beanClass.getPackage().getName()); > } > if (qNamefortheType == null) { > throw new AxisFault("Mapping qname not fond for the package: " + > beanObject.getClass().getPackage().getName()); > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org For additional commands, e-mail: java-dev-help@axis.apache.org