コード例 #1
0
 private KitInfo loadKitInfo(ZipEntry paramZipEntry, ZipFile paramZipFile) {
   Object localObject1 = null;
   ZipFile localZipFile = null;
   try {
     paramZipFile = paramZipFile.getInputStream(paramZipEntry);
     localZipFile = paramZipFile;
     localObject1 = paramZipFile;
     localObject3 = new Properties();
     localZipFile = paramZipFile;
     localObject1 = paramZipFile;
     ((Properties) localObject3).load(paramZipFile);
     localZipFile = paramZipFile;
     localObject1 = paramZipFile;
     localObject2 = ((Properties) localObject3).getProperty("fabric-identifier");
     localZipFile = paramZipFile;
     localObject1 = paramZipFile;
     str = ((Properties) localObject3).getProperty("fabric-version");
     localZipFile = paramZipFile;
     localObject1 = paramZipFile;
     localObject3 = ((Properties) localObject3).getProperty("fabric-build-type");
     localZipFile = paramZipFile;
     localObject1 = paramZipFile;
     if (!TextUtils.isEmpty((CharSequence) localObject2)) {
       localZipFile = paramZipFile;
       localObject1 = paramZipFile;
       if (!TextUtils.isEmpty(str)) {}
     } else {
       localZipFile = paramZipFile;
       localObject1 = paramZipFile;
       throw new IllegalStateException("Invalid format of fabric file," + paramZipEntry.getName());
     }
   } catch (IOException paramZipFile) {
     Object localObject3;
     String str;
     localObject1 = localZipFile;
     Fabric.getLogger()
         .e(
             "Fabric",
             "Error when parsing fabric properties " + paramZipEntry.getName(),
             paramZipFile);
     CommonUtils.closeQuietly(localZipFile);
     return null;
     localZipFile = paramZipFile;
     localObject1 = paramZipFile;
     Object localObject2 = new KitInfo((String) localObject2, str, (String) localObject3);
     CommonUtils.closeQuietly(paramZipFile);
     return (KitInfo) localObject2;
   } finally {
     CommonUtils.closeQuietly((Closeable) localObject1);
   }
 }
コード例 #2
0
 @Test
 public void testDeserialization() throws IOException {
   JsonReader reader = null;
   try {
     reader =
         new JsonReader(
             new InputStreamReader(testResources.getAsStream("model_tweetentities.json")));
     final TweetEntities tweetEntities = gson.fromJson(reader, TweetEntities.class);
     // We simply assert that we parsed it successfully and rely on our other unit tests to
     // verify parsing of the individual objects.
     assertEquals(EXPECTED_URLS_SIZE, tweetEntities.urls.size());
     assertEquals(EXPECTED_USER_MENTIONS_SIZE, tweetEntities.userMentions.size());
     assertEquals(EXPECTED_MEDIA_SIZE, tweetEntities.media.size());
     assertEquals(EXPECTED_HASHTAGS_SIZE, tweetEntities.hashtags.size());
   } finally {
     CommonUtils.closeQuietly(reader);
   }
 }
コード例 #3
0
 private void setupCallbackWrapperTest(
     String responseStr, Callback<OAuthResponse> authResponseCallback) throws IOException {
   final Callback<Response> callbackWrapper = service.getCallbackWrapper(authResponseCallback);
   final TypedInput mockValue = mock(TypedInput.class);
   final Response mockResponse =
       new Response(
           "url",
           HttpURLConnection.HTTP_OK,
           "reason",
           new ArrayList<retrofit.client.Header>(),
           mockValue);
   InputStream inputStream = null;
   try {
     inputStream = new ByteArrayInputStream(responseStr.getBytes("UTF-8"));
     when(mockValue.in()).thenReturn(inputStream);
     callbackWrapper.success(new Result<>(mockResponse, mockResponse));
   } finally {
     CommonUtils.closeQuietly(inputStream);
   }
 }