package com.square.pie.ui.setting.help.a; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.nio.charset.StandardCharsets; import java.util.regex.Matcher; import java.util.regex.Pattern; /* compiled from: IPUtil */ public class b { public static String a() { HttpURLConnection httpURLConnection; Throwable th; MalformedURLException e; IOException e2; String str = ""; InputStream inputStream = null; try { httpURLConnection = (HttpURLConnection) new URL("http://pv.sohu.com/cityjson?ie=utf-8").openConnection(); try { if (httpURLConnection.getResponseCode() == 200) { inputStream = httpURLConnection.getInputStream(); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); StringBuilder sb = new StringBuilder(); while (true) { String readLine = bufferedReader.readLine(); if (readLine == null) { break; } sb.append(readLine + "\n"); } Matcher matcher = Pattern.compile("((?:(?:25[0-5]|2[0-4]\\d|((1\\d{2})|([1-9]?\\d)))\\.){3}(?:25[0-5]|2[0-4]\\d|((1\\d{2})|([1-9]?\\d))))").matcher(sb.toString()); if (matcher.find()) { str = matcher.group(); } } try { inputStream.close(); httpURLConnection.disconnect(); } catch (IOException e3) { e3.printStackTrace(); } catch (Exception e4) { e4.printStackTrace(); } } catch (MalformedURLException e5) { e = e5; e.printStackTrace(); inputStream.close(); httpURLConnection.disconnect(); return str; } catch (IOException e6) { e2 = e6; try { e2.printStackTrace(); inputStream.close(); httpURLConnection.disconnect(); return str; } catch (Throwable th2) { th = th2; try { inputStream.close(); httpURLConnection.disconnect(); } catch (IOException e7) { e7.printStackTrace(); } catch (Exception e8) { e8.printStackTrace(); } throw th; } } } catch (MalformedURLException e9) { e = e9; httpURLConnection = null; e.printStackTrace(); inputStream.close(); httpURLConnection.disconnect(); return str; } catch (IOException e10) { e2 = e10; httpURLConnection = null; e2.printStackTrace(); inputStream.close(); httpURLConnection.disconnect(); return str; } catch (Throwable th3) { th = th3; httpURLConnection = null; inputStream.close(); httpURLConnection.disconnect(); throw th; } return str; } }