Program: 52362
Project: 52362
Buggy source:
private void encryptDecryptBCTest() throws Exception {
  byte[] text={(byte)'h',(byte)'e',(byte)'l',(byte)'l',(byte)'o',(byte)' ',(byte)'w',(byte)'o',(byte)'r',(byte)'l',(byte)'d',(byte)'!',(byte)'\n'};
  ECKeyPairGenerator keyGen=new ECKeyPairGenerator();
  X9ECParameters x9ECParameters=NISTNamedCurves.getByName("String_Node_Str");
  keyGen.init(new ECKeyGenerationParameters(new ECNamedDomainParameters(NISTNamedCurves.getOID("String_Node_Str"),x9ECParameters.getCurve(),x9ECParameters.getG(),x9ECParameters.getN()),new SecureRandom()));
  AsymmetricCipherKeyPair kpEnc=keyGen.generateKeyPair();
  PGPKeyPair ecdhKeyPair=new BcPGPKeyPair(PGPPublicKey.ECDH,kpEnc,new Date());
  PGPLiteralDataGenerator lData=new PGPLiteralDataGenerator();
  ByteArrayOutputStream ldOut=new ByteArrayOutputStream();
  OutputStream pOut=lData.open(ldOut,PGPLiteralDataGenerator.UTF8,PGPLiteralData.CONSOLE,text.length,new Date());
  pOut.write(text);
  pOut.close();
  byte[] data=ldOut.toByteArray();
  ByteArrayOutputStream cbOut=new ByteArrayOutputStream();
  PGPEncryptedDataGenerator cPk=new PGPEncryptedDataGenerator(new BcPGPDataEncryptorBuilder(SymmetricKeyAlgorithmTags.CAST5).setSecureRandom(new SecureRandom()));
  cPk.addMethod(new BcPublicKeyKeyEncryptionMethodGenerator(ecdhKeyPair.getPublicKey()));
  OutputStream cOut=cPk.open(new UncloseableOutputStream(cbOut),data.length);
  cOut.write(data);
  cOut.close();
  JcaPGPObjectFactory pgpF=new JcaPGPObjectFactory(cbOut.toByteArray());
  PGPEncryptedDataList encList=(PGPEncryptedDataList)pgpF.nextObject();
  PGPPublicKeyEncryptedData encP=(PGPPublicKeyEncryptedData)encList.get(0);
  InputStream clear=encP.getDataStream(new BcPublicKeyDataDecryptorFactory(ecdhKeyPair.getPrivateKey()));
  pgpF=new JcaPGPObjectFactory(clear);
  PGPLiteralData ld=(PGPLiteralData)pgpF.nextObject();
  clear=ld.getInputStream();
  ByteArrayOutputStream bOut=new ByteArrayOutputStream();
  int ch;
  while ((ch=clear.read()) >= 0) {
    bOut.write(ch);
  }
  byte[] out=bOut.toByteArray();
  if (!areEqual(out,text)) {
    fail("String_Node_Str");
  }
}

Fixed version (ground truth):
private void encryptDecryptBCTest(final String curve) throws Exception {
  byte[] text={(byte)'h',(byte)'e',(byte)'l',(byte)'l',(byte)'o',(byte)' ',(byte)'w',(byte)'o',(byte)'r',(byte)'l',(byte)'d',(byte)'!',(byte)'\n'};
  ECKeyPairGenerator keyGen=new ECKeyPairGenerator();
  X9ECParameters x9ECParameters=ECNamedCurveTable.getByName(curve);
  keyGen.init(new ECKeyGenerationParameters(new ECNamedDomainParameters(ECNamedCurveTable.getOID(curve),x9ECParameters.getCurve(),x9ECParameters.getG(),x9ECParameters.getN()),new SecureRandom()));
  AsymmetricCipherKeyPair kpEnc=keyGen.generateKeyPair();
  PGPKeyPair ecdhKeyPair=new BcPGPKeyPair(PGPPublicKey.ECDH,kpEnc,new Date());
  PGPLiteralDataGenerator lData=new PGPLiteralDataGenerator();
  ByteArrayOutputStream ldOut=new ByteArrayOutputStream();
  OutputStream pOut=lData.open(ldOut,PGPLiteralDataGenerator.UTF8,PGPLiteralData.CONSOLE,text.length,new Date());
  pOut.write(text);
  pOut.close();
  byte[] data=ldOut.toByteArray();
  ByteArrayOutputStream cbOut=new ByteArrayOutputStream();
  PGPEncryptedDataGenerator cPk=new PGPEncryptedDataGenerator(new BcPGPDataEncryptorBuilder(SymmetricKeyAlgorithmTags.CAST5).setSecureRandom(new SecureRandom()));
  cPk.addMethod(new BcPublicKeyKeyEncryptionMethodGenerator(ecdhKeyPair.getPublicKey()));
  OutputStream cOut=cPk.open(new UncloseableOutputStream(cbOut),data.length);
  cOut.write(data);
  cOut.close();
  JcaPGPObjectFactory pgpF=new JcaPGPObjectFactory(cbOut.toByteArray());
  PGPEncryptedDataList encList=(PGPEncryptedDataList)pgpF.nextObject();
  PGPPublicKeyEncryptedData encP=(PGPPublicKeyEncryptedData)encList.get(0);
  InputStream clear=encP.getDataStream(new BcPublicKeyDataDecryptorFactory(ecdhKeyPair.getPrivateKey()));
  pgpF=new JcaPGPObjectFactory(clear);
  PGPLiteralData ld=(PGPLiteralData)pgpF.nextObject();
  clear=ld.getInputStream();
  ByteArrayOutputStream bOut=new ByteArrayOutputStream();
  int ch;
  while ((ch=clear.read()) >= 0) {
    bOut.write(ch);
  }
  byte[] out=bOut.toByteArray();
  if (!areEqual(out,text)) {
    fail("String_Node_Str");
  }
}