Program: 67974
Project: 67974
Buggy source:
public static Image getImage(IImageContent content){
  Image image=null;
  try {
    String uri=content.getURI();
    String mimeType=content.getMIMEType();
    String extension=content.getExtension();
switch (content.getImageSource()) {
case IImageContent.IMAGE_FILE:
      ReportDesignHandle design=content.getReportContent().getDesign().getReportDesign();
    URL url=design.findResource(uri,IResourceLocator.IMAGE,content.getReportContent().getReportContext() == null ? null : content.getReportContent().getReportContext().getAppContext());
  InputStream in=url.openStream();
try {
  byte[] buffer;
  if (SvgFile.isSvg(content.getURI())) {
    buffer=SvgFile.transSvgToArray(in);
  }
 else {
    ArrayList<Byte> bytes=new ArrayList<Byte>();
    int data=in.read();
    while (data != -1) {
      bytes.add((byte)data);
      data=in.read();
    }
    buffer=new byte[bytes.size()];
    for (int i=0; i < buffer.length; i++) {
      buffer[i]=bytes.get(i);
    }
  }
  image=Image.getInstance(buffer);
}
 catch (Exception ex) {
  logger.log(Level.WARNING,ex.getMessage(),ex);
}
 finally {
  in.close();
}
break;
case IImageContent.IMAGE_NAME:
case IImageContent.IMAGE_EXPRESSION:
byte[] data=content.getData();
in=new ByteArrayInputStream(data);
if (SvgFile.isSvg(mimeType,uri,extension)) data=SvgFile.transSvgToArray(in);
image=Image.getInstance(data);
break;
case IImageContent.IMAGE_URL:
if (SvgFile.isSvg(uri)) {
image=Image.getInstance(SvgFile.transSvgToArray(uri));
}
 else {
image=Image.getInstance(new URL(content.getURI()));
}
break;
default :
assert(false);
}
}
 catch (Exception e) {
logger.log(Level.SEVERE,e.getLocalizedMessage());
}
return image;
}

Fixed version (ground truth):
public static Image getImage(IImageContent content){
  Image image=null;
  try {
    String uri=content.getURI();
    String mimeType=content.getMIMEType();
    String extension=content.getExtension();
switch (content.getImageSource()) {
case IImageContent.IMAGE_FILE:
      ReportDesignHandle design=content.getReportContent().getDesign().getReportDesign();
    URL url=design.findResource(uri,IResourceLocator.IMAGE,content.getReportContent().getReportContext() == null ? null : content.getReportContent().getReportContext().getAppContext());
  InputStream in=url.openStream();
try {
  byte[] buffer;
  if (SvgFile.isSvg(content.getURI())) {
    buffer=SvgFile.transSvgToArray(in);
  }
 else {
    ArrayList<Byte> bytes=new ArrayList<Byte>();
    int data=in.read();
    while (data != -1) {
      bytes.add((byte)data);
      data=in.read();
    }
    buffer=new byte[bytes.size()];
    for (int i=0; i < buffer.length; i++) {
      buffer[i]=bytes.get(i);
    }
  }
  image=Image.getInstance(buffer);
}
 catch (Exception ex) {
  logger.log(Level.WARNING,ex.getMessage(),ex);
}
 finally {
  in.close();
}
break;
case IImageContent.IMAGE_NAME:
case IImageContent.IMAGE_EXPRESSION:
byte[] data=content.getData();
in=new ByteArrayInputStream(data);
if (SvgFile.isSvg(mimeType,uri,extension)) data=SvgFile.transSvgToArray(in);
in.close();
image=Image.getInstance(data);
break;
case IImageContent.IMAGE_URL:
if (SvgFile.isSvg(uri)) {
image=Image.getInstance(SvgFile.transSvgToArray(uri));
}
 else {
image=Image.getInstance(new URL(content.getURI()));
}
break;
default :
assert(false);
}
}
 catch (Exception e) {
logger.log(Level.SEVERE,e.getLocalizedMessage());
}
return image;
}