| Summary: | Code typo in "Load a Class File From the Class Loader" doc | ||
|---|---|---|---|
| Product: | [JBoss] JBoss Enterprise Application Platform 6 | Reporter: | Pavel Jelinek <pjelinek> |
| Component: | Documentation | Assignee: | sgilda |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Russell Dickenson <rdickens> |
| Severity: | medium | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 6.2.0 | CC: | david.lloyd, twells |
| Target Milestone: | GA | Keywords: | Documentation, Triaged |
| Target Release: | EAP 6.2.1 | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: |
Build Name: 14875, Development Guide-6.2-1
Build Date: 12-11-2013 07:06:39
Topic ID: 24376-549765 [Specified]
|
|
| Last Closed: | 2014-02-24 20:15:57 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
This is actually incorrect. It *would* be correct if the left hand argument were a class loader, but because it's a class, it will already search in the class' current directory, thus only the simple name should be given. However this does raise a different issue: the .replace() is not actually needed here because there will never be path separator components. I will change the example to: InputStream inputStream = TargetClass.class.getResourceAsStream(TargetClass.class.getSimpleName() + ".class"); David reviewed the docbuilder version and said it looks much better. Moving to modified. This is not yet staged. @dmlloyde: This can be verified on the Customer Portal: https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Application_Platform/6.2/html-single/Development_Guide/index.html#Programmatically_Load_Classes_and_Resources_in_a_Deployment |
Title: Programmatically Load Classes and Resources in a Deployment Suggestions for improvement: In the "Load a Class File From the Class Loader" subsection change this: InputStream inputStream = TargetClass.class.getResourceAsStream(TargetClass.class.getSimpleName().replace('.', '/') + ".class"); to: InputStream inputStream = TargetClass.class.getResourceAsStream(TargetClass.class.getCanonicalName().replace('.', '/') + ".class");