MetaDataStore.java
14.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
package com.crashlytics.android.core;
import java.io.File;
import java.nio.charset.Charset;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;
class MetaDataStore
{
private static final String KEYDATA_SUFFIX = "keys";
private static final String KEY_USER_EMAIL = "userEmail";
private static final String KEY_USER_ID = "userId";
private static final String KEY_USER_NAME = "userName";
private static final String METADATA_EXT = ".meta";
private static final String USERDATA_SUFFIX = "user";
private static final Charset UTF_8 = Charset.forName("UTF-8");
private final File filesDir;
public MetaDataStore(File paramFile)
{
this.filesDir = paramFile;
}
private File getKeysFileForSession(String paramString)
{
return new File(this.filesDir, paramString + "keys.meta");
}
private File getUserDataFileForSession(String paramString)
{
return new File(this.filesDir, paramString + "user.meta");
}
private static Map<String, String> jsonToKeysData(String paramString)
throws JSONException
{
paramString = new JSONObject(paramString);
HashMap localHashMap = new HashMap();
Iterator localIterator = paramString.keys();
while (localIterator.hasNext())
{
String str = (String)localIterator.next();
localHashMap.put(str, valueOrNull(paramString, str));
}
return localHashMap;
}
private static UserMetaData jsonToUserData(String paramString)
throws JSONException
{
paramString = new JSONObject(paramString);
return new UserMetaData(valueOrNull(paramString, "userId"), valueOrNull(paramString, "userName"), valueOrNull(paramString, "userEmail"));
}
private static String keysDataToJson(Map<String, String> paramMap)
throws JSONException
{
return new JSONObject(paramMap).toString();
}
private static String userDataToJson(UserMetaData paramUserMetaData)
throws JSONException
{
new JSONObject() {}.toString();
}
private static String valueOrNull(JSONObject paramJSONObject, String paramString)
{
String str = null;
if (!paramJSONObject.isNull(paramString)) {
str = paramJSONObject.optString(paramString, null);
}
return str;
}
/* Error */
public Map<String, String> readKeyData(String paramString)
{
// Byte code:
// 0: aload_0
// 1: aload_1
// 2: invokespecial 144 com/crashlytics/android/core/MetaDataStore:getKeysFileForSession (Ljava/lang/String;)Ljava/io/File;
// 5: astore_1
// 6: aload_1
// 7: invokevirtual 147 java/io/File:exists ()Z
// 10: ifne +7 -> 17
// 13: invokestatic 153 java/util/Collections:emptyMap ()Ljava/util/Map;
// 16: areturn
// 17: new 155 java/io/FileInputStream
// 20: dup
// 21: aload_1
// 22: invokespecial 157 java/io/FileInputStream:<init> (Ljava/io/File;)V
// 25: astore_2
// 26: aload_2
// 27: astore_1
// 28: aload_2
// 29: invokestatic 163 io/fabric/sdk/android/services/common/CommonUtils:streamToString (Ljava/io/InputStream;)Ljava/lang/String;
// 32: invokestatic 165 com/crashlytics/android/core/MetaDataStore:jsonToKeysData (Ljava/lang/String;)Ljava/util/Map;
// 35: astore_3
// 36: aload_2
// 37: ldc -89
// 39: invokestatic 171 io/fabric/sdk/android/services/common/CommonUtils:closeOrLog (Ljava/io/Closeable;Ljava/lang/String;)V
// 42: aload_3
// 43: areturn
// 44: astore_3
// 45: aconst_null
// 46: astore_2
// 47: aload_2
// 48: astore_1
// 49: invokestatic 177 io/fabric/sdk/android/Fabric:getLogger ()Lio/fabric/sdk/android/Logger;
// 52: ldc -77
// 54: ldc -75
// 56: aload_3
// 57: invokeinterface 187 4 0
// 62: aload_2
// 63: ldc -89
// 65: invokestatic 171 io/fabric/sdk/android/services/common/CommonUtils:closeOrLog (Ljava/io/Closeable;Ljava/lang/String;)V
// 68: invokestatic 153 java/util/Collections:emptyMap ()Ljava/util/Map;
// 71: areturn
// 72: astore_2
// 73: aconst_null
// 74: astore_1
// 75: aload_1
// 76: ldc -89
// 78: invokestatic 171 io/fabric/sdk/android/services/common/CommonUtils:closeOrLog (Ljava/io/Closeable;Ljava/lang/String;)V
// 81: aload_2
// 82: athrow
// 83: astore_2
// 84: goto -9 -> 75
// 87: astore_3
// 88: goto -41 -> 47
// Local variable table:
// start length slot name signature
// 0 91 0 this MetaDataStore
// 0 91 1 paramString String
// 25 38 2 localFileInputStream java.io.FileInputStream
// 72 10 2 localObject1 Object
// 83 1 2 localObject2 Object
// 35 8 3 localMap Map
// 44 13 3 localException1 Exception
// 87 1 3 localException2 Exception
// Exception table:
// from to target type
// 17 26 44 java/lang/Exception
// 17 26 72 finally
// 28 36 83 finally
// 49 62 83 finally
// 28 36 87 java/lang/Exception
}
/* Error */
public UserMetaData readUserData(String paramString)
{
// Byte code:
// 0: aload_0
// 1: aload_1
// 2: invokespecial 190 com/crashlytics/android/core/MetaDataStore:getUserDataFileForSession (Ljava/lang/String;)Ljava/io/File;
// 5: astore_1
// 6: aload_1
// 7: invokevirtual 147 java/io/File:exists ()Z
// 10: ifne +7 -> 17
// 13: getstatic 194 com/crashlytics/android/core/UserMetaData:EMPTY Lcom/crashlytics/android/core/UserMetaData;
// 16: areturn
// 17: new 155 java/io/FileInputStream
// 20: dup
// 21: aload_1
// 22: invokespecial 157 java/io/FileInputStream:<init> (Ljava/io/File;)V
// 25: astore_2
// 26: aload_2
// 27: astore_1
// 28: aload_2
// 29: invokestatic 163 io/fabric/sdk/android/services/common/CommonUtils:streamToString (Ljava/io/InputStream;)Ljava/lang/String;
// 32: invokestatic 196 com/crashlytics/android/core/MetaDataStore:jsonToUserData (Ljava/lang/String;)Lcom/crashlytics/android/core/UserMetaData;
// 35: astore_3
// 36: aload_2
// 37: ldc -89
// 39: invokestatic 171 io/fabric/sdk/android/services/common/CommonUtils:closeOrLog (Ljava/io/Closeable;Ljava/lang/String;)V
// 42: aload_3
// 43: areturn
// 44: astore_3
// 45: aconst_null
// 46: astore_2
// 47: aload_2
// 48: astore_1
// 49: invokestatic 177 io/fabric/sdk/android/Fabric:getLogger ()Lio/fabric/sdk/android/Logger;
// 52: ldc -77
// 54: ldc -75
// 56: aload_3
// 57: invokeinterface 187 4 0
// 62: aload_2
// 63: ldc -89
// 65: invokestatic 171 io/fabric/sdk/android/services/common/CommonUtils:closeOrLog (Ljava/io/Closeable;Ljava/lang/String;)V
// 68: getstatic 194 com/crashlytics/android/core/UserMetaData:EMPTY Lcom/crashlytics/android/core/UserMetaData;
// 71: areturn
// 72: astore_2
// 73: aconst_null
// 74: astore_1
// 75: aload_1
// 76: ldc -89
// 78: invokestatic 171 io/fabric/sdk/android/services/common/CommonUtils:closeOrLog (Ljava/io/Closeable;Ljava/lang/String;)V
// 81: aload_2
// 82: athrow
// 83: astore_2
// 84: goto -9 -> 75
// 87: astore_3
// 88: goto -41 -> 47
// Local variable table:
// start length slot name signature
// 0 91 0 this MetaDataStore
// 0 91 1 paramString String
// 25 38 2 localFileInputStream java.io.FileInputStream
// 72 10 2 localObject1 Object
// 83 1 2 localObject2 Object
// 35 8 3 localUserMetaData UserMetaData
// 44 13 3 localException1 Exception
// 87 1 3 localException2 Exception
// Exception table:
// from to target type
// 17 26 44 java/lang/Exception
// 17 26 72 finally
// 28 36 83 finally
// 49 62 83 finally
// 28 36 87 java/lang/Exception
}
/* Error */
public void writeKeyData(String paramString, Map<String, String> paramMap)
{
// Byte code:
// 0: aload_0
// 1: aload_1
// 2: invokespecial 144 com/crashlytics/android/core/MetaDataStore:getKeysFileForSession (Ljava/lang/String;)Ljava/io/File;
// 5: astore 4
// 7: aconst_null
// 8: astore_1
// 9: aload_2
// 10: invokestatic 200 com/crashlytics/android/core/MetaDataStore:keysDataToJson (Ljava/util/Map;)Ljava/lang/String;
// 13: astore_3
// 14: new 202 java/io/BufferedWriter
// 17: dup
// 18: new 204 java/io/OutputStreamWriter
// 21: dup
// 22: new 206 java/io/FileOutputStream
// 25: dup
// 26: aload 4
// 28: invokespecial 207 java/io/FileOutputStream:<init> (Ljava/io/File;)V
// 31: getstatic 41 com/crashlytics/android/core/MetaDataStore:UTF_8 Ljava/nio/charset/Charset;
// 34: invokespecial 210 java/io/OutputStreamWriter:<init> (Ljava/io/OutputStream;Ljava/nio/charset/Charset;)V
// 37: invokespecial 213 java/io/BufferedWriter:<init> (Ljava/io/Writer;)V
// 40: astore_2
// 41: aload_2
// 42: astore_1
// 43: aload_2
// 44: aload_3
// 45: invokevirtual 218 java/io/Writer:write (Ljava/lang/String;)V
// 48: aload_2
// 49: astore_1
// 50: aload_2
// 51: invokevirtual 221 java/io/Writer:flush ()V
// 54: aload_2
// 55: ldc -33
// 57: invokestatic 171 io/fabric/sdk/android/services/common/CommonUtils:closeOrLog (Ljava/io/Closeable;Ljava/lang/String;)V
// 60: return
// 61: astore_3
// 62: aconst_null
// 63: astore_2
// 64: aload_2
// 65: astore_1
// 66: invokestatic 177 io/fabric/sdk/android/Fabric:getLogger ()Lio/fabric/sdk/android/Logger;
// 69: ldc -77
// 71: ldc -31
// 73: aload_3
// 74: invokeinterface 187 4 0
// 79: aload_2
// 80: ldc -33
// 82: invokestatic 171 io/fabric/sdk/android/services/common/CommonUtils:closeOrLog (Ljava/io/Closeable;Ljava/lang/String;)V
// 85: return
// 86: astore_3
// 87: aload_1
// 88: astore_2
// 89: aload_3
// 90: astore_1
// 91: aload_2
// 92: ldc -33
// 94: invokestatic 171 io/fabric/sdk/android/services/common/CommonUtils:closeOrLog (Ljava/io/Closeable;Ljava/lang/String;)V
// 97: aload_1
// 98: athrow
// 99: astore_3
// 100: aload_1
// 101: astore_2
// 102: aload_3
// 103: astore_1
// 104: goto -13 -> 91
// 107: astore_3
// 108: goto -44 -> 64
// Local variable table:
// start length slot name signature
// 0 111 0 this MetaDataStore
// 0 111 1 paramString String
// 0 111 2 paramMap Map<String, String>
// 13 32 3 str String
// 61 13 3 localException1 Exception
// 86 4 3 localObject1 Object
// 99 4 3 localObject2 Object
// 107 1 3 localException2 Exception
// 5 22 4 localFile File
// Exception table:
// from to target type
// 9 41 61 java/lang/Exception
// 9 41 86 finally
// 43 48 99 finally
// 50 54 99 finally
// 66 79 99 finally
// 43 48 107 java/lang/Exception
// 50 54 107 java/lang/Exception
}
/* Error */
public void writeUserData(String paramString, UserMetaData paramUserMetaData)
{
// Byte code:
// 0: aload_0
// 1: aload_1
// 2: invokespecial 190 com/crashlytics/android/core/MetaDataStore:getUserDataFileForSession (Ljava/lang/String;)Ljava/io/File;
// 5: astore 4
// 7: aconst_null
// 8: astore_1
// 9: aload_2
// 10: invokestatic 230 com/crashlytics/android/core/MetaDataStore:userDataToJson (Lcom/crashlytics/android/core/UserMetaData;)Ljava/lang/String;
// 13: astore_3
// 14: new 202 java/io/BufferedWriter
// 17: dup
// 18: new 204 java/io/OutputStreamWriter
// 21: dup
// 22: new 206 java/io/FileOutputStream
// 25: dup
// 26: aload 4
// 28: invokespecial 207 java/io/FileOutputStream:<init> (Ljava/io/File;)V
// 31: getstatic 41 com/crashlytics/android/core/MetaDataStore:UTF_8 Ljava/nio/charset/Charset;
// 34: invokespecial 210 java/io/OutputStreamWriter:<init> (Ljava/io/OutputStream;Ljava/nio/charset/Charset;)V
// 37: invokespecial 213 java/io/BufferedWriter:<init> (Ljava/io/Writer;)V
// 40: astore_2
// 41: aload_2
// 42: astore_1
// 43: aload_2
// 44: aload_3
// 45: invokevirtual 218 java/io/Writer:write (Ljava/lang/String;)V
// 48: aload_2
// 49: astore_1
// 50: aload_2
// 51: invokevirtual 221 java/io/Writer:flush ()V
// 54: aload_2
// 55: ldc -89
// 57: invokestatic 171 io/fabric/sdk/android/services/common/CommonUtils:closeOrLog (Ljava/io/Closeable;Ljava/lang/String;)V
// 60: return
// 61: astore_3
// 62: aconst_null
// 63: astore_2
// 64: aload_2
// 65: astore_1
// 66: invokestatic 177 io/fabric/sdk/android/Fabric:getLogger ()Lio/fabric/sdk/android/Logger;
// 69: ldc -77
// 71: ldc -24
// 73: aload_3
// 74: invokeinterface 187 4 0
// 79: aload_2
// 80: ldc -89
// 82: invokestatic 171 io/fabric/sdk/android/services/common/CommonUtils:closeOrLog (Ljava/io/Closeable;Ljava/lang/String;)V
// 85: return
// 86: astore_3
// 87: aload_1
// 88: astore_2
// 89: aload_3
// 90: astore_1
// 91: aload_2
// 92: ldc -89
// 94: invokestatic 171 io/fabric/sdk/android/services/common/CommonUtils:closeOrLog (Ljava/io/Closeable;Ljava/lang/String;)V
// 97: aload_1
// 98: athrow
// 99: astore_3
// 100: aload_1
// 101: astore_2
// 102: aload_3
// 103: astore_1
// 104: goto -13 -> 91
// 107: astore_3
// 108: goto -44 -> 64
// Local variable table:
// start length slot name signature
// 0 111 0 this MetaDataStore
// 0 111 1 paramString String
// 0 111 2 paramUserMetaData UserMetaData
// 13 32 3 str String
// 61 13 3 localException1 Exception
// 86 4 3 localObject1 Object
// 99 4 3 localObject2 Object
// 107 1 3 localException2 Exception
// 5 22 4 localFile File
// Exception table:
// from to target type
// 9 41 61 java/lang/Exception
// 9 41 86 finally
// 43 48 99 finally
// 50 54 99 finally
// 66 79 99 finally
// 43 48 107 java/lang/Exception
// 50 54 107 java/lang/Exception
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/crashlytics/android/core/MetaDataStore.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/