sysperfana/analyzetoolext/com.nokia.s60tools.analyzetool/src/com/nokia/s60tools/analyzetool/engine/ParseXMLFileSAX.java
author Matti Laitinen <matti.t.laitinen@nokia.com>
Tue, 24 Aug 2010 12:16:27 +0300
changeset 15 0367d2db2c06
parent 6 f65f740e69f9
permissions -rw-r--r--
AnalyzeTool Carbide extension 1.10.0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     1
/*
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
     2
 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     3
 * All rights reserved.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     5
 * under the terms of "Eclipse Public License v1.0"
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     8
 *
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     9
 * Initial Contributors:
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    10
 * Nokia Corporation - initial contribution.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    11
 *
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    12
 * Contributors:
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    13
 *
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    14
 * Description:  Definitions for the class ParseXMLFileSAX
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    15
 *
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    16
 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    17
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    18
package com.nokia.s60tools.analyzetool.engine;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    19
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    20
import java.io.File;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    21
import java.io.IOException;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    22
import java.util.AbstractList;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    23
import java.util.ArrayList;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    24
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    25
import javax.xml.parsers.ParserConfigurationException;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    26
import javax.xml.parsers.SAXParser;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    27
import javax.xml.parsers.SAXParserFactory;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    28
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    29
import org.eclipse.core.resources.IProject;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    30
import org.xml.sax.Attributes;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    31
import org.xml.sax.InputSource;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    32
import org.xml.sax.Locator;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    33
import org.xml.sax.SAXException;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    34
import org.xml.sax.XMLReader;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    35
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    36
/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    37
 * Parses atool.exe generated xml file and creates memory analysis results.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    38
 * Using the SAX parser to parse xml file. SAX parser fits better than DOM
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    39
 * parser because it is possible that AT must handle very big xml files.
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
    40
 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    41
 * @author kihe
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
    42
 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    43
 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    44
public class ParseXMLFileSAX implements org.xml.sax.ContentHandler {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    45
	/** XML constants. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    46
	public static final String XML_BUILD_TARGET = "build_target";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    47
	public static final String XML_CALC_MEMADDR = "calc_addr";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    48
	public static final String XML_CALLSTACK = "callstack";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    49
	public static final String XML_COUNT = "count";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    50
	public static final String XML_END_TIME = "end_time";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    51
	public static final String XML_FILE = "file";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    52
	public static final String XML_FUNCTION = "function";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    53
	public static final String XML_FUNCTION_LINE = "function_line";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    54
	public static final String XML_HANDLE_LEAKS = "handle_leaks";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    55
	public static final String XML_ID = "id";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    56
	public static final String XML_ITEM = "item";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    57
	public static final String XML_LEAK = "leak";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    58
	public static final String XML_LEAKS = "leaks";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    59
	public static final String XML_LINE = "line";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    60
	public static final String XML_MEM_LEAKS = "mem_leaks";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    61
	public static final String XML_MEMADDR = "memaddress";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    62
	public static final String XML_MODULE = "module";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    63
	public static final String XML_NAME = "name";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    64
	public static final String XML_PROCESS_NAME = "process_name";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    65
	public static final String XML_RUN = "run";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    66
	public static final String XML_SIZE = "size";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    67
	public static final String XML_START_TIME = "start_time";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    68
	public static final String XML_SUBTEST = "subtest";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    69
	public static final String XML_TIME = "time";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    70
	public static final String XML_UNKNOWN = "???";
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    71
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
    72
	/** Active call stack item id */
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    73
	private int activeCallstackID = 1;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    74
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    75
	/** Active item(memory leak) information */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    76
	private AnalysisItem activeItem;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    77
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
    78
	/** Active item(memory leak) id */
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    79
	private int activeItemID = 1;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    80
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
    81
	/** Summary field active module memory leak count */
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    82
	private String activeModuleCount;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    83
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
    84
	/** Summary field active module name */
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    85
	private String activeModuleName;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    86
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    87
	/** Active run information */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    88
	protected RunResults activeRunResults;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    89
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    90
	/** Contains all the runs parsed results */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    91
	private final AbstractList<RunResults> activeRuns;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    92
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    93
	/** Active subtest item information */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    94
	private Subtest activeSubtest;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    95
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
    96
	/** Active subtest id */
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    97
	private int activeSubtestID = 1;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    98
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    99
	/** Active callstack item information */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   100
	private CallstackItem callstackItem;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   101
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   102
	/** xml file path. */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   103
	private final String filePath;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   104
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   105
	/**
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   106
	 * Flag to demonstrate that is the memory leak summary parsing active. If
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   107
	 * this flag is set to False, then information is stored to the handle leak
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   108
	 * summary object, otherwise information is stored to the memory leak
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   109
	 * summary object.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   110
	 */
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   111
	private boolean moduleLeakActive = true;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   112
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   113
	/** List of modules */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   114
	private final AbstractList<String> moduleList;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   115
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   116
	/**
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   117
	 * Is subtest related information parsing active. If this flag is set to
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   118
	 * true all the information (such as memory leaks etc) is stored to the
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   119
	 * subtest object.
6
f65f740e69f9 AnalyzeTool Carbide Extension v1.9.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 1
diff changeset
   120
	 */
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   121
	private boolean parsingSubtest = false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   122
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   123
	/** Project reference */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   124
	private final IProject project;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   125
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   126
	/** Project result reference where to save results */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   127
	private final ProjectResults results;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   128
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   129
	/** Index for active items */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   130
	private int runID = 1;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   131
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   132
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   133
	 * Constructor.
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   134
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   135
	 * @param projectRef
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   136
	 *            Project reference
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   137
	 * @param newFilePath
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   138
	 *            Used file path
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   139
	 * @param projResults
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   140
	 *            Project results reference
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   141
	 */
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   142
	public ParseXMLFileSAX(final IProject projectRef, final String newFilePath,
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   143
			final ProjectResults projResults) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   144
		results = projResults;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   145
		filePath = newFilePath;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   146
		project = projectRef;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   147
		activeRuns = new ArrayList<RunResults>();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   148
		moduleList = new ArrayList<String>();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   149
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   150
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   151
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   152
	 * Adds module name to list
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   153
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   154
	 * @param moduleName
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   155
	 *            Module to add to the list
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   156
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   157
	private void addModuleNameToList(final String moduleName) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   158
		if (moduleName == null || ("").equals(moduleName)) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   159
			return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   160
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   161
		if (!moduleList.contains(moduleName)) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   162
			moduleList.add(moduleName);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   163
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   164
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   165
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   166
	public void characters(char[] ch, int start, int length) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   167
		// Do nothing be design, because AT is not interested of this
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   168
		// information
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   169
		// also this method is overloaded
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   170
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   171
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   172
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   173
	 * When the SAX parser reach the end of the XML file this function is
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   174
	 * called.
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   175
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   176
	 * Updates results.
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   177
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   178
	public void endDocument() throws SAXException {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   179
		results.updateRunResults(project, activeRuns, filePath);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   180
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   181
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   182
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   183
	 * When the SAX parser reach the end of the xml tag this function is called.
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   184
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   185
	 * Checks what tag read is finished and stores corresponding results
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   186
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   187
	public void endElement(String uri, String localName, String name)
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   188
			throws SAXException {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   189
		// "results" tag => store results
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   190
		if (name.equals(XML_RUN)) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   191
			activeRuns.add(activeRunResults);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   192
		} else if (name.equals(XML_LEAK)) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   193
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   194
			// not enough information so clear the active item
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   195
			if (activeItem == null || !activeItem.checkData()) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   196
				activeItem = null;
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   197
			} else if (parsingSubtest) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   198
				activeSubtest.addAnalysisItem(activeItem);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   199
			} else {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   200
				activeRunResults.addAnalysisItem(activeItem);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   201
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   202
		} else if (name.equals(XML_ITEM)) {
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   203
			if (callstackItem.isEmpty()) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   204
				callstackItem = null;
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   205
			} else {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   206
				activeItem.addCallstackItem(callstackItem);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   207
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   208
		} else if (name.equals(XML_SUBTEST)) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   209
			activeRunResults.addSubtest(activeSubtest);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   210
			parsingSubtest = false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   211
		} else if (name.equals(XML_MODULE)) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   212
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   213
			try {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   214
				// check that module count value is valid
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   215
				if (activeModuleCount == null || ("").equals(activeModuleCount)) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   216
					moduleLeakActive = true;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   217
					return;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   218
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   219
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   220
				// convert module count information to string object
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   221
				int count = Integer.parseInt(activeModuleCount, 16);
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   222
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   223
				// if module leak summary is active
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   224
				if (moduleLeakActive) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   225
					activeRunResults.addModuleLeak(activeModuleName, count);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   226
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   227
				// if handle leak summary is active
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   228
				else {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   229
					activeRunResults.addHandleLeak(activeModuleName, count);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   230
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   231
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   232
			} catch (NumberFormatException npe) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   233
				npe.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   234
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   235
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   236
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   237
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   238
	public void endPrefixMapping(String prefix) throws SAXException {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   239
		// Do nothing be design, because AT is not interested of this
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   240
		// information
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   241
		// also this method is overloaded
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   242
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   243
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   244
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   245
	 * Returns list of modules
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   246
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   247
	 * @return List of modules
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   248
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   249
	public AbstractList<String> getModules() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   250
		return moduleList;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   251
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   252
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   253
	public void ignorableWhitespace(char[] ch, int start, int length)
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   254
			throws SAXException {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   255
		// Do nothing be design, because AT is not interested of this
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   256
		// information
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   257
		// also this method is overloaded
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   258
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   259
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   260
	/**
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   261
	 * Parses XML file content.
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   262
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   263
	 * @return True if there are no errors while parsing XML file otherwise
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   264
	 *         False
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   265
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   266
	public final boolean parse() {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   267
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   268
		boolean ret = false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   269
		try {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   270
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   271
			// check that file exists
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   272
			File file = new File(filePath);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   273
			if (file.exists()) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   274
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   275
				SAXParserFactory factory = null;
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   276
				SAXParser parser = null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   277
				XMLReader xmlReader = null;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   278
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   279
				// get parser factory
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   280
				factory = SAXParserFactory.newInstance();
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   281
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   282
				if (factory != null) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   283
					// get xml parser
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   284
					parser = factory.newSAXParser();
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   285
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   286
					if (parser != null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   287
						// get xml reader
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   288
						xmlReader = parser.getXMLReader();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   289
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   290
						if (xmlReader != null) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   291
							// set content handle to this class
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   292
							xmlReader.setContentHandler(this);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   293
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   294
							// parse xml file
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   295
							xmlReader.parse(new InputSource(file.getPath()));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   296
							ret = true;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   297
						}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   298
					}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   299
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   300
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   301
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   302
			// file does not exists
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   303
			else {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   304
				ret = false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   305
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   306
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   307
			// check that XML file contains data
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   308
			// otherwise return false
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   309
			if (activeRunResults == null) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   310
				ret = false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   311
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   312
		} catch (SAXException sae) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   313
			sae.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   314
			ret = false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   315
		} catch (ParserConfigurationException pce) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   316
			pce.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   317
			ret = false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   318
		} catch (IOException ioe) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   319
			ioe.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   320
			ret = false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   321
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   322
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   323
		// no errors => return positive value
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   324
		return ret;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   325
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   326
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   327
	public void processingInstruction(String target, String data)
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   328
			throws SAXException {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   329
		// Do nothing be design, because AT is not interested of this
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   330
		// information
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   331
		// also this method is overloaded
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   332
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   333
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   334
	public void setDocumentLocator(Locator locator) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   335
		// Do nothing be design, because AT is not interested of this
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   336
		// information
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   337
		// also this method is overloaded
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   338
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   339
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   340
	public void skippedEntity(String name) throws SAXException {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   341
		// Do nothing be design, because AT is not interested of this
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   342
		// information
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   343
		// also this method is overloaded
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   344
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   345
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   346
	public void startDocument() throws SAXException {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   347
		// Do nothing be design, because AT is not interested of this
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   348
		// information
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   349
		// also this method is overloaded
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   350
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   351
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   352
	/**
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   353
	 * When the SAX parser start to read xml tag this function is called.
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   354
	 * 
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   355
	 * Checks what tag read is started and initializes corresponding objects
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   356
	 */
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   357
	public void startElement(String uri, String localName, String name,
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   358
			Attributes atts) throws SAXException {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   359
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   360
		// parse one run information
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   361
		if (name.equals(XML_RUN)) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   362
			activeRunResults = new RunResults(runID);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   363
			activeRunResults.setEndTime(atts.getValue(XML_END_TIME));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   364
			activeRunResults.setBuildTarget(atts.getValue(XML_BUILD_TARGET));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   365
			activeRunResults.setProcessName(atts.getValue(XML_PROCESS_NAME));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   366
			activeRunResults.setStartTime(atts.getValue(XML_START_TIME));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   367
			runID++;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   368
			activeItemID = 1;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   369
			activeSubtestID = 1;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   370
		}
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   371
		// parse one memory leak information
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   372
		else if (name.equals(XML_LEAK)) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   373
			try {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   374
				activeItem = new AnalysisItem();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   375
				activeItem.setID(activeItemID);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   376
				activeItem.setMemoryAddress(atts.getValue(XML_MEMADDR));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   377
				activeItem.setMemoryLeakTime(atts.getValue(XML_TIME));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   378
				String moduleName = atts.getValue(XML_MODULE);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   379
				addModuleNameToList(moduleName);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   380
				activeItem.setModuleName(moduleName);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   381
				String size = atts.getValue(XML_SIZE);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   382
				if (size != null && !("").equals(size)) {
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   383
					activeItem.setLeakSize(Integer.parseInt(size));
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   384
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   385
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   386
			} catch (NumberFormatException npe) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   387
				npe.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   388
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   389
			activeItemID++;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   390
			activeCallstackID = 1;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   391
		}
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   392
		// parse call stack item information
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   393
		else if (name.equals(XML_ITEM)) {
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   394
			try {
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   395
				// create new item
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   396
				callstackItem = new CallstackItem();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   397
				callstackItem.setID(activeCallstackID);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   398
				callstackItem.setFileName(atts.getValue(XML_FILE));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   399
				callstackItem.setFunctionName(atts.getValue(XML_FUNCTION));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   400
				callstackItem.setMemoryAddress(atts.getValue(XML_MEMADDR));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   401
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   402
				// get module name and add it to list
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   403
				// module name list is used later.
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   404
				String moduleName = atts.getValue(XML_MODULE);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   405
				addModuleNameToList(moduleName);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   406
				callstackItem.setModuleName(moduleName);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   407
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   408
				// if line number is added to the XML file
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   409
				// this means that the results are generated to UREL
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   410
				String lineNumber = atts.getValue(XML_LINE);
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   411
				if (lineNumber != null && !("").equals(lineNumber)
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   412
						&& !(XML_UNKNOWN).equals(lineNumber)) {
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   413
					callstackItem.setLeakLineNumber(Integer
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   414
							.parseInt(lineNumber));
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   415
				}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   416
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   417
				// if function line is added to the XML file
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   418
				// this means that the results are generated to UREL
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   419
				String functionLine = atts.getValue(XML_FUNCTION_LINE);
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   420
				if (functionLine != null && !("").equals(functionLine)
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   421
						&& !(XML_UNKNOWN).equals(functionLine)) {
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   422
					callstackItem.setLeakLineNumber(Integer
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   423
							.parseInt(functionLine));
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   424
					callstackItem.setUrelBuild(true);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   425
				}
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   426
			} catch (NumberFormatException npe) {
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   427
				npe.printStackTrace();
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   428
			}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   429
			activeCallstackID++;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   430
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   431
		}
15
0367d2db2c06 AnalyzeTool Carbide extension 1.10.0
Matti Laitinen <matti.t.laitinen@nokia.com>
parents: 6
diff changeset
   432
		// parse subtest information
1
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   433
		else if (name.equals(XML_SUBTEST)) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   434
			activeSubtest = new Subtest(activeSubtestID);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   435
			activeItemID = 1;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   436
			activeCallstackID = 1;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   437
			activeSubtest.setEndTime(atts.getValue(XML_END_TIME));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   438
			activeSubtest.setName(atts.getValue(XML_NAME));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   439
			activeSubtest.setStartTime(atts.getValue(XML_START_TIME));
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   440
			parsingSubtest = true;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   441
			activeSubtestID++;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   442
		} else if (name.equals(XML_HANDLE_LEAKS)) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   443
			moduleLeakActive = false;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   444
		} else if (name.equals(XML_MEM_LEAKS)) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   445
			moduleLeakActive = true;
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   446
		} else if (name.equals(XML_MODULE)) {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   447
			activeModuleName = atts.getValue(XML_NAME);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   448
			activeModuleCount = atts.getValue(XML_LEAKS);
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   449
		}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   450
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   451
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   452
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   453
	public void startPrefixMapping(String prefix, String uri)
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   454
			throws SAXException {
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   455
		// Do nothing be design, because AT is not interested of this
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   456
		// information
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   457
		// also this method is overloaded
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   458
	}
1050670c6980 Initial version of AnalyzeTool under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
   459
}