[jboss-dev-forums] [Embedded JBoss Development] - Re: Embedded API Design Problems
richard.opalka@jboss.com
do-not-reply at jboss.com
Fri Dec 4 03:15:26 EST 2009
"jason.greene at jboss.com" wrote : I disagree with the server factory example in Rule 4. IllegalArgumentException is the appropriate exception to be thrown
|
Of course you're right Jason, the correct code should be:
package org.jboss.bootstrap.api.factory;
|
| public class ServerFactory
| {
| ...
| public static Server<?, ?> createServer(final String implClassName)
| throws IllegalArgumentException, InstantiationException; // this is WRONG, see RULE 4
|
| public static Server<?, ?> createServer(final String implClassName, final ClassLoader cl)
| throws IllegalArgumentException, InstantiationException // this is WRONG, see RULE 4
| ...
| }
|
| public class ServerFactory
| {
| ...
| public static Server<?, ?> createServer(final String implClassName) // this is CORRECT
| {
| ...
| catch (InstantiationException ie)
| {
| throws BootstrapException(ie);
| }
| ...
| }
|
| public static Server<?, ?> createServer(final String implClassName, final ClassLoader cl) // this is CORRECT
| {
| ...
| throw new IllegalArgumentException();
| ...
| }
| ...
| }
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4268935#4268935
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4268935
More information about the jboss-dev-forums
mailing list