[jboss-user] [JBoss jBPM] - Re: loading resource from process class
gogoasa
do-not-reply at jboss.com
Sun Jun 10 16:05:35 EDT 2007
I fixed the class ProcessClassLoader in order to correctly load resources.
Either it is a bug it has always been there and nobody ever loaded a resource in a .par, or I don't get resource location inside par archives at all...
### Eclipse Workspace Patch 1.0
#P jbpm.3_HEAD
Index: jpdl/jar/src/main/java/org/jbpm/instantiation/ProcessClassLoader.java
===================================================================
RCS file: /cvsroot/jbpm/jbpm.3/jpdl/jar/src/main/java/org/jbpm/instantiation/ProcessClassLoader.java,v
retrieving revision 1.1
diff -u -r1.1 ProcessClassLoader.java
--- jpdl/jar/src/main/java/org/jbpm/instantiation/ProcessClassLoader.java 28 Apr 2006 15:09:22 -0000 1.1
+++ jpdl/jar/src/main/java/org/jbpm/instantiation/ProcessClassLoader.java 10 Jun 2007 20:02:19 -0000
@@ -28,7 +28,8 @@
import org.jbpm.graph.def.*;
public class ProcessClassLoader extends ClassLoader {
-
+ final static protected String CLASSES_SUBDIR = "classes/";
+
private ProcessDefinition processDefinition = null;
public ProcessClassLoader( ClassLoader parent, ProcessDefinition processDefinition ) {
@@ -37,10 +38,11 @@
}
public InputStream getResourceAsStream(String name) {
+ String filename = CLASSES_SUBDIR + name;
InputStream inputStream = null;
FileDefinition fileDefinition = processDefinition.getFileDefinition();
if (fileDefinition!=null) {
- byte[] bytes = fileDefinition.getBytes(name);
+ byte[] bytes = fileDefinition.getBytes(filename);
if (bytes!=null) {
inputStream = new ByteArrayInputStream(bytes);
}
@@ -53,7 +55,7 @@
FileDefinition fileDefinition = processDefinition.getFileDefinition();
if (fileDefinition!=null) {
- String fileName = "classes/" + name.replace( '.', '/' ) + ".class";
+ String fileName = CLASSES_SUBDIR + name.replace( '.', '/' ) + ".class";
byte[] classBytes;
try {
classBytes = fileDefinition.getBytes(fileName);
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4052948#4052948
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4052948
More information about the jboss-user
mailing list