nus-yam/ex-repair huggingface dataset:
Program: 111246
Project: 111246
Buggy source:
/** 
 * @param jsonKeyFormat JSON formated {@code EcdsaPrivateKeyFromat}-proto
 * @return {@code EcdsaKeyFormat}-proto
 */
@Override public MessageLite jsonToKeyFormat(final byte[] jsonKeyFormat) throws GeneralSecurityException {
  return new EcdsaVerifyKeyManager().jsonToKeyFormat(jsonKeyFormat);
}

Fixed version (ground truth):
/** 
 * @param jsonKeyFormat JSON formatted {@code EcdsaPrivateKeyFromat}-proto
 * @return {@code EcdsaKeyFormat}-proto
 */
@Override public MessageLite jsonToKeyFormat(final byte[] jsonKeyFormat) throws GeneralSecurityException {
  return new EcdsaVerifyKeyManager().jsonToKeyFormat(jsonKeyFormat);
}
Program: 111247
Project: 111247
Buggy source:
/** 
 * @param jsonKey JSON formated {@code Ed25519PrivateKey}-proto
 * @return {@code Ed25519PrivateKey}-proto
 */
@Override public MessageLite jsonToKey(final byte[] jsonKey) throws GeneralSecurityException {
  try {
    JSONObject json=new JSONObject(new String(jsonKey,Util.UTF_8));
    validateKey(json);
    Ed25519PublicKeyManager publicKeyManager=new Ed25519PublicKeyManager();
    return Ed25519PrivateKey.newBuilder().setVersion(json.getInt("String_Node_Str")).setKeyValue(ByteString.copyFrom(Base64.decode(json.getString("String_Node_Str")))).setPublicKey((Ed25519PublicKey)publicKeyManager.jsonToKey(json.getJSONObject("String_Node_Str").toString(4).getBytes(Util.UTF_8))).build();
  }
 catch (  JSONException e) {
    throw new GeneralSecurityException(e);
  }
}

Fixed version (ground truth):
/** 
 * @param jsonKey JSON formatted {@code Ed25519PrivateKey}-proto
 * @return {@code Ed25519PrivateKey}-proto
 */
@Override public MessageLite jsonToKey(final byte[] jsonKey) throws GeneralSecurityException {
  try {
    JSONObject json=new JSONObject(new String(jsonKey,Util.UTF_8));
    validateKey(json);
    Ed25519PublicKeyManager publicKeyManager=new Ed25519PublicKeyManager();
    return Ed25519PrivateKey.newBuilder().setVersion(json.getInt("String_Node_Str")).setKeyValue(ByteString.copyFrom(Base64.decode(json.getString("String_Node_Str")))).setPublicKey((Ed25519PublicKey)publicKeyManager.jsonToKey(json.getJSONObject("String_Node_Str").toString(4).getBytes(Util.UTF_8))).build();
  }
 catch (  JSONException e) {
    throw new GeneralSecurityException(e);
  }
}
Program: 111248
Project: 111248
Buggy source:
/** 
 * @param jsonKey JSON formated {@code Ed25519PublicKey}-proto
 * @return {@code Ed25519PublicKey}-proto
 */
@Override public MessageLite jsonToKey(final byte[] jsonKey) throws GeneralSecurityException {
  try {
    JSONObject json=new JSONObject(new String(jsonKey,Util.UTF_8));
    validateKey(json);
    return Ed25519PublicKey.newBuilder().setVersion(json.getInt("String_Node_Str")).setKeyValue(ByteString.copyFrom(Base64.decode(json.getString("String_Node_Str")))).build();
  }
 catch (  JSONException e) {
    throw new GeneralSecurityException(e);
  }
}

Fixed version (ground truth):
/** 
 * @param jsonKey JSON formatted {@code Ed25519PublicKey}-proto
 * @return {@code Ed25519PublicKey}-proto
 */
@Override public MessageLite jsonToKey(final byte[] jsonKey) throws GeneralSecurityException {
  try {
    JSONObject json=new JSONObject(new String(jsonKey,Util.UTF_8));
    validateKey(json);
    return Ed25519PublicKey.newBuilder().setVersion(json.getInt("String_Node_Str")).setKeyValue(ByteString.copyFrom(Base64.decode(json.getString("String_Node_Str")))).build();
  }
 catch (  JSONException e) {
    throw new GeneralSecurityException(e);
  }
}
Program: 111249
Project: 111249
Buggy source:
/** 
 * @param jsonKey JSON formated {@code AesCtrHmacStreamingKey}-proto
 * @return {@code AesCtrHmacStreamingKey}-proto
 */
@Override public MessageLite jsonToKey(final byte[] jsonKey) throws GeneralSecurityException {
  try {
    JSONObject json=new JSONObject(new String(jsonKey,Util.UTF_8));
    validateKey(json);
    byte[] keyValue=Base64.decode(json.getString("String_Node_Str"));
    return AesCtrHmacStreamingKey.newBuilder().setVersion(json.getInt("String_Node_Str")).setParams(paramsFromJson(json.getJSONObject("String_Node_Str"))).setKeyValue(ByteString.copyFrom(keyValue)).build();
  }
 catch (  JSONException e) {
    throw new GeneralSecurityException(e);
  }
}

Fixed version (ground truth):
/** 
 * @param jsonKey JSON formatted {@code AesCtrHmacStreamingKey}-proto
 * @return {@code AesCtrHmacStreamingKey}-proto
 */
@Override public MessageLite jsonToKey(final byte[] jsonKey) throws GeneralSecurityException {
  try {
    JSONObject json=new JSONObject(new String(jsonKey,Util.UTF_8));
    validateKey(json);
    byte[] keyValue=Base64.decode(json.getString("String_Node_Str"));
    return AesCtrHmacStreamingKey.newBuilder().setVersion(json.getInt("String_Node_Str")).setParams(paramsFromJson(json.getJSONObject("String_Node_Str"))).setKeyValue(ByteString.copyFrom(keyValue)).build();
  }
 catch (  JSONException e) {
    throw new GeneralSecurityException(e);
  }
}
Program: 111250
Project: 111250
Buggy source:
/** 
 * @param jsonKeyFormat JSON formated {@code AesCtrHmacStreamingKeyFromat}-proto
 * @return {@code AesCtrHmacStreamingKeyFormat}-proto
 */
@Override public MessageLite jsonToKeyFormat(final byte[] jsonKeyFormat) throws GeneralSecurityException {
  try {
    JSONObject json=new JSONObject(new String(jsonKeyFormat,Util.UTF_8));
    validateKeyFormat(json);
    return AesCtrHmacStreamingKeyFormat.newBuilder().setParams(paramsFromJson(json.getJSONObject("String_Node_Str"))).setKeySize(json.getInt("String_Node_Str")).build();
  }
 catch (  JSONException e) {
    throw new GeneralSecurityException(e);
  }
}

