No - the trigger is not valid
I have thought of this myself exactly! However I came to the conclusion that it could NOT, here's my reasoning:
"Releases the next javelin" is not a valid trigger in the combat situation - it should rather be:
- "After the bandit makes a ranged attack"
OR
- "When the bandit makes a ranged attack"
For situation 1, the action would trigger after the attack has been resolved.
While for situation 2, the action would trigger just before the bandit has released the javelin, thereby making the object an invalid target for the spell.