MD5 校验值:7cd346351ab05a28e42aff65173e0141
s.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package d9; import android.graphics.drawable.Drawable; import android.text.TextUtils; import android.util.Log; import java.io.BufferedOutputStream; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.Closeable; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; import java.net.UnknownHostException; import java.util.Map; import org.osmdroid.tileprovider.modules.CantContinueException; import org.osmdroid.tileprovider.tilesource.BitmapTileSourceBase; public class s { public long a(String str, String str2, long j10) { Long r9 = z8.a.a().r(); if (r9 != null) { return j10 + r9.longValue(); } long p9 = z8.a.a().p(); Long c10 = c(str2); if (c10 != null) { return j10 + (c10.longValue() * 1000) + p9; } Long d10 = d(str); return d10 != null ? d10.longValue() + p9 : j10 + 604800000 + p9; } public Drawable b(long j10, int i10, String str, f fVar, e9.c cVar) { Throwable th; InputStream inputStream; ByteArrayInputStream byteArrayInputStream; ByteArrayInputStream byteArrayInputStream2; HttpURLConnection httpURLConnection; ByteArrayInputStream byteArrayInputStream3; BitmapTileSourceBase.LowMemoryException lowMemoryException; Closeable closeable; Closeable closeable2; IOException iOException; InputStream inputStream2; ByteArrayInputStream byteArrayInputStream4; ByteArrayInputStream byteArrayInputStream5; UnknownHostException unknownHostException; InputStream inputStream3; ByteArrayInputStream byteArrayInputStream6; ByteArrayInputStream byteArrayInputStream7; FileNotFoundException fileNotFoundException; InputStream inputStream4; ByteArrayInputStream byteArrayInputStream8; ByteArrayInputStream byteArrayInputStream9; Throwable th2; Closeable closeable3; Closeable closeable4; ?? r12; InputStream inputStream5; ByteArrayInputStream byteArrayInputStream10; InputStream inputStream6; ByteArrayInputStream byteArrayInputStream11; InputStream inputStream7; ByteArrayInputStream byteArrayInputStream12; InputStream inputStream8; ByteArrayInputStream byteArrayInputStream13; ByteArrayInputStream byteArrayInputStream14; ByteArrayInputStream byteArrayInputStream15; ByteArrayInputStream byteArrayInputStream16; ByteArrayInputStream byteArrayInputStream17; ByteArrayInputStream byteArrayInputStream18; InputStream inputStream9; ByteArrayInputStream byteArrayInputStream19; InputStream inputStream10; ByteArrayInputStream byteArrayInputStream20; InputStream inputStream11; ByteArrayInputStream byteArrayInputStream21; InputStream inputStream12; ?? r22; ?? r32; ?? r13 = i10; ?? r23 = str; ?? r33 = "https://"; Object obj = null; if (r13 > 3) { return null; } String w9 = cVar.m().e() ? z8.a.a().w() : null; if (w9 == null) { w9 = z8.a.a().D(); } if (!cVar.m().c(w9)) { Log.e("OsmDroid", "Please configure a relevant user agent; current value is: " + w9); return null; } try { try { if (z8.a.a().c()) { Log.d("OsmDroid", "Downloading Maptile from url: " + r23); } if (!TextUtils.isEmpty(str)) { if (z8.a.a().y() != null) { httpURLConnection = (HttpURLConnection) new URL(r23).openConnection(z8.a.a().y()); } else { httpURLConnection = (HttpURLConnection) new URL(r23).openConnection(); } try { httpURLConnection.setUseCaches(true); httpURLConnection.setRequestProperty(z8.a.a().v(), w9); for (Map.Entry<String, String> entry : z8.a.a().s().entrySet()) { httpURLConnection.setRequestProperty(entry.getKey(), entry.getValue()); } httpURLConnection.connect(); if (httpURLConnection.getResponseCode() != 200) { int responseCode = httpURLConnection.getResponseCode(); if ((responseCode == 301 || responseCode == 302 || responseCode == 307 || responseCode == 308) && z8.a.a().x()) { String headerField = httpURLConnection.getHeaderField("Location"); if (headerField != null) { if (headerField.startsWith("/")) { URL url = new URL(r23); int port = url.getPort(); boolean startsWith = str.toLowerCase().startsWith("https://"); if (port == -1) { port = str.toLowerCase().startsWith("http://") ? 80 : 443; } StringBuilder sb = new StringBuilder(); sb.append(startsWith ? r33 : "http"); sb.append(url.getHost()); sb.append(":"); sb.append(port); sb.append(headerField); headerField = sb.toString(); } Log.i("OsmDroid", "Http redirect for MapTile: " + g9.m.h(j10) + " HTTP response: " + httpURLConnection.getResponseMessage() + " to url " + headerField); Drawable b10 = b(j10, r13 + 1, headerField, fVar, cVar); f9.f.a(null); f9.f.a(null); f9.f.a(null); f9.f.a(null); try { httpURLConnection.disconnect(); } catch (Exception unused) { } return b10; } } else { Log.w("OsmDroid", "Problem downloading MapTile: " + g9.m.h(j10) + " HTTP response: " + httpURLConnection.getResponseMessage()); if (z8.a.a().C()) { Log.d("OsmDroid", r23); } f9.b.f8450b++; f9.f.a(httpURLConnection.getErrorStream()); f9.f.a(null); f9.f.a(null); f9.f.a(null); try { httpURLConnection.disconnect(); } catch (Exception unused2) { } return null; } } String headerField2 = httpURLConnection.getHeaderField("Content-Type"); if (z8.a.a().C()) { Log.d("OsmDroid", r23 + " success, mime is " + headerField2); } if (headerField2 != null && !headerField2.toLowerCase().contains("image")) { Log.w("OsmDroid", r23 + " success, however the mime type does not appear to be an image " + headerField2); } InputStream inputStream13 = httpURLConnection.getInputStream(); try { r22 = new ByteArrayOutputStream(); } catch (FileNotFoundException e10) { fileNotFoundException = e10; byteArrayInputStream13 = null; inputStream8 = inputStream13; byteArrayInputStream17 = byteArrayInputStream13; inputStream12 = inputStream8; byteArrayInputStream21 = byteArrayInputStream13; byteArrayInputStream3 = byteArrayInputStream17; inputStream4 = inputStream12; byteArrayInputStream8 = byteArrayInputStream21; byteArrayInputStream9 = byteArrayInputStream17; f9.b.f8450b++; Log.w("OsmDroid", "Tile not found: " + g9.m.h(j10) + " : " + fileNotFoundException); r13 = inputStream4; r23 = byteArrayInputStream8; r33 = byteArrayInputStream9; f9.f.a(r13); f9.f.a(r33); f9.f.a(byteArrayInputStream3); f9.f.a(r23); try { httpURLConnection.disconnect(); } catch (Exception unused3) { } return null; } catch (UnknownHostException e11) { unknownHostException = e11; byteArrayInputStream12 = null; inputStream7 = inputStream13; byteArrayInputStream16 = byteArrayInputStream12; inputStream11 = inputStream7; byteArrayInputStream20 = byteArrayInputStream12; byteArrayInputStream3 = byteArrayInputStream16; inputStream3 = inputStream11; byteArrayInputStream6 = byteArrayInputStream20; byteArrayInputStream7 = byteArrayInputStream16; Log.w("OsmDroid", "UnknownHostException downloading MapTile: " + g9.m.h(j10) + " : " + unknownHostException); f9.b.f8450b = f9.b.f8450b + 1; r13 = inputStream3; r23 = byteArrayInputStream6; r33 = byteArrayInputStream7; f9.f.a(r13); f9.f.a(r33); f9.f.a(byteArrayInputStream3); f9.f.a(r23); httpURLConnection.disconnect(); return null; } catch (IOException e12) { iOException = e12; byteArrayInputStream11 = null; inputStream6 = inputStream13; byteArrayInputStream15 = byteArrayInputStream11; inputStream10 = inputStream6; byteArrayInputStream19 = byteArrayInputStream11; byteArrayInputStream3 = byteArrayInputStream15; inputStream2 = inputStream10; byteArrayInputStream4 = byteArrayInputStream19; byteArrayInputStream5 = byteArrayInputStream15; f9.b.f8450b++; Log.w("OsmDroid", "IOException downloading MapTile: " + g9.m.h(j10) + " : " + iOException); r13 = inputStream2; r23 = byteArrayInputStream4; r33 = byteArrayInputStream5; f9.f.a(r13); f9.f.a(r33); f9.f.a(byteArrayInputStream3); f9.f.a(r23); httpURLConnection.disconnect(); return null; } catch (BitmapTileSourceBase.LowMemoryException e13) { e = e13; r22 = 0; r32 = 0; } catch (Throwable th3) { th = th3; byteArrayInputStream10 = null; inputStream5 = inputStream13; byteArrayInputStream14 = byteArrayInputStream10; inputStream9 = inputStream5; byteArrayInputStream18 = byteArrayInputStream10; byteArrayInputStream3 = byteArrayInputStream14; inputStream = inputStream9; byteArrayInputStream = byteArrayInputStream18; byteArrayInputStream2 = byteArrayInputStream14; f9.b.f8450b++; Log.e("OsmDroid", "Error downloading MapTile: " + g9.m.h(j10), th); r13 = inputStream; r23 = byteArrayInputStream; r33 = byteArrayInputStream2; f9.f.a(r13); f9.f.a(r33); f9.f.a(byteArrayInputStream3); f9.f.a(r23); httpURLConnection.disconnect(); return null; } try { r32 = new BufferedOutputStream(r22, 8192); try { try { long a10 = a(httpURLConnection.getHeaderField("Expires"), httpURLConnection.getHeaderField("Cache-Control"), System.currentTimeMillis()); f9.f.b(inputStream13, r32); r32.flush(); byteArrayInputStream3 = new ByteArrayInputStream(r22.toByteArray()); if (fVar != 0) { try { fVar.b(cVar, j10, byteArrayInputStream3, Long.valueOf(a10)); byteArrayInputStream3.reset(); } catch (FileNotFoundException e14) { fileNotFoundException = e14; inputStream4 = inputStream13; byteArrayInputStream8 = r22; byteArrayInputStream9 = r32; f9.b.f8450b++; Log.w("OsmDroid", "Tile not found: " + g9.m.h(j10) + " : " + fileNotFoundException); r13 = inputStream4; r23 = byteArrayInputStream8; r33 = byteArrayInputStream9; f9.f.a(r13); f9.f.a(r33); f9.f.a(byteArrayInputStream3); f9.f.a(r23); httpURLConnection.disconnect(); return null; } catch (UnknownHostException e15) { unknownHostException = e15; inputStream3 = inputStream13; byteArrayInputStream6 = r22; byteArrayInputStream7 = r32; Log.w("OsmDroid", "UnknownHostException downloading MapTile: " + g9.m.h(j10) + " : " + unknownHostException); f9.b.f8450b = f9.b.f8450b + 1; r13 = inputStream3; r23 = byteArrayInputStream6; r33 = byteArrayInputStream7; f9.f.a(r13); f9.f.a(r33); f9.f.a(byteArrayInputStream3); f9.f.a(r23); httpURLConnection.disconnect(); return null; } catch (IOException e16) { iOException = e16; inputStream2 = inputStream13; byteArrayInputStream4 = r22; byteArrayInputStream5 = r32; f9.b.f8450b++; Log.w("OsmDroid", "IOException downloading MapTile: " + g9.m.h(j10) + " : " + iOException); r13 = inputStream2; r23 = byteArrayInputStream4; r33 = byteArrayInputStream5; f9.f.a(r13); f9.f.a(r33); f9.f.a(byteArrayInputStream3); f9.f.a(r23); httpURLConnection.disconnect(); return null; } catch (BitmapTileSourceBase.LowMemoryException e17) { e = e17; obj = inputStream13; lowMemoryException = e; closeable = r22; closeable2 = r32; try { f9.b.f8449a++; Log.w("OsmDroid", "LowMemoryException downloading MapTile: " + g9.m.h(j10) + " : " + lowMemoryException); throw new CantContinueException(lowMemoryException); } catch (Throwable th4) { th2 = th4; r12 = obj; closeable4 = closeable; closeable3 = closeable2; f9.f.a(r12); f9.f.a(closeable3); f9.f.a(byteArrayInputStream3); f9.f.a(closeable4); try { httpURLConnection.disconnect(); throw th2; } catch (Exception unused4) { throw th2; } } } catch (Throwable th5) { th = th5; inputStream = inputStream13; byteArrayInputStream = r22; byteArrayInputStream2 = r32; f9.b.f8450b++; Log.e("OsmDroid", "Error downloading MapTile: " + g9.m.h(j10), th); r13 = inputStream; r23 = byteArrayInputStream; r33 = byteArrayInputStream2; f9.f.a(r13); f9.f.a(r33); f9.f.a(byteArrayInputStream3); f9.f.a(r23); httpURLConnection.disconnect(); return null; } } Drawable e18 = cVar.e(byteArrayInputStream3); f9.f.a(inputStream13); f9.f.a(r32); f9.f.a(byteArrayInputStream3); f9.f.a(r22); try { httpURLConnection.disconnect(); } catch (Exception unused5) { } return e18; } catch (FileNotFoundException e19) { e = e19; fileNotFoundException = e; byteArrayInputStream3 = null; inputStream4 = inputStream13; byteArrayInputStream8 = r22; byteArrayInputStream9 = r32; f9.b.f8450b++; Log.w("OsmDroid", "Tile not found: " + g9.m.h(j10) + " : " + fileNotFoundException); r13 = inputStream4; r23 = byteArrayInputStream8; r33 = byteArrayInputStream9; f9.f.a(r13); f9.f.a(r33); f9.f.a(byteArrayInputStream3); f9.f.a(r23); httpURLConnection.disconnect(); return null; } catch (UnknownHostException e20) { e = e20; unknownHostException = e; byteArrayInputStream3 = null; inputStream3 = inputStream13; byteArrayInputStream6 = r22; byteArrayInputStream7 = r32; Log.w("OsmDroid", "UnknownHostException downloading MapTile: " + g9.m.h(j10) + " : " + unknownHostException); f9.b.f8450b = f9.b.f8450b + 1; r13 = inputStream3; r23 = byteArrayInputStream6; r33 = byteArrayInputStream7; f9.f.a(r13); f9.f.a(r33); f9.f.a(byteArrayInputStream3); f9.f.a(r23); httpURLConnection.disconnect(); return null; } catch (IOException e21) { e = e21; iOException = e; byteArrayInputStream3 = null; inputStream2 = inputStream13; byteArrayInputStream4 = r22; byteArrayInputStream5 = r32; f9.b.f8450b++; Log.w("OsmDroid", "IOException downloading MapTile: " + g9.m.h(j10) + " : " + iOException); r13 = inputStream2; r23 = byteArrayInputStream4; r33 = byteArrayInputStream5; f9.f.a(r13); f9.f.a(r33); f9.f.a(byteArrayInputStream3); f9.f.a(r23); httpURLConnection.disconnect(); return null; } catch (BitmapTileSourceBase.LowMemoryException e22) { e = e22; byteArrayInputStream3 = null; obj = inputStream13; lowMemoryException = e; closeable = r22; closeable2 = r32; f9.b.f8449a++; Log.w("OsmDroid", "LowMemoryException downloading MapTile: " + g9.m.h(j10) + " : " + lowMemoryException); throw new CantContinueException(lowMemoryException); } catch (Throwable th6) { th = th6; th = th; byteArrayInputStream3 = null; inputStream = inputStream13; byteArrayInputStream = r22; byteArrayInputStream2 = r32; f9.b.f8450b++; Log.e("OsmDroid", "Error downloading MapTile: " + g9.m.h(j10), th); r13 = inputStream; r23 = byteArrayInputStream; r33 = byteArrayInputStream2; f9.f.a(r13); f9.f.a(r33); f9.f.a(byteArrayInputStream3); f9.f.a(r23); httpURLConnection.disconnect(); return null; } } catch (FileNotFoundException e23) { e = e23; } catch (UnknownHostException e24) { e = e24; } catch (IOException e25) { e = e25; } catch (BitmapTileSourceBase.LowMemoryException e26) { e = e26; } catch (Throwable th7) { th = th7; } } catch (FileNotFoundException e27) { fileNotFoundException = e27; byteArrayInputStream17 = null; inputStream12 = inputStream13; byteArrayInputStream21 = r22; byteArrayInputStream3 = byteArrayInputStream17; inputStream4 = inputStream12; byteArrayInputStream8 = byteArrayInputStream21; byteArrayInputStream9 = byteArrayInputStream17; f9.b.f8450b++; Log.w("OsmDroid", "Tile not found: " + g9.m.h(j10) + " : " + fileNotFoundException); r13 = inputStream4; r23 = byteArrayInputStream8; r33 = byteArrayInputStream9; f9.f.a(r13); f9.f.a(r33); f9.f.a(byteArrayInputStream3); f9.f.a(r23); httpURLConnection.disconnect(); return null; } catch (UnknownHostException e28) { unknownHostException = e28; byteArrayInputStream16 = null; inputStream11 = inputStream13; byteArrayInputStream20 = r22; byteArrayInputStream3 = byteArrayInputStream16; inputStream3 = inputStream11; byteArrayInputStream6 = byteArrayInputStream20; byteArrayInputStream7 = byteArrayInputStream16; Log.w("OsmDroid", "UnknownHostException downloading MapTile: " + g9.m.h(j10) + " : " + unknownHostException); f9.b.f8450b = f9.b.f8450b + 1; r13 = inputStream3; r23 = byteArrayInputStream6; r33 = byteArrayInputStream7; f9.f.a(r13); f9.f.a(r33); f9.f.a(byteArrayInputStream3); f9.f.a(r23); httpURLConnection.disconnect(); return null; } catch (IOException e29) { iOException = e29; byteArrayInputStream15 = null; inputStream10 = inputStream13; byteArrayInputStream19 = r22; byteArrayInputStream3 = byteArrayInputStream15; inputStream2 = inputStream10; byteArrayInputStream4 = byteArrayInputStream19; byteArrayInputStream5 = byteArrayInputStream15; f9.b.f8450b++; Log.w("OsmDroid", "IOException downloading MapTile: " + g9.m.h(j10) + " : " + iOException); r13 = inputStream2; r23 = byteArrayInputStream4; r33 = byteArrayInputStream5; f9.f.a(r13); f9.f.a(r33); f9.f.a(byteArrayInputStream3); f9.f.a(r23); httpURLConnection.disconnect(); return null; } catch (BitmapTileSourceBase.LowMemoryException e30) { e = e30; r32 = 0; r22 = r22; byteArrayInputStream3 = r32; obj = inputStream13; lowMemoryException = e; closeable = r22; closeable2 = r32; f9.b.f8449a++; Log.w("OsmDroid", "LowMemoryException downloading MapTile: " + g9.m.h(j10) + " : " + lowMemoryException); throw new CantContinueException(lowMemoryException); } catch (Throwable th8) { th = th8; byteArrayInputStream14 = null; inputStream9 = inputStream13; byteArrayInputStream18 = r22; byteArrayInputStream3 = byteArrayInputStream14; inputStream = inputStream9; byteArrayInputStream = byteArrayInputStream18; byteArrayInputStream2 = byteArrayInputStream14; f9.b.f8450b++; Log.e("OsmDroid", "Error downloading MapTile: " + g9.m.h(j10), th); r13 = inputStream; r23 = byteArrayInputStream; r33 = byteArrayInputStream2; f9.f.a(r13); f9.f.a(r33); f9.f.a(byteArrayInputStream3); f9.f.a(r23); httpURLConnection.disconnect(); return null; } } catch (FileNotFoundException e31) { fileNotFoundException = e31; inputStream8 = null; byteArrayInputStream13 = null; } catch (UnknownHostException e32) { unknownHostException = e32; inputStream7 = null; byteArrayInputStream12 = null; } catch (IOException e33) { iOException = e33; inputStream6 = null; byteArrayInputStream11 = null; } catch (BitmapTileSourceBase.LowMemoryException e34) { lowMemoryException = e34; closeable = null; closeable2 = null; byteArrayInputStream3 = null; } catch (Throwable th9) { th = th9; inputStream5 = null; byteArrayInputStream10 = null; } } else { f9.f.a(null); f9.f.a(null); f9.f.a(null); f9.f.a(null); try { throw null; } catch (Exception unused6) { return null; } } } catch (Throwable th10) { th2 = th10; r12 = r13; closeable4 = r23; closeable3 = r33; f9.f.a(r12); f9.f.a(closeable3); f9.f.a(byteArrayInputStream3); f9.f.a(closeable4); httpURLConnection.disconnect(); throw th2; } } catch (FileNotFoundException e35) { fileNotFoundException = e35; inputStream4 = null; byteArrayInputStream8 = null; byteArrayInputStream9 = null; httpURLConnection = null; byteArrayInputStream3 = null; } catch (UnknownHostException e36) { unknownHostException = e36; inputStream3 = null; byteArrayInputStream6 = null; byteArrayInputStream7 = null; httpURLConnection = null; byteArrayInputStream3 = null; } catch (IOException e37) { iOException = e37; inputStream2 = null; byteArrayInputStream4 = null; byteArrayInputStream5 = null; httpURLConnection = null; byteArrayInputStream3 = null; } catch (BitmapTileSourceBase.LowMemoryException e38) { lowMemoryException = e38; closeable = null; closeable2 = null; httpURLConnection = null; byteArrayInputStream3 = null; } catch (Throwable th11) { th = th11; inputStream = null; byteArrayInputStream = null; byteArrayInputStream2 = null; httpURLConnection = null; byteArrayInputStream3 = null; } } public Long c(String str) { if (str == null || str.length() <= 0) { return null; } try { for (String str2 : str.split(", ")) { if (str2.indexOf("max-age=") == 0) { return Long.valueOf(str2.substring(8)); } } return null; } catch (Exception e10) { if (!z8.a.a().C()) { return null; } Log.d("OsmDroid", "Unable to parse cache control tag for tile, server returned " + str, e10); return null; } } public Long d(String str) { if (str == null || str.length() <= 0) { return null; } try { return Long.valueOf(z8.a.a().t().parse(str).getTime()); } catch (Exception e10) { if (!z8.a.a().C()) { return null; } Log.d("OsmDroid", "Unable to parse expiration tag for tile, server returned " + str, e10); return null; } } }