*/
static void generateJarSerialVersionUIDs(URL jar, TreeMap classVersionMap,
ClassLoader cl, String pkgPrefix) throws IOException
{
String jarName = jar.getFile();
JarFile jf = new JarFile(jarName);
Enumeration entries = jf.entries();
while( entries.hasMoreElements() )
{
JarEntry entry = (JarEntry) entries.nextElement();
String name = entry.getName();
if( name.endsWith(".class") && name.startsWith(pkgPrefix) )
{
name = name.substring(0, name.length() - 6);
String classname = name.replace('/', '.');
try
{
log.fine("Creating ClassVersionInfo for: "+classname);
ClassVersionInfo cvi = new ClassVersionInfo(classname, cl);
log.fine(cvi.toString());
if( cvi.getSerialVersion() != 0 )
{
ClassVersionInfo prevCVI = (ClassVersionInfo)
classVersionMap.put(classname, cvi);
if( prevCVI != null )
{
if( prevCVI.getSerialVersion() != cvi.getSerialVersion() )
{
log.severe("Found inconsistent classes, "
+prevCVI+" != "+cvi+", jar: "+jarName);
}
}
if( cvi.getHasExplicitSerialVersionUID() == false )
{
log.warning("No explicit serialVersionUID: "+cvi);
}
}
}
catch(OutOfMemoryError e)
{
log.log(Level.SEVERE, "Check the MaxPermSize", e);
}
catch(Throwable e)
{
log.log(Level.FINE, "While loading: "+name, e);
}
}
}
jf.close();
}