Program: 154094
Project: 154094
Buggy source:
/** 
 * Creates a <code>RemoteRenderedOp</code> which represents the named operation to be performed remotely, using the source(s) and/or parameter(s) specified in the <code>ParameterBlock</code>, and applying the specified hints to the destination. This method should only be used when the final result returned is a single <code>RemoteRenderedImage</code>. <p> The supplied operation name is validated against the names of the <code>OperationDescriptor</code>s returned from the <code>getServerSupportedOperationList()</code> method. The source(s) and/or parameter(s) in the <code>ParameterBlock</code> are validated against the named operation's descriptor, both in their numbers and types. Additional restrictions placed on the sources and parameters by an individual operation are also validated by calling its <code>OperationDescriptor.validateArguments()</code> method. <p>Parameters are allowed to have a <code>null</code> input value, if that particular parameter has a default value specified in its operation's descriptor.  In this case, the default value will replace the <code>null</code> input. <p>Unspecified tailing parameters are allowed, if these parameters have default values specified in the operation's descriptor. However, if a parameter, which has a default value, is followed by one or more parameters that have no default values, this parameter must be specified in the <code>ParameterBlock</code>, even if it only has a value of code>null</code>. <p> The rendering hints associated with this instance of <code>RemoteJAI</code> are overlaid with the hints passed to this method.  That is, the set of keys will be the union of the keys from the instance's hints and the hints parameter. If the same key exists in both places, the value from the hints parameter will be used.
 * @param opName The name of the operation.
 * @param args   The source(s) and/or parameter(s) for the operation.
 * @param hints  The hints for the operation.
 * @throws IllegalArgumentException if <code>opName</code> is<code>null</code>.
 * @throws IllegalArgumentException if <code>args</code> is<code>null</code>.
 * @throws IllegalArgumentException if no<code>OperationDescriptor</code> is available from the server with the specified operation name.
 * @throws IllegalArgumentException if the<code>OperationDescriptor</code> for the specified operation name on the server does not support the "rendered" registry mode.
 * @throws IllegalArgumentException if the specified operation doesnot produce a <code>java.awt.image.RenderedImage</code>.
 * @throws IllegalArgumentException if the specified operation isunable to handle the sources and parameters specified in <code>args</code>.
 * @return  A <code>RemoteRenderedOp</code> that represents the namedoperation to be performed remotely, or <code>null</code> if the specified operation is in the "immediate" mode and the rendering of the <code>PlanarImage</code> failed.
 */
public RemoteRenderedOp create(String opName,ParameterBlock args,RenderingHints hints){
  if (opName == null) {
    throw new IllegalArgumentException(JaiI18N.getString("String_Node_Str"));
  }
  if (args == null) {
    throw new IllegalArgumentException(JaiI18N.getString("String_Node_Str"));
  }
  getServerSupportedOperationList();
  OperationDescriptor odesc=(OperationDescriptor)odHash.get(new CaselessStringKey(opName));
  if (odesc == null) {
    throw new IllegalArgumentException(JaiI18N.getString("String_Node_Str"));
  }
  if (!odesc.isModeSupported("String_Node_Str")) {
    throw new IllegalArgumentException(JaiI18N.getString("String_Node_Str"));
  }
  if (!RenderedImage.class.isAssignableFrom(odesc.getDestClass("String_Node_Str"))) {
    throw new IllegalArgumentException(JaiI18N.getString("String_Node_Str"));
  }
  StringBuffer msg=new StringBuffer();
  args=(ParameterBlock)args.clone();
  if (!odesc.validateArguments("String_Node_Str",args,msg)) {
    throw new IllegalArgumentException(msg.toString());
  }
  RenderingHints mergedHints;
  if (hints == null) {
    mergedHints=renderingHints;
  }
 else   if (renderingHints.isEmpty()) {
    mergedHints=hints;
  }
 else {
    mergedHints=new RenderingHints(renderingHints);
    mergedHints.add(hints);
  }
  RemoteRenderedOp op=new RemoteRenderedOp(operationRegistry,protocolName,serverName,opName,args,mergedHints);
  if (odesc.isImmediate()) {
    PlanarImage im=null;
    im=op.getRendering();
    if (im == null) {
      return null;
    }
  }
  return op;
}