Fixed version (ground truth):
/** 
 * @param jsonKeyFormat JSON formatted {@code AesCtrHmacStreamingKeyFromat}-proto
 * @return {@code AesCtrHmacStreamingKeyFormat}-proto
 */
@Override public MessageLite jsonToKeyFormat(final byte[] jsonKeyFormat) throws GeneralSecurityException {
  try {
    JSONObject json=new JSONObject(new String(jsonKeyFormat,Util.UTF_8));
    validateKeyFormat(json);
    return AesCtrHmacStreamingKeyFormat.newBuilder().setParams(paramsFromJson(json.getJSONObject("String_Node_Str"))).setKeySize(json.getInt("String_Node_Str")).build();
  }
 catch (  JSONException e) {
    throw new GeneralSecurityException(e);
  }
}
Program: 111251
Project: 111251
Buggy source:
/** 
 * @param jsonKey JSON formated {@code AesGcmHkdfStreamingKey}-proto
 * @return {@code AesGcmHkdfStreamingKey}-proto
 */
@Override public MessageLite jsonToKey(final byte[] jsonKey) throws GeneralSecurityException {
  try {
    JSONObject json=new JSONObject(new String(jsonKey,Util.UTF_8));
    validateKey(json);
    byte[] keyValue=Base64.decode(json.getString("String_Node_Str"));
    return AesGcmHkdfStreamingKey.newBuilder().setVersion(json.getInt("String_Node_Str")).setParams(paramsFromJson(json.getJSONObject("String_Node_Str"))).setKeyValue(ByteString.copyFrom(keyValue)).build();
  }
 catch (  JSONException e) {
    throw new GeneralSecurityException(e);
  }
}

Fixed version (ground truth):
/** 
 * @param jsonKey JSON formatted {@code AesGcmHkdfStreamingKey}-proto
 * @return {@code AesGcmHkdfStreamingKey}-proto
 */
@Override public MessageLite jsonToKey(final byte[] jsonKey) throws GeneralSecurityException {
  try {
    JSONObject json=new JSONObject(new String(jsonKey,Util.UTF_8));
    validateKey(json);
    byte[] keyValue=Base64.decode(json.getString("String_Node_Str"));
    return AesGcmHkdfStreamingKey.newBuilder().setVersion(json.getInt("String_Node_Str")).setParams(paramsFromJson(json.getJSONObject("String_Node_Str"))).setKeyValue(ByteString.copyFrom(keyValue)).build();
  }
 catch (  JSONException e) {
    throw new GeneralSecurityException(e);
  }
}
Program: 111252
Project: 111252
Buggy source:
/** 
 * @param jsonKeyFormat JSON formated {@code AesGcmHkdfStreamingKeyFromat}-proto
 * @return {@code AesGcmHkdfStreamingKeyFormat}-proto
 */
@Override public MessageLite jsonToKeyFormat(final byte[] jsonKeyFormat) throws GeneralSecurityException {
  try {
    JSONObject json=new JSONObject(new String(jsonKeyFormat,Util.UTF_8));
    validateKeyFormat(json);
    return AesGcmHkdfStreamingKeyFormat.newBuilder().setParams(paramsFromJson(json.getJSONObject("String_Node_Str"))).setKeySize(json.getInt("String_Node_Str")).build();
  }
 catch (  JSONException e) {
    throw new GeneralSecurityException(e);
  }
}

Fixed version (ground truth):
/** 
 * @param jsonKeyFormat JSON formatted {@code AesGcmHkdfStreamingKeyFromat}-proto
 * @return {@code AesGcmHkdfStreamingKeyFormat}-proto
 */
@Override public MessageLite jsonToKeyFormat(final byte[] jsonKeyFormat) throws GeneralSecurityException {
  try {
    JSONObject json=new JSONObject(new String(jsonKeyFormat,Util.UTF_8));
    validateKeyFormat(json);
    return AesGcmHkdfStreamingKeyFormat.newBuilder().setParams(paramsFromJson(json.getJSONObject("String_Node_Str"))).setKeySize(json.getInt("String_Node_Str")).build();
  }
 catch (  JSONException e) {
    throw new GeneralSecurityException(e);
  }
}
Program: 111254
Project: 111254
Buggy source:
@Test public void testShouldFailIfSignatureWasChanged() throws Exception {
  EcdsaSignJce signer=new EcdsaSignJce(EllipticCurves.getEcPrivateKey(Base64.decode(GOOGLE_SIGNING_PRIVATE_KEY_PKCS8_BASE64)),"String_Node_Str");
  RewardedAdsVerifier verifier=new RewardedAdsVerifier.Builder().setVerifyingPublicKeys(GOOGLE_VERIFYING_PUBLIC_KEYS_JSON).build();
  byte[] validSig=signer.sign(REWARD_URL.getBytes(UTF_8));
  for (int i=0; i < validSig.length; i++) {
    byte[] modifiedSig=Arrays.copyOf(validSig,validSig.length);
    modifiedSig[i]^=0xff;
    String modifiedUrl=buildUrl(REWARD_URL,modifiedSig,KEY_ID);
    try {
      verifier.verify(modifiedUrl);
      fail("String_Node_Str");
    }
 catch (    GeneralSecurityException e) {
      System.out.println(e);
    }
  }
}

Fixed version (ground truth):
@Test public void testShouldFailIfSignatureWasChanged() throws Exception {
  EcdsaSignJce signer=new EcdsaSignJce(EllipticCurves.getEcPrivateKey(Base64.decode(GOOGLE_SIGNING_PRIVATE_KEY_PKCS8_BASE64)),"String_Node_Str");
  RewardedAdsVerifier verifier=new RewardedAdsVerifier.Builder().setVerifyingPublicKeys(GOOGLE_VERIFYING_PUBLIC_KEYS_JSON).build();
  byte[] validSig=signer.sign(REWARD_URL.getBytes(UTF_8));
  for (int i=0; i < validSig.length; i++) {
    byte[] modifiedSig=Arrays.copyOf(validSig,validSig.length);
    modifiedSig[i]=(byte)(modifiedSig[i] ^ 0xff);
    String modifiedUrl=buildUrl(REWARD_URL,modifiedSig,KEY_ID);
    try {
      verifier.verify(modifiedUrl);
      fail("String_Node_Str");
    }
 catch (    GeneralSecurityException e) {
      System.out.println(e);
    }
  }
}
Program: 111255
Project: 111255
Buggy source:
@Test public void testShouldFailIfSignedMessageWasChanged() throws Exception {
  RewardedAdsVerifier verifier=new RewardedAdsVerifier.Builder().setVerifyingPublicKeys(GOOGLE_VERIFYING_PUBLIC_KEYS_JSON).build();
  byte[] validSignedUrl=signUrl(REWARD_URL,GOOGLE_SIGNING_PRIVATE_KEY_PKCS8_BASE64,KEY_ID).getBytes(UTF_8);
  for (int i=REWARD_HOST_AND_PATH.length(); i < REWARD_URL.length(); i++) {
    byte[] modifiedUrl=Arrays.copyOf(validSignedUrl,validSignedUrl.length);
    modifiedUrl[i]^=0xff;
    try {
      verifier.verify(new String(modifiedUrl,UTF_8));
      fail("String_Node_Str");
    }
 catch (    GeneralSecurityException e) {
      assertEquals("String_Node_Str",e.getMessage());
    }
  }
}

