Fixes #1743. Fixes IndexOutOfBoundsException on Java warning with no position

Enbugged in #1702.
The d.getPosition, d.getStartPosition uses -1 as NOPOS value, but they
weren’t being checked.
Added checkNoPos.
Merge pull request #1744 from eed3si9n/fix/1743

Fixes #1743. Fixes IndexOutOfBoundsException on Java warning with no position
fix typo