in the while loop of getGoodProvinceCode() u didnt tell the while loop how to break if 'prov= "" '. Hence it continues running that loop which resulted into the stackoverflow error.
The solution...