Re: invoke

From: Québec (Once_at_WasEno.ugh)
Date: 07/06/04


Date: Tue, 6 Jul 2004 12:07:17 -0400

Here is the whole context. The method is there for sure. There is only one
class in the applet(see at the end).

java.lang.NoSuchMethodException: java.lang.Class.getParameterInfo()
        at java.lang.Class.getMethod(Unknown Source)
        at WhatsInJar.printMethodsTest(WhatsInJar.java:85)
        at WhatsInJar.main(WhatsInJar.java:49)
========

import java.io.*;
import java.util.jar.*;
import java.lang.reflect.*;
import java.net.URLClassLoader;
import java.net.URL;

public class WhatsInJar extends Thread {

  static String jarre;
  static String jarreText = "";
  static URLClassLoader clload;

  public static void main(String[] args) {
    if (args.length != 1) {
      System.out.println("Usage: java WhatsInJar <jar-file>");
      System.exit(1);
    }

    try {
      JarInputStream jis = new JarInputStream(
            new FileInputStream(args[0]), true);

      JarEntry je;
      while ((je = jis.getNextJarEntry()) != null) {
        String searchMain = je.toString();
        if ((searchMain.indexOf("class")) != -1 &&
            searchMain.indexOf("$") == -1) {
          String className = searchMain.substring(0,
              searchMain.lastIndexOf("."));
          className = className.replaceAll("/", ".");
          //------------------------------------------------------

          URL[] url = new URL[] { new File(args[0]).toURL()};
          clload = new URLClassLoader(url);
          Class klass = clload.loadClass(className);

          printMethodsTest(klass, className);
        }

        jis.closeEntry();
      }
      jis.close();
    } catch (Exception e) {
      e.printStackTrace();
    }

  }

  public static void printMethodsTest(Class cl, String theClass)
  throws IllegalAccessException,
        IllegalArgumentException,
        InvocationTargetException, NoSuchMethodException,
    ClassNotFoundException {

    Method[] methods = cl.getDeclaredMethods();
    for (int i = 0; i < methods.length; i++) {
      Method m = methods[i];
      String name = m.getName();
      if (name.indexOf("getParameterInfo") != -1) {
        Object myObject = cl;
        Class c = myObject.getClass();

        Method m2 = c.getMethod("getParameterInfo", new Class[]{});

        String[][] out = (String[][])m2.invoke(c, new Object[] {});
      }
    }
  }
=========jarred applet==============
// Decompiled by Jad v1.5.7. Copyright 1997-99 Pavel Kouznetsov.
// Jad home page:
http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3)
// Source File Name: Ehg.java

import java.applet.Applet;
import java.applet.AppletContext;
import java.awt.*;
import java.io.PrintStream;
import java.net.URL;

public class Ehg extends Applet
    implements Runnable
{

    public void stop()
    {
        runner = null;
    }

    public Ehg()
    {
        i = 0;
        f = new Font("TimesRoman", 1, 72);
        colors = new Color[600];
    }

    public String[][] getParameterInfo()
    {
        String as[][] = {
            {
                "rground", "background", "value= red three digits"
            }, {
                "gground", "background", "value= green three digits"
            }, {
                "bground", "background", "value= blue three digits"
            }, {
                "image", "image", "value= yours"
            }, {
                "link", "URL", "value= http://www.outaouais.net/JPDesign"
            }, {
                "message", "message", "value= yours"
            }, {
                "window", "target", "value=_blank"
            }
        };
        return as;
    }

    public void update(Graphics g1)
    {
        myPaint(g1);
    }

    public void myPaint(Graphics g1)
    {
        Dimension dimension = getSize();
        offscreen = null;
        offscreen = createImage(dimension.width, dimension.height);
        Graphics g2 = offscreen.getGraphics();
        g2.setColor(colors[i]);
        g2.drawImage(img, 0, 0, this);
        g2.setFont(f);
        g2.drawString(title, 46, 100);
        g2.drawString(title1, 97, 147);
        g2.drawString(title2, 154, 192);
        g1.drawImage(offscreen, 0, 0, this);
    }

    public void start()
    {
        if(runner == null)
        {
            float f1 = 0.0F;
            for(i = 0; i < colors.length; i++)
            {
                colors[i] = Color.getHSBColor(f1, 0.6F, 1.0F);
                f1 = (float)((double)f1 + 0.00165D);
            }

            i = 0;
            offscreen = null;
            runner = new Thread(this);
            runner.start();
        }
    }

    public String getAppletInfo()
    {
        return "daviau@atreide.net\nhttp://www.jeanpierredaviau.com\nShow's
Applet by Jean Pierre Daviau\nApril 2000 (c)\nFree for non commercial
purposes.\n THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED\n
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n IN NO
EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT,\n STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING\n IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE\n POSSIBILITY OF SUCH DAMAGE.\n";
    }

    public boolean mouseDown(Event event, int j, int k)
    {
        if(link != null)
            if(target == null)
                getAppletContext().showDocument(link);
            else
                getAppletContext().showDocument(link, target);
        return true;
    }

    void pause(int j)
    {
        try
        {
            Thread.sleep(j);
        }
        catch(Exception exception)
        {
            System.out.println("Erreur: " + exception.getMessage());
        }
    }

    public void run()
    {
        i = 0;
        for(Thread thread = Thread.currentThread(); runner == thread;)
        {
            pause(200);
            if(++i == colors.length - 1)
            {
                i = 0;
                System.gc();
            }
            myPaint(getGraphics());
        }

    }

    public void init()
    {
        target = getParameter("target");
        String s = getParameter("link");
        int j = Integer.parseInt(getParameter("rground"));
        int k = Integer.parseInt(getParameter("gground"));
        int l = Integer.parseInt(getParameter("bground"));
        img = getImage(getCodeBase(), getParameter("image"));
        title = getParameter("message");
        title1 = getParameter("message1");
        title2 = getParameter("message2");
        s = getParameter("link");
        if(s != null)
            try
            {
                link = new URL(s);
            }
            catch(Exception _ex) { }
        Color color = new Color(j, k, l);
        setBackground(color);
        showStatus("http://www.jeanpierredaviau.com/feedback.htm (c) Show's
Applet by Jean Pierre Daviau april 2000 ");
    }

    static final int DELAY = 200;
    int r;
    int g;
    int b;
    int i;
    Image offscreen;
    Image img;
    Font f;
    Color colors[];
    Thread runner;
    String title;
    String title1;
    String title2;
    String target;
    URL link;
}



Relevant Pages

  • Re: XmlSerializer Collection with Collections
    ... What you can do here is hide the OptionList from serialization as follows: ... > public class TestSerializer ... > public int AddQuestion(Question question) ... > public Question(string QuestionText, string Type, int Score, bool ...
    (microsoft.public.dotnet.xml)
  • XmlSerializer Collection with Collections
    ... public class TestSerializer ... public int AddQuestion(Question question) ... public Question(string QuestionText, string Type, int Score, bool ...
    (microsoft.public.dotnet.xml)
  • MVC and subClass
    ... B(int ii, String ss) ... public int getI() ... public class D1 extends B ... public static void main ...
    (comp.object)
  • Re: Sorting on Multiple Columns
    ... > public class Student ... > public Student(final int theStudentId, final String theFirstName, ... > public class TryStudent ...
    (comp.lang.java.programmer)
  • Re: Brian Kernighan, maybe Im not worthy, maybe Im scum
    ... conformant string. ... int repeats, reps; ... ref satisfierLength); ...
    (comp.programming)

Loading