Source Code Cross Referenced for StackTrace.java in  » Development » proguard » proguard » retrace » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Development » proguard » proguard.retrace 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * ProGuard -- shrinking, optimization, obfuscation, and preverification
003:         *             of Java bytecode.
004:         *
005:         * Copyright (c) 2002-2007 Eric Lafortune (eric@graphics.cornell.edu)
006:         *
007:         * This program is free software; you can redistribute it and/or modify it
008:         * under the terms of the GNU General Public License as published by the Free
009:         * Software Foundation; either version 2 of the License, or (at your option)
010:         * any later version.
011:         *
012:         * This program is distributed in the hope that it will be useful, but WITHOUT
013:         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
014:         * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
015:         * more details.
016:         *
017:         * You should have received a copy of the GNU General Public License along
018:         * with this program; if not, write to the Free Software Foundation, Inc.,
019:         * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020:         */
021:        package proguard.retrace;
022:
023:        import proguard.obfuscate.MappingProcessor;
024:
025:        import java.io.*;
026:        import java.util.*;
027:
028:        /**
029:         * This class represents an obfuscated stack trace. It can read, de-obfuscate,
030:         * and then write its contents.
031:         *
032:         * @author Eric Lafortune
033:         */
034:        final class StackTrace implements  MappingProcessor {
035:            // The stack trace settings.
036:            private final boolean verbose;
037:
038:            // The stack trace items.
039:            private final List stackTraceItems = new ArrayList();
040:
041:            /**
042:             * Creates a new StackTrace.
043:             * @param verbose specifies whether the de-obfuscated stack trace should
044:             *                be verbose.
045:             */
046:            public StackTrace(boolean verbose) {
047:                this .verbose = verbose;
048:            }
049:
050:            /**
051:             * Reads the stack trace file.
052:             */
053:            public void read(File stackTraceFile) throws IOException {
054:                LineNumberReader lineNumberReader = null;
055:
056:                try {
057:                    Reader reader = stackTraceFile == null ? (Reader) new InputStreamReader(
058:                            System.in)
059:                            : (Reader) new BufferedReader(new FileReader(
060:                                    stackTraceFile));
061:
062:                    lineNumberReader = new LineNumberReader(reader);
063:
064:                    // Read the line in the stack trace.
065:                    while (true) {
066:                        String line = lineNumberReader.readLine();
067:                        if (line == null) {
068:                            break;
069:                        }
070:
071:                        line = line.trim();
072:                        if (line.length() == 0) {
073:                            continue;
074:                        }
075:
076:                        // Put the line in a stack trace item.
077:                        StackTraceItem item = new StackTraceItem(verbose);
078:
079:                        item.parse(line);
080:
081:                        stackTraceItems.add(item);
082:                    }
083:                } catch (IOException ex) {
084:                    throw new IOException("Can't read stack trace ("
085:                            + ex.getMessage() + ")");
086:                } finally {
087:                    if (stackTraceFile != null && lineNumberReader != null) {
088:                        try {
089:                            lineNumberReader.close();
090:                        } catch (IOException ex) {
091:                            // This shouldn't happen.
092:                        }
093:                    }
094:                }
095:            }
096:
097:            /**
098:             * Prints out the de-obfuscated stack trace.
099:             */
100:            public void print() {
101:                // Delegate to each of the stack trace items.
102:                for (int index = 0; index < stackTraceItems.size(); index++) {
103:                    StackTraceItem item = (StackTraceItem) stackTraceItems
104:                            .get(index);
105:
106:                    item.print();
107:                }
108:            }
109:
110:            // Implementations for MappingProcessor.
111:
112:            public boolean processClassMapping(String className,
113:                    String newClassName) {
114:                // Delegate to each of the stack trace items.
115:                boolean present = false;
116:                for (int index = 0; index < stackTraceItems.size(); index++) {
117:                    StackTraceItem item = (StackTraceItem) stackTraceItems
118:                            .get(index);
119:
120:                    present |= item
121:                            .processClassMapping(className, newClassName);
122:                }
123:
124:                return present;
125:            }
126:
127:            public void processFieldMapping(String className, String fieldType,
128:                    String fieldName, String newFieldName) {
129:                // A stack trace never contains any fields.
130:            }
131:
132:            public void processMethodMapping(String className,
133:                    int firstLineNumber, int lastLineNumber,
134:                    String methodReturnType, String methodNameAndArguments,
135:                    String newMethodName) {
136:                // Delegate to each of the stack trace items.
137:                for (int index = 0; index < stackTraceItems.size(); index++) {
138:                    StackTraceItem item = (StackTraceItem) stackTraceItems
139:                            .get(index);
140:
141:                    item.processMethodMapping(className, firstLineNumber,
142:                            lastLineNumber, methodReturnType,
143:                            methodNameAndArguments, newMethodName);
144:                }
145:            }
146:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.