Search in sources :

Example 11 with ServiceException

use of jp.ossc.nimbus.lang.ServiceException in project nimbus by nimbus-org.

the class CashedClassLoader method setupJarPropList.

/**
 * Jarファイルからクラス名の抽出を行う.
 * @param item
 */
protected void setupJarPropList(URL item) {
    String dirPath = StringOperator.replaceString(item.getFile(), C_BK_SRASH, C_SRASH);
    JarFile jar;
    try {
        jar = new JarFile(dirPath);
    } catch (IOException e) {
        // $NON-NLS-1$//$NON-NLS-2$
        throw new ServiceException("CASHCLASSLODER001", "IOException filename = " + dirPath, e);
    }
    for (Enumeration enumeration = jar.entries(); enumeration.hasMoreElements(); ) {
        ZipEntry entry = (ZipEntry) enumeration.nextElement();
        String name = entry.getName();
        if (name.endsWith(C_CLASS_EXT)) {
            name = StringOperator.replaceString(name, C_SRASH, C_DOT);
            // name = name.substring(1,name.length()-C_CLASS_EXT.length()) ;
            // 2003.11.13 Hirokado 1→0変更
            name = name.substring(0, name.length() - C_CLASS_EXT.length());
            Class cls = null;
            try {
                cls = this.loadClass(name);
            } catch (ClassNotFoundException e) {
                // $NON-NLS-1$//$NON-NLS-2$
                throw new ServiceException("CASHCLASSLODER002", "ClassNotFoundException clsename = " + name, e);
            }
            mClassHash.put(name, cls);
        }
    }
}
Also used : Enumeration(java.util.Enumeration) ServiceException(jp.ossc.nimbus.lang.ServiceException) ZipEntry(java.util.zip.ZipEntry) IOException(java.io.IOException) JarFile(java.util.jar.JarFile)

Aggregations

ServiceException (jp.ossc.nimbus.lang.ServiceException)11 JarFile (java.util.jar.JarFile)4 IOException (java.io.IOException)3 Date (java.util.Date)3 BeanFlowInvoker (jp.ossc.nimbus.service.beancontrol.interfaces.BeanFlowInvoker)3 File (java.io.File)2 FileInputStream (java.io.FileInputStream)2 Enumeration (java.util.Enumeration)2 ZipEntry (java.util.zip.ZipEntry)2 ExtentionFileFilter (jp.ossc.nimbus.io.ExtentionFileFilter)2 RecurciveSearchFile (jp.ossc.nimbus.io.RecurciveSearchFile)2 ArrayProperties (jp.ossc.nimbus.util.ArrayProperties)2 FileNotFoundException (java.io.FileNotFoundException)1 InputStream (java.io.InputStream)1 ParseException (java.text.ParseException)1 SimpleDateFormat (java.text.SimpleDateFormat)1 ListIterator (java.util.ListIterator)1 CsvArrayList (jp.ossc.nimbus.util.CsvArrayList)1