You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2016/03/23 00:26:27 UTC

svn commit: r1736258 - in /webservices/axiom/trunk: aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/ testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/ testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/

Author: veithen
Date: Tue Mar 22 23:26:27 2016
New Revision: 1736258

URL: http://svn.apache.org/viewvc?rev=1736258&view=rev
Log:
Fix regression in OMContainer#getBuilder().

Added:
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestGetBuilderNull.java   (with props)
Modified:
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomContainerSupport.aj
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomContainerSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomContainerSupport.aj?rev=1736258&r1=1736257&r2=1736258&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomContainerSupport.aj (original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomContainerSupport.aj Tue Mar 22 23:26:27 2016
@@ -84,11 +84,15 @@ public aspect AxiomContainerSupport {
 
     public final OMXMLParserWrapper AxiomContainer.getBuilder() {
         BuilderImpl builder = (BuilderImpl)coreGetBuilder();
-        OMXMLParserWrapper facade = (OMXMLParserWrapper)builder.getFacade();
-        if (facade == null) {
-            facade = new OMXMLParserWrapperImpl(builder, null);
+        if (builder == null) {
+            return null;
+        } else {
+            OMXMLParserWrapper facade = (OMXMLParserWrapper)builder.getFacade();
+            if (facade == null) {
+                facade = new OMXMLParserWrapperImpl(builder, null);
+            }
+            return facade;
         }
-        return facade;
     }
 
     public final XMLStreamReader AxiomContainer.getXMLStreamReader() {

Modified: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java?rev=1736258&r1=1736257&r2=1736258&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java (original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java Tue Mar 22 23:26:27 2016
@@ -164,6 +164,7 @@ public class OMTestSuiteBuilder extends
         }
         for (OMContainerFactory cf : getInstances(OMContainerFactory.class)) {
             addTest(new org.apache.axiom.ts.om.container.TestAddChildWithIncompleteSibling(metaFactory, cf));
+            addTest(new org.apache.axiom.ts.om.container.TestGetBuilderNull(metaFactory, cf));
             addTest(new org.apache.axiom.ts.om.container.TestGetDescendants(metaFactory, cf, true));
             addTest(new org.apache.axiom.ts.om.container.TestGetDescendants(metaFactory, cf, false));
         }

Added: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestGetBuilderNull.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestGetBuilderNull.java?rev=1736258&view=auto
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestGetBuilderNull.java (added)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestGetBuilderNull.java Tue Mar 22 23:26:27 2016
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.ts.om.container;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import org.apache.axiom.om.OMContainer;
+import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.ts.AxiomTestCase;
+
+/**
+ * Tests that {@link OMContainer#getBuilder()} returns {@code null} on a programmatically created
+ * node.
+ */
+public class TestGetBuilderNull extends AxiomTestCase {
+    private final OMContainerFactory containerFactory;
+
+    public TestGetBuilderNull(OMMetaFactory metaFactory, OMContainerFactory containerFactory) {
+        super(metaFactory);
+        this.containerFactory = containerFactory;
+        containerFactory.addTestParameters(this);
+    }
+
+    @Override
+    protected void runTest() throws Throwable {
+        OMContainer container = containerFactory.create(metaFactory.getOMFactory());
+        assertThat(container.getBuilder()).isNull();
+    }
+}

Propchange: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestGetBuilderNull.java
------------------------------------------------------------------------------
    svn:eol-style = native