Paths or filenames that contain a "." cause a problem when loading a
deserializer.
------------------------------------------------------------------------------------
Key: JIBX-212
URL: http://jira.codehaus.org/browse/JIBX-212
Project: JiBX
Issue Type: Bug
Components: core
Affects Versions: JiBX 1.1.5
Environment: Windows XP, JIBX Release 1.1.5, Java 1.6.0_03
Reporter: Jennifer Gau
PROBLEM
Paths or filenames that contain a "." cause a problem when loading a
deserializer.
The problem stems from org.jibx.binding.classes.ClassFile in the method
public static void setPaths(String[] paths), on Lines 2040 to 2045. Here is a
code excerpt:
// append trailing slash on directory paths
String path = paths[i];
int mark = path.lastIndexOf('/');
if (path.indexOf('.', mark) < 0) {
path = path + '/';
}
urls[i] = new URL("file:" + path);
There are several problems with this code:
1. The code assumes the '/' character is the path separator. On Windows
machines, this is not true, and the value of mark is -1
2. The path assumes that there are no "." in the characters following the
last '/' character.
Wouldn't it be better to look for path.endsWith(".jar")? In our case,
because
the source code directory contained a "." in the path, and we're using
Windows, the
trailing slash was never appended to the directory path
3. The URL is not quite formated correctly. To really adhere to the
standard, it should be "file:///" not just "file:"
RECOMMEND
Until this bug is fixed, do not use "." in your directory names.
RELEASE
Using jibx-1.1.5 dated May 23, 2007
ERROR MESSAGE
For reference here is the error we were seeing for some machines. It takes a
bit of searching to figure out that the
class loading was not appending the trailing slash to directories. If you just
look at the verbose option of jibx, it
appears that the paths referenced are correct when they are not being loaded
correctly into the URLClassLoader.
[bind] Error running binding compiler
[bind] org.jibx.runtime.JiBXException: Deserializer class org.sample.MyClass
not found for converting default value
[bind] at
org.jibx.binding.def.PrimitiveStringConversion.genToOptionalText(PrimitiveStringConversion.java:329)
[bind] at
org.jibx.binding.def.StringConversion.genWriteOptional(StringConversion.java:324)
[bind] at
org.jibx.binding.def.ValueChild.genMarshal(ValueChild.java:683)
[bind] at
org.jibx.binding.def.ValueChild.genContentMarshal(ValueChild.java:818)
[bind] at
org.jibx.binding.def.NestedStructure.genContentMarshal(NestedStructure.java:355)
[bind] at
org.jibx.binding.def.ObjectBinding.genMarshalContentCall(ObjectBinding.java:878)
[bind] at
org.jibx.binding.def.ObjectBinding.genContentMarshal(ObjectBinding.java:948)
[bind] at
org.jibx.binding.def.ComponentProperty.genContentMarshal(ComponentProperty.java:292)
[bind] at
org.jibx.binding.def.ElementWrapper.genContentMarshal(ElementWrapper.java:464)
[bind] at
org.jibx.binding.def.PassThroughComponent.genContentMarshal(PassThroughComponent.java:116)
[bind] at
org.jibx.binding.def.OptionalStructureWrapper.genContentMarshal(OptionalStructureWrapper.java:82)
[bind] at
org.jibx.binding.def.PassThroughComponent.genContentMarshal(PassThroughComponent.java:116)
[bind] at
org.jibx.binding.def.NestedStructure.genContentMarshal(NestedStructure.java:355)
[bind] at
org.jibx.binding.def.ObjectBinding.genMarshalContentCall(ObjectBinding.java:878)
[bind] at
org.jibx.binding.def.ObjectBinding.genContentMarshal(ObjectBinding.java:948)
[bind] at
org.jibx.binding.def.ElementWrapper.genContentMarshal(ElementWrapper.java:464)
[bind] at
org.jibx.binding.def.MappingDefinition.generateMarshalImplementation(MappingDefinition.java:797)
[bind] at
org.jibx.binding.def.MappingDefinition.generateCode(MappingDefinition.java:856)
[bind] at
org.jibx.binding.def.DefinitionContext.generateCode(DefinitionContext.java:669)
[bind] at
org.jibx.binding.def.BindingDefinition.generateCode(BindingDefinition.java:661)
[bind] at org.jibx.binding.Compile.compile(Compile.java:305)
[bind] at
org.jibx.binding.ant.CompileTask.execute(CompileTask.java:248)
[bind] at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[bind] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[bind] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[bind] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[bind] at java.lang.reflect.Method.invoke(Method.java:597)
[bind] at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
[bind] at org.apache.tools.ant.Task.perform(Task.java:342)
[bind] at
org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:62)
[bind] at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[bind] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[bind] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[bind] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[bind] at java.lang.reflect.Method.invoke(Method.java:597)
[bind] at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
[bind] at org.apache.tools.ant.Task.perform(Task.java:342)
[bind] at
org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:394)
[bind] at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[bind] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[bind] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[bind] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[bind] at java.lang.reflect.Method.invoke(Method.java:597)
[bind] at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
[bind] at org.apache.tools.ant.Task.perform(Task.java:342)
[bind] at
org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:62)
[bind] at net.sf.antcontrib.logic.IfTask.execute(Unknown Source)
[bind] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[bind] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[bind] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[bind] at java.lang.reflect.Method.invoke(Method.java:597)
[bind] at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
[bind] at
org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:134)
[bind] at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[bind] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[bind] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[bind] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[bind] at java.lang.reflect.Method.invoke(Method.java:597)
[bind] at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
[bind] at org.apache.tools.ant.Task.perform(Task.java:342)
[bind] at org.apache.tools.ant.Target.execute(Target.java:357)
[bind] at org.apache.tools.ant.Target.performTasks(Target.java:385)
[bind] at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1292)
[bind] at
org.apache.tools.ant.Project.executeTarget(Project.java:1261)
[bind] at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[bind] at
org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
[bind] at
org.apache.tools.ant.Project.executeTargets(Project.java:1144)
[bind] at
org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
[bind] at
org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
jibx-devs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-devs