|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 package com.nokia.s60tools.crashanalyser.files; |
|
19 |
|
20 import com.nokia.s60tools.crashanalyser.data.*; |
|
21 |
|
22 /** |
|
23 * This class represent an undecoded crash file such as MobileCrash.bin |
|
24 * |
|
25 */ |
|
26 public class UndecodedFile extends CrashAnalyserFile { |
|
27 |
|
28 /** |
|
29 * Constructor |
|
30 * @param filePath file path to this crash file |
|
31 * @param library error library |
|
32 */ |
|
33 protected UndecodedFile(String filePath, ErrorLibrary library) { |
|
34 super(filePath, library); |
|
35 } |
|
36 |
|
37 /** |
|
38 * Returns the file type of this crash file. |
|
39 * @return E.g "MobileCrash", "D_EXC", |
|
40 */ |
|
41 public String getFileType() { |
|
42 if (fileName.endsWith("."+CrashAnalyserFile.MOBILECRASH_FILE_EXTENSION) || |
|
43 fileName.endsWith("."+CrashAnalyserFile.TRACE_EXTENSION)) |
|
44 return "MobileCrash"; |
|
45 else |
|
46 return "D_EXC"; |
|
47 } |
|
48 |
|
49 /** |
|
50 * Reads crash file |
|
51 * @param folder folder which contains one binary crash file which will be read |
|
52 * @return read crash file |
|
53 */ |
|
54 public static UndecodedFile read(String folder) { |
|
55 String undecodedFile = findFile(folder, CrashAnalyserFile.MOBILECRASH_FILE_EXTENSION); |
|
56 if (undecodedFile == null) { |
|
57 undecodedFile = findFile(folder, CrashAnalyserFile.D_EXC_FILE_EXTENSION); |
|
58 } |
|
59 if (undecodedFile == null) { |
|
60 undecodedFile = findFile(folder, CrashAnalyserFile.TRACE_EXTENSION); |
|
61 } |
|
62 |
|
63 // if (undecodedFile == null) { |
|
64 // undecodedFile = findFile(folder, CrashAnalyserFile.ELF_CORE_DUMP_FILE_EXTENSION); // core dump file will be support in later version |
|
65 // } |
|
66 |
|
67 // undecoded file doesn't exist |
|
68 if (undecodedFile == null) |
|
69 return null; |
|
70 |
|
71 UndecodedFile file = new UndecodedFile(undecodedFile, null); |
|
72 file.doRead(); |
|
73 return file; |
|
74 } |
|
75 } |