#vulnerable code 
                              public static Credentials getCredentialFromPrivateKeyServiceAccount(
      String serviceAccountEmail, String privateKeyFile, List<String> scopes)
      throws IOException, GeneralSecurityException {

    PrivateKey privateKey =
        SecurityUtils.loadPrivateKeyFromKeyStore(
            SecurityUtils.getPkcs12KeyStore(),
            new FileInputStream(privateKeyFile),
            "notasecret",
            "privatekey",
            "notasecret");

    // Since the user specified scopes, we can't use JWT tokens
    return ServiceAccountCredentials.newBuilder()
        .setClientEmail(serviceAccountEmail)
        .setPrivateKey(privateKey)
        .setScopes(scopes)
        .setHttpTransportFactory(getHttpTransportFactory())
        .build();
  } 
                            #location 18 
                            #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code
                              public static Credentials getCredentialFromPrivateKeyServiceAccount(
      String serviceAccountEmail, String privateKeyFile, List<String> scopes)
      throws IOException, GeneralSecurityException {

    PrivateKey privateKey =
        SecurityUtils.loadPrivateKeyFromKeyStore(
            SecurityUtils.getPkcs12KeyStore(),
            new FileInputStream(privateKeyFile),
            "notasecret",
            "privatekey",
            "notasecret");

    // Since the user specified scopes, we can't use JWT tokens
    return patchCredentials(
        ServiceAccountCredentials.newBuilder()
            .setClientEmail(serviceAccountEmail)
            .setPrivateKey(privateKey)
            .setScopes(scopes)
            .setHttpTransportFactory(getHttpTransportFactory())
            .build());
  }