This is an automated email from the ASF dual-hosted git repository.

robertlazarski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-core.git

commit a003d3c467d5ab98b7e157530f2977526e566569
Author: Robert Lazarski <[email protected]>
AuthorDate: Sat Feb 14 09:20:22 2026 -1000

    Clarify AXIS2-6053 diagnostic hint to indicate it is one possible cause
    
    Reword the hint to say "if this attribute is expected to be valid, one
    common cause is..." rather than "This may be caused by...", making it
    clear the hint is advisory and only relevant when the attribute should
    have been allowed by the schema.
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
---
 .../java/org/apache/axis2/validation/SchemaValidationHandler.java  | 7 ++++---
 .../org/apache/axis2/validation/SchemaValidationHandlerTest.java   | 6 +++---
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git 
a/modules/schema-validation/src/main/java/org/apache/axis2/validation/SchemaValidationHandler.java
 
b/modules/schema-validation/src/main/java/org/apache/axis2/validation/SchemaValidationHandler.java
index 89add55110..b1383f9fbc 100644
--- 
a/modules/schema-validation/src/main/java/org/apache/axis2/validation/SchemaValidationHandler.java
+++ 
b/modules/schema-validation/src/main/java/org/apache/axis2/validation/SchemaValidationHandler.java
@@ -88,11 +88,12 @@ public class SchemaValidationHandler extends 
AbstractHandler {
     static String appendRefHint(SAXException ex) {
         String msg = ex.getMessage();
         if (msg != null && msg.contains("cvc-complex-type.3.2.2")) {
-            return ". This may be caused by a schema using xs:attribute ref= 
to reference"
+            return ". Note: if this attribute is expected to be valid,"
+                    + " one common cause is a schema using xs:attribute ref= 
to reference"
                     + " an attribute from an external namespace (e.g., 
xmime:contentType)"
                     + " whose schema was not imported or could not be 
resolved."
-                    + " Consider defining the attribute inline instead of 
using ref=,"
-                    + " or ensure the referenced schema is accessible.";
+                    + " In that case, ensure the referenced schema is 
accessible"
+                    + " or define the attribute inline instead of using ref=.";
         }
         return "";
     }
diff --git 
a/modules/schema-validation/src/test/java/org/apache/axis2/validation/SchemaValidationHandlerTest.java
 
b/modules/schema-validation/src/test/java/org/apache/axis2/validation/SchemaValidationHandlerTest.java
index 66314005fa..f7e320cea2 100644
--- 
a/modules/schema-validation/src/test/java/org/apache/axis2/validation/SchemaValidationHandlerTest.java
+++ 
b/modules/schema-validation/src/test/java/org/apache/axis2/validation/SchemaValidationHandlerTest.java
@@ -49,8 +49,8 @@ public class SchemaValidationHandlerTest {
         SAXException ex = new SAXException(
                 "cvc-complex-type.3.2.2: Attribute 'contentType' is not 
allowed to appear in element 'foo'");
         String hint = SchemaValidationHandler.appendRefHint(ex);
+        assertThat(hint).contains("if this attribute is expected to be valid");
         assertThat(hint).contains("xs:attribute ref=");
-        assertThat(hint).contains("xmime:contentType");
         assertThat(hint).contains("not imported or could not be resolved");
     }
 
@@ -128,7 +128,7 @@ public class SchemaValidationHandlerTest {
         assertThatThrownBy(() -> handler.invoke(msgCtx))
                 .isInstanceOf(AxisFault.class)
                 .hasMessageContaining("cvc-complex-type.3.2.2")
-                .hasMessageContaining("xs:attribute ref=")
-                .hasMessageContaining("not imported or could not be resolved");
+                .hasMessageContaining("if this attribute is expected to be 
valid")
+                .hasMessageContaining("xs:attribute ref=");
     }
 }

Reply via email to