Program: 47404
Project: 47404
Buggy source:
/** 
 * Stores a domain to the repository directly as an Input Stream
 * @param inputStream
 * @param domainId
 * @param overwrite
 */
@Override public void storeDomain(final InputStream inputStream,final String domainId,final boolean overwrite) throws DomainIdNullException, DomainAlreadyExistsException, DomainStorageException {
  logger.debug("String_Node_Str" + domainId + "String_Node_Str"+ overwrite+ "String_Node_Str");
  if (null == inputStream) {
    throw new IllegalArgumentException();
  }
  if (StringUtils.isEmpty(domainId)) {
    throw new DomainIdNullException(messages.getErrorString("String_Node_Str"));
  }
  final RepositoryFile domainFile=getMetadataRepositoryFile(domainId);
  if (!overwrite && domainFile != null) {
    final String errorString=messages.getErrorString("String_Node_Str",domainId);
    logger.error(errorString);
    throw new DomainAlreadyExistsException(errorString);
  }
  try {
    inputStream.reset();
    Domain domain=xmiParser.parseXmi(inputStream);
    inputStream.reset();
  }
 catch (  Exception ex) {
    logger.error(ex.getMessage());
    java.io.ByteArrayOutputStream byteArrayOutputStream=new ByteArrayOutputStream();
    ex.printStackTrace(new java.io.PrintStream(byteArrayOutputStream));
    throw new DomainStorageException(byteArrayOutputStream.toString(),ex);
  }
  final SimpleRepositoryFileData data=new SimpleRepositoryFileData(inputStream,DEFAULT_ENCODING,DOMAIN_MIME_TYPE);
  if (domainFile == null) {
    final RepositoryFile newDomainFile=createUniqueFile(domainId,null,data);
  }
 else {
    repository.updateFile(domainFile,data,null);
  }
  flushDomains();
}

Fixed version (ground truth):
/** 
 * Stores a domain to the repository directly as an Input Stream
 * @param inputStream
 * @param domainId
 * @param overwrite
 */
@Override public void storeDomain(final InputStream inputStream,final String domainId,final boolean overwrite) throws DomainIdNullException, DomainAlreadyExistsException, DomainStorageException {
  logger.debug("String_Node_Str" + domainId + "String_Node_Str"+ overwrite+ "String_Node_Str");
  if (null == inputStream) {
    throw new IllegalArgumentException();
  }
  if (StringUtils.isEmpty(domainId)) {
    throw new DomainIdNullException(messages.getErrorString("String_Node_Str"));
  }
  final RepositoryFile domainFile=getMetadataRepositoryFile(domainId);
  if (!overwrite && domainFile != null) {
    final String errorString=messages.getErrorString("String_Node_Str",domainId);
    logger.error(errorString);
    throw new DomainAlreadyExistsException(errorString);
  }
  InputStream inputStream2=null;
  String xmi=null;
  try {
    BufferedReader reader=new BufferedReader(new InputStreamReader(inputStream,DEFAULT_ENCODING));
    StringBuilder stringBuilder=new StringBuilder();
    while ((xmi=reader.readLine()) != null) {
      stringBuilder.append(xmi);
    }
    inputStream.close();
    xmi=stringBuilder.toString();
    Domain domain=xmiParser.parseXmi(new java.io.ByteArrayInputStream(xmi.getBytes(DEFAULT_ENCODING)));
    inputStream2=new java.io.ByteArrayInputStream(xmi.getBytes(DEFAULT_ENCODING));
  }
 catch (  Exception ex) {
    logger.error(ex.getMessage());
    java.io.ByteArrayOutputStream byteArrayOutputStream=new ByteArrayOutputStream();
    ex.printStackTrace(new java.io.PrintStream(byteArrayOutputStream));
    throw new DomainStorageException(byteArrayOutputStream.toString(),ex);
  }
  final SimpleRepositoryFileData data=new SimpleRepositoryFileData(inputStream2,DEFAULT_ENCODING,DOMAIN_MIME_TYPE);
  if (domainFile == null) {
    final RepositoryFile newDomainFile=createUniqueFile(domainId,null,data);
  }
 else {
    repository.updateFile(domainFile,data,null);
  }
  flushDomains();
}