You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@daffodil.apache.org by GitBox <gi...@apache.org> on 2019/06/06 11:51:24 UTC

[GitHub] [incubator-daffodil] stevedlawrence commented on a change in pull request #226: Sick of NPE. lexicalParent is now optLexicalParent and is Option type

stevedlawrence commented on a change in pull request #226: Sick of NPE. lexicalParent is now optLexicalParent and is Option type
URL: https://github.com/apache/incubator-daffodil/pull/226#discussion_r291138145
 
 

 ##########
 File path: daffodil-core/src/main/scala/org/apache/daffodil/dsom/SchemaComponentFactory.scala
 ##########
 @@ -79,14 +81,14 @@ trait SchemaFileLocatableImpl
 trait CommonContextMixin
   extends NestingMixin { self: OOLAGHost with ThrowsSDE =>
 
-  def lexicalParent: SchemaComponent
+  def optLexicalParent: Option[SchemaComponent]
 
-  lazy val schemaFile: Option[DFDLSchemaFile] = lexicalParent.schemaFile
-  lazy val schemaSet: SchemaSet = lexicalParent.schemaSet
-  def schemaDocument: SchemaDocument = lexicalParent.schemaDocument
-  lazy val xmlSchemaDocument: XMLSchemaDocument = lexicalParent.xmlSchemaDocument
-  lazy val schema: Schema = lexicalParent.schema
-  def uriString: String = lexicalParent.uriString
+  lazy val schemaFile: Option[DFDLSchemaFile] = optLexicalParent.flatMap { _.schemaFile }
 
 Review comment:
   Should this be ``.get.schemaFile`` like the onces below it? Seems there's an assumption in this class that lexicalParent isDefined.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services