Fixed version (ground truth):
/** 
 * Creates a <code>RemoteRenderedOp</code> which represents the named operation to be performed remotely, using the source(s) and/or parameter(s) specified in the <code>ParameterBlock</code>, and applying the specified hints to the destination. This method should only be used when the final result returned is a single <code>RemoteRenderedImage</code>. <p> The supplied operation name is validated against the names of the <code>OperationDescriptor</code>s returned from the <code>getServerSupportedOperationList()</code> method. The source(s) and/or parameter(s) in the <code>ParameterBlock</code> are validated against the named operation's descriptor, both in their numbers and types. Additional restrictions placed on the sources and parameters by an individual operation are also validated by calling its <code>OperationDescriptor.validateArguments()</code> method. <p>Parameters are allowed to have a <code>null</code> input value, if that particular parameter has a default value specified in its operation's descriptor.  In this case, the default value will replace the <code>null</code> input. <p>Unspecified tailing parameters are allowed, if these parameters have default values specified in the operation's descriptor. However, if a parameter, which has a default value, is followed by one or more parameters that have no default values, this parameter must be specified in the <code>ParameterBlock</code>, even if it only has a value of code>null</code>. <p> The rendering hints associated with this instance of <code>RemoteJAI</code> are overlaid with the hints passed to this method.  That is, the set of keys will be the union of the keys from the instance's hints and the hints parameter. If the same key exists in both places, the value from the hints parameter will be used.
 * @param opName The name of the operation.
 * @param args   The source(s) and/or parameter(s) for the operation.
 * @param hints  The hints for the operation.
 * @throws IllegalArgumentException if <code>opName</code> is<code>null</code>.
 * @throws IllegalArgumentException if <code>args</code> is<code>null</code>.
 * @throws IllegalArgumentException if no<code>OperationDescriptor</code> is available from the server with the specified operation name.
 * @throws IllegalArgumentException if the<code>OperationDescriptor</code> for the specified operation name on the server does not support the "rendered" registry mode.
 * @throws IllegalArgumentException if the specified operation doesnot produce a <code>java.awt.image.RenderedImage</code>.
 * @throws IllegalArgumentException if the specified operation isunable to handle the sources and parameters specified in <code>args</code>.
 * @return  A <code>RemoteRenderedOp</code> that represents the namedoperation to be performed remotely, or <code>null</code> if the specified operation is in the "immediate" mode and the rendering of the <code>PlanarImage</code> failed.
 */
public RemoteRenderedOp create(String opName,ParameterBlock args,RenderingHints hints){
  if (opName == null) {
    throw new IllegalArgumentException(JaiI18N.getString("String_Node_Str"));
  }
  if (args == null) {
    throw new IllegalArgumentException(JaiI18N.getString("String_Node_Str"));
  }
  getServerSupportedOperationList();
  OperationDescriptor odesc=(OperationDescriptor)odHash.get(new CaselessStringKey(opName));
  if (odesc == null) {
    throw new IllegalArgumentException(JaiI18N.getString("String_Node_Str"));
  }
  if (!odesc.isModeSupported("String_Node_Str")) {
    throw new IllegalArgumentException(JaiI18N.getString("String_Node_Str"));
  }
  if (!RenderedImage.class.isAssignableFrom(odesc.getDestClass("String_Node_Str"))) {
    throw new IllegalArgumentException(JaiI18N.getString("String_Node_Str"));
  }
  StringBuffer msg=new StringBuffer();
  args=(ParameterBlock)args.clone();
  if (!odesc.validateArguments("String_Node_Str",args,msg)) {
    throw new IllegalArgumentException(msg.toString());
  }
  RenderingHints mergedHints;
  if (hints == null) {
    mergedHints=renderingHints;
  }
 else   if (renderingHints.isEmpty()) {
    mergedHints=hints;
  }
 else {
    mergedHints=new RenderingHints((Map)renderingHints);
    mergedHints.add(hints);
  }
  RemoteRenderedOp op=new RemoteRenderedOp(operationRegistry,protocolName,serverName,opName,args,mergedHints);
  if (odesc.isImmediate()) {
    PlanarImage im=null;
    im=op.getRendering();
    if (im == null) {
      return null;
    }
  }
  return op;
}