1。同步块引起的goto: public String getMessage(Locale locale, String s) 中正确代码是什么?import java.io.InputStream;
import java.util.*;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;public class PropertyMessageResources extends MessageResources
{ private static Log _fldcase;
 private HashMap _fldbyte;
 private HashMap _fldchar;
 //static Class class$0; /* synthetic field */ public PropertyMessageResources(MessageResourcesFactory messageresourcesfactory, String s)
 {
     super(messageresourcesfactory, s);
     _fldbyte = new HashMap();
     _fldchar = new HashMap();
 } public PropertyMessageResources(MessageResourcesFactory messageresourcesfactory, String s, boolean flag)
 {
     super(messageresourcesfactory, s, flag);
     _fldbyte = new HashMap();
     _fldchar = new HashMap();
 } public String getMessage(Locale locale, String s)
 {
     String s1;
     String s4;
     boolean flag1;
     if(_fldcase.isDebugEnabled())
         _fldcase.debug("getMessage(" + locale + "," + s + ")");
     s1 = a(locale);
     s4 = a(s1, s);
     Object obj = null;
     Object obj1 = null;
     boolean flag = false;
     flag1 = false;
_L3:
     _mthif(s1);
     String s5 = a(s1, s);
     HashMap hashmap = _fldchar;
     JVM INSTR monitorenter ;//如何翻译
     String s6;
     s6 = (String)_fldchar.get(s5);
     if(s6 == null)
         break MISSING_BLOCK_LABEL_138;
     if(flag1)
         _fldchar.put(s4, s6);
     return s6;
     hashmap;
     JVM INSTR monitorexit ;
       goto _L1
     hashmap;
     JVM INSTR monitorexit ;
     throw ;
_L1:
     flag1 = true;
     int i = s1.lastIndexOf("_");
     if(i < 0)
         break; /* Loop/switch isn't completed */
     s1 = s1.substring(0, i);
     if(true) goto _L3; else goto _L2
_L2:
     if(getDefaultLocale().equals(locale)) goto _L5; else goto _L4
_L4:
     String s2 = a(getDefaultLocale());
     s5 = a(s2, s);
     _mthif(s2);
     hashmap = _fldchar;
     JVM INSTR monitorenter ;
     s6 = (String)_fldchar.get(s5);
     if(s6 == null)
         break MISSING_BLOCK_LABEL_256;
     _fldchar.put(s4, s6);
     return s6;
     hashmap;
     JVM INSTR monitorexit ;
       goto _L5
     hashmap;
     JVM INSTR monitorexit ;
     throw ;
_L5:
     String s3 = "";
     s5 = a(s3, s);
     _mthif(s3);
     hashmap = _fldchar;
     JVM INSTR monitorenter ;
     s6 = (String)_fldchar.get(s5);
     if(s6 == null)
         break MISSING_BLOCK_LABEL_327;
     _fldchar.put(s4, s6);
     return s6;
     hashmap;
     JVM INSTR monitorexit ;
       goto _L6
     hashmap;
     JVM INSTR monitorexit ;
     throw ;
_L6:
     if(getReturnNull())
         return null;
     else
         return "not found key:" + a(locale, s);
 } protected void _mthif(String s)
 {
label0:
     {
         synchronized(_fldbyte)
         {
             if(_fldbyte.get(s) == null)
                 break label0;
         }
         return;
     }
     _fldbyte.put(s, s);
     hashmap;
     JVM INSTR monitorexit ;
     String s1 = getConfig().replace('.', '/');
     if(s.length() > 0)
         s1 = s1 + "_" + s;
     s1 = s1 + ".properties";
     InputStream inputstream = null;
     Properties properties = new Properties();
     try
     {
         ClassLoader classloader = Thread.currentThread().getContextClassLoader();
         if(classloader == null)
             classloader = getClass().getClassLoader();
         inputstream = classloader.getResourceAsStream(s1);
         if(inputstream != null)
         {
             properties.load(inputstream);
             inputstream.close();
         }
     }
     catch(Throwable throwable)
     {
         _fldcase.error("loadLocale()", throwable);
         if(inputstream != null)
             try
             {
                 inputstream.close();
             }
             catch(Throwable throwable1) { }
     }
     if(properties.size() < 1)
         return;
     synchronized(_fldchar)
     {
         String s2;
         for(Enumeration enumeration = properties.keys(); enumeration.hasMoreElements(); _fldchar.put(a(s, s2), properties.getProperty(s2)))
             s2 = (String)enumeration.nextElement();     }
     return;
 } static 
 {
     _fldcase = LogFactory.getLog(com.cnhtc.web.taglib.util.RequestUtils.class);
 }
}

