using com.google.common.io.Files instead of homebrew methods

pull/1/head
Michael Peter Christen 13 years ago
parent a5eb91fa60
commit b9d42fd9c8

@ -50,7 +50,7 @@
<classpathentry kind="lib" path="lib/log4j-over-slf4j-1.6.1.jar"/> <classpathentry kind="lib" path="lib/log4j-over-slf4j-1.6.1.jar"/>
<classpathentry kind="lib" path="lib/commons-lang-2.6.jar"/> <classpathentry kind="lib" path="lib/commons-lang-2.6.jar"/>
<classpathentry kind="lib" path="lib/lucene-core-3.6.0.jar"/> <classpathentry kind="lib" path="lib/lucene-core-3.6.0.jar"/>
<classpathentry kind="lib" path="lib/apache-solr-solrj-3.6.0.jar"/> <classpathentry kind="lib" path="lib/apache-solr-solrj-3.6.0.jar" sourcepath="/Volumes/Raptor/Data/workspace1/apache-solr-3.6.0/src/java"/>
<classpathentry kind="lib" path="lib/lucene-phonetic-3.6.0.jar"/> <classpathentry kind="lib" path="lib/lucene-phonetic-3.6.0.jar"/>
<classpathentry kind="lib" path="lib/lucene-spatial-3.6.0.jar"/> <classpathentry kind="lib" path="lib/lucene-spatial-3.6.0.jar"/>
<classpathentry kind="lib" path="lib/lucene-spellchecker-3.6.0.jar"/> <classpathentry kind="lib" path="lib/lucene-spellchecker-3.6.0.jar"/>
@ -65,6 +65,6 @@
<classpathentry kind="lib" path="lib/sax-2.0.1.jar"/> <classpathentry kind="lib" path="lib/sax-2.0.1.jar"/>
<classpathentry kind="lib" path="lib/arq-2.8.7.jar"/> <classpathentry kind="lib" path="lib/arq-2.8.7.jar"/>
<classpathentry kind="lib" path="lib/iri-0.8.jar"/> <classpathentry kind="lib" path="lib/iri-0.8.jar"/>
<classpathentry kind="lib" path="lib/apache-solr-core-3.6.0.jar" sourcepath="/Users/admin/git/lucene-solr/solr/core/src/java/"/> <classpathentry kind="lib" path="lib/apache-solr-core-3.6.0.jar" sourcepath="/Volumes/Raptor/Data/workspace1/apache-solr-3.6.0/src/java"/>
<classpathentry kind="output" path="gen"/> <classpathentry kind="output" path="gen"/>
</classpath> </classpath>

@ -258,14 +258,6 @@
<target name="compile" depends="compile-core" description="compile YaCy core and YaCy servlets"> <target name="compile" depends="compile-core" description="compile YaCy core and YaCy servlets">
<!-- defining the classpath that should be used for compiling -->
<path id="project.class.path">
<pathelement location="${build}" />
<pathelement location="${htroot}" />
<pathelement location="${lib}/arq-2.8.7.jar" />
<pathelement location="${lib}/jena-2.6.4.jar" />
</path>
<!-- compile htroot, htroot/yacy and htroot/htdocsdefault --> <!-- compile htroot, htroot/yacy and htroot/htdocsdefault -->
<javac srcdir="${htroot}/" <javac srcdir="${htroot}/"
excludes="processing/**" excludes="processing/**"

