简体   繁体   English

为什么KeyPairGenerator返回null? 为什么条件语句不起作用?

[英]Why does KeyPairGenerator return null? Why don't conditional statements work?

This is the flow of execution of my program in image form. 这是我的程序以图像形式执行的流程。 I think these images were the next best thing to a video to adequately describe my problem. 我认为这些图像是足以充分描述我的问题的视频的第二佳。

  1. Nothing unusual happening here. 这里没有异常发生。 Control is at the while loop and the keyPair is null. 控件处于while循环,并且keyPair为null。 KeyPair为空

  2. The keyPair is still null even though the keyPairGen object called generateKeyPair(). 即使keyPairGen对象称为generateKeyPair(),keyPair仍为null。 进入while循环

  3. The for loop was just another test to see if i could initialize the keyPair object. for循环只是另一个测试,以查看是否可以初始化keyPair对象。 进入for循环以继续初始化keyPair

  4. Somehow, even though the keyPair is null, it is able to enter an if statement where the condition is specifically for the keyPair NOT being null. 以某种方式,即使keyPair为null,它也可以输入if语句,其中条件专门针对keyPair不为null。 不知何故,即使keyPair为null,也不为空

  5. Control goes back to the while loop after executing the break statement, which it shouldn't have. 执行break语句后,控制权返回while循环,这本不应该具有。 控制返回到while循环

  6. Even though the keyPair was null, the conditional statement in the while loop does not hold and control moves past the while loop, and the keyPair object is still null. 即使keyPair为null,while循环中的条件语句也不成立,并且控件移过while循环,并且keyPair对象仍然为null。 即使keyPair仍然为null,控制也会转到执行的下一行

Why doesn't keyPair get initialized? 为什么keyPair无法初始化? I created a sandbox application and used the same code as in the images, and the keyPair object in my sandbox application is initialized. 我创建了一个沙箱应用程序,并使用了与图像中相同的代码,并且沙箱应用程序中的keyPair对象已初始化。

Why do the conditional statements fail? 为什么条件语句失败?

Note: I checked on another user's computer after he updated his working copy from svn, and he seemed to have the same problem as i did. 注意:在他从svn更新了他的工作副本后,我检查了另一个用户的计算机,他似乎和我有同样的问题。 We are using eclipse, java ee, jdk 7. 我们正在使用eclipse,java ee,jdk 7。

It is possible that eclipse may be giving you wrong information. 日食可能会给您错误的信息。 However, trust the code - the conditional statements don't just fail. 但是,请相信代码-条件语句不仅会失败。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM