[Soot-list] soot

Peng Li lipeng360 at gmail.com
Sat Oct 7 03:49:20 EDT 2006


Hi
I emailed the list my wired question, but nobody answered it, so I am
wondering if this is because I did not describe it clearly. So I email the
list again and give me clearer explanation of my problem. Sorry for
the duplication


This is my problem,

I am using soot to find all the methods which have the returned value in one
class(com.oreilly.struts.storefront.security.LoginAction). From the code, we
can find there is only one  method ("execute") which has returned value
. However, when I run my program, besides the method "execute", there is
another method called "class$", which returns "r0", the signature is "<
com.oreilly.struts.storefront.security.LoginAction: java.lang.Class class$(
java.lang.String)>". My program is ok for all other 5 classes. Could anyone
give me any clues and how to filter out the useless method(class$) using
some soot API?

I gave the output, source code and jimple file as following, Thank you very
much for your help

The output

Soot started on Sat Oct 07 15:41:35 CST 2006
Transforming com.oreilly.struts.storefront.security.LoginAction...
instrumenting method : <com.oreilly.struts.storefront.security.LoginAction:
void <init>()>
instrumenting method : <com.oreilly.struts.storefront.security.LoginAction:
org.apache.struts.action.ActionForward execute(
org.apache.struts.action.ActionMapping,org.apache.struts.action.ActionForm,
javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse
)>
Method is execute
Returned Value is "Success"
instrumenting method : <com.oreilly.struts.storefront.security.LoginAction:
java.lang.Class class$(java.lang.String)>
Method is class$
Returned Value is r0
instrumenting method : <com.oreilly.struts.storefront.security.LoginAction:
void <clinit>()>
Writing to
sootOutput\com\oreilly\struts\storefront\security\LoginAction.class
Soot finished on Sat Oct 07 15:41:38 CST 2006
Soot has run for 0 min. 2 sec.
The source,
package com.oreilly.struts.storefront.security;

import java.util.Locale;
import javax.servlet.http.*;
import javax.servlet.ServletContext;
import org.apache.struts.action.*;
import org.apache.struts.util.MessageResources;
import com.oreilly.struts.storefront.customer.view.UserView;
import com.oreilly.struts.storefront.framework.exceptions.*;
import com.oreilly.struts.storefront.framework.UserContainer;
import com.oreilly.struts.storefront.framework.StorefrontBaseAction;
import com.oreilly.struts.storefront.framework.util.IConstants;
import com.oreilly.struts.storefront.service.IStorefrontService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
 * Implements the logic to authenticate a user for the storefront
application.
 */
