java - The exception is thrown - and the code is executed further -
faced situation - in main method, child method called, checks object, , exception thrown in child method (one of objects in list null). code of main method still continues executed! example code: @transactional public boolean addcompany(list<company> companies, list<address> addresses) throws exception{ checkaddress(addresses); try{ for(int = 0; < companies.size(); i++){ if(findcompany(companies.get(i).getid()) == null && !isexistscompany(companies.get(i))){ companies.get(i).setaddress(addresses.get(i)); this.em.persist(companies.get(i)); } } }catch(exception e){ return false; } return true; } public void checkaddress(list<address> addresses) throws exception{ try{ if(addresses == null) throw new exception(thread.currentthread().getstacktrace()[2].getclassname() + "." + thread.currentthread().getstacktrace()[2].getmeth...