Fixed version (ground truth):
@Test public void testShouldFailIfSignedMessageWasChanged() throws Exception {
  RewardedAdsVerifier verifier=new RewardedAdsVerifier.Builder().setVerifyingPublicKeys(GOOGLE_VERIFYING_PUBLIC_KEYS_JSON).build();
  byte[] validSignedUrl=signUrl(REWARD_URL,GOOGLE_SIGNING_PRIVATE_KEY_PKCS8_BASE64,KEY_ID).getBytes(UTF_8);
  for (int i=REWARD_HOST_AND_PATH.length(); i < REWARD_URL.length(); i++) {
    byte[] modifiedUrl=Arrays.copyOf(validSignedUrl,validSignedUrl.length);
    modifiedUrl[i]=(byte)(modifiedUrl[i] ^ 0xff);
    try {
      verifier.verify(new String(modifiedUrl,UTF_8));
      fail("String_Node_Str");
    }
 catch (    GeneralSecurityException e) {
      assertEquals("String_Node_Str",e.getMessage());
    }
  }
}
Program: 111256
Project: 111256
Buggy source:
@Test public void testErrors() throws Exception {
  HybridDecryptCatalogue catalogue=new HybridDecryptCatalogue();
  String keyType="String_Node_Str";
  try {
    KeyManager<HybridDecrypt> manager=catalogue.getKeyManager(keyType,"String_Node_Str",0);
    fail("String_Node_Str");
  }
 catch (  GeneralSecurityException e) {
    assertThat(e.toString()).contains("String_Node_Str");
  }
  try {
    KeyManager<HybridDecrypt> manager=catalogue.getKeyManager(keyType,"String_Node_Str",1);
    fail("String_Node_Str");
  }
 catch (  GeneralSecurityException e) {
    assertThat(e.toString()).contains("String_Node_Str");
    assertThat(e.toString()).contains("String_Node_Str");
  }
  try {
    KeyManager<HybridDecrypt> manager=catalogue.getKeyManager("String_Node_Str","String_Node_Str",0);
    fail("String_Node_Str");
  }
 catch (  GeneralSecurityException e) {
    assertThat(e.toString()).contains("String_Node_Str");
    assertThat(e.toString()).contains("String_Node_Str");
  }
}

Fixed version (ground truth):
@Test public void testErrors() throws Exception {
  HybridDecryptCatalogue catalogue=new HybridDecryptCatalogue();
  String keyType="String_Node_Str";
  try {
    catalogue.getKeyManager(keyType,"String_Node_Str",0);
    fail("String_Node_Str");
  }
 catch (  GeneralSecurityException e) {
    assertThat(e.toString()).contains("String_Node_Str");
  }
  try {
    catalogue.getKeyManager(keyType,"String_Node_Str",1);
    fail("String_Node_Str");
  }
 catch (  GeneralSecurityException e) {
    assertThat(e.toString()).contains("String_Node_Str");
    assertThat(e.toString()).contains("String_Node_Str");
  }
  try {
    catalogue.getKeyManager("String_Node_Str","String_Node_Str",0);
    fail("String_Node_Str");
  }
 catch (  GeneralSecurityException e) {
    assertThat(e.toString()).contains("String_Node_Str");
    assertThat(e.toString()).contains("String_Node_Str");
  }
}
Program: 111257
Project: 111257
Buggy source:
@Test public void testBasic() throws Exception {
  HybridDecryptCatalogue catalogue=new HybridDecryptCatalogue();
  String keyType="String_Node_Str";
{
    KeyManager<HybridDecrypt> manager=catalogue.getKeyManager(keyType,"String_Node_Str",0);
    assertThat(manager.doesSupport(keyType)).isTrue();
  }
{
    KeyManager<HybridDecrypt> manager=catalogue.getKeyManager(keyType,"String_Node_Str",0);
    assertThat(manager.doesSupport(keyType)).isTrue();
  }
{
    KeyManager<HybridDecrypt> manager=catalogue.getKeyManager(keyType,"String_Node_Str",0);
    assertThat(manager.doesSupport(keyType)).isTrue();
  }
  RegistryConfig config=HybridConfig.TINK_1_0_0;
  int count=0;
  for (  KeyTypeEntry entry : config.getEntryList()) {
    if (entry.getPrimitiveName() == "String_Node_Str") {
      count=count + 1;
      KeyManager<HybridDecrypt> manager=catalogue.getKeyManager(entry.getTypeUrl(),"String_Node_Str",entry.getKeyManagerVersion());
      assertThat(manager.doesSupport(entry.getTypeUrl())).isTrue();
    }
  }
  assertEquals(1,count);
}

Fixed version (ground truth):
@Test public void testBasic() throws Exception {
  HybridDecryptCatalogue catalogue=new HybridDecryptCatalogue();
  String keyType="String_Node_Str";
{
    KeyManager<HybridDecrypt> manager=catalogue.getKeyManager(keyType,"String_Node_Str",0);
    assertThat(manager.doesSupport(keyType)).isTrue();
  }
{
    KeyManager<HybridDecrypt> manager=catalogue.getKeyManager(keyType,"String_Node_Str",0);
    assertThat(manager.doesSupport(keyType)).isTrue();
  }
{
    KeyManager<HybridDecrypt> manager=catalogue.getKeyManager(keyType,"String_Node_Str",0);
    assertThat(manager.doesSupport(keyType)).isTrue();
  }
  RegistryConfig config=HybridConfig.TINK_1_0_0;
  int count=0;
  for (  KeyTypeEntry entry : config.getEntryList()) {
    if ("String_Node_Str".equals(entry.getPrimitiveName())) {
      count=count + 1;
      KeyManager<HybridDecrypt> manager=catalogue.getKeyManager(entry.getTypeUrl(),"String_Node_Str",entry.getKeyManagerVersion());
      assertThat(manager.doesSupport(entry.getTypeUrl())).isTrue();
    }
  }
  assertEquals(1,count);
}
Program: 111258
Project: 111258
Buggy source:
@Test public void testErrors() throws Exception {
  PublicKeyVerifyCatalogue catalogue=new PublicKeyVerifyCatalogue();
  String keyType="String_Node_Str";
  try {
    KeyManager<PublicKeyVerify> manager=catalogue.getKeyManager(keyType,"String_Node_Str",0);
    fail("String_Node_Str");
  }
 catch (  GeneralSecurityException e) {
    assertThat(e.toString()).contains("String_Node_Str");
  }
  try {
    KeyManager<PublicKeyVerify> manager=catalogue.getKeyManager(keyType,"String_Node_Str",1);
    fail("String_Node_Str");
  }
 catch (  GeneralSecurityException e) {
    assertThat(e.toString()).contains("String_Node_Str");
    assertThat(e.toString()).contains("String_Node_Str");
  }
  try {
    KeyManager<PublicKeyVerify> manager=catalogue.getKeyManager("String_Node_Str","String_Node_Str",0);
    fail("String_Node_Str");
  }
 catch (  GeneralSecurityException e) {
    assertThat(e.toString()).contains("String_Node_Str");
    assertThat(e.toString()).contains("String_Node_Str");
  }
}

