if (s == null) {
throw new NullPointerException("No null string argument allowed");
}
int pos1 = s.indexOf("::");
if (pos1 != -1) {
SiteType siteType = map.get(s.substring(0, pos1));
if (siteType != null) {
pos1 += 2;
int pos2 = s.indexOf("::", pos1);
if (pos2 != -1) {
String siteName = s.substring(pos1, pos2);
pos2 += 2;
if (pos2 > pos1 && pos2 < s.length()) {
String pageName = s.substring(pos2);
return siteType.key(siteName).page(pageName);
}
}
}
}
throw new IllegalArgumentException("Invalid page reference: " + s);