if (packages.length == 0) {
return;
}
for (int i = 0; i < packages.length; i++) {
PackageType temp = packages[i];
PackageTypeChoice choice = temp.getPackageTypeChoice();
if (choice.getNamespace() != null) {
super.setNamespacePackageMapping(choice.getNamespace(), temp.getName());
} else if (choice.getSchemaLocation() != null) {
//1--Handle relative locations
String tempLocation = choice.getSchemaLocation();
String currentDir = System.getProperty("user.dir");
currentDir = currentDir.replace('\\', '/');
if (tempLocation.startsWith("./")) {
tempLocation = tempLocation.substring(1);
tempLocation = currentDir + tempLocation;
} else if (tempLocation.startsWith("../")) {
tempLocation = tempLocation.substring("../".length());
int lastDir = currentDir.lastIndexOf('/');
currentDir = currentDir.substring(0, lastDir + 1);
tempLocation = currentDir + tempLocation;
}
super.setLocationPackageMapping(tempLocation, temp.getName());
currentDir = null;
tempLocation = null;
}
}
}