You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by mb...@apache.org on 2018/02/28 19:48:39 UTC
[incubator-daffodil] branch master updated: Added WarnIDs for all
warnings. Removed non-warnID forms of methods.
This is an automated email from the ASF dual-hosted git repository.
mbeckerle pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-daffodil.git
The following commit(s) were added to refs/heads/master by this push:
new 075084f Added WarnIDs for all warnings. Removed non-warnID forms of methods.
075084f is described below
commit 075084f5a825bde3168b8e89a02c7e58404cc325
Author: Michael Beckerle <mb...@tresys.com>
AuthorDate: Tue Feb 27 14:06:34 2018 -0500
Added WarnIDs for all warnings. Removed non-warnID forms of methods.
Fixes DAFFODIL-1874, and also DAFFODIL-1838
Enables fixing https://github.com/DFDLSchemas/NACHA/issues/2
DAFFODIL-1874, DAFFODIL-1838
---
.../org/apache/daffodil/dpath/Expression.scala | 5 +-
.../daffodil/dsom/AnnotatedSchemaComponent.scala | 5 +-
.../org/apache/daffodil/dsom/DFDLAssertion.scala | 3 +-
.../org/apache/daffodil/dsom/ElementBase.scala | 11 +-
.../scala/org/apache/daffodil/dsom/IIBase.scala | 3 +-
.../org/apache/daffodil/dsom/SchemaDocument.scala | 7 +-
.../apache/daffodil/dsom/TermEncodingMixin.scala | 3 +-
.../daffodil/grammar/ElementBaseGrammarMixin.scala | 207 ++++++++++-----------
.../org/apache/daffodil/grammar/GrammarTerm.scala | 4 +-
.../grammar/primitives/PatternChecker.scala | 3 +-
.../primitives/PrimitivesElementKinds.scala | 3 +-
.../scala/org/apache/daffodil/api/WarnID.scala | 65 ++++++-
.../org/apache/daffodil/exceptions/ThrowsSDE.scala | 18 +-
.../schema/annotation/props/ByHandMixins.scala | 5 +-
.../resources/org/apache/daffodil/xsd/dafext.xsd | 24 ++-
.../scala/org/apache/daffodil/dpath/DState.scala | 5 +-
.../apache/daffodil/dsom/CompiledExpression1.scala | 3 +-
.../main/scala/org/apache/daffodil/dsom/SDE.scala | 16 +-
project/Dependencies.scala | 3 +-
19 files changed, 224 insertions(+), 169 deletions(-)
diff --git a/daffodil-core/src/main/scala/org/apache/daffodil/dpath/Expression.scala b/daffodil-core/src/main/scala/org/apache/daffodil/dpath/Expression.scala
index 25795ee..03e5309 100644
--- a/daffodil-core/src/main/scala/org/apache/daffodil/dpath/Expression.scala
+++ b/daffodil-core/src/main/scala/org/apache/daffodil/dpath/Expression.scala
@@ -29,6 +29,7 @@ import org.apache.daffodil.dsom.RelativePathPastRootError
import org.apache.daffodil.equality._
import java.math.{ BigDecimal => JBigDecimal, BigInteger => JBigInt }
import org.apache.daffodil.util.Numbers
+import org.apache.daffodil.api.WarnID
/**
* Root class of the type hierarchy for the AST nodes used when we
@@ -1299,12 +1300,12 @@ case class FunctionCallExpression(functionQNameString: String, expressions: List
DAFTraceExpr(functionQNameString, functionQName, args)
case (RefQName(_, "error", DAF_NCSA), args) => {
- SDW("Expression daf:error is deprecated. Use fn:error instead")
+ SDW(WarnID.DeprecatedFunctionDAFError, "Expression daf:error is deprecated. Use fn:error instead")
DAFErrorExpr(functionQNameString, functionQName, args)
}
case (RefQName(_, "error", DAF_APACHE), args) => {
- SDW("Expression daf:error is deprecated. Use fn:error instead")
+ SDW(WarnID.DeprecatedFunctionDAFError, "Expression daf:error is deprecated. Use fn:error instead")
DAFErrorExpr(functionQNameString, functionQName, args)
}
diff --git a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/AnnotatedSchemaComponent.scala b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/AnnotatedSchemaComponent.scala
index 8f52196..fb5944c 100644
--- a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/AnnotatedSchemaComponent.scala
+++ b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/AnnotatedSchemaComponent.scala
@@ -27,6 +27,7 @@ import org.apache.daffodil.schema.annotation.props.PropertyLookupResult
import org.apache.daffodil.schema.annotation.props.NotFound
import org.apache.daffodil.schema.annotation.props.Found
import org.apache.daffodil.schema.annotation.props.FindPropertyMixin
+import org.apache.daffodil.api.WarnID
/**
* Only objects from which we generate processors (parsers/unparsers)
@@ -284,7 +285,7 @@ trait AnnotatedMixin
{
ai.attribute("source") match {
case None => {
- this.SDW("""xs:appinfo without source attribute. Is source="http://www.ogf.org/dfdl/" missing?""")
+ this.SDW(WarnID.AppinfoNoSource, """xs:appinfo without source attribute. Is source="http://www.ogf.org/dfdl/" missing?""")
false
}
case Some(n) => {
@@ -306,7 +307,7 @@ trait AnnotatedMixin
//
val hasRightSource = (sourceNS =:= officialAppinfoSourceAttributeNS)
val isAcceptable = sourceNS.toString.contains("ogf") && sourceNS.toString.contains("dfdl")
- schemaDefinitionWarningWhen(!hasRightSource && isAcceptable,
+ schemaDefinitionWarningWhen(WarnID.AppinfoDFDLSourceWrong, !hasRightSource && isAcceptable,
"The xs:appinfo source attribute value '%s' should be '%s'.", sourceNS, officialAppinfoSourceAttributeNS)
(hasRightSource || isAcceptable)
}
diff --git a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/DFDLAssertion.scala b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/DFDLAssertion.scala
index b2b54a7..dd2dd85 100644
--- a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/DFDLAssertion.scala
+++ b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/DFDLAssertion.scala
@@ -28,6 +28,7 @@ import org.apache.daffodil.grammar.primitives.DiscriminatorPatternPrim
import org.apache.daffodil.grammar.primitives.DiscriminatorBooleanPrim
import org.apache.daffodil.grammar.primitives.AssertPatternPrim
import org.apache.daffodil.grammar.primitives.AssertBooleanPrim
+import org.apache.daffodil.api.WarnID
abstract class DFDLAssertionBase(node: Node, decl: AnnotatedSchemaComponent)
extends DFDLStatement(node, decl) {
@@ -69,7 +70,7 @@ abstract class DFDLAssertionBase(node: Node, decl: AnnotatedSchemaComponent)
case term: Term => {
val encInfo = term.termRuntimeData.encodingInfo
if (encInfo.knownEncodingIsUnicode && hasWord)
- SDW("The encoding is '%s' and \\w was detected in the pattern '%s'. This is not recommended with Unicode encodings.",
+ SDW(WarnID.PatternEncodingSlashW, "The encoding is '%s' and \\w was detected in the pattern '%s'. This is not recommended with Unicode encodings.",
encInfo.knownEncodingName, thePattern)
}
case _ => // ok
diff --git a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/ElementBase.scala b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/ElementBase.scala
index 55f4a14..594e438 100644
--- a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/ElementBase.scala
+++ b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/ElementBase.scala
@@ -41,6 +41,7 @@ import org.apache.daffodil.infoset.NoNextElement
import org.apache.daffodil.infoset.OnlyOnePossibilityForNextElement
import org.apache.daffodil.infoset.NextElementResolver
import org.apache.daffodil.infoset.ChildResolver
+import org.apache.daffodil.api.WarnID
/**
* Note about DSOM design versus say XSOM or Apache XSD library.
@@ -432,7 +433,7 @@ trait ElementBase
groupedByName.foreach {
case (_, sameNamesEB) =>
if (sameNamesEB.length > 1) {
- SDW("Neighboring QNames differ only by namespaces. Infoset representations that do not support namespacess cannot differentiate between these elements and may fail to unparse. QNames are: %s",
+ SDW(WarnID.NamespaceDifferencesOnly, "Neighboring QNames differ only by namespaces. Infoset representations that do not support namespacess cannot differentiate between these elements and may fail to unparse. QNames are: %s",
sameNamesEB.map(_.namedQName.toExtendedSyntax).mkString(", "))
hasNamesDifferingOnlyByNS = true
}
@@ -683,8 +684,8 @@ trait ElementBase
SDE("The given alignment (%s bits) must be a multiple of the encoding specified alignment (%s bits) for %s when representation='text'. Encoding: %s",
alignInBits, implicitAlignmentInBits, primType.name, this.knownEncodingName)
}
- case Representation.Binary => primType match {
- case PrimType.Float | PrimType.Double | PrimType.Boolean=> /* Non textual data, no need to compare alignment to encoding's expected alignment */
+ case Representation.Binary => primType match {
+ case PrimType.Float | PrimType.Double | PrimType.Boolean => /* Non textual data, no need to compare alignment to encoding's expected alignment */
case _ => binaryNumberRep match {
case BinaryNumberRep.Packed | BinaryNumberRep.Bcd | BinaryNumberRep.Ibm4690Packed => {
if ((alignInBits % 4) != 0)
@@ -1083,7 +1084,7 @@ trait ElementBase
else if (!hasDefaultValue) false
else {
if (!emptyIsAnObservableConcept)
- SDW("Element has no empty representation so cannot have XSD default='%s' as a default value.", defaultValueAsString)
+ SDW(WarnID.NoEmptyDefault, "Element with no empty representation. XSD default='%s' can only be used when unparsing.", defaultValueAsString)
schemaDefinitionWhen(isOptional, "Optional elements cannot have default values but default='%s' was found.", defaultValueAsString)
if (isArray && !isRequiredArrayElement) {
(optMinOccurs, occursCountKind) match {
@@ -1192,7 +1193,7 @@ trait ElementBase
this.possibleNextTerms.filterNot(m => m == this).foreach { that =>
val isSame = this.alignmentValueInBits == that.alignmentValueInBits
if (!isSame) {
- this.SDW("%s is an optional element or a variable-occurrence array and its alignment (%s) is not the same as %s's alignment (%s).",
+ this.SDW(WarnID.AlignmentNotSame, "%s is an optional element or a variable-occurrence array and its alignment (%s) is not the same as %s's alignment (%s).",
this.toString, this.alignmentValueInBits, that.toString, that.alignmentValueInBits)
}
}
diff --git a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/IIBase.scala b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/IIBase.scala
index 3f9f741..ddd8681 100644
--- a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/IIBase.scala
+++ b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/IIBase.scala
@@ -31,6 +31,7 @@ import java.net.URLEncoder
import org.apache.daffodil.api.DaffodilSchemaSource
import org.apache.daffodil.api.URISchemaSource
import java.net.URISyntaxException
+import org.apache.daffodil.api.WarnID
/**
* This file along with DFDLSchemaFile are the implementation of import and include
@@ -168,7 +169,7 @@ abstract class IIBase( final override val xml: Node, xsdArg: XMLSchemaDocument,
final lazy val schemaLocationProperty = {
val prop = getAttributeOption("schemaLocation")
if (prop.isDefined && prop.get == "edu/illinois/ncsa/daffodil/xsd/built-in-formats.xsd") {
- SDW("schemaLocation property uses deprecated include/import of edu/illinois/ncsa/daffodil/xsd/built-in-formats.xsd. Use org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd instead and change the dfdl:format ref to \"GeneralFormat\".")
+ SDW(WarnID.DeprecatedBuiltInFormats, "schemaLocation property uses deprecated include/import of edu/illinois/ncsa/daffodil/xsd/built-in-formats.xsd. Use org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd instead and change the dfdl:format ref to \"GeneralFormat\".")
}
prop
}
diff --git a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/SchemaDocument.scala b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/SchemaDocument.scala
index c646974..534cc1d 100644
--- a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/SchemaDocument.scala
+++ b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/SchemaDocument.scala
@@ -23,6 +23,7 @@ import org.apache.daffodil.dsom.IIUtils.IIMap
import org.apache.daffodil.exceptions.Assert
import org.apache.daffodil.schema.annotation.props.SeparatorSuppressionPolicyMixin
import org.apache.daffodil.schema.annotation.props.gen.Format_AnnotationMixin
+import org.apache.daffodil.api.WarnID
/**
* A schema document corresponds to one file usually named with an ".xsd" extension.
@@ -116,9 +117,9 @@ final class XMLSchemaDocument(xmlArg: Node,
val hasSchemaLocation = (xml \ "@schemaLocation").text != ""
val hasBlockDefault = (xml \ "@blockDefault").text != ""
val hasFinalDefault = (xml \ "@finalDefault").text != ""
- schemaDefinitionWarningUnless(!hasSchemaLocation, "schemaLocation is ignored.")
- schemaDefinitionWarningUnless(!hasBlockDefault, "blockDefault is ignored")
- schemaDefinitionWarningUnless(!hasFinalDefault, "finalDefault is ignored")
+ schemaDefinitionWarningUnless(WarnID.UnsupportedAttributeSchemaLocation, !hasSchemaLocation, "schemaLocation is ignored.")
+ schemaDefinitionWarningUnless(WarnID.UnsupportedAttributeBlockDefault, !hasBlockDefault, "blockDefault is ignored")
+ schemaDefinitionWarningUnless(WarnID.UnsupportedAttributeFinalDefault, !hasFinalDefault, "finalDefault is ignored")
schemaDefinitionUnless(attributeFormDefault == "unqualified", "attributeFormDefault='qualified' is not yet implemented.")
val res = hasSchemaLocation | hasBlockDefault | hasFinalDefault
res
diff --git a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/TermEncodingMixin.scala b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/TermEncodingMixin.scala
index fe86da9..b911f0e 100644
--- a/daffodil-core/src/main/scala/org/apache/daffodil/dsom/TermEncodingMixin.scala
+++ b/daffodil-core/src/main/scala/org/apache/daffodil/dsom/TermEncodingMixin.scala
@@ -21,6 +21,7 @@ import org.apache.daffodil.processors.EncodingRuntimeData
import org.apache.daffodil.schema.annotation.props.gen.Representation
import org.apache.daffodil.schema.annotation.props.gen.EncodingErrorPolicy
import org.apache.daffodil.processors.KnownEncodingMixin
+import org.apache.daffodil.api.WarnID
/**
* Captures concepts around dfdl:encoding property and Terms.
@@ -70,7 +71,7 @@ trait TermEncodingMixin extends KnownEncodingMixin { self: Term =>
*/
override final lazy val knownEncodingAlignmentInBits = {
if (isKnownEncoding) {
- schemaDefinitionWarningWhen(knownEncodingName == "US-ASCII-7-BIT-PACKED",
+ schemaDefinitionWarningWhen(WarnID.DeprecatedEncodingNameUSASCII7BitPacked, knownEncodingName == "US-ASCII-7-BIT-PACKED",
"Character set encoding name US-ASCII-7-BIT-PACKED is deprecated." +
"Please update your DFDL schema to use the name X-DFDL-US-ASCII-7-BIT-PACKED.")
val cs = charsetEv.optConstant.get
diff --git a/daffodil-core/src/main/scala/org/apache/daffodil/grammar/ElementBaseGrammarMixin.scala b/daffodil-core/src/main/scala/org/apache/daffodil/grammar/ElementBaseGrammarMixin.scala
index 72cd32e..899fba0 100644
--- a/daffodil-core/src/main/scala/org/apache/daffodil/grammar/ElementBaseGrammarMixin.scala
+++ b/daffodil-core/src/main/scala/org/apache/daffodil/grammar/ElementBaseGrammarMixin.scala
@@ -17,132 +17,115 @@
package org.apache.daffodil.grammar
-import org.apache.daffodil.exceptions.Assert
-import org.apache.daffodil.processors._
-import org.apache.daffodil.schema.annotation.props.gen._
-import org.apache.daffodil.dpath.NodeInfo.PrimType
-import org.apache.daffodil.dsom.InitiatedTerminatedMixin
-import org.apache.daffodil.dsom.ElementBase
import java.lang.{ Long => JLong }
+
+import scala.Boolean
+import scala.Long
+
+import org.apache.daffodil.api.WarnID
import org.apache.daffodil.dpath.NodeInfo
+import org.apache.daffodil.dpath.NodeInfo.PrimType
+import org.apache.daffodil.dsom.ElementBase
import org.apache.daffodil.dsom.ExpressionCompilers
-import org.apache.daffodil.xml.GlobalQName
-import org.apache.daffodil.xml.XMLUtils
-import org.apache.daffodil.util.PackedSignCodes
-import org.apache.daffodil.grammar.primitives.InputValueCalc
-import org.apache.daffodil.grammar.primitives.ZonedTextIntPrim
-import org.apache.daffodil.grammar.primitives.PaddingInfoMixin
-import org.apache.daffodil.grammar.primitives.StringOfSpecifiedLength
-import org.apache.daffodil.grammar.primitives.StringDelimitedEndOfData
-import org.apache.daffodil.grammar.primitives.PrefixLength
-import org.apache.daffodil.grammar.primitives.LiteralNilDelimitedEndOfData
-import org.apache.daffodil.grammar.primitives.HexBinarySpecifiedLength
-import org.apache.daffodil.grammar.primitives.HexBinaryEndOfBitLimit
-import org.apache.daffodil.grammar.primitives.HexBinaryDelimitedEndOfData
-import org.apache.daffodil.grammar.primitives.TrailingSkipRegion
-import org.apache.daffodil.grammar.primitives.LeadingSkipRegion
+import org.apache.daffodil.dsom.InitiatedTerminatedMixin
+import org.apache.daffodil.exceptions.Assert
import org.apache.daffodil.grammar.primitives.AlignmentFill
-import org.apache.daffodil.grammar.primitives.LogicalNilValue
-import org.apache.daffodil.grammar.primitives.LiteralValueNilOfSpecifiedLength
-import org.apache.daffodil.grammar.primitives.LiteralCharacterNilOfSpecifiedLength
+import org.apache.daffodil.grammar.primitives.BCDDecimalDelimitedEndOfData
+import org.apache.daffodil.grammar.primitives.BCDDecimalKnownLength
+import org.apache.daffodil.grammar.primitives.BCDDecimalRuntimeLength
+import org.apache.daffodil.grammar.primitives.BCDIntegerDelimitedEndOfData
+import org.apache.daffodil.grammar.primitives.BCDIntegerKnownLength
+import org.apache.daffodil.grammar.primitives.BCDIntegerRuntimeLength
import org.apache.daffodil.grammar.primitives.BinaryBoolean
-import org.apache.daffodil.grammar.primitives.SpecifiedLengthPattern
-import org.apache.daffodil.grammar.primitives.SpecifiedLengthImplicitCharacters
-import org.apache.daffodil.grammar.primitives.SpecifiedLengthImplicit
-import org.apache.daffodil.grammar.primitives.SpecifiedLengthExplicitCharacters
-import org.apache.daffodil.grammar.primitives.SpecifiedLengthExplicit
-import org.apache.daffodil.grammar.primitives.ConvertTextUnsignedShortPrim
-import org.apache.daffodil.grammar.primitives.ConvertTextUnsignedLongPrim
-import org.apache.daffodil.grammar.primitives.ConvertTextUnsignedIntPrim
-import org.apache.daffodil.grammar.primitives.ConvertTextUnsignedBytePrim
-import org.apache.daffodil.grammar.primitives.ConvertTextShortPrim
-import org.apache.daffodil.grammar.primitives.ConvertTextNonNegativeIntegerPrim
-import org.apache.daffodil.grammar.primitives.ConvertTextLongPrim
-import org.apache.daffodil.grammar.primitives.ConvertTextIntegerPrim
-import org.apache.daffodil.grammar.primitives.ConvertTextIntPrim
-import org.apache.daffodil.grammar.primitives.ConvertTextFloatPrim
-import org.apache.daffodil.grammar.primitives.ConvertTextDoublePrim
-import org.apache.daffodil.grammar.primitives.ConvertTextDecimalPrim
-import org.apache.daffodil.grammar.primitives.ConvertTextCombinator
-import org.apache.daffodil.grammar.primitives.ConvertTextBytePrim
-import org.apache.daffodil.grammar.primitives.ConvertTextBooleanPrim
-import org.apache.daffodil.grammar.primitives.ConvertTextTimePrim
-import org.apache.daffodil.grammar.primitives.ConvertTextDateTimePrim
-import org.apache.daffodil.grammar.primitives.ConvertTextDatePrim
-import org.apache.daffodil.grammar.primitives.Terminator
-import org.apache.daffodil.grammar.primitives.Initiator
-import org.apache.daffodil.grammar.primitives.RightFill
-import org.apache.daffodil.grammar.primitives.RightCenteredPadding
-import org.apache.daffodil.grammar.primitives.OnlyPadding
-import org.apache.daffodil.grammar.primitives.OVCRetry
-import org.apache.daffodil.grammar.primitives.NilLiteralCharacter
-import org.apache.daffodil.grammar.primitives.LeftCenteredPadding
-import org.apache.daffodil.grammar.primitives.ElementUnused
-import org.apache.daffodil.grammar.primitives.ElementParseAndUnspecifiedLength
-import org.apache.daffodil.grammar.primitives.ElementCombinator
-import org.apache.daffodil.grammar.primitives.CaptureValueLengthStart
-import org.apache.daffodil.grammar.primitives.CaptureValueLengthEnd
-import org.apache.daffodil.grammar.primitives.CaptureContentLengthStart
+import org.apache.daffodil.grammar.primitives.BinaryDecimalKnownLength
+import org.apache.daffodil.grammar.primitives.BinaryDecimalRuntimeLength
+import org.apache.daffodil.grammar.primitives.BinaryDouble
+import org.apache.daffodil.grammar.primitives.BinaryFloat
+import org.apache.daffodil.grammar.primitives.BinaryIntegerKnownLength
+import org.apache.daffodil.grammar.primitives.BinaryIntegerRuntimeLength
import org.apache.daffodil.grammar.primitives.CaptureContentLengthEnd
-import org.apache.daffodil.grammar.primitives.SimpleNilOrValue
+import org.apache.daffodil.grammar.primitives.CaptureContentLengthStart
+import org.apache.daffodil.grammar.primitives.CaptureValueLengthEnd
+import org.apache.daffodil.grammar.primitives.CaptureValueLengthStart
import org.apache.daffodil.grammar.primitives.ComplexNilOrContent
-import org.apache.daffodil.grammar.primitives.BinaryIntegerRuntimeLength
-import org.apache.daffodil.grammar.primitives.BinaryIntegerKnownLength
-import org.apache.daffodil.grammar.primitives.BinaryFloat
-import org.apache.daffodil.grammar.primitives.BinaryDouble
-import org.apache.daffodil.grammar.primitives.BinaryDecimalRuntimeLength
-import org.apache.daffodil.grammar.primitives.BinaryDecimalKnownLength
-import org.apache.daffodil.grammar.primitives.PackedIntegerRuntimeLength
-import org.apache.daffodil.grammar.primitives.PackedIntegerKnownLength
-import org.apache.daffodil.grammar.primitives.PackedIntegerDelimitedEndOfData
-import org.apache.daffodil.grammar.primitives.PackedDecimalDelimitedEndOfData
-import org.apache.daffodil.grammar.primitives.PackedDecimalRuntimeLength
-import org.apache.daffodil.grammar.primitives.PackedDecimalKnownLength
-import org.apache.daffodil.grammar.primitives.IBM4690PackedIntegerRuntimeLength
-import org.apache.daffodil.grammar.primitives.IBM4690PackedIntegerKnownLength
-import org.apache.daffodil.grammar.primitives.IBM4690PackedIntegerDelimitedEndOfData
-import org.apache.daffodil.grammar.primitives.IBM4690PackedDecimalDelimitedEndOfData
-import org.apache.daffodil.grammar.primitives.IBM4690PackedDecimalRuntimeLength
-import org.apache.daffodil.grammar.primitives.IBM4690PackedDecimalKnownLength
-import org.apache.daffodil.grammar.primitives.BCDIntegerRuntimeLength
-import org.apache.daffodil.grammar.primitives.BCDIntegerKnownLength
-import org.apache.daffodil.grammar.primitives.BCDIntegerDelimitedEndOfData
-import org.apache.daffodil.grammar.primitives.BCDDecimalDelimitedEndOfData
-import org.apache.daffodil.grammar.primitives.BCDDecimalRuntimeLength
-import org.apache.daffodil.grammar.primitives.BCDDecimalKnownLength
-import org.apache.daffodil.grammar.primitives.DynamicEscapeSchemeCombinatorElement
-import org.apache.daffodil.grammar.primitives.DelimiterStackCombinatorElement
-import org.apache.daffodil.grammar.primitives.LogicalNilValue
-import org.apache.daffodil.grammar.primitives.ConvertTextDatePrim
-import org.apache.daffodil.grammar.primitives.ZonedTextIntPrim
-import org.apache.daffodil.grammar.primitives.ConvertTextShortPrim
-import org.apache.daffodil.grammar.primitives.TrailingSkipRegion
-import org.apache.daffodil.grammar.primitives.DynamicEscapeSchemeCombinatorElement
-import org.apache.daffodil.grammar.primitives.ConvertTextDecimalPrim
import org.apache.daffodil.grammar.primitives.ConvertTextBooleanPrim
import org.apache.daffodil.grammar.primitives.ConvertTextBytePrim
-import org.apache.daffodil.grammar.primitives.AlignmentFill
-import org.apache.daffodil.grammar.primitives.ComplexNilOrContent
-import org.apache.daffodil.grammar.primitives.LeadingSkipRegion
+import org.apache.daffodil.grammar.primitives.ConvertTextCombinator
+import org.apache.daffodil.grammar.primitives.ConvertTextDatePrim
+import org.apache.daffodil.grammar.primitives.ConvertTextDateTimePrim
+import org.apache.daffodil.grammar.primitives.ConvertTextDecimalPrim
+import org.apache.daffodil.grammar.primitives.ConvertTextDoublePrim
import org.apache.daffodil.grammar.primitives.ConvertTextFloatPrim
-import org.apache.daffodil.grammar.primitives.ConvertTextUnsignedIntPrim
-import org.apache.daffodil.grammar.primitives.ConvertTextUnsignedBytePrim
-import org.apache.daffodil.grammar.primitives.ConvertTextUnsignedLongPrim
import org.apache.daffodil.grammar.primitives.ConvertTextIntPrim
+import org.apache.daffodil.grammar.primitives.ConvertTextIntegerPrim
import org.apache.daffodil.grammar.primitives.ConvertTextLongPrim
import org.apache.daffodil.grammar.primitives.ConvertTextNonNegativeIntegerPrim
-import org.apache.daffodil.grammar.primitives.ConvertTextUnsignedShortPrim
-import org.apache.daffodil.grammar.primitives.ConvertTextIntegerPrim
-import org.apache.daffodil.grammar.primitives.ConvertTextDoublePrim
-import org.apache.daffodil.grammar.primitives.LiteralCharacterNilOfSpecifiedLength
+import org.apache.daffodil.grammar.primitives.ConvertTextShortPrim
import org.apache.daffodil.grammar.primitives.ConvertTextTimePrim
+import org.apache.daffodil.grammar.primitives.ConvertTextUnsignedBytePrim
+import org.apache.daffodil.grammar.primitives.ConvertTextUnsignedIntPrim
+import org.apache.daffodil.grammar.primitives.ConvertTextUnsignedLongPrim
+import org.apache.daffodil.grammar.primitives.ConvertTextUnsignedShortPrim
import org.apache.daffodil.grammar.primitives.DelimiterStackCombinatorElement
-import org.apache.daffodil.grammar.primitives.ConvertTextCombinator
-import org.apache.daffodil.grammar.primitives.SimpleNilOrValue
-import org.apache.daffodil.grammar.primitives.ConvertTextDateTimePrim
+import org.apache.daffodil.grammar.primitives.DynamicEscapeSchemeCombinatorElement
+import org.apache.daffodil.grammar.primitives.ElementCombinator
+import org.apache.daffodil.grammar.primitives.ElementParseAndUnspecifiedLength
+import org.apache.daffodil.grammar.primitives.ElementUnused
+import org.apache.daffodil.grammar.primitives.HexBinaryDelimitedEndOfData
+import org.apache.daffodil.grammar.primitives.HexBinaryEndOfBitLimit
+import org.apache.daffodil.grammar.primitives.HexBinarySpecifiedLength
+import org.apache.daffodil.grammar.primitives.IBM4690PackedDecimalDelimitedEndOfData
+import org.apache.daffodil.grammar.primitives.IBM4690PackedDecimalKnownLength
+import org.apache.daffodil.grammar.primitives.IBM4690PackedDecimalRuntimeLength
+import org.apache.daffodil.grammar.primitives.IBM4690PackedIntegerDelimitedEndOfData
+import org.apache.daffodil.grammar.primitives.IBM4690PackedIntegerKnownLength
+import org.apache.daffodil.grammar.primitives.IBM4690PackedIntegerRuntimeLength
+import org.apache.daffodil.grammar.primitives.Initiator
+import org.apache.daffodil.grammar.primitives.InputValueCalc
+import org.apache.daffodil.grammar.primitives.LeadingSkipRegion
+import org.apache.daffodil.grammar.primitives.LeftCenteredPadding
+import org.apache.daffodil.grammar.primitives.LiteralCharacterNilOfSpecifiedLength
+import org.apache.daffodil.grammar.primitives.LiteralNilDelimitedEndOfData
import org.apache.daffodil.grammar.primitives.LiteralValueNilOfSpecifiedLength
-import org.apache.daffodil.schema.annotation.props.NotFound
+import org.apache.daffodil.grammar.primitives.LogicalNilValue
+import org.apache.daffodil.grammar.primitives.NilLiteralCharacter
+import org.apache.daffodil.grammar.primitives.OVCRetry
+import org.apache.daffodil.grammar.primitives.OnlyPadding
+import org.apache.daffodil.grammar.primitives.PackedDecimalDelimitedEndOfData
+import org.apache.daffodil.grammar.primitives.PackedDecimalKnownLength
+import org.apache.daffodil.grammar.primitives.PackedDecimalRuntimeLength
+import org.apache.daffodil.grammar.primitives.PackedIntegerDelimitedEndOfData
+import org.apache.daffodil.grammar.primitives.PackedIntegerKnownLength
+import org.apache.daffodil.grammar.primitives.PackedIntegerRuntimeLength
+import org.apache.daffodil.grammar.primitives.PaddingInfoMixin
+import org.apache.daffodil.grammar.primitives.PrefixLength
+import org.apache.daffodil.grammar.primitives.RightCenteredPadding
+import org.apache.daffodil.grammar.primitives.RightFill
+import org.apache.daffodil.grammar.primitives.SimpleNilOrValue
+import org.apache.daffodil.grammar.primitives.SpecifiedLengthExplicit
+import org.apache.daffodil.grammar.primitives.SpecifiedLengthExplicitCharacters
+import org.apache.daffodil.grammar.primitives.SpecifiedLengthImplicit
+import org.apache.daffodil.grammar.primitives.SpecifiedLengthImplicitCharacters
+import org.apache.daffodil.grammar.primitives.SpecifiedLengthPattern
+import org.apache.daffodil.grammar.primitives.StringDelimitedEndOfData
+import org.apache.daffodil.grammar.primitives.StringOfSpecifiedLength
+import org.apache.daffodil.grammar.primitives.Terminator
+import org.apache.daffodil.grammar.primitives.TrailingSkipRegion
+import org.apache.daffodil.grammar.primitives.ZonedTextIntPrim
+import org.apache.daffodil.processors.TextJustificationType
import org.apache.daffodil.schema.annotation.props.Found
+import org.apache.daffodil.schema.annotation.props.NotFound
+import org.apache.daffodil.schema.annotation.props.gen.BinaryFloatRep
+import org.apache.daffodil.schema.annotation.props.gen.BinaryNumberRep
+import org.apache.daffodil.schema.annotation.props.gen.LengthKind
+import org.apache.daffodil.schema.annotation.props.gen.LengthUnits
+import org.apache.daffodil.schema.annotation.props.gen.NilKind
+import org.apache.daffodil.schema.annotation.props.gen.Representation
+import org.apache.daffodil.schema.annotation.props.gen.TextNumberRep
+import org.apache.daffodil.schema.annotation.props.gen.YesNo
+import org.apache.daffodil.util.PackedSignCodes
+import org.apache.daffodil.xml.GlobalQName
+import org.apache.daffodil.xml.XMLUtils
/////////////////////////////////////////////////////////////////
// Elements System
@@ -727,7 +710,7 @@ trait ElementBaseGrammarMixin
case PrimType.Long | PrimType.Int | PrimType.Short | PrimType.Byte => SDE("%s is not an allowed type for bcd binary values", primType.name)
case _ => (lengthKind, binaryNumberKnownLengthInBits) match {
case (LengthKind.Delimited, -1) => new BCDIntegerDelimitedEndOfData(this)
- case (_, -1) => new BCDIntegerRuntimeLength(this)
+ case (_, -1) => new BCDIntegerRuntimeLength(this)
case (_, _) => new BCDIntegerKnownLength(this, binaryNumberKnownLengthInBits)
}
}
@@ -1181,7 +1164,7 @@ trait ElementBaseGrammarMixin
//
// JIRA DFDL-1690
//
- SDW("dfdl:lengthKind '%s' is not consistent with dfdl:length specified (as %s). The dfdl:length will be ignored.",
+ SDW(WarnID.InconsistentLengthKind, "dfdl:lengthKind '%s' is not consistent with dfdl:length specified (as %s). The dfdl:length will be ignored.",
lengthKind,
lengthExpr.prettyExpr)
}
@@ -1209,7 +1192,7 @@ trait ElementBaseGrammarMixin
val len = optLengthConstant.get
val maxLengthLong = maxLength.longValueExact
val minLengthLong = minLength.longValueExact
- def warn(m: String, value: Long) = SDW("Explicit dfdl:length of %s is out of range for facet %sLength='%s'.", len, "max", value)
+ def warn(m: String, value: Long) = SDW(WarnID.FacetExplicitLengthOutOfRange, "Explicit dfdl:length of %s is out of range for facet %sLength='%s'.", len, "max", value)
if (maxLengthLong != -1 && len > maxLengthLong) warn("max", maxLengthLong)
Assert.invariant(minLengthLong >= 0)
if (minLengthLong > 0 && len < minLengthLong) warn("min", minLengthLong)
diff --git a/daffodil-core/src/main/scala/org/apache/daffodil/grammar/GrammarTerm.scala b/daffodil-core/src/main/scala/org/apache/daffodil/grammar/GrammarTerm.scala
index 37f28de..14b3796 100644
--- a/daffodil-core/src/main/scala/org/apache/daffodil/grammar/GrammarTerm.scala
+++ b/daffodil-core/src/main/scala/org/apache/daffodil/grammar/GrammarTerm.scala
@@ -26,6 +26,7 @@ import org.apache.daffodil.oolag.OOLAG.OOLAGHostImpl
import org.apache.daffodil.compiler.ParserOrUnparser
import org.apache.daffodil.util.Misc
import org.apache.daffodil.compiler.BothParserAndUnparser
+import org.apache.daffodil.api.WarnID
trait HasNoUnparser {
final lazy val unparser: Unparser = hasNoUnparser
@@ -43,7 +44,8 @@ abstract class Gram(contextArg: SchemaComponent)
extends OOLAGHostImpl(contextArg) {
final def SDE(str: String, args: Any*): Nothing = context.SDE(str, args: _*)
- final def SDW(str: String, args: Any*): Unit = context.SDW(str, args: _*)
+
+ final def SDW(warnID: WarnID, str: String, args: Any*): Unit = context.SDW(warnID, str, args: _*)
val forWhat: ParserOrUnparser = BothParserAndUnparser
diff --git a/daffodil-core/src/main/scala/org/apache/daffodil/grammar/primitives/PatternChecker.scala b/daffodil-core/src/main/scala/org/apache/daffodil/grammar/primitives/PatternChecker.scala
index 90172b1..4ce29f4 100644
--- a/daffodil-core/src/main/scala/org/apache/daffodil/grammar/primitives/PatternChecker.scala
+++ b/daffodil-core/src/main/scala/org/apache/daffodil/grammar/primitives/PatternChecker.scala
@@ -21,6 +21,7 @@ import org.apache.daffodil.exceptions.SavesErrorsAndWarnings
import java.util.regex.Pattern
import org.apache.daffodil.util.Misc
import java.util.regex.PatternSyntaxException
+import org.apache.daffodil.api.WarnID
/**
* The purpose of this checker is to examine a regex and look for a situation
@@ -55,7 +56,7 @@ object PatternChecker {
"\nMissing <![CDATA[...]]> around the regular expression." +
"\nThis is required for free-form regular expression syntax with comments."
} else ""
- context.SDW("Regular expression pattern '%s'.\n" +
+ context.SDW(WarnID.RegexPatternZeroLength, "Regular expression pattern '%s'.\n" +
"This pattern will match with zero length, so it can always match.%s", pattern, needCDATA)
}
} catch {
diff --git a/daffodil-core/src/main/scala/org/apache/daffodil/grammar/primitives/PrimitivesElementKinds.scala b/daffodil-core/src/main/scala/org/apache/daffodil/grammar/primitives/PrimitivesElementKinds.scala
index 8885680..f8f2dcf 100644
--- a/daffodil-core/src/main/scala/org/apache/daffodil/grammar/primitives/PrimitivesElementKinds.scala
+++ b/daffodil-core/src/main/scala/org/apache/daffodil/grammar/primitives/PrimitivesElementKinds.scala
@@ -44,6 +44,7 @@ import org.apache.daffodil.equality._;
import org.apache.daffodil.exceptions.Assert
import org.apache.daffodil.util.Maybe._
import org.apache.daffodil.cookers.ChoiceBranchKeyCooker
+import org.apache.daffodil.api.WarnID
object ENoWarn3 { EqualitySuppressUnusedImportWarning() }
@@ -223,7 +224,7 @@ case class ChoiceCombinator(ch: ChoiceTermBase, alternatives: Seq[Gram]) extends
val defaultableBranches = ch.groupMembers.filter { _.childrenInHiddenGroupNotDefaultableOrOVC.length == 0 }
Assert.invariant(defaultableBranches.length > 0)
if (defaultableBranches.length > 1) {
- SDW("xs:choice inside a hidden group has unparse ambiguity: multiple branches exist with all children either defaulable or have the dfdl:outputValueCalc property set. The first branch will be chosen during unparse. Defaultable branches are:\n%s",
+ SDW(WarnID.ChoiceInsideHiddenGroup, "xs:choice inside a hidden group has unparse ambiguity: multiple branches exist with all children either defaulable or have the dfdl:outputValueCalc property set. The first branch will be chosen during unparse. Defaultable branches are:\n%s",
defaultableBranches.mkString("\n"))
}
val defaultableBranchRD = defaultableBranches(0).runtimeData
diff --git a/daffodil-lib/src/main/scala/org/apache/daffodil/api/WarnID.scala b/daffodil-lib/src/main/scala/org/apache/daffodil/api/WarnID.scala
index 6299f9e..5d5178d 100644
--- a/daffodil-lib/src/main/scala/org/apache/daffodil/api/WarnID.scala
+++ b/daffodil-lib/src/main/scala/org/apache/daffodil/api/WarnID.scala
@@ -21,14 +21,63 @@ import org.apache.daffodil.exceptions.ThrowsSDE
import org.apache.daffodil.exceptions.Assert
import org.apache.daffodil.schema.annotation.props.{ Enum => PropsEnum }
- sealed trait WarnID extends WarnID.Value
+sealed trait WarnID extends WarnID.Value
- object WarnID extends PropsEnum[WarnID] {
- case object All extends WarnID; forceConstruction(All)
- case object MultipleChoiceBranches extends WarnID; forceConstruction(MultipleChoiceBranches)
- case object EscapeSchemeRefUndefined extends WarnID; forceConstruction(EscapeSchemeRefUndefined)
+/**
+ * Warning Identifiers for use in suppressing warning messages that are
+ * unavoidable and not helpful.
+ *
+ * TODO: This file really should be generated from dafext.xsd's
+ * enumerations for the XML syntax that specifies these suppressions in
+ * config files. As this list grows, it's more and more unwieldy.
+ */
+object WarnID extends PropsEnum[WarnID] {
+ /**
+ * Suppresses All Warnings
+ */
+ case object All extends WarnID; forceConstruction(All)
+
+ /**
+ * For selective suppression of individual warnings.
+ *
+ * Please add additional, preserving alphabetical order and copying the
+ * apparent naming conventions.
+ */
+ case object AlignmentNotSame extends WarnID; forceConstruction(AlignmentNotSame)
+ case object AppinfoDFDLSourceWrong extends WarnID; forceConstruction(AppinfoDFDLSourceWrong)
+ case object AppinfoNoSource extends WarnID; forceConstruction(AppinfoNoSource)
+ case object ChoiceInsideHiddenGroup extends WarnID; forceConstruction(ChoiceInsideHiddenGroup)
+
+ /**
+ * For DeprecatedThing warning suppression
+ */
+ case object DeprecatedBuiltInFormats extends WarnID; forceConstruction(DeprecatedBuiltInFormats)
+ case object DeprecatedEncodingNameUSASCII7BitPacked extends WarnID; forceConstruction(DeprecatedEncodingNameUSASCII7BitPacked)
+ case object DeprecatedFunctionDAFError extends WarnID; forceConstruction(DeprecatedFunctionDAFError)
+
+ /**
+ * Deprecated properties should all begin with "DeprecatedProperty..."
+ */
+ case object DeprecatedPropertySeparatorPolicy extends WarnID; forceConstruction(DeprecatedPropertySeparatorPolicy)
+ case object EscapeSchemeRefUndefined extends WarnID; forceConstruction(EscapeSchemeRefUndefined)
+ case object FacetExplicitLengthOutOfRange extends WarnID; forceConstruction(FacetExplicitLengthOutOfRange)
+ case object InconsistentLengthKind extends WarnID; forceConstruction(InconsistentLengthKind)
+ case object MultipleChoiceBranches extends WarnID; forceConstruction(MultipleChoiceBranches)
+ case object NamespaceDifferencesOnly extends WarnID; forceConstruction(NamespaceDifferencesOnly)
+ case object NoEmptyDefault extends WarnID; forceConstruction(NoEmptyDefault)
+ case object PathNotToArray extends WarnID; forceConstruction(PathNotToArray)
+ case object PatternEncodingSlashW extends WarnID; forceConstruction(PatternEncodingSlashW)
+ case object QueryStylePathExpression extends WarnID; forceConstruction(QueryStylePathExpression)
+ case object RegexPatternZeroLength extends WarnID; forceConstruction(RegexPatternZeroLength)
+
+ /**
+ * UnsupportedThing warning suppression.
+ */
+ case object UnsupportedAttributeBlockDefault extends WarnID; forceConstruction(UnsupportedAttributeBlockDefault)
+ case object UnsupportedAttributeFinalDefault extends WarnID; forceConstruction(UnsupportedAttributeFinalDefault)
+ case object UnsupportedAttributeSchemaLocation extends WarnID; forceConstruction(UnsupportedAttributeSchemaLocation)
- def apply(name: String, context: ThrowsSDE) = Assert.usageError("not to be called. Call find(name) method instead.")
+ override def apply(name: String, context: ThrowsSDE) = Assert.usageError("not to be called. Call find(name) method instead.")
- def find(name: String): Option[WarnID] = optionStringToEnum("warning identifier", name)
- }
+ def find(name: String): Option[WarnID] = optionStringToEnum("warning identifier", name)
+}
diff --git a/daffodil-lib/src/main/scala/org/apache/daffodil/exceptions/ThrowsSDE.scala b/daffodil-lib/src/main/scala/org/apache/daffodil/exceptions/ThrowsSDE.scala
index 23fdc2b..f78a9d3 100644
--- a/daffodil-lib/src/main/scala/org/apache/daffodil/exceptions/ThrowsSDE.scala
+++ b/daffodil-lib/src/main/scala/org/apache/daffodil/exceptions/ThrowsSDE.scala
@@ -57,7 +57,8 @@ trait ThrowsSDE {
final def schemaDefinitionError(str: String, args: Any*): Nothing = SDE(str, args: _*) // long form synonym
- /***
+ /**
+ * *
* These functions are now macros as the original code:
* final def schemaDefinitionUnless(testThatWillThrowIfFalse: Boolean, str: => String, args: => Any*) = if (!testThatWillThrowIfFalse) SDE(str, args: _*)
* would cause expensive object allocation, even when the
@@ -82,32 +83,29 @@ trait ThrowsSDE {
trait SavesErrorsAndWarnings {
def SDE(id: String, args: Any*): Nothing
- def SDW(str: String, args: Any*): Unit
+
/**
- * Use this form if you need to be able to suppress the warning
+ * Issue a warning. The WarnID enables suppression of warning messages.
*/
def SDW(warnID: WarnID, str: String, args: Any*): Unit
def SDEButContinue(str: String, args: Any*): Unit
def schemaDefinitionErrorButContinue(str: String, args: Any*): Unit = SDEButContinue(str, args: _*)
- /***
+ /*
* These functions are now macros as the original code:
- * final def schemaDefinitionUnless(testThatWillThrowIfFalse: Boolean, str: => String, args: => Any*) = if (!testThatWillThrowIfFalse) SDE(str, args: _*)
+ * final def schemaDefinitionUnless(warnID: WarnID, testThatWillThrowIfFalse: Boolean, str: => String, args: => Any*) = if (!testThatWillThrowIfFalse) SDE(warnID, str, args: _*)
* would cause expensive object allocation, even when the
* test would be true and even when the function was inlined
*/
- def schemaDefinitionWarningUnless(testThatWillWarnIfFalse: Boolean, str: String, args: Any*): Unit = macro SDEMacros.schemaDefinitionWarningUnlessMacro
/**
- * Use this form if you need to be able to suppress the warning
+ * Conditionally issue a warning. The WarnID allows warning suppression.
*/
def schemaDefinitionWarningUnless(warnID: WarnID, testThatWillWarnIfFalse: Boolean, str: String, args: Any*): Unit = macro SDEMacros.schemaDefinitionWarningUnlessSuppressMacro
- def schemaDefinitionWarningWhen(testThatWillWarnIfTrue: Boolean, str: String, args: Any*): Unit = macro SDEMacros.schemaDefinitionWarningWhenMacro
-
/**
- * Use this form if you need to be able to suppress the warning
+ * Conditionally issue a warning. The WarnID allows warning suppression.
*/
def schemaDefinitionWarningWhen(warnID: WarnID, testThatWillWarnIfTrue: Boolean, str: String, args: Any*): Unit = macro SDEMacros.schemaDefinitionWarningWhenSuppressMacro
diff --git a/daffodil-lib/src/main/scala/org/apache/daffodil/schema/annotation/props/ByHandMixins.scala b/daffodil-lib/src/main/scala/org/apache/daffodil/schema/annotation/props/ByHandMixins.scala
index 39e9b73..5423b24 100644
--- a/daffodil-lib/src/main/scala/org/apache/daffodil/schema/annotation/props/ByHandMixins.scala
+++ b/daffodil-lib/src/main/scala/org/apache/daffodil/schema/annotation/props/ByHandMixins.scala
@@ -36,6 +36,7 @@ import org.apache.daffodil.cookers.NilValueLiteralValueTextCooker
import org.apache.daffodil.cookers.NilValueLiteralValueBinaryCooker
import org.apache.daffodil.cookers.NilValueLiteralCharacterCooker
import org.apache.daffodil.cookers.TextNumberPadCharacterCooker
+import org.apache.daffodil.api.WarnID
/**
* We don't want to make the code generator so sophisticated as to be
@@ -126,13 +127,13 @@ trait SeparatorSuppressionPolicyMixin
val ssp = getPropertyOption("separatorSuppressionPolicy")
(sp, ssp) match {
case (Some(spValue), Some(sspStr)) => {
- SDW("Both separatorPolicy(deprecated) and separatorSuppressionPolicy are defined. The separatorPolicy will be ignored.")
+ SDW(WarnID.DeprecatedPropertySeparatorPolicy, "Both separatorPolicy(deprecated) and separatorSuppressionPolicy are defined. The separatorPolicy will be ignored.")
SeparatorSuppressionPolicy(sspStr, this)
}
case (None, Some(sspStr)) => SeparatorSuppressionPolicy(sspStr, this)
case (None, None) => getProperty("separatorSuppressionPolicy") // which will SDE!
case (Some(spString), None) => {
- SDW("Property separatorPolicy is deprecated. Use separatorSuppressionPolicy instead.")
+ SDW(WarnID.DeprecatedPropertySeparatorPolicy, "Property separatorPolicy is deprecated. Use separatorSuppressionPolicy instead.")
spString match {
case "required" => SeparatorSuppressionPolicy.Never
case "suppressed" => SeparatorSuppressionPolicy.AnyEmpty
diff --git a/daffodil-propgen/src/main/resources/org/apache/daffodil/xsd/dafext.xsd b/daffodil-propgen/src/main/resources/org/apache/daffodil/xsd/dafext.xsd
index 66cccd7..896ec43 100644
--- a/daffodil-propgen/src/main/resources/org/apache/daffodil/xsd/dafext.xsd
+++ b/daffodil-propgen/src/main/resources/org/apache/daffodil/xsd/dafext.xsd
@@ -119,8 +119,30 @@
<xsd:simpleType>
<xsd:restriction base="xsd:token">
<xsd:enumeration value="all"/>
- <xsd:enumeration value="multipleChoiceBranches"/>
+ <!--
+ Please keep these in alphabetical order
+ -->
+ <xsd:enumeration value="alignmentNotSame"/>
+ <xsd:enumeration value="appinfoDFDLSourceWrong"/>
+ <xsd:enumeration value="appinfoNoSource"/>
+ <xsd:enumeration value="choiceInsideHiddenGroup" />
+ <xsd:enumeration value="deprecatedBuiltInFormats"/>
+ <xsd:enumeration value="deprecatedEncodingNameUSASCII7BitPacked"/>
+ <xsd:enumeration value="deprecatedFunctionDAFError"/>
+ <xsd:enumeration value="deprecatedPropertySeparatorPolicy" />
<xsd:enumeration value="escapeSchemeRefUndefined"/>
+ <xsd:enumeration value="facetExplicitLengthOutOfRange"/>
+ <xsd:enumeration value="inconsistentLengthKind"/>
+ <xsd:enumeration value="multipleChoiceBranches"/>
+ <xsd:enumeration value="namespaceDifferencesOnly"/>
+ <xsd:enumeration value="noEmptyDefault"/>
+ <xsd:enumeration value="pathNotToArray" />
+ <xsd:enumeration value="patternEncodingSlashW"/>
+ <xsd:enumeration value="queryStylePathExpression"/>
+ <xsd:enumeration value="regexPatternZeroLength" />
+ <xsd:enumeration value="unsupportedAttributeBlockDefault" />
+ <xsd:enumeration value="unsupportedAttributeFinalDefault" />
+ <xsd:enumeration value="unsupportedAttributeSchemaLocation" />
</xsd:restriction>
</xsd:simpleType>
</xsd:list>
diff --git a/daffodil-runtime1/src/main/scala/org/apache/daffodil/dpath/DState.scala b/daffodil-runtime1/src/main/scala/org/apache/daffodil/dpath/DState.scala
index 9cfce69..75bff27 100644
--- a/daffodil-runtime1/src/main/scala/org/apache/daffodil/dpath/DState.scala
+++ b/daffodil-runtime1/src/main/scala/org/apache/daffodil/dpath/DState.scala
@@ -25,6 +25,7 @@ import org.apache.daffodil.calendar.DFDLCalendar
import org.apache.daffodil.equality._; object EqualityNoWarn2 { EqualitySuppressUnusedImportWarning() }
import org.apache.daffodil.api.DataLocation
import java.math.{ BigDecimal => JBigDecimal, BigInteger => JBigInt }
+import org.apache.daffodil.api.WarnID
/**
* Modes for expression evaluation.
@@ -198,9 +199,9 @@ case class DState() {
if (!currentNode.isInstanceOf[DIArray]) {
Assert.invariant(errorOrWarn.isDefined)
if (currentNode.isInstanceOf[DIElement]) {
- errorOrWarn.get.SDW("The specified path to element %s is not to an array. Suggest using fn:exists instead.", currentElement.name)
+ errorOrWarn.get.SDW(WarnID.PathNotToArray, "The specified path to element %s is not to an array. Suggest using fn:exists instead.", currentElement.name)
} else {
- errorOrWarn.get.SDW("The specified path is not to an array. Suggest using fn:exists instead.")
+ errorOrWarn.get.SDW(WarnID.PathNotToArray, "The specified path is not to an array. Suggest using fn:exists instead.")
}
false
} else {
diff --git a/daffodil-runtime1/src/main/scala/org/apache/daffodil/dsom/CompiledExpression1.scala b/daffodil-runtime1/src/main/scala/org/apache/daffodil/dsom/CompiledExpression1.scala
index 31d3833..21a5ea2 100644
--- a/daffodil-runtime1/src/main/scala/org/apache/daffodil/dsom/CompiledExpression1.scala
+++ b/daffodil-runtime1/src/main/scala/org/apache/daffodil/dsom/CompiledExpression1.scala
@@ -35,6 +35,7 @@ import org.apache.daffodil.exceptions.HasSchemaFileLocation
import org.apache.daffodil.processors.ParseOrUnparseState
import org.apache.daffodil.api.DaffodilTunables
import org.apache.daffodil.api.UnqualifiedPathStepPolicy
+import org.apache.daffodil.api.WarnID
trait ContentValueReferencedElementInfoMixin {
@@ -498,7 +499,7 @@ class DPathElementCompileInfo(
private def queryMatchWarning(step: StepQName, matches: Seq[DPathElementCompileInfo],
expr: ImplementsThrowsOrSavesSDE) = {
- expr.SDW("Statically ambiguous or query-style paths not supported in step path: '%s'. Matches are at locations:\n%s",
+ expr.SDW(WarnID.QueryStylePathExpression, "Statically ambiguous or query-style paths not supported in step path: '%s'. Matches are at locations:\n%s",
step, matches.map(_.schemaFileLocation.locationDescription).mkString("- ", "\n- ", ""))
}
}
diff --git a/daffodil-runtime1/src/main/scala/org/apache/daffodil/dsom/SDE.scala b/daffodil-runtime1/src/main/scala/org/apache/daffodil/dsom/SDE.scala
index 6ed16a7..0b4d6d4 100644
--- a/daffodil-runtime1/src/main/scala/org/apache/daffodil/dsom/SDE.scala
+++ b/daffodil-runtime1/src/main/scala/org/apache/daffodil/dsom/SDE.scala
@@ -169,7 +169,7 @@ trait ImplementsThrowsSDE
trait ImplementsThrowsOrSavesSDE
extends ImplementsThrowsSDE with SavesErrorsAndWarnings {
-
+
def tunable: DaffodilTunables
def error(th: Diagnostic): Unit
@@ -182,19 +182,7 @@ trait ImplementsThrowsOrSavesSDE
}
/**
- * This form allows All warnings to be suppressed centrally but not individually.
- */
- def SDW(id: String, args: Any*): Unit = {
- if (tunable.notSuppressedWarning(WarnID.All)) {
- ExecutionMode.requireCompilerMode
- val sdw = new SchemaDefinitionWarning(Some(schemaFileLocation), NoAnnotationContext, id, args: _*)
- warn(sdw)
- }
- }
-
- /**
- * Use this form if you need to be able to suppress the warning
- * individually selectively.
+ * Issue a warning. The WarnID allows suppression of warning messages.
*/
def SDW(warnID: WarnID, fmt: String, args: Any*): Unit = {
if (tunable.notSuppressedWarning(warnID)) {
diff --git a/project/Dependencies.scala b/project/Dependencies.scala
index 8a49b52..9c706cc 100644
--- a/project/Dependencies.scala
+++ b/project/Dependencies.scala
@@ -18,6 +18,7 @@
import sbt._
object Dependencies {
+
lazy val common = core ++ infoset ++ test
lazy val core = Seq(
@@ -39,7 +40,7 @@ object Dependencies {
lazy val cli = Seq(
"org.fusesource.jansi" % "jansi" % "1.14",
"org.rogach" %% "scallop" % "0.9.5", // new version avail. 2.0.5 requires code changes
- "net.sf.expectit" % "expectit-core" % "0.8.1" % "test",
+ "net.sf.expectit" % "expectit-core" % "0.8.1" % "test"
)
lazy val test = Seq(
--
To stop receiving notification emails like this one, please contact
mbeckerle@apache.org.