Fixed version (ground truth):
@Test public void testErrors() throws Exception {
  PublicKeyVerifyCatalogue catalogue=new PublicKeyVerifyCatalogue();
  String keyType="String_Node_Str";
  try {
    catalogue.getKeyManager(keyType,"String_Node_Str",0);
    fail("String_Node_Str");
  }
 catch (  GeneralSecurityException e) {
    assertThat(e.toString()).contains("String_Node_Str");
  }
  try {
    catalogue.getKeyManager(keyType,"String_Node_Str",1);
    fail("String_Node_Str");
  }
 catch (  GeneralSecurityException e) {
    assertThat(e.toString()).contains("String_Node_Str");
    assertThat(e.toString()).contains("String_Node_Str");
  }
  try {
    catalogue.getKeyManager("String_Node_Str","String_Node_Str",0);
    fail("String_Node_Str");
  }
 catch (  GeneralSecurityException e) {
    assertThat(e.toString()).contains("String_Node_Str");
    assertThat(e.toString()).contains("String_Node_Str");
  }
}
Program: 111259
Project: 111259
Buggy source:
@Test public void testBasic() throws Exception {
  PublicKeyVerifyCatalogue catalogue=new PublicKeyVerifyCatalogue();
  String keyType="String_Node_Str";
{
    KeyManager<PublicKeyVerify> manager=catalogue.getKeyManager(keyType,"String_Node_Str",0);
    assertThat(manager.doesSupport(keyType)).isTrue();
  }
{
    KeyManager<PublicKeyVerify> manager=catalogue.getKeyManager(keyType,"String_Node_Str",0);
    assertThat(manager.doesSupport(keyType)).isTrue();
  }
{
    KeyManager<PublicKeyVerify> manager=catalogue.getKeyManager(keyType,"String_Node_Str",0);
    assertThat(manager.doesSupport(keyType)).isTrue();
  }
  RegistryConfig config=SignatureConfig.TINK_1_0_0;
  int count=0;
  for (  KeyTypeEntry entry : config.getEntryList()) {
    if (entry.getPrimitiveName() == "String_Node_Str") {
      count=count + 1;
      KeyManager<PublicKeyVerify> manager=catalogue.getKeyManager(entry.getTypeUrl(),"String_Node_Str",entry.getKeyManagerVersion());
      assertThat(manager.doesSupport(entry.getTypeUrl())).isTrue();
    }
  }
  assertEquals(2,count);
}

Fixed version (ground truth):
@Test public void testBasic() throws Exception {
  PublicKeyVerifyCatalogue catalogue=new PublicKeyVerifyCatalogue();
  String keyType="String_Node_Str";
{
    KeyManager<PublicKeyVerify> manager=catalogue.getKeyManager(keyType,"String_Node_Str",0);
    assertThat(manager.doesSupport(keyType)).isTrue();
  }
{
    KeyManager<PublicKeyVerify> manager=catalogue.getKeyManager(keyType,"String_Node_Str",0);
    assertThat(manager.doesSupport(keyType)).isTrue();
  }
{
    KeyManager<PublicKeyVerify> manager=catalogue.getKeyManager(keyType,"String_Node_Str",0);
    assertThat(manager.doesSupport(keyType)).isTrue();
  }
  RegistryConfig config=SignatureConfig.TINK_1_0_0;
  int count=0;
  for (  KeyTypeEntry entry : config.getEntryList()) {
    if ("String_Node_Str".equals(entry.getPrimitiveName())) {
      count=count + 1;
      KeyManager<PublicKeyVerify> manager=catalogue.getKeyManager(entry.getTypeUrl(),"String_Node_Str",entry.getKeyManagerVersion());
      assertThat(manager.doesSupport(entry.getTypeUrl())).isTrue();
    }
  }
  assertEquals(2,count);
}
Program: 111260
Project: 111260
Buggy source:
@Test(expected=IllegalArgumentException.class) public void xorByteBufferLengthLargerThanFirstInput(){
  ByteBuffer output=ByteBuffer.allocate(10);
  ByteBuffer x=ByteBuffer.allocate(9);
  ByteBuffer y=ByteBuffer.allocate(10);
  Bytes.xor(output,x,y,10);
}

Fixed version (ground truth):
@Test public void xorByteBufferLengthLargerThanFirstInput(){
  ByteBuffer output=ByteBuffer.allocate(10);
  ByteBuffer x=ByteBuffer.allocate(9);
  ByteBuffer y=ByteBuffer.allocate(10);
  try {
    Bytes.xor(output,x,y,10);
    fail("String_Node_Str");
  }
 catch (  IllegalArgumentException ex) {
  }
}
Program: 111261
Project: 111261
Buggy source:
@Test(expected=IllegalArgumentException.class) public void xorByteBufferLengthLargerThanSecondInput(){
  ByteBuffer output=ByteBuffer.allocate(10);
  ByteBuffer x=ByteBuffer.allocate(10);
  ByteBuffer y=ByteBuffer.allocate(9);
  Bytes.xor(output,x,y,10);
}

Fixed version (ground truth):
@Test public void xorByteBufferLengthLargerThanSecondInput(){
  ByteBuffer output=ByteBuffer.allocate(10);
  ByteBuffer x=ByteBuffer.allocate(10);
  ByteBuffer y=ByteBuffer.allocate(9);
  try {
    Bytes.xor(output,x,y,10);
    fail("String_Node_Str");
  }
 catch (  IllegalArgumentException ex) {
  }
}
Program: 111262
Project: 111262
Buggy source:
@Test(expected=IllegalArgumentException.class) public void xorByteBufferLengthLargerThanOutput(){
  ByteBuffer output=ByteBuffer.allocate(9);
  ByteBuffer x=ByteBuffer.allocate(10);
  ByteBuffer y=ByteBuffer.allocate(10);
  Bytes.xor(output,x,y,10);
}

Fixed version (ground truth):
@Test public void xorByteBufferLengthLargerThanOutput(){
  ByteBuffer output=ByteBuffer.allocate(9);
  ByteBuffer x=ByteBuffer.allocate(10);
  ByteBuffer y=ByteBuffer.allocate(10);
  try {
    Bytes.xor(output,x,y,10);
    fail("String_Node_Str");
  }
 catch (  IllegalArgumentException ex) {
  }
}
Program: 111263
Project: 111263
Buggy source:
@Test(expected=IllegalArgumentException.class) public void xorByteBufferNegativeLength(){
  ByteBuffer output=ByteBuffer.allocate(10);
  ByteBuffer x=ByteBuffer.allocate(10);
  ByteBuffer y=ByteBuffer.allocate(10);
  Bytes.xor(output,x,y,-1);
}

