[ 
https://issues.apache.org/jira/browse/DAFFODIL-2211?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17751116#comment-17751116
 ] 

Steve Lawrence commented on DAFFODIL-2211:
------------------------------------------

Any ideas for a reasonable behavior?

If we have something like {{dfdlx:repType="xs:unsignedInt"}} then we don't have 
a place to hang the rep properties, so they must all come from the default 
format, which in most cases probably isn't going to be correct unless 
everything is implicit. Maybe that uses an implied simpletype where everything 
is implicit and just ignores the general format? That doesn' work for 
representation="text", maybe has other issues as well?

Or should we just create a SDE with an error that provides a suggestion about 
creating a new simpleType with the primitive type and set the repType to that?

Note that dfdl:prefixLengthType is a similar concept to dfdlx:repType. If you 
specify a primitive type for that property you get the error:
{quote}
[error] Schema Definition Error: Failed to resolve 
dfdl:prefixLengthType="xs:unsignedInt" to a simpleType
{quote}

Maybe that message could be improved, but maybe that is precedent for doing 
something similar for repType?


> Poor handling when dfdlx:repType is a built-in xsd type
> -------------------------------------------------------
>
>                 Key: DAFFODIL-2211
>                 URL: https://issues.apache.org/jira/browse/DAFFODIL-2211
>             Project: Daffodil
>          Issue Type: Bug
>          Components: Front End
>    Affects Versions: 2.4.0
>            Reporter: Brandon Sloane
>            Assignee: Steve Lawrence
>            Priority: Major
>         Attachments: TestCSV.scala, b.dfdl.xsd, c.dfdl.xsd, csv.tdml, 
> csvDetailed.dfdl.xsd, simpleCSVDetailed.csv, simpleCSVDetailed.xml
>
>
> Attached are two cases, both of which contain:
> {quote}<xs:simpleType name="SomeEnumType" dfdlx:repType="xs:unsignedByte">
>  <xs:restriction base="xs:unsignedShort">
>  <xs:enumeration value="55" dfdlx:repValues="0" />
>  <xs:enumeration value="56" dfdlx:repValues="1" />
>  <xs:enumeration value="57" dfdlx:repValues="2" />
>  </xs:restriction>
> </xs:simpleType>
> {quote}
> In some cases this could potentially make sense (eg. when the document format 
> is such that unsignedByte is automatically 8 bits), but we probably want to 
> disallow this entirely.
> In b.dfdl.xsd, the entire document is using representation='text'. This fails 
> with a somewhat reasonable error:
> {quote}[error] Schema Definition Error: Type UnsignedShort with 
> dfdl:representation='text' cannot have dfdl:lengthKind='implicit'
> Schema context: element reference tns:a Location line 1 in 
> file:/home/bsloane/Documents/incubator-daffodil/test/test/b.dfdl.xsd
> [error] Schema Definition Error: Type UnsignedShort cannot have 
> lengthKind='implicit' when representation='text'
> Schema context: element reference tns:a Location line 1 in 
> file:/home/bsloane/Documents/incubator-daffodil/test/test/b.dfdl.xsd
> {quote}
> in c.dfdl.xsd, the document is useing representation='binary', and fails with 
> an unhandled exception:
> {quote}!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
>    An unexpected exception occurred. This is a bug!   
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
>  Please report this bug and help us fix it:
>   https://daffodil.apache.org/community/#issue-tracker
>  Please include the following exception, the command you ran, and any input, 
> schema, or tdml files used that led to this bug.
> java.util.NoSuchElementException: None.get at 
> scala.None$.get(Option.scala:349) at scala.None$.get(Option.scala:347) at 
> org.apache.daffodil.grammar.primitives.TypeValueCalc.repTypeUnparser$lzycompute(PrimitivesExpressions.scala:264)
>  at 
> org.apache.daffodil.grammar.primitives.TypeValueCalc.repTypeUnparser(PrimitivesExpressions.scala:264)
>  at 
> org.apache.daffodil.grammar.primitives.TypeValueCalc.unparser$lzycompute(PrimitivesExpressions.scala:276)
>  at 
> org.apache.daffodil.grammar.primitives.TypeValueCalc.unparser(PrimitivesExpressions.scala:272)
>  at org.apache.daffodil.grammar.Gram.maybeUnparser(GrammarTerm.scala:146) at 
> org.apache.daffodil.grammar.primitives.ElementCombinatorBase.eRepTypeUnparser$lzycompute(ElementCombinator.scala:421)
>  at 
> org.apache.daffodil.grammar.primitives.ElementCombinatorBase.eRepTypeUnparser(ElementCombinator.scala:421)
>  at 
> org.apache.daffodil.grammar.primitives.ElementParseAndUnspecifiedLength.unparser$lzycompute(ElementCombinator.scala:332)
>  at 
> org.apache.daffodil.grammar.primitives.ElementParseAndUnspecifiedLength.unparser(ElementCombinator.scala:327)
>  at 
> org.apache.daffodil.grammar.primitives.ElementCombinator.unparser$lzycompute(ElementCombinator.scala:143)
>  at 
> org.apache.daffodil.grammar.primitives.ElementCombinator.unparser(ElementCombinator.scala:119)
>  at org.apache.daffodil.grammar.Prod.unparser$lzycompute(Production.scala:92) 
> at org.apache.daffodil.grammar.Prod.unparser(Production.scala:84) at 
> org.apache.daffodil.grammar.Prod.unparser$lzycompute(Production.scala:92) at 
> org.apache.daffodil.grammar.Prod.unparser(Production.scala:84) at 
> org.apache.daffodil.compiler.ProcessorFactory.$anonfun$unparser$1(Compiler.scala:106)
>  at 
> org.apache.daffodil.oolag.OOLAG$OOLAGValueBase.liftedTree1$1(OOLAG.scala:549) 
> at 
> org.apache.daffodil.oolag.OOLAG$OOLAGValueBase.valueAsAny$lzycompute(OOLAG.scala:547)
>  at 
> org.apache.daffodil.oolag.OOLAG$OOLAGValueBase.valueAsAny(OOLAG.scala:544) at 
> org.apache.daffodil.oolag.OOLAG$OOLAGValue.value$lzycompute(OOLAG.scala:594) 
> at org.apache.daffodil.oolag.OOLAG$OOLAGValue.value(OOLAG.scala:594) at 
> org.apache.daffodil.compiler.ProcessorFactory.unparser$lzycompute(Compiler.scala:105)
>  at 
> org.apache.daffodil.compiler.ProcessorFactory.unparser(Compiler.scala:105) at 
> org.apache.daffodil.compiler.ProcessorFactory.$anonfun$new$4(Compiler.scala:127)
>  at 
> org.apache.daffodil.oolag.OOLAG$OOLAGValueBase.liftedTree1$1(OOLAG.scala:549) 
> at 
> org.apache.daffodil.oolag.OOLAG$OOLAGValueBase.valueAsAny$lzycompute(OOLAG.scala:547)
>  at 
> org.apache.daffodil.oolag.OOLAG$OOLAGValueBase.valueAsAny(OOLAG.scala:544) at 
> org.apache.daffodil.oolag.OOLAG$OOLAGHost.$anonfun$checkErrors$2(OOLAG.scala:286)
>  at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12) at 
> org.apache.daffodil.oolag.OOLAG$.keepGoing(OOLAG.scala:60) at 
> org.apache.daffodil.oolag.OOLAG$OOLAGHost.checkErrors(OOLAG.scala:286) at 
> org.apache.daffodil.oolag.OOLAG$OOLAGHost.checkErrors$(OOLAG.scala:277) at 
> org.apache.daffodil.dsom.SchemaComponentImpl.checkErrors(SchemaComponent.scala:38)
>  at org.apache.daffodil.oolag.OOLAG$OOLAGHost.isError(OOLAG.scala:345) at 
> org.apache.daffodil.oolag.OOLAG$OOLAGHost.isError$(OOLAG.scala:344) at 
> org.apache.daffodil.compiler.ProcessorFactory.super$isError(Compiler.scala:141)
>  at 
> org.apache.daffodil.compiler.ProcessorFactory.$anonfun$isError$3(Compiler.scala:141)
>  at scala.runtime.java8.JFunction0$mcZ$sp.apply(JFunction0$mcZ$sp.java:12) at 
> org.apache.daffodil.oolag.OOLAG$.keepGoing(OOLAG.scala:60) at 
> org.apache.daffodil.compiler.ProcessorFactory.$anonfun$isError$1(Compiler.scala:132)
>  at scala.runtime.java8.JFunction0$mcZ$sp.apply(JFunction0$mcZ$sp.java:12) at 
> scala.util.DynamicVariable.withValue(DynamicVariable.scala:58) at 
> org.apache.daffodil.ExecutionMode$.$anonfun$usingCompilerMode$1(ExecutionMode.scala:64)
>  at org.apache.daffodil.compiler.ProcessorFactory.isError(Compiler.scala:132) 
> at org.apache.daffodil.compiler.Compiler.compileSource(Compiler.scala:359) at 
> org.apache.daffodil.Main$.$anonfun$createProcessorFromSchema$1(Main.scala:704)
>  at org.apache.daffodil.util.Timer$.getTimeResult(Timer.scala:76) at 
> org.apache.daffodil.util.Timer$.getResult(Timer.scala:35) at 
> org.apache.daffodil.Main$.createProcessorFromSchema(Main.scala:703) at 
> org.apache.daffodil.Main$.run(Main.scala:816) at 
> org.apache.daffodil.Main$.main(Main.scala:1351) at 
> org.apache.daffodil.Main.main(Main.scala)
> {quote}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to