mirror of
https://github.com/yacy/yacy_search_server.git
synced 2025-07-19 08:44:42 -04:00
Corrected access to Load_MediawikiWiki.html and Load_PHPBB3.html
A NullPointerException occured when trying to access theses pages in Robinson (Search portal) mode
This commit is contained in:
@ -24,6 +24,8 @@
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import net.yacy.cora.protocol.RequestHeader;
|
||||
import net.yacy.search.Switchboard;
|
||||
import net.yacy.search.SwitchboardConstants;
|
||||
@ -38,10 +40,16 @@ public class Load_MediawikiWiki {
|
||||
final serverObjects prop = new serverObjects();
|
||||
|
||||
// define visible variables
|
||||
String a = sb.peers.mySeed().getPublicAddress(sb.peers.mySeed().getIP());
|
||||
if (a == null) a = "localhost:" + sb.getLocalPort();
|
||||
final boolean intranet = sb.getConfig(SwitchboardConstants.NETWORK_NAME, "").equals("intranet");
|
||||
final String repository = "http://" + a + "/repository/";
|
||||
String a;
|
||||
Set<String> ips = sb.peers.mySeed().getIPs();
|
||||
/* There may eventually have no registered ip in mySeed, for example in Robinson mode : this shouldn't prevent crawling a MediaWiki */
|
||||
if(ips != null && !ips.isEmpty()) {
|
||||
a = sb.peers.mySeed().getPublicAddress(ips.iterator().next());
|
||||
} else {
|
||||
a = "localhost:" + sb.getLocalPort();
|
||||
}
|
||||
final boolean intranet = sb.getConfig(SwitchboardConstants.NETWORK_NAME, "").equals("intranet");
|
||||
final String repository = "http://" + a + "/repository/";
|
||||
prop.put("starturl", (intranet) ? repository : "http://");
|
||||
prop.put("address", a);
|
||||
|
||||
|
@ -24,6 +24,8 @@
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import net.yacy.cora.protocol.RequestHeader;
|
||||
import net.yacy.search.Switchboard;
|
||||
import net.yacy.search.SwitchboardConstants;
|
||||
@ -38,8 +40,14 @@ public class Load_PHPBB3 {
|
||||
final serverObjects prop = new serverObjects();
|
||||
|
||||
// define visible variables
|
||||
String a = sb.peers.mySeed().getPublicAddress(sb.peers.mySeed().getIP());
|
||||
if (a == null) a = "localhost:" + sb.getLocalPort();
|
||||
String a;
|
||||
Set<String> ips = sb.peers.mySeed().getIPs();
|
||||
/* There may eventually have no registered ip in mySeed, for example in Robinson mode : this shouldn't prevent crawling a MediaWiki */
|
||||
if(ips != null && !ips.isEmpty()) {
|
||||
a = sb.peers.mySeed().getPublicAddress(ips.iterator().next());
|
||||
} else {
|
||||
a = "localhost:" + sb.getLocalPort();
|
||||
}
|
||||
final boolean intranet = sb.getConfig(SwitchboardConstants.NETWORK_NAME, "").equals("intranet");
|
||||
final String repository = "http://" + a + "/repository/";
|
||||
prop.put("starturl", (intranet) ? repository : "http://");
|
||||
|
Reference in New Issue
Block a user