解决方案 »

  1.   

    2。
    //static Class class$0; /* synthetic field */正确代码是什么?
    private static void a(String s, SqlParser sqlparser, ApplicationContext applicationcontext)方法中的 obj.close();正确代码是什么?
    import java.io.*;
    import java.sql.*;
    import java.util.List;
    import javax.sql.DataSource;
    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;
    import com.cnhtc.commons.exception.BaseRuntimeException;
    import org.springframework.context.ApplicationContext;// Referenced classes of package com.cnhtc.util:
    //            SqlParserpublic class SqlExecutor
    {    private static final Log a;
        //static Class class$0; /* synthetic field */    public SqlExecutor()
        {
        }    public static void emptyTable(DataSource datasource, String s)
        {
            String s1 = "DELETE FORM " + s;
            executeSql(datasource, s1);
        }    public static void emptyTableArray(DataSource datasource, String as[])
        {
            String as1[] = new String[as.length];
            for(int i = 0; i < as.length; i++)
                as1[i] = "DELETE FROM " + as[i];        executeSqlArray(datasource, as1);
        }    public static void emptyTableList(DataSource datasource, List list)
        {
            emptyTableArray(datasource, (String[])list.toArray());
        }    public static void executeSql(DataSource datasource, String s)
        {
            Connection connection = null;
            try
            {
                connection = datasource.getConnection();
                connection.setAutoCommit(false);
                Statement statement = connection.createStatement();
                statement.executeUpdate(s);
                connection.commit();
            }
            catch(Exception exception)
            {
                a.error("执行sql出错:", exception);
                try
                {
                    if(connection != null)
                        connection.rollback();
                }
                catch(SQLException sqlexception) { }
                throw new BaseRuntimeException("执行sql出错:", exception);
            }
            finally
            {
                try
                {
                    if(connection != null)
                        connection.close();
                }
                catch(SQLException sqlexception1) { }
            }
            return;
        }    public static void executeSqlArray(DataSource datasource, String as[])
        {
            Connection connection = null;
            try
            {
                connection = datasource.getConnection();
                connection.setAutoCommit(false);
                Statement statement = connection.createStatement();
                for(int i = 0; i < as.length; i++)
                {
                    a.debug(as[i]);
                    statement.executeUpdate(as[i]);
                }            connection.commit();
            }
            catch(Exception exception)
            {
                a.error("执行sql出错:", exception);
                try
                {
                    if(connection != null)
                        connection.rollback();
                }
                catch(SQLException sqlexception) { }
                throw new BaseRuntimeException("执行sql出错:", exception);
            }
            finally
            {
                try
                {
                    if(connection != null)
                        connection.close();
                }
                catch(SQLException sqlexception1) { }
            }
            return;
        }    public static void executeSqlFile(DataSource datasource, String s)
        {
            SqlParser sqlparser = new SqlParser();
            a(s, sqlparser);
            executeSqlArray(datasource, sqlparser.getSql());
        }    public static void executeSqlFile(DataSource datasource, String s, ApplicationContext applicationcontext)
        {
            SqlParser sqlparser = new SqlParser();
            a(s, sqlparser, applicationcontext);
            executeSqlArray(datasource, sqlparser.getSql());
        }    public static void executeMoreSqlFile(DataSource datasource, String as[], ApplicationContext applicationcontext)
        {
            SqlParser sqlparser = new SqlParser();
            a(as, sqlparser, applicationcontext);
            executeSqlArray(datasource, sqlparser.getSql());
        }    public static void executeMoreSqlFile(DataSource datasource, List list, ApplicationContext applicationcontext)
        {
            executeMoreSqlFile(datasource, (String[])list.toArray(), applicationcontext);
        }    public static void executeMoreSqlFile(DataSource datasource, String as[])
        {
            SqlParser sqlparser = new SqlParser();
            a(as, sqlparser);
            executeSqlArray(datasource, sqlparser.getSql());
        }    public static void executeMoreSqlFile(DataSource datasource, List list)
        {
            executeMoreSqlFile(datasource, (String[])list.toArray());
        }    private static void a(String s, SqlParser sqlparser)
        {
            FileInputStream fileinputstream = null;
            try
            {
                a.debug(s);
                fileinputstream = new FileInputStream(s);
                sqlparser.load(fileinputstream);
            }
            catch(IOException ioexception)
            {
                a.error("解析sql文件出错:", ioexception);
                throw new BaseRuntimeException("解析sql文件出错:", ioexception);
            }
            finally
            {
                try
                {
                    if(fileinputstream != null)
                        fileinputstream.close();
                }
                catch(Exception exception1) { }
            }
            return;
        }    private static void a(String s, SqlParser sqlparser, ApplicationContext applicationcontext)
        {
            Object obj = null;
            try
            {
                sqlparser.load(applicationcontext.getResourceAsStream(s));
            }
            catch(IOException ioexception)
            {
                a.error("解析sql文件出错:", ioexception);
                throw new BaseRuntimeException("解析sql文件出错:", ioexception);
            }
            finally
            {
                try
                {
                    if(obj != null)
                        obj.close();//错误
                }
                catch(Exception exception1) { }
            }
            return;
        }    private static void a(String as[], SqlParser sqlparser)
        {
            for(int i = 0; i < as.length; i++)
                a(as[i], sqlparser);    }    private static void a(String as[], SqlParser sqlparser, ApplicationContext applicationcontext)
        {
            for(int i = 0; i < as.length; i++)
                a(as[i], sqlparser, applicationcontext);    }    static 
        {
            a = LogFactory.getLog(com.cnhtc.util.SqlExecutor.class);
        }
    }
      

  2.   

    建议用DJ Java Decompiler试试
    可读性强些
      

  3.   

    我用了DJ Java Decompiler3.8 翻译出来的基本也是这个样子,有朋友告诉我要学习JVM的知识,不知道是不是这样??