New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xsi:nil="1" is not accepted as nil #217

Closed
aoprisan opened this Issue Jul 3, 2013 · 4 comments

Comments

Projects
None yet
2 participants
@aoprisan

aoprisan commented Jul 3, 2013

Given the following element definition in the WSDL file:

<element minOccurs="0" name="TotalDeltaTcv" nillable="true" type="decimal" />

I get an NumberFormatException when parsing the following line in the response

<ns1:TotalDeltaTcv xsi:nil="1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns1="http://api.zuora.com/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"/>

I have tried both version 1.1.0 and snapshot of scalaxb.

If you need more details, please let me know.

@eed3si9n

This comment has been minimized.

Show comment
Hide comment
@eed3si9n

eed3si9n Jul 4, 2013

Owner

Thanks for reporting this. I think it's a bug in scalaxb runtime that's not recognizing "1" as true.

Owner

eed3si9n commented Jul 4, 2013

Thanks for reporting this. I think it's a bug in scalaxb runtime that's not recognizing "1" as true.

@eed3si9n eed3si9n closed this in b781ee1 Jul 4, 2013

@eed3si9n

This comment has been minimized.

Show comment
Hide comment
@eed3si9n

eed3si9n Jul 4, 2013

Owner

1.1.1-SNAPSHOT is out with the fix.

Owner

eed3si9n commented Jul 4, 2013

1.1.1-SNAPSHOT is out with the fix.

@aoprisan

This comment has been minimized.

Show comment
Hide comment
@aoprisan

aoprisan Jul 4, 2013

You're welcome, thank you for fixing it so fast :), I have checked it on our WSDL file and it worked just fine. I had some troubles testing it (it was still failing due to an old version in the ivy cache and me being silly ) which made me have a look on the scalaxb's source code and I might have found a similar place where the same handling of 1 as true has to happen, namely in cli/src/main/scala/scalaxb/compiler/xsd/Decl.scala, lines 407 and 459, but I am not sure :) :

val minOccurs = CompositorDecl.buildOccurrence((node \ "@minOccurs").text)
     val maxOccurs = CompositorDecl.buildOccurrence((node \ "@maxOccurs").text)
     val (namespace, typeName) = TypeSymbolParser.splitTypeName(ref, node.scope, config.targetNamespace, config.isCameleonInclude)
-    val nillable = (node \ "@nillable").headOption map { _.text == "true" }
+    val nillable = (node \ "@nillable").headOption map { case x => x.text == "true" || x.text == "1"}

-----------
     val fixedValue = (node \ "@fixed").headOption map { _.text }
     val minOccurs = CompositorDecl.buildOccurrence((node \ "@minOccurs").text)
     val maxOccurs = CompositorDecl.buildOccurrence((node \ "@maxOccurs").text)
-    val nillable = (node \ "@nillable").headOption map { _.text == "true" }
+    val nillable = (node \ "@nillable").headOption map { case x => x.text == "true" || x.text == "1"}

aoprisan commented Jul 4, 2013

You're welcome, thank you for fixing it so fast :), I have checked it on our WSDL file and it worked just fine. I had some troubles testing it (it was still failing due to an old version in the ivy cache and me being silly ) which made me have a look on the scalaxb's source code and I might have found a similar place where the same handling of 1 as true has to happen, namely in cli/src/main/scala/scalaxb/compiler/xsd/Decl.scala, lines 407 and 459, but I am not sure :) :

val minOccurs = CompositorDecl.buildOccurrence((node \ "@minOccurs").text)
     val maxOccurs = CompositorDecl.buildOccurrence((node \ "@maxOccurs").text)
     val (namespace, typeName) = TypeSymbolParser.splitTypeName(ref, node.scope, config.targetNamespace, config.isCameleonInclude)
-    val nillable = (node \ "@nillable").headOption map { _.text == "true" }
+    val nillable = (node \ "@nillable").headOption map { case x => x.text == "true" || x.text == "1"}

-----------
     val fixedValue = (node \ "@fixed").headOption map { _.text }
     val minOccurs = CompositorDecl.buildOccurrence((node \ "@minOccurs").text)
     val maxOccurs = CompositorDecl.buildOccurrence((node \ "@maxOccurs").text)
-    val nillable = (node \ "@nillable").headOption map { _.text == "true" }
+    val nillable = (node \ "@nillable").headOption map { case x => x.text == "true" || x.text == "1"}

@eed3si9n eed3si9n reopened this Jul 5, 2013

@eed3si9n eed3si9n closed this in affbc75 Jul 6, 2013

@eed3si9n

This comment has been minimized.

Show comment
Hide comment
@eed3si9n

eed3si9n Jul 6, 2013

Owner

Those are schema parsing code, so if "1" appeared in xsd file, it'd have the same problem.

Owner

eed3si9n commented Jul 6, 2013

Those are schema parsing code, so if "1" appeared in xsd file, it'd have the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment