Search code examples
exceptionjava-metry-catchbouncycastle

J2ME bouncycastle incompatible types required: Throwable found DataLengthException


I have some code with bouncycastle that generates an exception, but even if i surround with try catch, the catch statement still give me this error :

  incompatible types
  required: java.lang.Throwable
  found:    org.bouncycastle.crypto.DataLengthException

here is my code:

int decryptedLength;
try {
      decryptedLength = cipher.processBytes(cipherBytes, 0, cipherBytes.length,     decryptedBytes, 0);
    } catch (DataLengthException ex) {
    }

the catch statement doesn't accept the exception, how to solve this ?


Solution

  • I changed the project name and there are no more errors. I am using Netbeans (7.3). I hope this will help someone to avoid losing hours looking for a solution to a problem which doesn't exist.