s243a

sone identity insert try/catch block

Jun 4th, 2015
633
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.25 KB | None | 0 0
  1. line 238 of https://github.com/Bombe/Sone/blob/d525d4ad65878cfd895945512650d978f6a5c034/src/main/java/net/pterodactylus/sone/core/SoneInserter.java
  2.                     try {
  3.                         sone.setStatus(SoneStatus.inserting);
  4.                         long insertTime = System.currentTimeMillis();
  5.                         insertInformation.setTime(insertTime);
  6.                         eventBus.post(new SoneInsertingEvent(sone));
  7.                         FreenetURI finalUri = freenetInterface.insertDirectory(insertInformation.getInsertUri(), insertInformation.generateManifestEntries(), "index.html");
  8.                         eventBus.post(new SoneInsertedEvent(sone, System.currentTimeMillis() - insertTime));
  9.                         /* at this point we might already be stopped. */
  10.                         if (shouldStop()) {
  11.                             /* if so, bail out, don’t change anything. */
  12.                             break;
  13.                         }
  14.                         sone.setTime(insertTime);
  15.                         sone.setLatestEdition(finalUri.getEdition());
  16.                         core.touchConfiguration();
  17.                         success = true;
  18.                         logger.log(Level.INFO, String.format("Inserted Sone “%s” at %s.", sone.getName(), finalUri));
  19.                     } catch (SoneException se1) {
  20.                         eventBus.post(new SoneInsertAbortedEvent(sone, se1));
  21.                         logger.log(Level.WARNING, String.format("Could not insert Sone “%s”!", sone.getName()), se1);
  22.                     } finally {
  23.                         sone.setStatus(SoneStatus.idle);
  24.                     }
Advertisement
Add Comment
Please, Sign In to add comment