@Override
 public void getRevisionFile(File originalFile, File revisionFile) {
   assert originalFile != null;
   if (originalFile == null) {
     LocalHistory.LOG.log(
         Level.FINE, "revision {0} requested for null file", se.getDate().getTime()); // NOI18N
     return;
   }
   LocalHistory.LOG.log(
       Level.FINE,
       "revision {0} requested for file {1}",
       new Object[] {se.getDate().getTime(), originalFile.getAbsolutePath()}); // NOI18N
   try {
     // we won't use the member store entry as that might have been
     // set for e.g. a stored .form while this is the according .java
     // file beeing requested. In case the storage can't find a revision it
     // returns the next nearest in time
     long ts = se.getTimestamp();
     StoreEntry storeEntry =
         LocalHistory.getInstance().getLocalHistoryStore().getStoreEntry(originalFile, ts);
     if (storeEntry != null) {
       FileUtils.copy(storeEntry.getStoreFileInputStream(), revisionFile);
     } else {
       LocalHistory.LOG.log(
           Level.WARNING,
           "No entry in Local History for file {0} {1} {2}",
           new Object[] {originalFile, new Date(ts), ts}); // NOI18N
     }
   } catch (IOException e) {
     LocalHistory.LOG.log(
         Level.WARNING,
         "Error while retrieving history for file {0} stored as {1}",
         new Object[] {se.getFile(), se.getStoreFile()}); // NOI18N
   }
 }
Ejemplo n.º 2
0
 @Override
 protected void setUp() throws Exception {
   super.setUp();
   System.setProperty("netbeans.localhistory.storeChangesAsynchronously", "true");
   cleanUpDataFolder();
   LocalHistoryTestStore store = createStore();
   store.cleanUp(1);
   store.getReleasedLocks().clear();
   dataDir = new File(getDataDir(), getName());
   FileUtils.deleteRecursively(dataDir);
 }