Program: 154095
Project: 154095
Buggy source:
/** 
 * Overrides the <code>RenderableOp</code> method to return a <code>RemoteRenderedImage</code> that represents the remote rendering of this image using a given <code>RenderContext</code>.  This is the most general way to obtain a rendering of a <code>RemoteRenderableOp</code>. <p> This method does not validate sources and parameters supplied in the <code>ParameterBlock</code> against the specification of the operation this node represents.  It is the caller's responsibility to ensure that the data in the <code>ParameterBlock</code> are suitable for this operation. Otherwise, some kind of exception or error will occur. <p> <code>RemoteJAI.createRenderable()</code> is the method that does the validation.  Therefore, it is strongly recommended that all <code>RemoteRenderableOp</code>s are created using <code>RemoteJAI.createRenderable()</code>. <p> The <code>RenderContext</code> may contain a <code>Shape</code> that represents the area-of-interest (aoi).  If the aoi is specifed, it is still legal to return an image that's larger than this aoi. Therefore, by default, the aoi, if specified, is ignored at the rendering. <p> The <code>RenderingHints</code> in the <code>RenderContext</code> may contain negotiation preferences specified under the <code>KEY_NEGOTIATION_PREFERENCES</code> key. These preferences can be ignored by the rendering if it so chooses.
 * @param renderContext the RenderContext to use to produce the rendering.
 * @return a RemoteRenderedImage containing the rendered data.
 */
