Archive

Archive for December 15, 2009

InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty

December 15, 2009 Leave a comment

Problem Statement: Getting exception while trying to connecting remote https system.

Caused by: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
	at java.security.cert.PKIXParameters.setTrustAnchors(PKIXParameters.java:183)
	at java.security.cert.PKIXParameters.<init>(PKIXParameters.java:103)
	at java.security.cert.PKIXBuilderParameters.<init>(PKIXBuilderParameters.java:87)
	at sun.security.validator.PKIXValidator.<init>(PKIXValidator.java:57)
	... 28 common frames omitted

Solution: System is not getting keystore from relative path.
Provide absolutepath and keystore name. It should be resolved.

//System.setProperty("javax.net.ssl.trustStore", relativePath+key_name); //Not working

System.setProperty("javax.net.ssl.trustStore", absolutePath+key_name); //Working

-o-

Log4j Performance debate – isDebugEnabled()

December 15, 2009 Leave a comment

Problem statement: Do we need to use isDebugEnabled() ?

Short answer: It is better to use.

1. In log4j we need to use.
2. In SLF4J we need to use parametrized debug statements.

For more information read
http://www.slf4j.org/faq.html#logging_performance

-o-

Code coverage – pitfalls

December 15, 2009 Leave a comment

Problem Statement: Code coverage 100%. There are x number of bugs. What happened?

Code coverage 100% doesn’t mean that test coverage 100%.
Sample code

public int add(int a, int b)
{
   return a+b;
}

we can have simple unit test case and it can show 100% code coverage.
But it is not talking about business.
i.e It should support float, double and other data types.
Boundary checks..etc

We need to make sure that we have all unit test cases according to business requirements.
Code coverage 100%, doesn’t mean that code is bug free.
-o-

Follow

Get every new post delivered to your Inbox.