byte[] newClassBytes) throws IOException
{
// Create a new InMemoryJarfile based on the original catalog bytes,
// modify it in place based on the @UpdateClasses inputs, and then
// recompile it if necessary
InMemoryJarfile jarfile = CatalogUtil.loadInMemoryJarFile(oldCatalogBytes);
boolean deletedClasses = false;
if (deletePatterns != null) {
String[] patterns = deletePatterns.split(",");
ClassMatcher matcher = new ClassMatcher();
// Need to concatenate all the classnames together for ClassMatcher
String currentClasses = "";
for (String classname : jarfile.getLoader().getClassNames()) {
currentClasses = currentClasses.concat(classname + "\n");
}
matcher.m_classList = currentClasses;
for (String pattern : patterns) {
ClassNameMatchStatus status = matcher.addPattern(pattern.trim());
if (status == ClassNameMatchStatus.MATCH_FOUND) {
deletedClasses = true;
}
}
for (String classname : matcher.getMatchedClassList()) {
jarfile.removeClassFromJar(classname);
}
}
boolean foundClasses = false;
if (newClassBytes != null) {
InMemoryJarfile newJarfile = new InMemoryJarfile(newClassBytes);
for (Entry<String, byte[]> e : newJarfile.entrySet()) {
String filename = e.getKey();
if (!filename.endsWith(".class")) {
continue;
}
foundClasses = true;