Hi,
I was using the core-spi project and ran into a NullPointerException because I passed a null into a method. Reading the JavaDoc for the method, it did not say that I was not allowed to pass a null into the method. The case that I ran into of the ContextFactoryExtensionPoint.addFactory(Object factory) method. The JavaDoc says: /** * Add a context factory extension. * * @param factory The factory to add */ The problem is that it does not provide any details of what happens if a null value is passed in for the factory parameter. What actually happens in the code is that it throws a NullPointerException. As the core-spi is a public API, we should be very clear to the developers that use it what will happen. My question is how should we handle this? The JavaDoc should be updated to include information about what will happen if a null is passed in. The question is - what should the Tuscany code do? Options include: 1) Do an if check and throw an IllegalArgumentException. 2) Don't do anything else - just document it in the JavaDoc. If the user is "stupid" enough to pass null into a method that should not be passed a null then they deserve what they get. 3) Use Java Asserts. When things start going wrong, enable Asserts and the error will be spotted. Since it is an Assert, it has no cost a runtime if Asserts are off. Personally, I would update the JavaDoc and do option 1 - throw IllegalArgumentException. I'm interested in what other people think and if there is a current policy for handling this kind of error in Tuscany? Assuming that people are in general agreement with doing option 1, I will update the core-spi accordingly. Thanks, Mark