设置断点的IntelliJ

问题描述:

我试图调试this问题中提及的代码,更具体地说,在下面的代码的最后一行:设置断点的IntelliJ

 // 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); 

.store的声明( )(用Ctrl + B)打开一个文件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); 
    } 

最后调用.engineStore()实际上将证书写入输出流。要该方法(Ctrl + Alt + B)的执行下列选项中示出:

store keys

封装导入含有在我的代码的方法是从:

import java.security.KeyStore; 

我有在KeyStore.java放置一个断点,它已达到。但是,放置在反编译的.class文件中的断点(如图中所示的断点)不是。

我该如何调试.engineStore()方法?

+1

当然,不是你在找什么:但是如果重点是调试某种方法;并在该方法内的断点不工作;为什么不在调用该方法的行上放置一个断点;然后做一些“步入”? – GhostCat

+0

我尝试着步入,并强行进入。许多类正在实现容器,比如向量和列表,这些都是你不可避免地加入的。在代码中很容易“迷失”,并且忽略了你正在调试的范围。 – Sebi

如果您想要调试,则需要附加source files。您无法调试.class文件。

See this post了解如何将源代码添加到库配置中。

+0

我该怎么做? – Sebi

+0

下载该jar的源代码并添加。 –

+0

编辑了答案。 –