コード例 #1
0
 private void createCatalogIfRequired(RetrieveEntry rent) {
   URI curURI = null;
   String addr = rent.getEffectiveAddress();
   try {
     // check if this is the first entry and the connection was redirected. If yes, then
     // store the URI as the original URI instead of the redirected URI
     String tempStr =
         URLResourceRetriever.resolveURL(rent.getBaseAddress(), rent.getCurrentAddress());
     if (!(new URI(tempStr).equals(new URI(addr)))) {
       addr = tempStr;
     }
   } catch (URISyntaxException ex) {
     // ignore
   }
   if (isSave2SingleFolder()) {
     if (!rent.getCurrentAddress().equals(rent.getEffectiveAddress()))
       addr = rent.getCurrentAddress();
   }
   try {
     curURI = new URI(addr);
   } catch (URISyntaxException ex) {
     // this is not supposed to happen. But if it does, then just return
     return;
   }
   FileObject fobj = null;
   try {
     fobj = FileUtil.toFileObject(FileUtil.normalizeFile(rent.getSaveFile()));
   } catch (Exception e) {
     return;
   }
   if (fobj == null) return;
   CatalogWriteModel dr = null;
   try {
     if (this.catalogFileObject == null) {
       Project project = FileOwnerQuery.getOwner(fobj);
       if (project == null) {
         // See issue #176769
         // In can happen if the file was saved outside of the project
         return;
       }
       dr = CatalogWriteModelFactory.getInstance().getCatalogWriteModelForProject(fobj);
     } else {
       dr =
           CatalogWriteModelFactory.getInstance()
               .getCatalogWriteModelForCatalogFile(this.catalogFileObject);
     }
   } catch (CatalogModelException ex) {
     // ignore this exception but return
     return;
   }
   // fobj = FileUtil.toFileObject(rent.getSaveFile());
   try {
     dr.addURI(curURI, fobj);
   } catch (Exception ex) {
     // ignore this exception but return
     ex = new Exception("Exception while writing in to catalog.", ex);
     handleException(rent, ex);
     return;
   }
 }
コード例 #2
0
 private void updateDownloadedInfo(RetrieveEntry rent) {
   retrievedList.add(rent);
   OutputWriter opt = getOPOut();
   String str = "   " + rent.getEffectiveAddress();
   opt.println(
       NbBundle.getMessage(
           RetrieverEngineImpl.class,
           "MSG_retrieved_saved_at",
           str,
           rent.getSaveFile())); // NOI18N
   opt.flush();
 }