[izpack-changes] r1521 - in izpack-src/trunk/src/lib/com/izforge/izpack: compiler installer
noreply at berlios.de
noreply at berlios.de
Tue Aug 8 10:53:03 CEST 2006
Author: bartzkau
Date: 2006-08-08 10:53:02 +0200 (Tue, 08 Aug 2006)
New Revision: 1521
Modified:
izpack-src/trunk/src/lib/com/izforge/izpack/compiler/CompilerConfig.java
izpack-src/trunk/src/lib/com/izforge/izpack/installer/InstallerFrame.java
Log:
Throw an IllegalArgumentException in the compiler if the
declared class name in the xml file differs in case from
the founded class file. This will be better as to get
the class not found error at install time.
Modified: izpack-src/trunk/src/lib/com/izforge/izpack/compiler/CompilerConfig.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/compiler/CompilerConfig.java 2006-08-08 07:29:44 UTC (rev 1520)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/compiler/CompilerConfig.java 2006-08-08 08:53:02 UTC (rev 1521)
@@ -1011,7 +1011,7 @@
{
fullClassName = getFullClassName(url, className);
}
- catch (Exception e)
+ catch (IOException e)
{
}
if (fullClassName != null)
@@ -1988,9 +1988,9 @@
* @param url url of the jar file which contains the class
* @param className short name of the class for which the full name should be resolved
* @return full qualified class name
- * @throws Exception
+ * @throws IOException
*/
- private String getFullClassName(URL url, String className) throws Exception
+ private String getFullClassName(URL url, String className) throws IOException //throws Exception
{
JarInputStream jis = new JarInputStream(url.openStream());
ZipEntry zentry = null;
@@ -2004,15 +2004,22 @@
}
name = name.replace('/', '.');
int pos = -1;
+ int nonCasePos = -1;
if (className != null)
{
pos = name.indexOf(className);
+ nonCasePos = name.toLowerCase().indexOf(className.toLowerCase());
}
if (pos != -1 && name.length() == pos + className.length() + 6) // "Main" class found
{
jis.close();
return (name.substring(0, lastPos));
}
+
+ if (nonCasePos != -1 && name.length() == nonCasePos + className.length() + 6)
+ // "Main" class with different case found
+ throw new IllegalArgumentException("Fatal error! The declared panel name in the xml file ("
+ + className + ") differs in case to the founded class file (" + name + ").");
}
jis.close();
return (null);
Modified: izpack-src/trunk/src/lib/com/izforge/izpack/installer/InstallerFrame.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/installer/InstallerFrame.java 2006-08-08 07:29:44 UTC (rev 1520)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/installer/InstallerFrame.java 2006-08-08 08:53:02 UTC (rev 1521)
@@ -231,7 +231,7 @@
if (!OsConstraint.oneMatchesCurrentSystem(p.osConstraints)) continue;
className = (String) p.className;
String praefix = "com.izforge.izpack.panels.";
- if (className.compareTo(".") > -1)
+ if (className.indexOf('.') > -1)
// Full qualified class name
praefix = "";
objectClass = Class.forName(praefix + className);
More information about the izpack-changes
mailing list