bname = sname;
}
BoundClass.setModify(cf.getRoot(), tpack, bname);
}
BindingDefinition bdef =
BindingBuilder.unmarshalBindingDefinition(uctx, sname, url);
// set package and class if not validated
if (!test) {
// a kludge, but needed to support skipping validation
ArrayList maps = bdef.getDefinitionContext().getMappings();
if (maps != null) {
// set up package information from mapped class
for (int i = 0; i < maps.size(); i++) {
Object child = maps.get(i);
if (child instanceof MappingBase) {
// end scan if a real mapping is found
MappingBase mapbase = (MappingBase)child;
cf = mapbase.getBoundClass().getMungedFile();
if (mapbase.getBoundClass().isDirectAccess()) {
break;
}
}
}
}
}
// set up binding root based on first mapping
File root = null;
if (tpack == null) {
tpack = bdef.getDefaultPackage();
}
if (cf == null) {
root = ClassCache.getModifiablePath();
if (root == null) {
throw new IllegalStateException("Need modifiable directory on classpath for storing generated factory class file");
}
if (tpack == null) {
tpack = "";
}
} else {
root = cf.getRoot();
if (tpack == null) {
tpack = cf.getPackage();
}
}
bdef.setFactoryLocation(tpack, root);
return bdef;
} catch (JiBXException e) {
throw new JiBXException
("\n*** Error during code generation for file '" + fname +