public class LoginAction extends StorefrontBaseAction {
  protected static Log log = LogFactory.getLog( StorefrontBaseAction.class);
  /**
   * Called by the controller when the a user attempts to login to the
   * storefront application.
   */
  public ActionForward execute( ActionMapping mapping,
                                ActionForm form,
                                HttpServletRequest request,
                                HttpServletResponse response )
  throws Exception{
    String email = ((LoginForm)form).getEmail();
    String password = ((LoginForm)form).getPassword();
    ServletContext context = getServlet().getServletContext();
    IStorefrontService serviceImpl = getStorefrontService();
    UserView userView = serviceImpl.authenticate(email, password);

UserContainer existingContainer = getUserContainer(request);
    existingContainer.setUserView(userView);
    System.out.println( existingContainer.getUserView() );
    return mapping.findForward(IConstants.SUCCESS_KEY);
  }
}
The jimple,
public class com.oreilly.struts.storefront.security.LoginAction extends
com.oreilly.struts.storefront.framework.StorefrontBaseAction
{
    protected static org.apache.commons.logging.Log log;
    static java.lang.Class class$0;

    static void <clinit>()
    {
        java.lang.Class $r0;
        java.lang.NoClassDefFoundError $r1;
        java.lang.ClassNotFoundException $r2;
        java.lang.String $r3;
        org.apache.commons.logging.Log $r4;

        $r0 = <com.oreilly.struts.storefront.security.LoginAction:
java.lang.Class class$0>;
        if $r0 != null goto label3;

     label0:
        $r0 = staticinvoke <java.lang.Class: java.lang.Class forName(
java.lang.String)>("
com.oreilly.struts.storefront.framework.StorefrontBaseAction");

     label1:
        <com.oreilly.struts.storefront.security.LoginAction:
java.lang.Classclass$0> = $r0;
        goto label3;

     label2:
        $r2 := @caughtexception;
        $r1 = new java.lang.NoClassDefFoundError;
        $r3 = virtualinvoke $r2.<java.lang.Throwable:
java.lang.StringgetMessage()>();
        specialinvoke $r1.< java.lang.NoClassDefFoundError: void <init>(
java.lang.String)>($r3);
        throw $r1;

     label3:
        $r4 = staticinvoke <org.apache.commons.logging.LogFactory:
org.apache.commons.logging.Log getLog(java.lang.Class)>($r0);
        <com.oreilly.struts.storefront .security.LoginAction:
org.apache.commons.logging.Log log> = $r4;
        return;

        catch java.lang.ClassNotFoundException from label0 to label1 with
label2;
    }

    public void <init>()
    {
        com.oreilly.struts.storefront.security.LoginAction r0;

        r0 := @this: com.oreilly.struts.storefront.security.LoginAction;
        specialinvoke r0.<
com.oreilly.struts.storefront.framework.StorefrontBaseAction: void
<init>()>();
        return;
    }

    public org.apache.struts.action.ActionForward execute(
org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm,
javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse) throws java.lang.Exception
    {
        com.oreilly.struts.storefront.security.LoginAction r0;
        org.apache.struts.action.ActionMapping r1;
        org.apache.struts.action.ActionForm r2;
        javax.servlet.http.HttpServletRequest r3;
        javax.servlet.http.HttpServletResponse r4;
        java.lang.String r5, r6;
        com.oreilly.struts.storefront.service.IStorefrontService r8;
        com.oreilly.struts.storefront.customer.view.UserView r9, $r15;
        com.oreilly.struts.storefront.framework.UserContainer r10;
        com.oreilly.struts.storefront.security.LoginForm $r11, $r12;
        org.apache.struts.action.ActionServlet $r13;
        java.io.PrintStream $r14;
        org.apache.struts.action.ActionForward $r16;

        r0 := @this: com.oreilly.struts.storefront.security.LoginAction;
        r1 := @parameter0: org.apache.struts.action.ActionMapping;
        r2 := @parameter1: org.apache.struts.action.ActionForm;
        r3 := @parameter2: javax.servlet.http.HttpServletRequest;
        r4 := @parameter3: javax.servlet.http.HttpServletResponse;
        $r11 = ( com.oreilly.struts.storefront.security.LoginForm) r2;
        r5 = virtualinvoke $r11.<
com.oreilly.struts.storefront.security.LoginForm: java.lang.StringgetEmail()>();
        $r12 = (com.oreilly.struts.storefront.security.LoginForm) r2;
        r6 = virtualinvoke $r12.<
com.oreilly.struts.storefront.security.LoginForm :
java.lang.StringgetPassword()>();
        $r13 = virtualinvoke r0.<
com.oreilly.struts.storefront.security.LoginAction:
org.apache.struts.action.ActionServlet getServlet()>();
        virtualinvoke $r13.< org.apache.struts.action.ActionServlet:
javax.servlet.ServletContext getServletContext()>();
        r8 = virtualinvoke r0.<
com.oreilly.struts.storefront.security.LoginAction:
com.oreilly.struts.storefront.service.IStorefrontServicegetStorefrontService()>();
        r9 = interfaceinvoke r8.<
com.oreilly.struts.storefront.service.IStorefrontService:
com.oreilly.struts.storefront.customer.view.UserView authenticate(
java.lang.String,java.lang.String )>(r5, r6);
        r10 = virtualinvoke r0.<
com.oreilly.struts.storefront.security.LoginAction:
com.oreilly.struts.storefront.framework.UserContainer getUserContainer(
javax.servlet.http.HttpServletRequest)>(r3);
        virtualinvoke r10.<
com.oreilly.struts.storefront.framework.UserContainer: void setUserView(
com.oreilly.struts.storefront.customer.view.UserView)>(r9);
        $r14 = <java.lang.System: java.io.PrintStream out>;
        $r15 = virtualinvoke r10.<
com.oreilly.struts.storefront.framework.UserContainer:
com.oreilly.struts.storefront.customer.view.UserView getUserView()>();
        virtualinvoke $r14.<java.io.PrintStream : void println(
java.lang.Object)>($r15);
        $r16 = virtualinvoke r1.<org.apache.struts.action.ActionMapping:
org.apache.struts.action.ActionForward findForward(java.lang.String
)>("Success");
        return $r16;
    }
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20061007/b64eceec/attachment.htm


More information about the Soot-list mailing list