コード例 #1
0
 public static Object readData(String filePath) {
   Object result = null;
   try {
     filePath = StringUtil.checkFullPathLength(filePath);
     FileLockManager.startFileRead(filePath);
     if (isValid(filePath)) {
       FileInputStream os = new FileInputStream(filePath);
       XMLDecoder decoder = new XMLDecoder(os);
       decoder.setExceptionListener(
           new ExceptionListener() {
             public void exceptionThrown(Exception exception) {
               log.error("readData(): error", exception);
             }
           });
       result = decoder.readObject();
       decoder.close();
     }
   } catch (java.io.FileNotFoundException fnfe) {
     log.trace("readData(): file not found exception, filePath=" + filePath);
   } catch (Error e) {
     log.error("readData(): error, filePath=" + filePath, e);
   } catch (Exception e) {
     log.error("readData(): exception, filePath=" + filePath, e);
   } finally {
     FileLockManager.endFileRead(filePath);
   }
   return result;
 }