Sebi
Sebi

Reputation: 4532

Setting breakpoints in .class files Intellij

I'm trying to debug the code mentioned in this question, more specifically, the last line in the following code:

        // client credentials
        KeyStore keyStore = null;

        keyStore = KeyStore.getInstance("PKCS12", "BC");
        keyStore.load(null, null);
        keyStore.setKeyEntry(CryptographyUtils.CLIENT_NAME, endCredential.getPrivateKey(), CryptographyUtils.CLIENT_PASSWORD,
                new Certificate[]{endCredential.getCertificate(), interCredential.getCertificate(), rootCredential.getCertificate()});
        keyStore.store(new FileOutputStream(CryptographyUtils.CLIENT_NAME + ".p12"), CryptographyUtils.CLIENT_PASSWORD);

Going to the declaration of .store() (using Ctrl + B) opens a file KeyStore.java:

public final void store(OutputStream stream, char[] password)
        throws KeyStoreException, IOException, NoSuchAlgorithmException,
            CertificateException
    {
        if (!initialized) {
            throw new KeyStoreException("Uninitialized keystore");
        }
        keyStoreSpi.engineStore(stream, password);
    }

The last call .engineStore() actually writes the certificates to an output stream. Going to the implementation of the method (Ctrl + Alt + B) the following options are shown:

store keys

The package imported containing the method in my code is from:

import java.security.KeyStore;

I have put a breakpoint in KeyStore.java and it is reached. However, breakpoints placed in decompiled .class files such as those shown in the picture are not.

How may I debug the .engineStore() method?

Upvotes: 4

Views: 7283

Answers (1)

RockAndRoll
RockAndRoll

Reputation: 2287

You need to attach source files if you want to debug that.You cant debug .class files.

See this post to understand how you can add source code to the library configuration.

Upvotes: 2

Related Questions