in remoting/ide/api/src/org/netbeans/modules/jackpot30/remotingapi/options/CustomizeRemoteIndex.java [451:554]
public void run() {
String localFolder = checkingIndexFolderContentCopy.get();
if (!localFolder.isEmpty()) {
checkingIndexAgainstFolder.set(true);
checkingIndexURLWarning.set(null);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
updateErrors();
}
});
String urlText = indexInfoURLContentCopy.get();
String subIndex = indexInfoSubIndexCopy.get();
URL folderURL = Utils.fromDisplayName(localFolder);
FileObject folder = URLMapper.findFileObject(folderURL);
try {
if (folder != null) {
Collection<? extends String> random = indexRandomFiles.get();
if (random == null) {
URL url = new URL(urlText);
if (!url.getPath().endsWith("/"))
url = new URL(url.getProtocol(), url.getHost(), url.getPort(), url.getPath() + "/" + (url.getQuery() != null ? "?" + url.getQuery() : ""));
indexRandomFiles.set(random = WebUtilities.requestStringArrayResponse(url.toURI().resolve("source/randomfiles?path=" + WebUtilities.escapeForQuery(subIndex))));
}
if (!random.isEmpty()) {
boolean found = matches(folder, random);
if (!found) {
if (folder.getParent() != null && matches(folder.getParent(), random)) {
checkingIndexURLWarning.set("The given folder is unlikely to match the index content, parent folder does.");
} else {
StringBuilder matchingChildren = new StringBuilder();
for (FileObject c : folder.getChildren()) {
if (matches(c, random)) {
if (matchingChildren.length() > 0) matchingChildren.append(", ");
matchingChildren.append(c.getName());
}
}
if (matchingChildren.length() > 0) {
checkingIndexURLWarning.set("The given folder is unlikely to match the index content, subfolders: " + matchingChildren.toString() + " do.");
} else {
checkingIndexURLWarning.set("The given folder is unlikely to match the index content.");
}
}
}
} else {
//no random files? ignoring for now...
}
}
} catch (URISyntaxException ex) {
checkingIndexURLError.set(ex.getLocalizedMessage());
} catch (MalformedURLException ex) {
checkingIndexURLError.set(ex.getLocalizedMessage());
} catch (ThreadDeath td) {
throw td;
} catch (Throwable t) {//#6541019
checkingIndexURLError.set("Invalid URL");
} finally {
checkingIndexAgainstFolder.set(false);
}
}
//XXX: the index currently does not provide the info anyway...
// IndexInfo info = null;
//
// try {
// URL url = new URL(urlText);
//
// if (!url.getPath().endsWith("/"))
// url = new URL(url.getProtocol(), url.getHost(), url.getPort(), url.getPath() + "/" + (url.getQuery() != null ? "?" + url.getQuery() : ""));
//
// String indexInfoText = WebUtilities.requestStringResponse(url.toURI().resolve("info?path=" + WebUtilities.escapeForQuery(subIndex)));
// info = IndexInfo.empty();
//
// if (indexInfoText != null)
// Pojson.update(info, indexInfoText);
// } catch (URISyntaxException ex) {
// Logger.getLogger(CustomizeRemoteIndex.class.getName()).log(Level.FINE, null, ex);
// } catch (MalformedURLException ex) {
// Logger.getLogger(CustomizeRemoteIndex.class.getName()).log(Level.FINE, null, ex);
// }
//
// final IndexInfo infoFinal = info;
//
SwingUtilities.invokeLater(new Runnable() {
public void run() {
updateErrors();
// if (infoFinal != null) {
// indexInfo.setText(toDisplayText(infoFinal));
// } else {
// indexInfo.setText("");
// }
}
});
}