[
https://issues.apache.org/jira/browse/DAFFODIL-1101?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17089071#comment-17089071
]
John Interrante commented on DAFFODIL-1101:
-------------------------------------------
I uncommented and ran the namespace-uri() tests using the current Daffodil
source (2.6.0). An Abort exception has replaced the
MissingFormatArgumentException in test_namespace_uri_01():
{{org.apache.daffodil.exceptions.Abort: Format specifier '%s'\nFormat string
"Root element %s is ambiguous. Candidates are %s." did not accept these
arguments: List(e1 in namespace http://first.com, e1 in namespace
http://home.com).}}
I did a search to find the place that formats the "Root element %s is
ambiguous. Candidates are %s." message and noticed that line of code passes
only one argument, not two arguments. I patched that line of code,
{{diff --git
a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/SchemaSet.scala
b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/SchemaSet.scala}}
{{index 2bebab74e..0ed791cd0 100644}}
{{--- a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/SchemaSet.scala}}
{{+++ b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/SchemaSet.scala}}
{{@@ -287,7 +287,7 @@ final class SchemaSet(}}
{{ // log(Info("%s searching for root element with name %s",
Misc.getNameFromClass(this), name))}}
{{ val candidates = schemas.flatMap \{ _.getGlobalElementDecl(name) }}}
{{ schemaDefinitionUnless(candidates.length != 0, "No root element found for %s
in any available namespace", name)}}
{{- schemaDefinitionUnless(candidates.length <= 1, "Root element %s is
ambiguous. Candidates are %s.",}}
{{+ schemaDefinitionUnless(candidates.length <= 1, "Root element %s is
ambiguous. Candidates are %s.", name,}}
{{ candidates.map { gef =>}}
{{ {}}
{{ val tns = gef.schemaDocument.targetNamespace}}
and now test_namespace_uri_01() throws:
{{org.apache.daffodil.tdml.TDMLExceptionImpl: (Implementation: daffodil)
SchemaDefinitionError: Schema Definition Error: Root element e1 is ambiguous.
Candidates are List(e1 in namespace http://first.com, e1 in namespace
http://home.com).}}
{{Schema context: SchemaSet Location in
file:/C:/GAPS/dfdl/incubator-daffodil/daffodil-test/target/scala-2.12/test-classes/org/apache/daffodil/section23/dfdl_functions/home_schema.dfdl.xsd}}
I'm not sure what the root cause of that exception is, but I will check again
after I finish working on DAFFODIL-1114 (Unsupported function fn:namespace-uri).
> MissingFormatArgumentException: Format specifier 's'
> ----------------------------------------------------
>
> Key: DAFFODIL-1101
> URL: https://issues.apache.org/jira/browse/DAFFODIL-1101
> Project: Daffodil
> Issue Type: Bug
> Components: Back End, General
> Reporter: Jessie Chab
> Priority: Major
>
> When creating tests for the namespace-uri() function, I somehow managed to
> trigger an error condition that caused this exception:
> [error] Test
> edu.illinois.ncsa.daffodil.section23.dfdl_expressions.TestDFDLExpressions.test_namespace_uri_01
> failed: edu.illinois.ncsa.daffodil.exceptions.Abort: why are you comparing
> two things that aren't the same type even?
> [error] edu.illinois.ncsa.daffodil.exceptions.Assert$.abort(Assert.scala:95)
> I had this test working at one point so I'm not sure how I got to this state.
> I was amused by the exception but figured we should either revisit the
> wording or figure out how it was triggered and make sure that can't happen
> anymore.
> See test namespace_uri_01 in the following files:
> daffodil-test/src/test/resources/edu/illinois/ncsa/daffodil/section23/dfdl_functions/Functions.tdml
> daffodil-test/src/test/resources/edu/illinois/ncsa/daffodil/section23/dfdl_functions/first_schema.dfdl.xsd
> daffodil-test/src/test/resources/edu/illinois/ncsa/daffodil/section23/dfdl_functions/home_schema.dfdl.xsd
> daffodil-test/src/test/resources/edu/illinois/ncsa/daffodil/section23/dfdl_functions/second_schema.dfdl.xsd
> daffodil-test/src/test/scala-debug/edu/illinois/ncsa/daffodil/section23/dfdl_expressions/TestDFDLExpressionsDebug.scala
> daffodil-test/src/test/scala/edu/illinois/ncsa/daffodil/section23/dfdl_expressions/TestDFDLExpressions.scala
--
This message was sent by Atlassian Jira
(v8.3.4#803005)