File-By-File
NullPointException

NullPointException

This exception is thrown whenever an operation is requested to be performed on a PointXY or PointXYZ object that is null. It helps prevent NullPointerExceptions and provides more specific error messages related to point objects.

If you keep getting this exception, consider using the PointXY.zeroIfNull(PointXY) or PointXYZ.zeroIfNull(PointXYZ) methods. These methods ensure that any point you pass is never null; if the point would have been null, the method will return a zero point instead.

This exception is typically caused by an odometry subsystem reporting a null value. Regardless of the cause, these exceptions are widely known as being "not very cool" and "kind of lame," so you should definitely fix them.

Methods

NullPointException(String s)

Constructs a new NullPointException with the specified detail message.

  • s: The detail message (a String) explaining the reason for the exception.

throwIfInvalid(String message, PointXY point)

Static method that throws a NullPointException if the provided point is null.

  • message: The message to be used for the exception if it is thrown.
  • point: The PointXY object to validate for nullity.