InvalidKeySpecException y = new InvalidKeySpecException(); y.initCause(x); throw y;
throw new InvalidKeySpecException(x.getMessage(), x);
  protected PrivateKey engineGeneratePrivate(KeySpec keySpec)      throws InvalidKeySpecException  {    if (keySpec instanceof DSAPrivateKeySpec)      {        DSAPrivateKeySpec spec = (DSAPrivateKeySpec) keySpec;        BigInteger p = spec.getP();        BigInteger q = spec.getQ();        BigInteger g = spec.getG();        BigInteger x = spec.getX();        return new DSSPrivateKey(Registry.PKCS8_ENCODING_ID, p, q, g, x);      }    if (keySpec instanceof PKCS8EncodedKeySpec)      {        PKCS8EncodedKeySpec spec = (PKCS8EncodedKeySpec) keySpec;        byte[] encoded = spec.getEncoded();        PrivateKey result;        try          {            result = new DSSKeyPairPKCS8Codec().decodePrivateKey(encoded);            return result;          }        catch (RuntimeException x)          {            InvalidKeySpecException y = new InvalidKeySpecException();            y.initCause(x);            throw y;          }      }    throw new InvalidKeySpecException("Unsupported (private) key specification");  }