Fixed version (ground truth):
@Test public void xorByteBufferNegativeLength(){
  ByteBuffer output=ByteBuffer.allocate(10);
  ByteBuffer x=ByteBuffer.allocate(10);
  ByteBuffer y=ByteBuffer.allocate(10);
  try {
    Bytes.xor(output,x,y,-1);
    fail("String_Node_Str");
  }
 catch (  IllegalArgumentException ex) {
  }
}
Program: 111265
Project: 111265
Buggy source:
/** 
 * Tests encryption and decryption functionalities using   {@code encryptionStreamingAead} forencryption and  {@code decryptionStreamingAead} for decryption on inputs {@code plaintext} and{@code aad}.
 */
public static void testEncryptionAndDecryption(StreamingAead encryptionStreamingAead,StreamingAead decryptionStreamingAead,byte[] plaintext,byte[] aad) throws Exception {
  ByteArrayOutputStream ciphertext=new ByteArrayOutputStream();
  WritableByteChannel encChannel=encryptionStreamingAead.newEncryptingChannel(Channels.newChannel(ciphertext),aad);
  encChannel.write(ByteBuffer.wrap(plaintext));
  encChannel.close();
{
    ByteBufferChannel ciphertextChannel=new ByteBufferChannel(ciphertext.toByteArray());
    ReadableByteChannel decChannel=decryptionStreamingAead.newDecryptingChannel(ciphertextChannel,aad);
    ByteBuffer decrypted=ByteBuffer.allocate(plaintext.length);
    int readCount=decChannel.read(decrypted);
    TestUtil.assertByteArrayEquals(plaintext,decrypted.array());
  }
{
    ByteBufferChannel ciphertextChannel=new ByteBufferChannel(ciphertext.toByteArray());
    SeekableByteChannel decChannel=decryptionStreamingAead.newSeekableDecryptingChannel(ciphertextChannel,aad);
    ByteBuffer decrypted=ByteBuffer.allocate(plaintext.length);
    int readCount=decChannel.read(decrypted);
    TestUtil.assertByteArrayEquals(plaintext,decrypted.array());
  }
}

Fixed version (ground truth):
/** 
 * Tests encryption and decryption functionalities using   {@code encryptionStreamingAead} forencryption and  {@code decryptionStreamingAead} for decryption on inputs {@code plaintext} and{@code aad}.
 */
public static void testEncryptionAndDecryption(StreamingAead encryptionStreamingAead,StreamingAead decryptionStreamingAead,byte[] plaintext,byte[] aad) throws Exception {
  ByteArrayOutputStream ciphertext=new ByteArrayOutputStream();
  WritableByteChannel encChannel=encryptionStreamingAead.newEncryptingChannel(Channels.newChannel(ciphertext),aad);
  encChannel.write(ByteBuffer.wrap(plaintext));
  encChannel.close();
{
    ByteBufferChannel ciphertextChannel=new ByteBufferChannel(ciphertext.toByteArray());
    ReadableByteChannel decChannel=decryptionStreamingAead.newDecryptingChannel(ciphertextChannel,aad);
    ByteBuffer decrypted=ByteBuffer.allocate(plaintext.length);
    int unused=decChannel.read(decrypted);
    TestUtil.assertByteArrayEquals(plaintext,decrypted.array());
  }
{
    ByteBufferChannel ciphertextChannel=new ByteBufferChannel(ciphertext.toByteArray());
    SeekableByteChannel decChannel=decryptionStreamingAead.newSeekableDecryptingChannel(ciphertextChannel,aad);
    ByteBuffer decrypted=ByteBuffer.allocate(plaintext.length);
    int unused=decChannel.read(decrypted);
    TestUtil.assertByteArrayEquals(plaintext,decrypted.array());
  }
}
Program: 111266
Project: 111266
Buggy source:
@Test public void testModifiedCiphertext() throws Exception {
  byte[] ikm=TestUtil.hexDecode("String_Node_Str");
  int keySize=16;
  int tagSize=12;
  int segmentSize=256;
  int offset=8;
  int plaintextSize=512;
  AesCtrHmacStreaming ags=new AesCtrHmacStreaming(ikm,keySize,tagSize,segmentSize,offset);
  StreamingTestUtil.testModifiedCiphertext(ags,segmentSize,offset);
}

Fixed version (ground truth):
@Test public void testModifiedCiphertext() throws Exception {
  byte[] ikm=TestUtil.hexDecode("String_Node_Str");
  int keySize=16;
  int tagSize=12;
  int segmentSize=256;
  int offset=8;
  AesCtrHmacStreaming ags=new AesCtrHmacStreaming(ikm,keySize,tagSize,segmentSize,offset);
  StreamingTestUtil.testModifiedCiphertext(ags,segmentSize,offset);
}
Program: 111267
Project: 111267
Buggy source:
public static KeyTypeEntry getTinkKeyTypeEntry(String catalogueName,String primitiveName,String keyProtoName,int keyManagerVersion,boolean newKeyAllowed){
  return KeyTypeEntry.newBuilder().setPrimitiveName(primitiveName).setTypeUrl("String_Node_Str" + keyProtoName).setKeyManagerVersion(keyManagerVersion).setNewKeyAllowed(newKeyAllowed).setCatalogueName(catalogueName).build();
}

Fixed version (ground truth):
/** 
 * Returns a   {@link KeyTypeEntry} for Tink key types with the specified properties.
 */
public static KeyTypeEntry getTinkKeyTypeEntry(String catalogueName,String primitiveName,String keyProtoName,int keyManagerVersion,boolean newKeyAllowed){
  return KeyTypeEntry.newBuilder().setPrimitiveName(primitiveName).setTypeUrl("String_Node_Str" + keyProtoName).setKeyManagerVersion(keyManagerVersion).setNewKeyAllowed(newKeyAllowed).setCatalogueName(catalogueName).build();
}
Program: 111268
Project: 111268
Buggy source:
/** 
 * Registers a key manager according to the specification in   {@code entry}.
 */
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) public static void registerKeyType(KeyTypeEntry entry) throws GeneralSecurityException {
  validate(entry);
  Catalogue catalogue=Registry.getCatalogue(entry.getCatalogueName());
  KeyManager keyManager=catalogue.getKeyManager(entry.getTypeUrl(),entry.getPrimitiveName(),entry.getKeyManagerVersion());
  Registry.registerKeyManager(entry.getTypeUrl(),keyManager,entry.getNewKeyAllowed());
}

