Finite-size effects in a bosonic Josephson junction