0
votes

I have one method where I used InvalidParameterException() class to throw the invalid parameter exception. I am used this class from GWT client side code. When I ran this method then I got this exception

No source code is available for type java.security.InvalidParameterException; did you forget to inherit a required module?

I know why this exception is coming because I did not used any inherits module for that. But my question is that what module I used for this to run my program?

I used InvalidParameterException from this below method

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();
  }

If I am not right then what should I do to solve this issue?

1
It looks like 'java.security.InvalidParameterException' is not part of the JRE Emulation in GWT. gwtproject.org/doc/latest/RefJreEmulation.html - El Hoss
@ElHoss That means InvalidParameterException will not support from GWT client side? - Shiladittya Chakraborty
Regarding the JRE Emulation doc, I would say yes. - El Hoss

1 Answers

1
votes

Is there any specific reason for using InvalidParameterException? From the code sample, it seems that if either shape is null, you want to throw exception. I think IllegalArgumentException is best suited for such parameter sanity checks.