public FreenetURI getSeednodesURI() { return updateURI.sskForUSK().setDocName( "seednodes-" + Version.buildNumber()); }
public FreenetURI getInstallerNonWindowsURI() { return updateURI.sskForUSK().setDocName( "installer-" + Version.buildNumber()); }
public FreenetURI getInstallerWindowsURI() { return updateURI.sskForUSK().setDocName( "wininstaller-" + Version.buildNumber()); }
public FreenetURI getIPv4ToCountryURI() { return updateURI.sskForUSK().setDocName( "iptocountryv4-" + Version.buildNumber()); }
private void fetchSone(Sone sone) { fetchSone(sone, sone.getRequestUri().sskForUSK()); }
if (tempURI.isUSK()) { if (errors != null) { tempURI = tempURI.sskForUSK(); errors.add("URI was an USK, converted it to SSK for you"); if (breakOnErrors) break Outer;
protected void maybeProcessOldBlob() { File oldBlob = getBlobFile(currentVersion); if(oldBlob.exists()) { File temp; try { temp = File.createTempFile(blobFilenamePrefix + availableVersion + "-", ".fblob.tmp", manager.node.clientCore.getPersistentTempDir()); } catch (IOException e) { Logger.error(this, "Unable to process old blob: "+e, e); return; } if(oldBlob.renameTo(temp)) { FreenetURI uri = URI.setSuggestedEdition(currentVersion); uri = uri.sskForUSK(); try { manager.uom.processMainJarBlob(temp, null, currentVersion, uri); } catch (Throwable t) { // Don't disrupt startup. Logger.error(this, "Unable to process old blob, caught "+t, t); } temp.delete(); } else { Logger.error(this, "Unable to rename old blob file "+oldBlob+" to "+temp+" so can't process it."); } } }
@Override public FreenetURI checkSource(String source) throws PluginNotFoundException { OfficialPluginDescription desc = node.getPluginManager().getOfficialPlugin(source); if(desc == null) throw new PluginNotFoundException("Not in the official plugins list: "+source); if(desc.uri != null) return desc.uri; else { return node.nodeUpdater.getURI().setDocName(source).setSuggestedEdition(desc.recommendedVersion).sskForUSK(); } }
@Test(expected = NullPointerException.class) public void exceptionWhileFetchingAKnownSoneDoesNotUpdateCore() { FreenetURI finalRequestUri = requestUri.sskForUSK() .setMetaString(new String[] { "sone.xml" }); when(freenetInterface.fetchUri(finalRequestUri)).thenThrow( NullPointerException.class); try { soneDownloader.fetchSoneAction(sone).run(); } finally { verify(freenetInterface).fetchUri(finalRequestUri); verifyThatSoneStatusWasChangedToDownloadingAndBackTo(idle); verify(core, never()).updateSone(any(Sone.class)); } }
@Test public void notBeingAbleToFetchAKnownSoneDoesNotUpdateCore() { FreenetURI finalRequestUri = requestUri.sskForUSK() .setMetaString(new String[] { "sone.xml" }); soneDownloader.fetchSoneAction(sone).run(); verify(freenetInterface).fetchUri(finalRequestUri); verifyThatSoneStatusWasChangedToDownloadingAndBackTo(idle); verify(core, never()).updateSone(any(Sone.class)); }
@Test public void notBeingAbleToFetchAnUnknownSoneDoesNotUpdateCore() { FreenetURI finalRequestUri = requestUri.sskForUSK() .setMetaString(new String[] { "sone.xml" }); setupSoneAsUnknown(); soneDownloader.fetchSoneAction(sone).run(); verify(freenetInterface).fetchUri(finalRequestUri); verifyThatSoneStatusWasChangedToDownloadingAndBackTo(unknown); verify(core, never()).updateSone(any(Sone.class)); }
return rcBulk; }, key.getURI().sskForUSK() /* FIXME add getSSKURI() */, fctx, RequestStarter.UPDATE_PRIORITY_CLASS, new NullBucket(), null, null); try { get.start(context);
/** * Add links to the changelog for the given version to the given node. * @param version USK edition to point to * @param node to add links to */ public synchronized void addChangelogLinks(long version, HTMLNode node) { String changelogUri = getChangelogURI().setSuggestedEdition(version).sskForUSK().toASCIIString(); String developerDetailsUri = getDeveloperChangelogURI().setSuggestedEdition(version).sskForUSK().toASCIIString(); node.addChild("a", "href", '/' + changelogUri + "?type=text/plain", NodeL10n.getBase().getString("UpdatedVersionAvailableUserAlert.changelog")); node.addChild("br"); node.addChild("a", "href", '/' + developerDetailsUri + "?type=text/plain", NodeL10n.getBase().getString("UpdatedVersionAvailableUserAlert.devchangelog")); }
@Test(expected = NullPointerException.class) public void exceptionWhileFetchingAnUnknownSoneDoesNotUpdateCore() { FreenetURI finalRequestUri = requestUri.sskForUSK() .setMetaString(new String[] { "sone.xml" }); setupSoneAsUnknown(); when(freenetInterface.fetchUri(finalRequestUri)).thenThrow(NullPointerException.class); try { soneDownloader.fetchSoneAction(sone).run(); } finally { verify(freenetInterface).fetchUri(finalRequestUri); verifyThatSoneStatusWasChangedToDownloadingAndBackTo(unknown); verify(core, never()).updateSone(any(Sone.class)); } }
FreenetURI newURI = originalURI; if(originalURI.isUSK()) newURI = newURI.sskForUSK(); InsertableClientSSK issk = InsertableClientSSK.create(newURI); newURI = issk.getURI();
FreenetURI uri2 = new FreenetURI(WANNA_SSK_1); assertEquals(uri2, uri1.sskForUSK()); assertEquals(uri1, uri2.uskForSSK()); uri2.sskForUSK(); fail("no exception throw!"); } catch (IllegalStateException e) { new FreenetURI(WANNA_CHK_1).sskForUSK(); fail("no exception throw!"); } catch (IllegalStateException e) { new FreenetURI( "SSK@5hH~39FtjA7A9~VXWtBKI~prUDTuJZURudDG0xFn3KA,GDgRGt5f6xqbmo-WraQtU54x4H~871Sho9Hz6hC-0RA,AQACAAE/Search-17XXXX/index_d51.xml") .sskForUSK(); fail("no exception throw!"); } catch (IllegalStateException e) { new FreenetURI( "SSK@5hH~39FtjA7A9~VXWtBKI~prUDTuJZURudDG0xFn3KA,GDgRGt5f6xqbmo-WraQtU54x4H~871Sho9Hz6hC-0RA,AQACAAE/Search17/index_d51.xml") .sskForUSK(); fail("no exception throw!"); } catch (IllegalStateException e) {
/** * A non-authoritative hint that a specific edition *might* exist. At the moment, * we just fetch the block. We do not fetch the contents, and it is possible that * USKFetcher's are also fetching the block. FIXME would it be more efficient to * pass it along to a USKFetcher? * @param usk * @param edition * @param context */ public void hintUpdate(USK usk, long edition, ClientContext context) { if(edition < lookupLatestSlot(usk)) return; FreenetURI uri = usk.copy(edition).getURI().sskForUSK(); final ClientGetter get = new ClientGetter(new NullClientCallback(rcBulk), uri, new FetchContext(backgroundFetchContext, FetchContext.IDENTICAL_MASK), RequestStarter.UPDATE_PRIORITY_CLASS, new NullBucket(), null, null); try { get.start(context); } catch (FetchException e) { // Ignore } }
File.createTempFile(blobFilenamePrefix + availableVersion + "-", ".fblob.tmp", manager.node.clientCore.getPersistentTempDir()); FreenetURI uri = URI.setSuggestedEdition(availableVersion); uri = uri.sskForUSK(); cg = new ClientGetter(this, uri, ctx, RequestStarter.IMMEDIATE_SPLITFILE_PRIORITY_CLASS,
if(uri.isUSK()) uri = uri.sskForUSK(); if(logMINOR) Logger.minor(this, "Doing hint fetch for "+uri); final ClientGetter get = new ClientGetter(new ClientGetCallback() {
/** * A non-authoritative hint that a specific edition *might* exist. At the moment, * we just fetch the block. We do not fetch the contents, and it is possible that * USKFetcher's are also fetching the block. FIXME would it be more efficient to * pass it along to a USKFetcher? * @param context * @throws MalformedURLException If the uri passed in is not a USK. */ public void hintUpdate(FreenetURI uri, ClientContext context, short priority) throws MalformedURLException { if(uri.getSuggestedEdition() < lookupLatestSlot(USK.create(uri))) { if(logMINOR) Logger.minor(this, "Ignoring hint because edition is "+uri.getSuggestedEdition()+" but latest is "+lookupLatestSlot(USK.create(uri))); return; } uri = uri.sskForUSK(); if(logMINOR) Logger.minor(this, "Doing hint fetch for "+uri); final ClientGetter get = new ClientGetter(new NullClientCallback(rcBulk), uri, new FetchContext(backgroundFetchContext, FetchContext.IDENTICAL_MASK), priority, new NullBucket(), null, null); try { get.start(context); } catch (FetchException e) { if(logMINOR) Logger.minor(this, "Cannot start hint fetch for "+uri+" : "+e, e); // Ignore } }