Fixed version (ground truth):
/** 
 * Tries to register a key manager according to the specification in   {@code entry}.
 * @throws GeneralSecurityException if cannot register this config with the {@link Registry}. This usually happens when   {@code entry} is already registered or the Registry cannot findany  {@link com.google.crypto.tink.KeyManager} or {@link com.google.crypto.tink.Catalogue}that can handle the entry. In both cases the error message should show how to resolve it.
 */
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) public static void registerKeyType(KeyTypeEntry entry) throws GeneralSecurityException {
  validate(entry);
  Catalogue catalogue=Registry.getCatalogue(entry.getCatalogueName());
  KeyManager keyManager=catalogue.getKeyManager(entry.getTypeUrl(),entry.getPrimitiveName(),entry.getKeyManagerVersion());
  Registry.registerKeyManager(entry.getTypeUrl(),keyManager,entry.getNewKeyAllowed());
}
Program: 111269
Project: 111269
Buggy source:
/** 
 * Registers key managers according to the specification in   {@code config}.
 */
public static void register(RegistryConfig config) throws GeneralSecurityException {
  logger.info("String_Node_Str" + config.getConfigName() + "String_Node_Str");
  for (  KeyTypeEntry entry : config.getEntryList()) {
    registerKeyType(entry);
  }
  logger.info("String_Node_Str" + config.getConfigName() + "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Tries to register key managers according to the specification in   {@code config}.
 * @throws GeneralSecurityException if cannot register this config with the {@link Registry}. This usually happens when either   {@code config} contains any {@link KeyTypeEntry} that isalready registered or the Registry cannot find any  {@link com.google.crypto.tink.KeyManager}or   {@link com.google.crypto.tink.Catalogue} that can handle the entry. In both cases theerror message should show how to resolve it.
 */
public static void register(RegistryConfig config) throws GeneralSecurityException {
  for (  KeyTypeEntry entry : config.getEntryList()) {
    registerKeyType(entry);
  }
}
Program: 111270
Project: 111270
Buggy source:
private JsonKeysetReader(String input){
  this(new JSONObject(input));
}

Fixed version (ground truth):
private JsonKeysetReader(String input){
  try {
    json=new JSONObject(input);
  }
 catch (  JSONException e) {
    throw new IllegalArgumentException(e);
  }
}
Program: 111271
Project: 111271
Buggy source:
/** 
 * Resets the registry.  After reset the registry is empty, i.e. it contains no key managers. This method is intended for testing.
 */
public static synchronized void reset(){
  keyManagerMap.clear();
  newKeyAllowedMap.clear();
  catalogueMap.clear();
}

Fixed version (ground truth):
/** 
 * Resets the registry. <p>After reset the registry is empty, i.e. it contains no key managers. Thus one might need to call   {@code XyzConfig.init()} to re-install the catalogues.<p>This method is intended for testing.
 */
static synchronized void reset(){
  keyManagerMap.clear();
  newKeyAllowedMap.clear();
  catalogueMap.clear();
}
Program: 111272
Project: 111272
Buggy source:
/** 
 * Registers   {@code manager} for the given {@code typeUrl}. If   {@code newKeyAllowed} is true,users can generate new keys with this manager using the  {@link Registry#newKey} methods.<p>If there is an existing key manager, throw exception if  {@code manager} and the existingkey manager aren't instances of the same class, and do nothing if they are.
 * @throws IllegalArgumentException if {@code manager} is null.
 * @throws GeneralSecurityException if there's an existing key manager is not an instance ofthe same class as  {@code manager}.
 */
@SuppressWarnings("String_Node_Str") public static synchronized <P>void registerKeyManager(String typeUrl,final KeyManager<P> manager,boolean newKeyAllowed) throws GeneralSecurityException {
  if (manager == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (keyManagerMap.containsKey(typeUrl)) {
    KeyManager<P> existingManager=getKeyManager(typeUrl);
    boolean existingNewKeyAllowed=newKeyAllowedMap.get(typeUrl).booleanValue();
    if (!manager.getClass().equals(existingManager.getClass()) || (!existingNewKeyAllowed && newKeyAllowed)) {
      logger.warning("String_Node_Str" + typeUrl);
      throw new GeneralSecurityException(String.format("String_Node_Str",typeUrl,existingManager.getClass().getName(),manager.getClass().getName()));
    }
  }
  keyManagerMap.put(typeUrl,manager);
  newKeyAllowedMap.put(typeUrl,Boolean.valueOf(newKeyAllowed));
  logger.info("String_Node_Str" + manager.getClass().getName() + "String_Node_Str"+ typeUrl);
}

Fixed version (ground truth):
/** 
 * Registers   {@code manager} for the given {@code typeUrl}. If   {@code newKeyAllowed} is true,users can generate new keys with this manager using the  {@link Registry#newKey} methods.<p>If there is an existing key manager, throw exception if  {@code manager} and the existingkey manager aren't instances of the same class, and do nothing if they are.
 * @throws IllegalArgumentException if {@code manager} is null.
 * @throws GeneralSecurityException if there's an existing key manager is not an instance ofthe same class as  {@code manager}.
 */
@SuppressWarnings("String_Node_Str") public static synchronized <P>void registerKeyManager(String typeUrl,final KeyManager<P> manager,boolean newKeyAllowed) throws GeneralSecurityException {
  if (manager == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (keyManagerMap.containsKey(typeUrl)) {
    KeyManager<P> existingManager=getKeyManager(typeUrl);
    boolean existingNewKeyAllowed=newKeyAllowedMap.get(typeUrl).booleanValue();
    if (!manager.getClass().equals(existingManager.getClass()) || (!existingNewKeyAllowed && newKeyAllowed)) {
      logger.warning("String_Node_Str" + typeUrl);
      throw new GeneralSecurityException(String.format("String_Node_Str",typeUrl,existingManager.getClass().getName(),manager.getClass().getName()));
    }
  }
  keyManagerMap.put(typeUrl,manager);
  newKeyAllowedMap.put(typeUrl,Boolean.valueOf(newKeyAllowed));
}
Program: 111273
Project: 111273
Buggy source:
/** 
 * Registers   {@link Aead} catalogues with the {@link Registry}. <p>Because Aead key types depend on   {@link Mac} key types, this method alsoregisters all  {@link Mac} catalogues.
 */
public static void init() throws GeneralSecurityException {
  Registry.addCatalogue(CATALOGUE_NAME,new AeadCatalogue());
  MacConfig.init();
}

Fixed version (ground truth):
/** 
 * Tries to register with the   {@link Registry} all instances of{@link com.google.crypto.tink.Catalogue} needed to handle Aead key types supported in Tink.<p>Because Aead key types depend on  {@link com.google.crypto.tink.Mac} key types, this methodalso registers all Mac catalogues.
 */
public static void init() throws GeneralSecurityException {
  Registry.addCatalogue(CATALOGUE_NAME,new AeadCatalogue());
  MacConfig.init();
}
Program: 111274
Project: 111274
Buggy source:
/** 
 * Registers standard (for the current release) Aead key types and their managers with the   {@code Registry}. Deprecated-yet-still-supported key types are registered in so-called "no new key"-mode, which allows for usage of existing keys forbids generation of new key material.
 * @throws GeneralSecurityException
 * @deprecated
 */
@Deprecated public static void registerStandardKeyTypes() throws GeneralSecurityException {
  Config.register(TINK_1_0_0);
}

Fixed version (ground truth):
/** 
 * Registers with the   {@code Registry} all Aead key types released with the latest versionof Tink. Deprecated-yet-still-supported key types are registered in so-called "no new key"-mode, which allows for usage of existing keys forbids generation of new key material.
 * @deprecated
 */
@Deprecated public static void registerStandardKeyTypes() throws GeneralSecurityException {
  Config.register(TINK_1_0_0);
}
Program: 111275
Project: 111275
Buggy source:
/** 
 * Registers all catalogues with the   {@link Registry}.
 */
public static void init() throws GeneralSecurityException {
  HybridConfig.init();
  SignatureConfig.init();
}

Fixed version (ground truth):
/** 
 * Tries to register with the   {@link com.google.crypto.tink.Registry} all instances of{@link com.google.crypto.tink.Catalogue} needed to handle all key types supported in Tink.
 */
public static void init() throws GeneralSecurityException {
  HybridConfig.init();
  SignatureConfig.init();
}
Program: 111276
Project: 111276
Buggy source:
/** 
 * Registers all   {@link HybridEncrypt} and {@link HybridDecrypt} catalogues with the{@link Registry}. <p>Because hybrid key types depend on   {@link Aead} and {@link Mac} key types, this methodalso registers all  {@link Aead} and {@link Mac} catalogues.
 */
public static void init() throws GeneralSecurityException {
  Registry.addCatalogue(CATALOGUE_NAME,new HybridCatalogue());
  AeadConfig.init();
}

Fixed version (ground truth):
/** 
 * Tries to register with the   {@link Registry} all instances of{@link com.google.crypto.tink.Catalogue} needed to handle HybridDecrypt and HybridEncryptkey types supported in Tink. <p>Because HybridDecrypt and HybridEncrypt key types depend on {@link com.google.crypto.tink.Aead} and {@link com.google.crypto.tink.Mac} key types, thismethod also registers all Aead and Mac catalogues.
 */
public static void init() throws GeneralSecurityException {
  Registry.addCatalogue(CATALOGUE_NAME,new HybridCatalogue());
  AeadConfig.init();
}
Program: 111277
Project: 111277
Buggy source:
/** 
 * Registers all   {@link Mac} catalogues with the {@link Registry}.
 */
public static void init() throws GeneralSecurityException {
  Registry.addCatalogue(CATALOGUE_NAME,new MacCatalogue());
}

Fixed version (ground truth):
/** 
 * Tries to register with the   {@link Registry} all instances of{@link com.google.crypto.tink.Catalogue} needed to handle Mac key types supported in Tink.
 */
public static void init() throws GeneralSecurityException {
  Registry.addCatalogue(CATALOGUE_NAME,new MacCatalogue());
}
Program: 111278
Project: 111278
Buggy source:
/** 
 * Registers standard (for the current release) Mac key types and their managers with the   {@code Registry}. Deprecated-yet-still-supported key types are registered in so-called "no new key"-mode, which allows for usage of existing keys forbids generation of new key material.
 * @throws GeneralSecurityException
 * @deprecated
 */
@Deprecated public static void registerStandardKeyTypes() throws GeneralSecurityException {
  Config.register(TINK_1_0_0);
}

Fixed version (ground truth):
/** 
 * Registers with the   {@code Registry} all Mac key types released with the latestversion of Tink. Deprecated-yet-still-supported key types are registered in so-called "no new key"-mode, which allows for usage of existing keys forbids generation of new key material.
 * @deprecated
 */
@Deprecated public static void registerStandardKeyTypes() throws GeneralSecurityException {
  Config.register(TINK_1_0_0);
}
Program: 111279
Project: 111279
Buggy source:
/** 
 * Registers all   {@link PublicKeyVerify} and {@link PublicKeySign} catalogues with the{@link Registry}.
 */
public static void init() throws GeneralSecurityException {
  Registry.addCatalogue(CATALOGUE_NAME,new SignatureCatalogue());
}

Fixed version (ground truth):
/** 
 * Tries to register with the   {@link Registry} all instances of{@link com.google.crypto.tink.Catalogue} needed to handle PublicKeySign and PublicKeyVerifykey types supported in Tink.
 */
public static void init() throws GeneralSecurityException {
  Registry.addCatalogue(CATALOGUE_NAME,new SignatureCatalogue());
}
Program: 111280
Project: 111280
Buggy source:
/** 
 * @return a KeyManager for the given {@code typeUrl},   {@code primitiveName}, and version at least   {@code minVersion} (if it exists in the catalogue).
 */
@SuppressWarnings("String_Node_Str") public KeyManager getKeyManager(String typeUrl,String primitiveName,int minVersion) throws GeneralSecurityException ;

Fixed version (ground truth):
/** 
 * @return a {@link KeyManager} for the given {@code typeUrl},   {@code primitiveName}, and version at least   {@code minVersion} (if it exists in the catalogue).
 */
@SuppressWarnings("String_Node_Str") public KeyManager getKeyManager(String typeUrl,String primitiveName,int minVersion) throws GeneralSecurityException ;
Program: 111281
Project: 111281
Buggy source:
/** 
 * @return a new keyset handle from a keyset obtained from {@code reader}.
 * @throws GeneralSecurityException
 */
public static KeysetHandle read(KeysetReader reader) throws GeneralSecurityException, IOException {
  return KeysetHandle.fromKeyset(reader.read());
}

Fixed version (ground truth):
/** 
 * @return a new {@link KeysetHandle} from a keyset obtained from {@code reader}.
 * @throws GeneralSecurityException
 */
public static KeysetHandle read(KeysetReader reader) throws GeneralSecurityException, IOException {
  return KeysetHandle.fromKeyset(reader.read());
}
Program: 111282
Project: 111282
Buggy source:
/** 
 * @return a new keyset handle from {@code serialized} which is a serialized {@code Keyset}.
 * @throws GeneralSecurityException
 * @deprecated use {@link CleartextKeysetHandle#read} instead
 */
@Deprecated public static final KeysetHandle parseFrom(final byte[] serialized) throws GeneralSecurityException {
  try {
    Keyset keyset=Keyset.parseFrom(serialized);
    return KeysetHandle.fromKeyset(keyset);
  }
 catch (  InvalidProtocolBufferException e) {
    throw new GeneralSecurityException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * @return a new {@link KeysetHandle} from {@code serialized} that is a serialized {@link Keyset}
 * @throws GeneralSecurityException
 * @deprecated use {@link CleartextKeysetHandle#read} instead
 */
@Deprecated public static final KeysetHandle parseFrom(final byte[] serialized) throws GeneralSecurityException {
  try {
    Keyset keyset=Keyset.parseFrom(serialized);
    return KeysetHandle.fromKeyset(keyset);
  }
 catch (  InvalidProtocolBufferException e) {
    throw new GeneralSecurityException("String_Node_Str");
  }
}
Program: 111283
Project: 111283
Buggy source:
/** 
 * Serializes and writes the keyset to   {@code keysetWriter}.
 */
public static void write(KeysetHandle handle,KeysetWriter keysetWriter) throws IOException {
  keysetWriter.write(handle.getKeyset());
  return;
}

Fixed version (ground truth):
/** 
 * Serializes and writes the keyset managed by   {@code handle} to {@code keysetWriter}.
 * @throws IOException
 */
public static void write(KeysetHandle handle,KeysetWriter keysetWriter) throws IOException {
  keysetWriter.write(handle.getKeyset());
}
Program: 111284
Project: 111284
Buggy source:
/** 
 * Constructs an instance of P for the key given in   {@code key}.
 * @return the new constructed P.
 * @throws GeneralSecurityException if the key given in {@code key} is corruptedor not supported.
 */
P getPrimitive(MessageLite key) throws GeneralSecurityException ;

Fixed version (ground truth):
/** 
 * Constructs an instance of P for the key given in   {@code key}.
 * @return the new constructed P
 * @throws GeneralSecurityException if the key given in {@code key} is corruptedor not supported
 */
P getPrimitive(MessageLite key) throws GeneralSecurityException ;
Program: 111285
Project: 111285
Buggy source:
/** 
 * Generates a new key according to specification in   {@code keyFormat}.
 * @return the new generated key.
 * @throws GeneralSecurityException if the specified format is wrong or not supported.
 */
MessageLite newKey(MessageLite keyFormat) throws GeneralSecurityException ;

Fixed version (ground truth):
/** 
 * Generates a new key according to specification in   {@code keyFormat}.
 * @return the new generated key
 * @throws GeneralSecurityException if the specified format is wrong or not supported
 */
MessageLite newKey(MessageLite keyFormat) throws GeneralSecurityException ;
Program: 111286
Project: 111286
Buggy source:
/** 
 * Generates a new   {@code KeyData} according to specification in {@code serializedkeyFormat}. This should be used solely by the key management API.
 * @return the new generated key.
 * @throws GeneralSecurityException if the specified format is wrong or not supported.
 */
KeyData newKeyData(ByteString serializedKeyFormat) throws GeneralSecurityException ;

Fixed version (ground truth):
/** 
 * Generates a new   {@code KeyData} according to specification in {@code serializedkeyFormat}. <p>This should be used solely by   {@link KeysetManager}.
 * @return the new generated key
 * @throws GeneralSecurityException if the specified format is wrong or not supported
 */
KeyData newKeyData(ByteString serializedKeyFormat) throws GeneralSecurityException ;
Program: 111287
Project: 111287
Buggy source:
/** 
 * Creates keyset handles from an encrypted keyset obtained via   {@code reader}. Users that need to load cleartext keysets can use   {@code CleartextKeysetHandle}.
 * @return a new {@code KeysetHandle} from {@code encryptedKeysetProto} that was encryptedwith  {@code masterKey}.
 * @throws GeneralSecurityException
 */
public static final KeysetHandle read(KeysetReader reader,Aead masterKey) throws GeneralSecurityException, IOException {
  EncryptedKeyset encryptedKeyset=reader.readEncrypted();
  assertEnoughEncryptedKeyMaterial(encryptedKeyset);
  return new KeysetHandle(decrypt(encryptedKeyset,masterKey));
}

Fixed version (ground truth):
/** 
 * Tries to create a   {@link KeysetHandle} from an encrypted keyset obtained via {@code reader}. <p>Users that need to load cleartext keysets can use   {@link CleartextKeysetHandle}.
 * @return a new {@link KeysetHandle} from {@code encryptedKeysetProto} that was encryptedwith  {@code masterKey}
 * @throws GeneralSecurityException if cannot decrypt the keyset or it doesn't containencrypted key material
 */
public static final KeysetHandle read(KeysetReader reader,Aead masterKey) throws GeneralSecurityException, IOException {
  EncryptedKeyset encryptedKeyset=reader.readEncrypted();
  assertEnoughEncryptedKeyMaterial(encryptedKeyset);
  return new KeysetHandle(decrypt(encryptedKeyset,masterKey));
}
Program: 111288
Project: 111288
Buggy source:
/** 
 * @return a new {@code KeysetHandle} from a {@code keyset}.
 * @throws GeneralSecurityException
 */
static final KeysetHandle fromKeyset(Keyset keyset) throws GeneralSecurityException {
  assertEnoughKeyMaterial(keyset);
  return new KeysetHandle(keyset);
}

Fixed version (ground truth):
/** 
 * @return a new {@link KeysetHandle} from a {@code keyset}.
 * @throws GeneralSecurityException
 */
static final KeysetHandle fromKeyset(Keyset keyset) throws GeneralSecurityException {
  assertEnoughKeyMaterial(keyset);
  return new KeysetHandle(keyset);
}
Program: 111289
Project: 111289
Buggy source:
/** 
 * @return the {@code KeysetInfo} that doesn't contain actual key material.
 */
public KeysetInfo getKeysetInfo(){
  return Util.getKeysetInfo(keyset);
}

Fixed version (ground truth):
/** 
 * @return the {@link com.google.crypto.tink.proto.KeysetInfo} that doesn't contain actual keymaterial.
 */
public KeysetInfo getKeysetInfo(){
  return Util.getKeysetInfo(keyset);
}
Program: 111290
Project: 111290
Buggy source:
/** 
 * If the managed keyset contains private keys, returns a   {@code KeysetHandle}of the public keys.
 */
public KeysetHandle getPublicKeysetHandle() throws GeneralSecurityException {
  if (keyset == null) {
    throw new GeneralSecurityException("String_Node_Str");
  }
  Keyset.Builder keysetBuilder=Keyset.newBuilder();
  for (  Keyset.Key key : keyset.getKeyList()) {
    KeyData keyData=createPublicKeyData(key.getKeyData());
    keysetBuilder.addKey(Keyset.Key.newBuilder().mergeFrom(key).setKeyData(keyData).build());
  }
  keysetBuilder.setPrimaryKeyId(keyset.getPrimaryKeyId());
  return new KeysetHandle(keysetBuilder.build());
}

Fixed version (ground truth):
/** 
 * If the managed keyset contains private keys, returns a   {@link KeysetHandle}of the public keys.
 * @throws GenernalSecurityException if the managed keyset is null or if it contains anynon-private keys.
 */
public KeysetHandle getPublicKeysetHandle() throws GeneralSecurityException {
  if (keyset == null) {
    throw new GeneralSecurityException("String_Node_Str");
  }
  Keyset.Builder keysetBuilder=Keyset.newBuilder();
  for (  Keyset.Key key : keyset.getKeyList()) {
    KeyData keyData=createPublicKeyData(key.getKeyData());
    keysetBuilder.addKey(Keyset.Key.newBuilder().mergeFrom(key).setKeyData(keyData).build());
  }
  keysetBuilder.setPrimaryKeyId(keyset.getPrimaryKeyId());
  return new KeysetHandle(keysetBuilder.build());
}