no error message about missing browser in headless environments

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7832 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 14 years ago
parent d3c89b90ce
commit 9eb8e9acd9

@ -28,7 +28,6 @@ package net.yacy;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
//import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@ -56,7 +55,6 @@ import net.yacy.cora.storage.ScoreMap;
import net.yacy.gui.YaCyApp;
import net.yacy.gui.framework.Browser;
import net.yacy.kelondro.blob.MapDataMining;
//import net.yacy.kelondro.data.meta.DigestURI;
import net.yacy.kelondro.data.meta.URIMetadataRow;
import net.yacy.kelondro.data.word.Word;
import net.yacy.kelondro.data.word.WordReference;
@ -69,23 +67,18 @@ import net.yacy.kelondro.util.FileUtils;
import net.yacy.kelondro.util.Formatter;
import net.yacy.kelondro.util.MemoryControl;
import net.yacy.kelondro.util.OS;
//import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
import de.anomic.data.Translator;
//import de.anomic.http.client.Client;
import de.anomic.http.server.HTTPDemon;
//import de.anomic.http.server.ResponseContainer;
import de.anomic.search.MetadataRepository;
import de.anomic.search.Segment;
import de.anomic.search.Switchboard;
import de.anomic.search.SwitchboardConstants;
import de.anomic.server.serverCore;
import de.anomic.tools.enumerateFiles;
import de.anomic.yacy.yacySeedDB;
import de.anomic.yacy.Tray;
import de.anomic.yacy.yacyBuildProperties;
import de.anomic.yacy.yacyRelease;
import de.anomic.yacy.yacySeedDB;
import de.anomic.yacy.yacyVersion;
/**
@ -148,7 +141,7 @@ public final class yacy {
* @param homePath Root-path where all information is to be found.
* @param startupFree free memory at startup time, to be used later for statistics
*/
private static void startup(final File dataHome, final File appHome, final long startupMemFree, final long startupMemTotal, boolean gui) {
private static void startup(final File dataHome, final File appHome, final long startupMemFree, final long startupMemTotal, final boolean gui) {
try {
// start up
System.out.println(copyright);
@ -203,7 +196,7 @@ public final class yacy {
}
if(!f.createNewFile())
Log.logSevere("STARTUP", "WARNING: the file " + f + " can not be created!");
try { new FileOutputStream(f).write(Integer.toString(OS.getPID()).getBytes()); } catch (Exception e) { } // write PID
try { new FileOutputStream(f).write(Integer.toString(OS.getPID()).getBytes()); } catch (final Exception e) { } // write PID
f.deleteOnExit();
final String oldconf = "DATA/SETTINGS/httpProxy.conf".replace("/", File.separator);
@ -230,10 +223,10 @@ public final class yacy {
int oldRev;
try {
oldRev = Integer.parseInt(sb.getConfig("svnRevision", "0"));
} catch (NumberFormatException e) {
} catch (final NumberFormatException e) {
oldRev = 0;
}
int newRev = Integer.parseInt(yacyBuildProperties.getSVNRevision());
final int newRev = Integer.parseInt(yacyBuildProperties.getSVNRevision());
sb.setConfig("svnRevision", yacyBuildProperties.getSVNRevision());
sb.setConfig("applicationRoot", appHome.toString());
sb.setConfig("dataRoot", dataHome.toString());
@ -313,8 +306,9 @@ public final class yacy {
//boolean properPW = (sb.getConfig("adminAccount", "").length() == 0) && (sb.getConfig(httpd.ADMIN_ACCOUNT_B64MD5, "").length() > 0);
//if (!properPW) browserPopUpPage = "ConfigBasic.html";
Browser.openBrowser((server.withSSL()?"https":"http") + "://localhost:" + serverCore.getPortNr(port) + "/" + browserPopUpPage);
} catch (RuntimeException e) {
Log.logException(e);
} catch (final RuntimeException e) {
// cannot open browser. This may be normal in headless environments
//Log.logException(e);
}
// unlock yacyTray browser popup
@ -327,11 +321,11 @@ public final class yacy {
final File[] locale_source_files = locale_source.listFiles();
mkdirsIfNeseccary(locale_work);
File target;
for (int i=0; i < locale_source_files.length; i++){
target = new File(locale_work, locale_source_files[i].getName());
if (locale_source_files[i].getName().endsWith(".lng")) {
for (final File locale_source_file : locale_source_files) {
target = new File(locale_work, locale_source_file.getName());
if (locale_source_file.getName().endsWith(".lng")) {
if (target.exists()) delete(target);
FileUtils.copy(locale_source_files[i], target);
FileUtils.copy(locale_source_file, target);
}
}
Log.logInfo("STARTUP", "Copied the default locales to " + locale_work.toString());
@ -426,13 +420,13 @@ public final class yacy {
shutdownSemaphore.release(1000);
try {
System.exit(0);
} catch (Exception e) {} // was once stopped by de.anomic.net.ftpc$sm.checkExit(ftpc.java:1790)
} catch (final Exception e) {} // was once stopped by de.anomic.net.ftpc$sm.checkExit(ftpc.java:1790)
}
/**
* @param f
*/
private static void delete(File f) {
private static void delete(final File f) {
if(!f.delete())
Log.logSevere("STARTUP", "WARNING: the file " + f + " can not be deleted!");
}
@ -492,7 +486,7 @@ public final class yacy {
if(fis != null) {
try {
fis.close();
} catch (IOException e) {
} catch (final IOException e) {
Log.logException(e);
}
}
@ -521,7 +515,7 @@ public final class yacy {
submitURL(homePath, "ConfigUpdate_p.html?autoUpdate=", "Update YaCy to most recent version");
}
private static void submitURL(final File homePath, String path, String processdescription) {
private static void submitURL(final File homePath, final String path, final String processdescription) {
final Properties config = configuration("COMMAND-STEERING", homePath);
// read port
@ -569,7 +563,7 @@ public final class yacy {
try {
HTTPClient.closeConnectionManager();
} catch (InterruptedException e) {
} catch (final InterruptedException e) {
e.printStackTrace();
}
@ -892,8 +886,8 @@ public final class yacy {
final File yacyDBPath = new File(homePath, "DATA/INDEX/freeworld/NETWORK");
final String[] dbFileNames = {"seed.new.db","seed.old.db","seed.pot.db"};
for (int i=0; i < dbFileNames.length; i++) {
final File dbFile = new File(yacyDBPath,dbFileNames[i]);
for (final String dbFileName : dbFileNames) {
final File dbFile = new File(yacyDBPath,dbFileName);
final MapDataMining db = new MapDataMining(dbFile, Word.commonHashLength, Base64Order.enhancedCoder, 1024 * 512, 500, yacySeedDB.sortFields, yacySeedDB.longaccFields, yacySeedDB.doubleaccFields, null);
MapDataMining.mapIterator it;
@ -907,7 +901,7 @@ public final class yacy {
final String peerPort = dna.get("Port");
while (peerHash.length() < Word.commonHashLength) { peerHash = peerHash + "_"; }
System.err.println("Invalid Peer-Hash found in '" + dbFileNames[i] + "': " + peerName + ":" + peerHash + ", http://" + peerIP + ":" + peerPort);
System.err.println("Invalid Peer-Hash found in '" + dbFileName + "': " + peerName + ":" + peerHash + ", http://" + peerIP + ":" + peerPort);
}
}
db.close();
@ -950,7 +944,7 @@ public final class yacy {
if (args.length >= 1 && args[0].toLowerCase().equals("-gui")) headless = false;
System.setProperty("java.awt.headless", headless ? "true" : "false");
String s = ""; for (String a: args) s += a + " ";
String s = ""; for (final String a: args) s += a + " ";
yacyRelease.startParameter = s.trim();
File applicationRoot = new File(System.getProperty("user.dir").replace('\\', '/'));

Loading…
Cancel
Save