Program: 92209
Project: 92209
Buggy source:
/** 
 * Ensures that <var>lower</var> &lt;= <var>upper</var> for every dimensions. If a   {@linkplain #getUpper(int) upper ordinate value} is less than a{@linkplain #getLower(int) lower ordinate value}, then there is a choice: <ul> <li>If the axis has   {@link RangeMeaning#WRAPAROUND}, then:<ul> <li>the lower ordinate value is set to the   {@linkplain CoordinateSystemAxis#getMinimumValue() axis minimum value}, and</li> <li>the upper ordinate value is set to the   {@linkplain CoordinateSystemAxis#getMaximumValue() axis maximum value}.</li> </ul></li> <li>Otherwise an   {@link IllegalStateException} is thrown.</li></ul> This method is useful when the envelope needs to be used with libraries that do not support envelopes spanning the anti-meridian.
 * @return {@code true} if this envelope has been modified as a result of this method call,or  {@code false} if no change has been done.
 * @throws IllegalStateException If a upper ordinate value is less than a lower ordinatevalue on an axis which does not have the  {@code WRAPAROUND} range meaning.
 * @see #toSimpleEnvelopes()
 */
public boolean simplify() throws IllegalStateException {
  boolean changed=false;
  final int d=ordinates.length >>> 1;
  final int beginIndex=beginIndex();
  final int dimension=endIndex() - beginIndex;
  for (int i=0; i < dimension; i++) {
    final int iLower=beginIndex + i;
    final int iUpper=iLower + d;
    final double lower=ordinates[iLower];
    final double upper=ordinates[iUpper];
    if (isNegative(upper - lower)) {
      final CoordinateSystemAxis axis=getAxis(crs,i);
      if (axis != null && RangeMeaning.WRAPAROUND.equals(axis.getRangeMeaning())) {
        ordinates[iLower]=axis.getMinimumValue();
        ordinates[iUpper]=axis.getMaximumValue();
        changed=true;
      }
 else {
        throw new IllegalStateException(Errors.format(Errors.Keys.IllegalOrdinateRange_3,(axis != null) ? axis.getName() : i,lower,upper));
      }
    }
  }
  return changed;
}

Fixed version (ground truth):
/** 
 * Ensures that <var>lower</var> &lt;= <var>upper</var> for every dimensions. If a   {@linkplain #getUpper(int) upper ordinate value} is less than a{@linkplain #getLower(int) lower ordinate value}, then there is a choice: <ul> <li>If the axis has   {@link RangeMeaning#WRAPAROUND}, then:<ul> <li>the lower ordinate value is set to the   {@linkplain CoordinateSystemAxis#getMinimumValue() axis minimum value}, and</li> <li>the upper ordinate value is set to the   {@linkplain CoordinateSystemAxis#getMaximumValue() axis maximum value}.</li> </ul></li> <li>Otherwise an   {@link IllegalStateException} is thrown.</li></ul> This method is useful when the envelope needs to be used with libraries that do not support envelopes spanning the anti-meridian.
 * @return {@code true} if this envelope has been modified as a result of this method call,or  {@code false} if no change has been done.
 * @throws IllegalStateException If a upper ordinate value is less than a lower ordinatevalue on an axis which does not have the  {@code WRAPAROUND} range meaning.
 * @see #toSimpleEnvelopes()
 */
public boolean simplify() throws IllegalStateException {
  boolean changed=false;
  final int d=ordinates.length >>> 1;
  final int beginIndex=beginIndex();
  final int dimension=endIndex() - beginIndex;
  for (int i=0; i < dimension; i++) {
    final int iLower=beginIndex + i;
    final int iUpper=iLower + d;
    final double lower=ordinates[iLower];
    final double upper=ordinates[iUpper];
    if (isNegative(upper - lower)) {
      final CoordinateSystemAxis axis=getAxis(crs,i);
      if (axis != null && RangeMeaning.WRAPAROUND.equals(axis.getRangeMeaning())) {
        ordinates[iLower]=axis.getMinimumValue();
        ordinates[iUpper]=axis.getMaximumValue();
        changed=true;
      }
 else {
        throw new IllegalStateException(Errors.format(Errors.Keys.IllegalOrdinateRange_3,lower,upper,(axis != null) ? axis.getName() : i));
      }
    }
  }
  return changed;
}