How are you so sure that the pos is positive (not -1 to indicate that this was not found), and that the result is at least 25 characters long. This will definitely through exceptions if no network info is available... 
Moreover, there is a dedicated library for network info as described in http://stackoverflow.com/questions/212528/get-the-ip-address-of-the-machine.