Java Doc for Pass1Verifier.java in  » Scripting » bcel » org » apache » bcel » verifier » statics » 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 » Scripting » bcel » org.apache.bcel.verifier.statics 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.bcel.verifier.PassVerifier
      org.apache.bcel.verifier.statics.Pass1Verifier

Pass1Verifier
final public class Pass1Verifier extends PassVerifier (Code)
This PassVerifier verifies a class file according to pass 1 as described in The Java Virtual Machine Specification, 2nd edition. More detailed information is to be found at the do_verify() method's documentation.
version:
   $Id: Pass1Verifier.java 371539 2006-01-23 14:08:00Z tcurdt $
author:
   Enver Haase
See Also:   Pass1Verifier.do_verify()



Constructor Summary
public  Pass1Verifier(Verifier owner)
     Should only be instantiated by a Verifier.

Method Summary
public  VerificationResultdo_verify()
     Pass-one verification basically means loading in a class file. The Java Virtual Machine Specification is not too precise about what makes the difference between passes one and two. The answer is that only pass one is performed on a class file as long as its resolution is not requested; whereas pass two and pass three are performed during the resolution process. Only four constraints to be checked are explicitely stated by The Java Virtual Machine Specification, 2nd edition:
  • The first four bytes must contain the right magic number (0xCAFEBABE).
  • All recognized attributes must be of the proper length.
  • The class file must not be truncated or have extra bytes at the end.
  • The constant pool must not contain any superficially unrecognizable information.
A more in-depth documentation of what pass one should do was written by Philip W.
public  String[]getMessages()
     Currently this returns an empty array of String.


Constructor Detail
Pass1Verifier
public Pass1Verifier(Verifier owner)(Code)
Should only be instantiated by a Verifier.
See Also:   org.apache.bcel.verifier.Verifier




Method Detail
do_verify
public VerificationResult do_verify()(Code)
Pass-one verification basically means loading in a class file. The Java Virtual Machine Specification is not too precise about what makes the difference between passes one and two. The answer is that only pass one is performed on a class file as long as its resolution is not requested; whereas pass two and pass three are performed during the resolution process. Only four constraints to be checked are explicitely stated by The Java Virtual Machine Specification, 2nd edition:
  • The first four bytes must contain the right magic number (0xCAFEBABE).
  • All recognized attributes must be of the proper length.
  • The class file must not be truncated or have extra bytes at the end.
  • The constant pool must not contain any superficially unrecognizable information.
A more in-depth documentation of what pass one should do was written by Philip W. L. Fong:
  • the file should not be truncated.
  • the file should not have extra bytes at the end.
  • all variable-length structures should be well-formatted:
    • there should only be constant_pool_count-1 many entries in the constant pool.
    • all constant pool entries should have size the same as indicated by their type tag.
    • there are exactly interfaces_count many entries in the interfaces array of the class file.
    • there are exactly fields_count many entries in the fields array of the class file.
    • there are exactly methods_count many entries in the methods array of the class file.
    • there are exactly attributes_count many entries in the attributes array of the class file, fields, methods, and code attribute.
    • there should be exactly attribute_length many bytes in each attribute. Inconsistency between attribute_length and the actually size of the attribute content should be uncovered. For example, in an Exceptions attribute, the actual number of exceptions as required by the number_of_exceptions field might yeild an attribute size that doesn't match the attribute_length. Such an anomaly should be detected.
    • all attributes should have proper length. In particular, under certain context (e.g. while parsing method_info), recognizable attributes (e.g. "Code" attribute) should have correct format (e.g. attribute_length is 2).
  • Also, certain constant values are checked for validity:
    • The magic number should be 0xCAFEBABE.
    • The major and minor version numbers are valid.
    • All the constant pool type tags are recognizable.
    • All undocumented access flags are masked off before use. Strictly speaking, this is not really a check.
    • The field this_class should point to a string that represents a legal non-array class name, and this name should be the same as the class file being loaded.
    • the field super_class should point to a string that represents a legal non-array class name.
    • Because some of the above checks require cross referencing the constant pool entries, guards are set up to make sure that the referenced entries are of the right type and the indices are within the legal range (0 < index < constant_pool_count).
  • Extra checks done in pass 1:
    • the constant values of static fields should have the same type as the fields.
    • the number of words in a parameter list does not exceed 255 and locals_max.
    • the name and signature of fields and methods are verified to be of legal format.
(From the Paper The Mysterious Pass One, first draft, September 2, 1997.)
However, most of this is done by parsing a class file or generating a class file into BCEL's internal data structure. Therefore, all that is really done here is look up the class file from BCEL's repository. This is also motivated by the fact that some omitted things (like the check for extra bytes at the end of the class file) are handy when actually using BCEL to repair a class file (otherwise you would not be able to load it into BCEL).
See Also:   org.apache.bcel.Repository



getMessages
public String[] getMessages()(Code)
Currently this returns an empty array of String. One could parse the error messages of BCEL (written to java.lang.System.err) when loading a class file such as detecting unknown attributes or trailing garbage at the end of a class file. However, Markus Dahm does not like the idea so this method is currently useless and therefore marked as TODO.



Methods inherited from org.apache.bcel.verifier.PassVerifier
public void addMessage(String message)(Code)(Java Doc)
abstract public VerificationResult do_verify()(Code)(Java Doc)
public String[] getMessages()(Code)(Java Doc)
public VerificationResult verify()(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.