Program: 91908
Project: 91908
Buggy source:
/** 
 * Evaluates the quality of this attribute at this method invocation time. The data quality reports may include information about whether the attribute value mets the constraints defined by the  {@linkplain DefaultAttributeType attribute type}, or any other criterion at implementation choice. <p>The default implementation reports data quality with at least the following information:</p> <ul> <li> The   {@linkplain org.apache.sis.metadata.iso.quality.DefaultDataQuality#getScope() scope}{@linkplain org.apache.sis.metadata.iso.quality.DefaultScope#getLevel() level} is set to{@link org.opengis.metadata.maintenance.ScopeCode#ATTRIBUTE}. </li><li> At most one   {@linkplain org.apache.sis.metadata.iso.quality.DefaultDomainConsistency domain consistency}element is added to the   {@linkplain org.apache.sis.metadata.iso.quality.DefaultDataQuality#getReports() reports} list (implementations are free to omit that element if they have nothing to report).If a report is provided, then it will contain at least the following information: <ul> <li> <p>The  {@linkplain #getName() attribute name} as the data quality{@linkplain org.apache.sis.metadata.iso.quality.DefaultDomainConsistency#getMeasureIdentification() measure identification}.</p> <div class="note"><b>Note:</b> strictly speaking,   {@code measureIdentification} identifies the<em>quality measurement</em>, not the “real” measurement itself. However this implementation uses the same set of identifiers for both for simplicity.</div> </li><li> <p>If the attribute  {@linkplain #getValue() value} is not an {@linkplain Class#isInstance instance}of the expected   {@linkplain DefaultAttributeType#getValueClass() value class}, or if the number of occurrences is not inside the cardinality range, or if any other constraint is violated, then a   {@linkplain org.apache.sis.metadata.iso.quality.DefaultConformanceResult conformance result} isadded for each violation with an {@linkplain org.apache.sis.metadata.iso.quality.DefaultConformanceResult#getExplanation() explanation}set to the error message.</p> <div class="warning"><b>Note:</b> this is a departure from ISO intend, since   {@code explanation}should be a statement about what a successful conformance means. This point may be reformulated in a future SIS version.</div> </li> </ul> </li> </ul> This attribute is valid if this method does not report any  {@linkplain org.apache.sis.metadata.iso.quality.DefaultConformanceResult conformance result} having a{@linkplain org.apache.sis.metadata.iso.quality.DefaultConformanceResult#pass() pass} value of {@code false}. <div class="note"><b>Example:</b> given an attribute named “population” with [1 … 1] cardinality, if no value has been assigned to that attribute, then this   {@code quality()} method will returnthe following data quality report: {@preformat textData quality   ├─Scope   │   └─Level………………………………………………… Attribute   └─Report       ├─Measure identification       │   └─Code………………………………………… population       ├─Evaluation method type…… Direct internal       └─Result           ├─Explanation……………………… Missing value for “population” property.           └─Pass………………………………………… false}</div>
 * @return Reports on all constraint violations found.
 * @see AbstractFeature#quality()
 */
public DataQuality quality(){
  final Validator v=new Validator(ScopeCode.ATTRIBUTE);
  v.validate(type,getValues());
  return v.quality;
}

Fixed version (ground truth):
/** 
 * Evaluates the quality of this attribute at this method invocation time. The data quality reports may include information about whether the attribute value mets the constraints defined by the  {@linkplain DefaultAttributeType attribute type}, or any other criterion at implementation choice. <p>The default implementation reports data quality with at least the following information:</p> <ul> <li> The   {@linkplain org.apache.sis.metadata.iso.quality.DefaultDataQuality#getScope() scope}{@linkplain org.apache.sis.metadata.iso.quality.DefaultScope#getLevel() level} is set to{@link org.opengis.metadata.maintenance.ScopeCode#ATTRIBUTE}. </li><li> At most one   {@linkplain org.apache.sis.metadata.iso.quality.DefaultDomainConsistency domain consistency}element is added to the   {@linkplain org.apache.sis.metadata.iso.quality.DefaultDataQuality#getReports() reports} list (implementations are free to omit that element if they have nothing to report).If a report is provided, then it will contain at least the following information: <ul> <li> <p>The  {@linkplain #getName() attribute name} as the data quality{@linkplain org.apache.sis.metadata.iso.quality.DefaultDomainConsistency#getMeasureIdentification() measure identification}.</p> <div class="note"><b>Note:</b> strictly speaking,   {@code measureIdentification} identifies the<em>quality measurement</em>, not the “real” measurement itself. However this implementation uses the same set of identifiers for both for simplicity.</div> </li><li> <p>If the attribute  {@linkplain #getValue() value} is not an {@linkplain Class#isInstance instance}of the expected   {@linkplain DefaultAttributeType#getValueClass() value class}, or if the number of occurrences is not inside the cardinality range, or if any other constraint is violated, then a   {@linkplain org.apache.sis.metadata.iso.quality.DefaultConformanceResult conformance result} isadded for each violation with an {@linkplain org.apache.sis.metadata.iso.quality.DefaultConformanceResult#getExplanation() explanation}set to the error message.</p> <div class="warning"><b>Note:</b> this is a departure from ISO intend, since   {@code explanation}should be a statement about what a successful conformance means. This point may be reformulated in a future SIS version.</div> </li> </ul> </li> </ul> This attribute is valid if this method does not report any  {@linkplain org.apache.sis.metadata.iso.quality.DefaultConformanceResult conformance result} having a{@linkplain org.apache.sis.metadata.iso.quality.DefaultConformanceResult#pass() pass} value of {@code false}. <div class="note"><b>Example:</b> given an attribute named “population” with [1 … 1] cardinality, if no value has been assigned to that attribute, then this   {@code quality()} method will returnthe following data quality report: {@preformat textData quality   ├─Scope   │   └─Level………………………………………………… Attribute   └─Report       ├─Measure identification       │   └─Code………………………………………… population       ├─Evaluation method type…… Direct internal       └─Result           ├─Explanation……………………… Missing value for “population” property.           └─Pass………………………………………… false}</div>
 * @return reports on all constraint violations found.
 * @see AbstractFeature#quality()
 */
public DataQuality quality(){
  final Validator v=new Validator(ScopeCode.ATTRIBUTE);
  v.validate(type,getValues());
  return v.quality;
}