ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephane Bailliez <stephane.baill...@haht.com>
Subject RE: cvs commit: jakarta-ant/src/main/org/apache/tools/ant Main.ja va Diagnostics.java
Date Thu, 27 Jun 2002 09:54:04 GMT
> -----Original Message-----
> From: Stefan Bodewig [mailto:bodewig@apache.org]
> 
> On Thu, 27 Jun 2002, Stephane Bailliez <sbailliez@apache.org> wrote:
> 
> BTW, there seems to be some funny classloader stuff going on as well,
> can you shed some light on
> <http://cvs.apache.org/~bodewig/gump/20020627/test-ant.html>?
> 

Only if you tell me what's wrong with this code in JDK 1.2+, that must be
damn stupid. à$*# !
I keep having nosuchmethod...<g> that must be sooo simple !

    private static String getImplementationVersion(Class clazz){
        try {
          // Package pkg = clazz.getPackage();        
          Method method = clazz.getMethod("getPackage", new Class[0]);
          Object pkg = method.invoke(null, null);        
          if (pkg != null) {
              // pkg.getImplementationVersion();
              method = pkg.getClass().getMethod("getImplementationVersion",
new Class[0]);
              Object version = method.invoke(pkg, null);          
              return (String)version;
          }
        } catch (Exception e){
          e.printStackTrace();
          // JDK < 1.2 should land here because the method above don't
exist.
          return "?.?";
        }
        return null;
    }

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message