public RenderedImage createRendering(RenderContext renderContext){
  findRemoteCRIF();
  ParameterBlock renderedPB=(ParameterBlock)nodeSupport.getParameterBlock().clone();
  RenderContext rcIn=renderContext;
  RenderingHints nodeHints=nodeSupport.getRenderingHints();
  if (nodeHints != null) {
    RenderingHints hints=renderContext.getRenderingHints();
    RenderingHints mergedHints;
    if (hints == null) {
      mergedHints=nodeHints;
    }
 else     if (nodeHints == null || nodeHints.isEmpty()) {
      mergedHints=hints;
    }
 else {
      mergedHints=new RenderingHints(nodeHints);
      mergedHints.add(hints);
    }
    if (mergedHints != hints) {
      rcIn=new RenderContext(renderContext.getTransform(),renderContext.getAreaOfInterest(),mergedHints);
    }
  }
  Vector sources=nodeSupport.getParameterBlock().getSources();
  try {
    if (sources != null) {
      Vector renderedSources=new Vector();
      for (int i=0; i < sources.size(); i++) {
        RenderedImage rdrdImage=null;
        Object source=sources.elementAt(i);
        if (source instanceof RenderableImage) {
          RenderContext rcOut=remoteCRIF.mapRenderContext(serverName,nodeSupport.getOperationName(),i,renderContext,nodeSupport.getParameterBlock(),this);
          RenderableImage src=(RenderableImage)source;
          rdrdImage=src.createRendering(rcOut);
        }
 else         if (source instanceof RenderedOp) {
          rdrdImage=((RenderedOp)source).getRendering();
        }
 else         if (source instanceof RenderedImage) {
          rdrdImage=(RenderedImage)source;
        }
        if (rdrdImage == null) {
          return null;
        }
        renderedSources.addElement(rdrdImage);
      }
      if (renderedSources.size() > 0) {
        renderedPB.setSources(renderedSources);
      }
    }
    RenderedImage rendering=remoteCRIF.create(serverName,nodeSupport.getOperationName(),renderContext,renderedPB);
    if (rendering instanceof RenderedOp) {
      rendering=((RenderedOp)rendering).getRendering();
    }
    linkToRemoteOp=rendering;
    if (rendering != null && rendering instanceof WritablePropertySource) {
      String[] propertyNames=getPropertyNames();
      if (propertyNames != null) {
        WritablePropertySource wps=(WritablePropertySource)rendering;
        for (int j=0; j < propertyNames.length; j++) {
          String name=propertyNames[j];
          Object value=getProperty(name);
          if (value != null && value != java.awt.Image.UndefinedProperty) {
            wps.setProperty(name,value);
          }
        }
      }
    }
    return rendering;
  }
 catch (  ArrayIndexOutOfBoundsException e) {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Overrides the <code>RenderableOp</code> method to return a <code>RemoteRenderedImage</code> that represents the remote rendering of this image using a given <code>RenderContext</code>.  This is the most general way to obtain a rendering of a <code>RemoteRenderableOp</code>. <p> This method does not validate sources and parameters supplied in the <code>ParameterBlock</code> against the specification of the operation this node represents.  It is the caller's responsibility to ensure that the data in the <code>ParameterBlock</code> are suitable for this operation. Otherwise, some kind of exception or error will occur. <p> <code>RemoteJAI.createRenderable()</code> is the method that does the validation.  Therefore, it is strongly recommended that all <code>RemoteRenderableOp</code>s are created using <code>RemoteJAI.createRenderable()</code>. <p> The <code>RenderContext</code> may contain a <code>Shape</code> that represents the area-of-interest (aoi).  If the aoi is specifed, it is still legal to return an image that's larger than this aoi. Therefore, by default, the aoi, if specified, is ignored at the rendering. <p> The <code>RenderingHints</code> in the <code>RenderContext</code> may contain negotiation preferences specified under the <code>KEY_NEGOTIATION_PREFERENCES</code> key. These preferences can be ignored by the rendering if it so chooses.
 * @param renderContext the RenderContext to use to produce the rendering.
 * @return a RemoteRenderedImage containing the rendered data.
 */
public RenderedImage createRendering(RenderContext renderContext){
  findRemoteCRIF();
  ParameterBlock renderedPB=(ParameterBlock)nodeSupport.getParameterBlock().clone();
  RenderContext rcIn=renderContext;
  RenderingHints nodeHints=nodeSupport.getRenderingHints();
  if (nodeHints != null) {
    RenderingHints hints=renderContext.getRenderingHints();
    RenderingHints mergedHints;
    if (hints == null) {
      mergedHints=nodeHints;
    }
 else     if (nodeHints == null || nodeHints.isEmpty()) {
      mergedHints=hints;
    }
 else {
      mergedHints=new RenderingHints((Map)nodeHints);
      mergedHints.add(hints);
    }
    if (mergedHints != hints) {
      rcIn=new RenderContext(renderContext.getTransform(),renderContext.getAreaOfInterest(),mergedHints);
    }
  }
  Vector sources=nodeSupport.getParameterBlock().getSources();
  try {
    if (sources != null) {
      Vector renderedSources=new Vector();
      for (int i=0; i < sources.size(); i++) {
        RenderedImage rdrdImage=null;
        Object source=sources.elementAt(i);
        if (source instanceof RenderableImage) {
          RenderContext rcOut=remoteCRIF.mapRenderContext(serverName,nodeSupport.getOperationName(),i,renderContext,nodeSupport.getParameterBlock(),this);
          RenderableImage src=(RenderableImage)source;
          rdrdImage=src.createRendering(rcOut);
        }
 else         if (source instanceof RenderedOp) {
          rdrdImage=((RenderedOp)source).getRendering();
        }
 else         if (source instanceof RenderedImage) {
          rdrdImage=(RenderedImage)source;
        }
        if (rdrdImage == null) {
          return null;
        }
        renderedSources.addElement(rdrdImage);
      }
      if (renderedSources.size() > 0) {
        renderedPB.setSources(renderedSources);
      }
    }
    RenderedImage rendering=remoteCRIF.create(serverName,nodeSupport.getOperationName(),renderContext,renderedPB);
    if (rendering instanceof RenderedOp) {
      rendering=((RenderedOp)rendering).getRendering();
    }
    linkToRemoteOp=rendering;
    if (rendering != null && rendering instanceof WritablePropertySource) {
      String[] propertyNames=getPropertyNames();
      if (propertyNames != null) {
        WritablePropertySource wps=(WritablePropertySource)rendering;
        for (int j=0; j < propertyNames.length; j++) {
          String name=propertyNames[j];
          Object value=getProperty(name);
          if (value != null && value != java.awt.Image.UndefinedProperty) {
            wps.setProperty(name,value);
          }
        }
      }
    }
    return rendering;
  }
 catch (  ArrayIndexOutOfBoundsException e) {
    return null;
  }
}