Upload correct code

This commit is contained in:
Victor Shcherb 2012-04-04 00:01:30 +02:00
parent 5d9b91154a
commit cebe5401c0
2 changed files with 18 additions and 30 deletions

View file

@ -12,6 +12,7 @@ import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import net.osmand.LogUtil;
@ -29,28 +30,11 @@ public class DownloaderIndexFromGoogleCode {
* @throws IOException
*/
public static void main(String[] args) throws URISyntaxException, IOException {
// Map<String, String> files = DownloaderIndexFromGoogleCode.getContent(new LinkedHashMap<String, String>(),
// BINARY_MAP_VERSION + BINARY_MAP_INDEX_EXT,
// BINARY_MAP_VERSION + BINARY_MAP_INDEX_EXT_ZIP,
// VOICE_VERSION + VOICE_INDEX_EXT_ZIP);
// for(String s : files.keySet()){
// System.out.println(s + " " + files.get(s)); //$NON-NLS-1$
// }
// String odb = ""; //$NON-NLS-1$
// put your cookies and personal information for delete
// String cookieHSID = ""; //$NON-NLS-1$
// String cookieSID = ""; //$NON-NLS-1$
// String pagegen = ""; //$NON-NLS-1$
// String token = ""; //$NON-NLS-1$
//
// for(String odb : indexFiles.keySet()){
// System.out.println("DELETING " + odb);
// deleteFileFromGoogleDownloads(odb, token, pagegen, cookieHSID,cookieSID);
// }
// System.out.println("DELETED " + indexFiles.size());
Map<String, String> files = DownloaderIndexFromGoogleCode.getContent(new LinkedHashMap<String, String>(),
".zip");
for(String s : files.keySet()){
System.out.println(s + " " + files.get(s)); //$NON-NLS-1$
}
}
@ -103,12 +87,10 @@ public class DownloaderIndexFromGoogleCode {
int i = content.indexOf(ext, 0);
if (i != -1) {
int j = i - 1;
while (content.charAt(j) == '_' || Character.isLetterOrDigit(content.charAt(j)) || content.charAt(j) == '-') {
while (content.charAt(j) == '_' || Character.isLetterOrDigit(content.charAt(j)) || content.charAt(j) == '-' || content.charAt(j) == '.') {
j--;
}
if (content.substring(j + 1, i).endsWith("_")) { //$NON-NLS-1$
prevFile = content.substring(j + 1, i) + ext;
}
}
if (prevFile != null && ((i = content.indexOf('{')) != -1)) {

View file

@ -82,6 +82,10 @@ public class IndexUploader {
super(message);
}
public IndexUploadException(String message, Throwable e) {
super(message, e);
}
}
/**
@ -281,13 +285,15 @@ public class IndexUploader {
log.info("About to delete files from googlecode");
Map<String, String> files = DownloaderIndexFromGoogleCode.getIndexFiles(new LinkedHashMap<String, String>());
for (String f : files.keySet()) {
System.out.println("File on googlecode " + f + " " + files.get(f));
if (deleteFileFilter.patternMatches(f)) {
log.info("About to delete " + f);
try {
DownloaderIndexFromGoogleCode.deleteFileFromGoogleDownloads(f, ((UploadToGoogleCodeCredentials)uploadCredentials).ggtokens);
} catch (IOException e) {
throw new IndexUploadException("Delete " + f + " was failed", e);
}
}
}
//DownloaderIndexFromGoogleCode.deleteFileFromGoogleDownloads(f.getName(), ((UploadToGoogleCodeCredentials)uploadCredentials).ggtokens);
} else {
log.error("Delete file filter is not supported with this credentions (method) " + uploadCredentials);
}