Program: 92182
Project: 92182
Buggy source:
/** 
 * If there is exactly one transform step which is   {@linkplain Parameterized parameterized}, returns that transform step. Otherwise returns   {@code null}. <p>This method normally requires that there is exactly one transform step remaining after we processed map projections in the special way described in   {@link #getParameterValues()}, because if they were more than one remaining steps, the returned parameters would not be sufficient for rebuilding the full concatenated transform. Returning parameters when there is more than one remaining step, even if all other transform steps are not parameterizable, would be a contract violation.</p> <p>However in the special case where we are formatting   {@code PROJCS} element, the above ruleis slightly relaxed. More specifically we ignore affine transforms in order to accept axis swapping or unit conversions. This special case is internal to SIS implementation of WKT formatter and should be unknown to users.</p> <p>See  {@link org.apache.sis.referencing.operation.DefaultSingleOperation#getParameterValues()}for the code where the above-cited special case is applied.</p>
 * @return The parameterizable transform step, or {@code null} if none.
 * @see org.apache.sis.referencing.operation.DefaultSingleOperation#simplify(MathTransform)
 */
private Parameterized getParameterised(){
  Parameterized param=null;
  final List<Object> transforms=getPseudoSteps();
  if (transforms.size() == 1 || Semaphores.query(Semaphores.PROJCS)) {
    for (    final Object candidate : transforms) {
      if (!(candidate instanceof Parameterized)) {
        return null;
      }
      if (param != null) {
        final boolean isLinear=(candidate instanceof LinearTransform);
        if ((param instanceof LinearTransform) == isLinear) {
          return null;
        }
        if (isLinear) {
          continue;
        }
      }
      param=(Parameterized)candidate;
    }
  }
  return param;
}

Fixed version (ground truth):
/** 
 * If there is exactly one transform step which is   {@linkplain Parameterized parameterized}, returns that transform step. Otherwise returns   {@code null}. <p>This method normally requires that there is exactly one transform step remaining after we processed map projections in the special way described in   {@link #getParameterValues()}, because if they were more than one remaining steps, the returned parameters would not be sufficient for rebuilding the full concatenated transform. Returning parameters when there is more than one remaining step, even if all other transform steps are not parameterizable, would be a contract violation.</p> <p>However in the special case where we are formatting   {@code PROJCS} element, the above ruleis slightly relaxed. More specifically we ignore affine transforms in order to accept axis swapping or unit conversions. This special case is internal to SIS implementation of WKT formatter and should be unknown to users.</p> <p>See  {@link org.apache.sis.referencing.operation.DefaultSingleOperation#getParameterValues()}for the code where the above-cited special case is applied.</p>
 * @return The parameterizable transform step, or {@code null} if none.
 * @see org.apache.sis.referencing.operation.DefaultSingleOperation#simplify(MathTransform)
 */
private Parameterized getParameterised(){
  Parameterized param=null;
  final List<Object> transforms=getPseudoSteps();
  if (transforms.size() == 1 || Semaphores.query(Semaphores.PROJCS)) {
    for (    final Object candidate : transforms) {
      if (!(candidate instanceof Matrix) && !(candidate instanceof LinearTransform)) {
        if ((param == null) && (candidate instanceof Parameterized)) {
          param=(Parameterized)candidate;
        }
 else {
          return null;
        }
      }
    }
  }
  return param;
}