@ -39,9 +39,11 @@ import net.yacy.cora.document.UTF8;
import net.yacy.cora.protocol.HeaderFramework; import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader; import net.yacy.cora.protocol.RequestHeader;
import net.yacy.kelondro.logging.Log; import net.yacy.kelondro.logging.Log;
import net.yacy.kelondro.util.FileUtils;
import net.yacy.peers.Network; import net.yacy.peers.Network;
import net.yacy.search.Switchboard; import net.yacy.search.Switchboard;
import com.google.common.io.Files;
import de.anomic.data.BlogBoard; import de.anomic.data.BlogBoard;
import de.anomic.data.BlogBoard.BlogEntry; import de.anomic.data.BlogBoard.BlogEntry;
import de.anomic.data.BlogBoardComments; import de.anomic.data.BlogBoardComments;
@ -53,7 +55,7 @@ import de.anomic.server.serverSwitch;
public class BlogComments { public class BlogComments {
private static final String DEFAULT_PAGE = "blog_default"; private static final String DEFAULT_PAGE = "blog_default";
public static String dateString(final Date date) { public static String dateString(final Date date) {
return Blog.dateString(date); return Blog.dateString(date);
} }
@ -142,7 +144,7 @@ public class BlogComments {
final File notifierSource = new File(sb.getAppPath(), sb.getConfig("htRootPath","htroot") + "/env/grafics/message.gif"); final File notifierSource = new File(sb.getAppPath(), sb.getConfig("htRootPath","htroot") + "/env/grafics/message.gif");
final File notifierDest = new File(sb.getDataPath("htDocsPath", "DATA/HTDOCS"), "notifier.gif"); final File notifierDest = new File(sb.getDataPath("htDocsPath", "DATA/HTDOCS"), "notifier.gif");
try { try {
FileUtils.copy(notifierSource, notifierDest); Files.copy(notifierSource, notifierDest);
} catch (final IOException e) { } catch (final IOException e) {
Log.logSevere("MESSAGE", "NEW MESSAGE ARRIVED! (error: " + e.getMessage() + ")"); Log.logSevere("MESSAGE", "NEW MESSAGE ARRIVED! (error: " + e.getMessage() + ")");

@ -1,4 +1,4 @@
// ConfigAppearance_p.java // ConfigAppearance_p.java
// ----------------------- // -----------------------
// part of YaCy // part of YaCy
// (C) by Michael Peter Christen; mc@yacy.net // (C) by Michael Peter Christen; mc@yacy.net
@ -14,7 +14,7 @@
//$LastChangedBy$ //$LastChangedBy$
// //
// LICENSE // LICENSE
// //
// This program is free software; you can redistribute it and/or modify // This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or // the Free Software Foundation; either version 2 of the License, or
@ -34,6 +34,7 @@ import java.io.File;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -44,9 +45,10 @@ import net.yacy.kelondro.data.meta.DigestURI;
import net.yacy.kelondro.util.FileUtils; import net.yacy.kelondro.util.FileUtils;
import net.yacy.search.Switchboard; import net.yacy.search.Switchboard;
import com.google.common.io.Files;
import de.anomic.server.serverObjects; import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch; import de.anomic.server.serverSwitch;
import java.util.Collections;
public class ConfigAppearance_p { public class ConfigAppearance_p {
@ -77,7 +79,7 @@ public class ConfigAppearance_p {
if (skinFiles.contains(selectedSkin)) { if (skinFiles.contains(selectedSkin)) {
changeSkin(sb, skinPath, selectedSkin); changeSkin(sb, skinPath, selectedSkin);
} }
} }
if (post.containsKey("delete_button")) { if (post.containsKey("delete_button")) {
@ -91,7 +93,7 @@ public class ConfigAppearance_p {
FileUtils.deletedelete(skinfile); FileUtils.deletedelete(skinfile);
} }
} }
if (post.containsKey("install_button")) { if (post.containsKey("install_button")) {
// load skin from URL // load skin from URL
final String url = post.get("url"); final String url = post.get("url");
@ -112,7 +114,7 @@ public class ConfigAppearance_p {
while (it.hasNext()) { while (it.hasNext()) {
bw.write(it.next() + "\n"); bw.write(it.next() + "\n");
} }
bw.close(); bw.close();
} catch (final IOException e) { } catch (final IOException e) {
prop.put("status", "2");// error saving the skin prop.put("status", "2");// error saving the skin
@ -148,7 +150,7 @@ public class ConfigAppearance_p {
} }
prop.put("skinlist", count); prop.put("skinlist", count);
prop.putHTML("currentskin", env.getConfig("currentSkin", "default")); prop.putHTML("currentskin", env.getConfig("currentSkin", "default"));
// write colors from generic skin // write colors from generic skin
Iterator<String> i = env.configKeys(); Iterator<String> i = env.configKeys();
while (i.hasNext()) { while (i.hasNext()) {
@ -165,7 +167,7 @@ public class ConfigAppearance_p {
styleFile.getParentFile().mkdirs(); styleFile.getParentFile().mkdirs();
try { try {
FileUtils.copy(skinFile, styleFile); Files.copy(skinFile, styleFile);
sb.setConfig("currentSkin", skin.substring(0, skin.length() - 4)); sb.setConfig("currentSkin", skin.substring(0, skin.length() - 4));
return true; return true;
} catch (final IOException e) { } catch (final IOException e) {

@ -1,4 +1,4 @@
// Messages_p.java // Messages_p.java
// ----------------------- // -----------------------
// part of the AnomicHTTPD caching proxy // part of the AnomicHTTPD caching proxy
// (C) by Michael Peter Christen; mc@yacy.net // (C) by Michael Peter Christen; mc@yacy.net
@ -35,10 +35,11 @@ import java.util.TreeMap;
import net.yacy.cora.document.UTF8; import net.yacy.cora.document.UTF8;
import net.yacy.cora.protocol.HeaderFramework; import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader; import net.yacy.cora.protocol.RequestHeader;
import net.yacy.kelondro.util.FileUtils;
import net.yacy.peers.Seed; import net.yacy.peers.Seed;
import net.yacy.search.Switchboard; import net.yacy.search.Switchboard;
import com.google.common.io.Files;
import de.anomic.data.MessageBoard; import de.anomic.data.MessageBoard;
import de.anomic.server.serverObjects; import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch; import de.anomic.server.serverSwitch;
@ -98,7 +99,7 @@ public class Messages_p {
final File notifierSource = new File(sb.getAppPath(), sb.getConfig("htRootPath", "htroot") + "/env/grafics/empty.gif"); final File notifierSource = new File(sb.getAppPath(), sb.getConfig("htRootPath", "htroot") + "/env/grafics/empty.gif");
final File notifierDest = new File(sb.getDataPath("htDocsPath", "DATA/HTDOCS"), "notifier.gif"); final File notifierDest = new File(sb.getDataPath("htDocsPath", "DATA/HTDOCS"), "notifier.gif");
try { try {
FileUtils.copy(notifierSource, notifierDest); Files.copy(notifierSource, notifierDest);
} catch (final IOException e) { } catch (final IOException e) {
} }

@ -40,11 +40,13 @@ import net.yacy.cora.protocol.Domains;
import net.yacy.cora.protocol.HeaderFramework; import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader; import net.yacy.cora.protocol.RequestHeader;
import net.yacy.kelondro.logging.Log; import net.yacy.kelondro.logging.Log;
import net.yacy.kelondro.util.FileUtils;
import net.yacy.peers.Seed;
import net.yacy.peers.Protocol;
import net.yacy.peers.Network; import net.yacy.peers.Network;
import net.yacy.peers.Protocol;
import net.yacy.peers.Seed;
import net.yacy.search.Switchboard; import net.yacy.search.Switchboard;
import com.google.common.io.Files;
import de.anomic.data.MessageBoard; import de.anomic.data.MessageBoard;
import de.anomic.server.serverObjects; import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch; import de.anomic.server.serverSwitch;
@ -150,7 +152,7 @@ public final class message {
final File notifierSource = new File(sb.getAppPath(), sb.getConfig("htRootPath","htroot") + "/env/grafics/message.gif"); final File notifierSource = new File(sb.getAppPath(), sb.getConfig("htRootPath","htroot") + "/env/grafics/message.gif");
final File notifierDest = new File(sb.getDataPath("htDocsPath", "DATA/HTDOCS"), "notifier.gif"); final File notifierDest = new File(sb.getDataPath("htDocsPath", "DATA/HTDOCS"), "notifier.gif");
try { try {
FileUtils.copy(notifierSource, notifierDest); Files.copy(notifierSource, notifierDest);
} catch (final IOException e) { } catch (final IOException e) {
Log.logSevere("MESSAGE", "NEW MESSAGE ARRIVED! (error: " + e.getMessage() + ")"); Log.logSevere("MESSAGE", "NEW MESSAGE ARRIVED! (error: " + e.getMessage() + ")");

@ -38,7 +38,6 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import net.yacy.cora.storage.ConfigurationSet.Entry; import net.yacy.cora.storage.ConfigurationSet.Entry;
import net.yacy.kelondro.util.FileUtils;
import net.yacy.search.index.SolrField; import net.yacy.search.index.SolrField;
/** /**
* this class reads configuration attributes as a list of keywords from a list * this class reads configuration attributes as a list of keywords from a list
@ -199,7 +198,7 @@ public class ConfigurationSet extends TreeMap<String,Entry> implements Serializa
if (this.file == null) return; if (this.file == null) return;
// create a temporary bak file, use it as template to preserve user comments // create a temporary bak file, use it as template to preserve user comments
File bakfile = new File (this.file.getAbsolutePath() + ".bak"); File bakfile = new File (this.file.getAbsolutePath() + ".bak");
FileUtils.copy (this.file, bakfile); Files.copy (this.file, bakfile);
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
TreeMap<String,Entry> tclone = (TreeMap<String,Entry>) this.clone(); // clone to write appended entries TreeMap<String,Entry> tclone = (TreeMap<String,Entry>) this.clone(); // clone to write appended entries

@ -64,6 +64,7 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
import net.yacy.cora.document.UTF8; import net.yacy.cora.document.UTF8;
import net.yacy.cora.storage.Files;
import net.yacy.kelondro.index.Row; import net.yacy.kelondro.index.Row;
import net.yacy.kelondro.index.RowSet; import net.yacy.kelondro.index.RowSet;
import net.yacy.kelondro.logging.Log; import net.yacy.kelondro.logging.Log;
@ -280,41 +281,6 @@ public final class FileUtils
} }
} }
/**
* Copies a File to a File.
*
* @param source File
* @param dest File
* @param count the amount of bytes to copy
* @throws IOException
* @see #copy(InputStream source, OutputStream dest)
* @see #copy(InputStream source, File dest)
* @see #copyRange(File source, OutputStream dest, int start)
* @see #copy(File source, OutputStream dest)
*/
public static void copy(final File source, final File dest) throws IOException {
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(source);
fos = new FileOutputStream(dest);
copy(fis, fos, -1);
} finally {
if ( fis != null ) {
try {
fis.close();
} catch ( final Exception e ) {
}
}
if ( fos != null ) {
try {
fos.close();
} catch ( final Exception e ) {
}
}
}
}
public static void copy(final byte[] source, final OutputStream dest) throws IOException { public static void copy(final byte[] source, final OutputStream dest) throws IOException {
dest.write(source, 0, source.length); dest.write(source, 0, source.length);
dest.flush(); dest.flush();
@ -957,7 +923,7 @@ public final class FileUtils
private static void forceMove(final File from, final File to) throws IOException { private static void forceMove(final File from, final File to) throws IOException {
if ( !(to.delete() && from.renameTo(to)) ) { if ( !(to.delete() && from.renameTo(to)) ) {
// do it manually // do it manually
copy(from, to); Files.copy(from, to);
FileUtils.deletedelete(from); FileUtils.deletedelete(from);
} }
} }

@ -32,6 +32,8 @@ import net.yacy.kelondro.util.FileUtils;
import net.yacy.search.Switchboard; import net.yacy.search.Switchboard;
import net.yacy.search.SwitchboardConstants; import net.yacy.search.SwitchboardConstants;
import com.google.common.io.Files;
public class migration { public class migration {
//SVN constants //SVN constants
public static final int USE_WORK_DIR=1389; //wiki & messages in DATA/WORK public static final int USE_WORK_DIR=1389; //wiki & messages in DATA/WORK
@ -96,7 +98,7 @@ public class migration {
final File from = new File(defaultSkinsPath, skinFile); final File from = new File(defaultSkinsPath, skinFile);
final File to = new File(skinsPath, skinFile); final File to = new File(skinsPath, skinFile);
if (from.lastModified() > to.lastModified()) try { if (from.lastModified() > to.lastModified()) try {
FileUtils.copy(from, to); Files.copy(from, to);
} catch (final IOException e) {} } catch (final IOException e) {}
} }
} }
@ -118,7 +120,7 @@ public class migration {
}else{ }else{
try { try {
mkdirs(styleFile.getParentFile()); mkdirs(styleFile.getParentFile());
FileUtils.copy(skinFile, styleFile); Files.copy(skinFile, styleFile);
Log.logInfo("MIGRATION", "copied new Skinfile"); Log.logInfo("MIGRATION", "copied new Skinfile");
} catch (final IOException e) { } catch (final IOException e) {
Log.logSevere("MIGRATION", "Cannot copy skinfile."); Log.logSevere("MIGRATION", "Cannot copy skinfile.");
@ -164,7 +166,7 @@ public class migration {
sb.wikiDB.close(); sb.wikiDB.close();
file2 = new File(sb.workPath, "wiki.db"); file2 = new File(sb.workPath, "wiki.db");
try { try {
FileUtils.copy(file, file2); Files.copy(file, file2);
file.delete(); file.delete();
} catch (final IOException e) { } catch (final IOException e) {
} }
@ -174,7 +176,7 @@ public class migration {
Log.logInfo("MIGRATION", "Migrating wiki-bkp.db to "+ sb.workPath); Log.logInfo("MIGRATION", "Migrating wiki-bkp.db to "+ sb.workPath);
file2 = new File(sb.workPath, "wiki-bkp.db"); file2 = new File(sb.workPath, "wiki-bkp.db");
try { try {
FileUtils.copy(file, file2); Files.copy(file, file2);
file.delete(); file.delete();
} catch (final IOException e) {} } catch (final IOException e) {}
} }
@ -192,7 +194,7 @@ public class migration {
sb.messageDB.close(); sb.messageDB.close();
file2=new File(sb.workPath, "message.db"); file2=new File(sb.workPath, "message.db");
try { try {
FileUtils.copy(file, file2); Files.copy(file, file2);
file.delete(); file.delete();
} catch (final IOException e) {} } catch (final IOException e) {}
try { try {

@ -52,6 +52,7 @@ import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.protocol.ResponseHeader; import net.yacy.cora.protocol.ResponseHeader;
import net.yacy.cora.protocol.http.HTTPClient; import net.yacy.cora.protocol.http.HTTPClient;
import net.yacy.cora.services.federated.yacy.CacheStrategy; import net.yacy.cora.services.federated.yacy.CacheStrategy;
import net.yacy.cora.storage.Files;
import net.yacy.document.Document; import net.yacy.document.Document;
import net.yacy.document.parser.tarParser; import net.yacy.document.parser.tarParser;
import net.yacy.kelondro.data.meta.DigestURI; import net.yacy.kelondro.data.meta.DigestURI;
@ -495,7 +496,7 @@ public final class yacyRelease extends yacyVersion {
final File InfoPlistSource = new File(sb.getDataPath(), "DATA/RELEASE/yacy/addon/YaCy.app/Contents/Info.plist"); final File InfoPlistSource = new File(sb.getDataPath(), "DATA/RELEASE/yacy/addon/YaCy.app/Contents/Info.plist");
final File InfoPlistDestination = new File(sb.getAppPath(), "addon/YaCy.app/Contents/Info.plist"); final File InfoPlistDestination = new File(sb.getAppPath(), "addon/YaCy.app/Contents/Info.plist");
if (InfoPlistSource.exists() && InfoPlistDestination.exists()) { if (InfoPlistSource.exists() && InfoPlistDestination.exists()) {
FileUtils.copy(InfoPlistSource, InfoPlistDestination); Files.copy(InfoPlistSource, InfoPlistDestination);
Log.logInfo("UPDATE", "replaced Info.plist"); Log.logInfo("UPDATE", "replaced Info.plist");
} }
} }

@ -1,4 +1,4 @@
//yacySeedUploadFile.java //yacySeedUploadFile.java
//------------------------------------- //-------------------------------------
//part of YACY //part of YACY
//(C) by Michael Peter Christen; mc@yacy.net //(C) by Michael Peter Christen; mc@yacy.net
@ -27,30 +27,32 @@ package net.yacy.peers.operation;
import java.io.File; import java.io.File;
import net.yacy.kelondro.util.FileUtils; import com.google.common.io.Files;
import de.anomic.server.serverSwitch; import de.anomic.server.serverSwitch;
public class yacySeedUploadFile implements yacySeedUploader { public class yacySeedUploadFile implements yacySeedUploader {
public static final String CONFIG_FILE_PATH = "seedFilePath"; public static final String CONFIG_FILE_PATH = "seedFilePath";
@Override
public String uploadSeedFile(final serverSwitch sb, final File seedFile) throws Exception { public String uploadSeedFile(final serverSwitch sb, final File seedFile) throws Exception {
String seedFilePath = ""; String seedFilePath = "";
try { try {
seedFilePath = sb.getConfig(CONFIG_FILE_PATH,""); seedFilePath = sb.getConfig(CONFIG_FILE_PATH,"");
if (seedFilePath.length() == 0) throw new Exception("Path to seed file is not configured properly"); if (seedFilePath.length() == 0) throw new Exception("Path to seed file is not configured properly");
final File publicSeedFile = new File(seedFilePath); final File publicSeedFile = new File(seedFilePath);
FileUtils.copy(seedFile,publicSeedFile); Files.copy(seedFile,publicSeedFile);
return "Seed-List file stored successfully"; return "Seed-List file stored successfully";
} catch (final Exception e) { } catch (final Exception e) {
throw new Exception("Unable to store the seed-list file into the filesystem using path '" + seedFilePath + "'. " + e.getMessage()); throw new Exception("Unable to store the seed-list file into the filesystem using path '" + seedFilePath + "'. " + e.getMessage());
} }
} }
@Override
public String[] getConfigurationOptions() { public String[] getConfigurationOptions() {
return new String[]{CONFIG_FILE_PATH}; return new String[]{CONFIG_FILE_PATH};
} }

@ -93,9 +93,9 @@ import net.yacy.cora.protocol.ResponseHeader;
import net.yacy.cora.protocol.TimeoutRequest; import net.yacy.cora.protocol.TimeoutRequest;
import net.yacy.cora.protocol.http.HTTPClient; import net.yacy.cora.protocol.http.HTTPClient;
import net.yacy.cora.protocol.http.ProxySettings; import net.yacy.cora.protocol.http.ProxySettings;
import net.yacy.cora.services.federated.solr.SolrDoc;
import net.yacy.cora.services.federated.solr.ShardSolrConnector;
import net.yacy.cora.services.federated.solr.ShardSelection; import net.yacy.cora.services.federated.solr.ShardSelection;
import net.yacy.cora.services.federated.solr.ShardSolrConnector;
import net.yacy.cora.services.federated.solr.SolrDoc;
import net.yacy.cora.services.federated.yacy.CacheStrategy; import net.yacy.cora.services.federated.yacy.CacheStrategy;
import net.yacy.document.Condenser; import net.yacy.document.Condenser;
import net.yacy.document.Document; import net.yacy.document.Document;
@ -151,6 +151,9 @@ import net.yacy.search.query.SearchEvent;
import net.yacy.search.query.SearchEventCache; import net.yacy.search.query.SearchEventCache;
import net.yacy.search.ranking.BlockRank; import net.yacy.search.ranking.BlockRank;
import net.yacy.search.ranking.RankingProfile; import net.yacy.search.ranking.RankingProfile;
import com.google.common.io.Files;
import de.anomic.crawler.Cache; import de.anomic.crawler.Cache;
import de.anomic.crawler.CrawlProfile; import de.anomic.crawler.CrawlProfile;
import de.anomic.crawler.CrawlQueues; import de.anomic.crawler.CrawlQueues;
@ -392,7 +395,7 @@ public final class Switchboard extends serverSwitch
getConfig("federated.service.solr.indexing.schemefile", "solr.keys.default.list"); getConfig("federated.service.solr.indexing.schemefile", "solr.keys.default.list");
final File solrWorkProfile = new File(getDataPath(), "DATA/SETTINGS/" + schemename); final File solrWorkProfile = new File(getDataPath(), "DATA/SETTINGS/" + schemename);
if ( !solrWorkProfile.exists() ) { if ( !solrWorkProfile.exists() ) {
FileUtils.copy(solrBackupProfile, solrWorkProfile); Files.copy(solrBackupProfile, solrWorkProfile);
} }
final SolrConfiguration backupScheme = new SolrConfiguration(solrBackupProfile); final SolrConfiguration backupScheme = new SolrConfiguration(solrBackupProfile);
this.solrScheme = new SolrConfiguration(solrWorkProfile); this.solrScheme = new SolrConfiguration(solrWorkProfile);
@ -731,7 +734,7 @@ public final class Switchboard extends serverSwitch
getDataPath(SwitchboardConstants.HTDOCS_PATH, SwitchboardConstants.HTDOCS_PATH_DEFAULT), getDataPath(SwitchboardConstants.HTDOCS_PATH, SwitchboardConstants.HTDOCS_PATH_DEFAULT),
"notifier.gif"); "notifier.gif");
try { try {
FileUtils.copy(notifierSource, notifierDest); Files.copy(notifierSource, notifierDest);
} catch ( final IOException e ) { } catch ( final IOException e ) {
} }

@ -80,6 +80,9 @@ import net.yacy.search.Switchboard;
import net.yacy.search.SwitchboardConstants; import net.yacy.search.SwitchboardConstants;
import net.yacy.search.index.MetadataRepository; import net.yacy.search.index.MetadataRepository;
import net.yacy.search.index.Segment; import net.yacy.search.index.Segment;
import com.google.common.io.Files;
import de.anomic.data.Translator; import de.anomic.data.Translator;
import de.anomic.http.server.HTTPDemon; import de.anomic.http.server.HTTPDemon;
import de.anomic.server.serverCore; import de.anomic.server.serverCore;
@ -181,7 +184,7 @@ public final class yacy {
f = new File(dataHome, "DATA/LOG/yacy.logging"); f = new File(dataHome, "DATA/LOG/yacy.logging");
final File f0 = new File(appHome, "defaults/yacy.logging"); final File f0 = new File(appHome, "defaults/yacy.logging");
if (!f.exists() || f0.lastModified() > f.lastModified()) try { if (!f.exists() || f0.lastModified() > f.lastModified()) try {
FileUtils.copy(f0, f); Files.copy(f0, f);
} catch (final IOException e){ } catch (final IOException e){
System.out.println("could not copy yacy.logging"); System.out.println("could not copy yacy.logging");
} }
@ -268,7 +271,7 @@ public final class yacy {
// create default notifier picture // create default notifier picture
//TODO: Use templates instead of copying images ... //TODO: Use templates instead of copying images ...
if (!((new File(htDocsPath, "notifier.gif")).exists())) try { if (!((new File(htDocsPath, "notifier.gif")).exists())) try {
FileUtils.copy(new File(htRootPath, "env/grafics/empty.gif"), Files.copy(new File(htRootPath, "env/grafics/empty.gif"),
new File(htDocsPath, "notifier.gif")); new File(htDocsPath, "notifier.gif"));
} catch (final IOException e) {} } catch (final IOException e) {}

Loading…
Cancel
Save