Permalink
Browse files

Remove hacky `constructUrlFromLocatorAndFileName` in favor of using l…

…ocator's BaseUri and ContentAccessToken
  • Loading branch information...
1 parent 75e4a80 commit 5702ea8fe08e696a43d36f6d88206bbc0b54b89e @jcookems jcookems committed Jan 11, 2013
@@ -371,8 +371,8 @@ public void cancelJob(JobInfo job) throws ServiceException {
List<AssetFileInfo> publishedFiles = service.list(AssetFile.list(asset.getAssetFilesLink()));
for (AssetFileInfo fi : publishedFiles) {
- URL file = constructUrlFromLocatorAndFileName(readLocator, fi.getName());
- ret.put(fi.getName(), file);
+ ret.put(fi.getName(),
+ new URL(readLocator.getBaseUri() + "/" + fi.getName() + readLocator.getContentAccessToken()));
}
return ret;
@@ -417,17 +417,6 @@ private InputStream getInputStreamWithRetry(URL file) throws IOException, Interr
return reader;
}
- private URL constructUrlFromLocatorAndFileName(LocatorInfo locator, String fileName) throws MalformedURLException {
- String locatorPath = locator.getPath();
- int startOfSas = locatorPath.indexOf("?");
- String blobPath = locatorPath + fileName;
- if (startOfSas >= 0) {
- blobPath = locatorPath.substring(0, startOfSas) + "/" + fileName + locatorPath.substring(startOfSas);
- }
-
- return new URL(blobPath);
- }
-
public void removeAllAssetsWithPrefix(String assetPrefix) throws ServiceException {
ListResult<LocatorInfo> locators = service.list(Locator.list());
EntityListOperation<AssetInfo> operation = Asset.list();

0 comments on commit 5702ea8

Please sign in to comment.