示例#1
0
 private void copyEntry(IInputSource source, IOutputTarget target, String entryPath)
     throws CoreException {
   try {
     InputStream in = getInputStream(source, entryPath);
     if (in != null) {
       OutputStream out = getOutputStream(target, entryPath);
       if (out != null) {
         try {
           FileUtils.transfer(in, out, true);
         } finally {
           long time = source.getEntryTime(entryPath);
           if (time >= 0) {
             target.setEntryTime(entryPath, time);
           }
           Exception e2 = checkChecksum(source, entryPath, in, null);
           if (e2 instanceof CoreException) {
             throw (CoreException) e2;
           }
         }
       }
     }
   } catch (IOException e) {
     Core.getLogger().log(e);
   } catch (CoreException e) {
     if (e.getType() == Core.ERROR_WRONG_PASSWORD || e.getType() == Core.ERROR_CANCELLATION)
       throw e;
     Core.getLogger().log(e);
   }
 }
示例#2
0
 private void loadMarkerSheet() throws IOException, CoreException {
   try {
     IMarkerSheet markerSheet =
         ((MarkerSheetBuilderImpl) Core.getMarkerSheetBuilder())
             .loadFromInputSource(source, this, new WorkbookMarkerResourceProvider(workbook));
     workbook.setMarkerSheet((MarkerSheetImpl) markerSheet);
   } catch (IOException e) {
     throw e;
   } catch (CoreException e) {
     if (e.getType() != Core.ERROR_NO_SUCH_ENTRY) throw e;
   }
 }
示例#3
0
 private void loadStyleSheet() throws IOException, CoreException {
   try {
     IStyleSheet styleSheet =
         ((StyleSheetBuilderImpl) Core.getStyleSheetBuilder()).loadFromInputSource(source, this);
     ((StyleSheetImpl) styleSheet).setManifest(manifest);
     workbook.setStyleSheet((StyleSheetImpl) styleSheet);
   } catch (IOException e) {
     throw e;
   } catch (CoreException e) {
     if (e.getType() != Core.ERROR_NO_SUCH_ENTRY) throw e;
   }
 }
示例#4
0
 private Document forceLoadXML(String entryPath) throws IOException, CoreException {
   try {
     return loadXMLFile(source, entryPath);
   } catch (Throwable e) {
     if (e instanceof CoreException) {
       CoreException coreEx = (CoreException) e;
       if (coreEx.getType() == Core.ERROR_WRONG_PASSWORD
           || coreEx.getType() == Core.ERROR_CANCELLATION) {
         throw coreEx;
       }
     }
     // in case the file is damaged,
     // try continue loading
     Core.getLogger().log(e, "Faild to load " + entryPath); // $NON-NLS-1$
     return createDocument();
   }
 }