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:

 1) "After the bandit makes a ranged attack"

OR

 2) "When the bandit makes a ranged attack"

In which case the action would trigger after the attack has resolved in situation 1. While for situation 2, the action would trigger before the bandit has released the javelin, thereby making the object an invalid target for the spell

Grey zone trigger
=
Alternately, you might accept the trigger to be "After the bandit makes a ranged attack, but before the attack resolves", however here we might enter a grey-zone as this allow you to set triggers against any ranged (and perhaps melee) attacks, this could be exploited in many combat situations -> e.g. readying spells to disrupt enemies from fulfilling their attack action or use spells to put team mates out of harms way.