我有一种方法,使用 InvalidParameterException()
类抛出无效参数异常。我在 GWT 客户端代码中使用了此类。当我运行这个方法时,我得到了这个异常
No source code is available for type java.security.InvalidParameterException; did you forget to inherit a required module?
我知道为什么会出现这个异常,因为我没有为此使用任何继承模块。但我的问题是我使用什么模块来运行我的程序?
我在下面的方法中使用了InvalidParameterException
public static List<Coordinate> getIntersectionPoints(Shape shape1, Shape shape2) {
if ((shape1 != null) && (shape2 != null)) {
if ((shape1 instanceof Line) && (shape2 instanceof Line)) {
return getIntersectionPoints((Line)shape1, (Line)shape2);
}
}
throw new InvalidParameterException();
}
如果我不对,那么我应该怎么做才能解决这个问题?
最佳答案
使用 InvalidParameterException 有什么具体原因吗?从代码示例来看,似乎如果任一形状为空,您就想抛出异常。我认为IllegalArgumentException最适合此类参数健全性检查。
关于java - java.security.InvalidParameterException 类型没有可用的源代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33296616/