Java apps have most flaws, Cobol apps the least, study finds