mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
removed warnings
This commit is contained in:
parent
7bf5f6c7ad
commit
867f96a32b
|
@ -2553,8 +2553,14 @@ public class MultiProtocolURL implements Serializable, Comparable<MultiProtocolU
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] get(final ClientIdentification.Agent agent, final String username, final String pass) throws IOException {
|
public byte[] get(final ClientIdentification.Agent agent, final String username, final String pass) throws IOException {
|
||||||
if (isFile()) return read(new FileInputStream(getFSFile()));
|
if (isFile()) {
|
||||||
if (isSMB()) return read(new SmbFileInputStream(getSmbFile()));
|
byte[] b = read(new FileInputStream(getFSFile()));
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
if (isSMB()) {
|
||||||
|
byte[] b = read(new SmbFileInputStream(getSmbFile()));
|
||||||
|
return b;
|
||||||
|
}
|
||||||
if (isFTP()) {
|
if (isFTP()) {
|
||||||
final FTPClient client = new FTPClient();
|
final FTPClient client = new FTPClient();
|
||||||
client.open(this.host, this.port < 0 ? 21 : this.port);
|
client.open(this.host, this.port < 0 ? 21 : this.port);
|
||||||
|
|
|
@ -94,6 +94,7 @@ public class GeonamesLocation implements Locations {
|
||||||
final ZipEntry ze = zf.getEntry(entryName);
|
final ZipEntry ze = zf.getEntry(entryName);
|
||||||
final InputStream is = zf.getInputStream(ze);
|
final InputStream is = zf.getInputStream(ze);
|
||||||
reader = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8));
|
reader = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8));
|
||||||
|
zf.close();
|
||||||
} catch (final IOException e ) {
|
} catch (final IOException e ) {
|
||||||
log.warn(e);
|
log.warn(e);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -25,8 +25,8 @@
|
||||||
package net.yacy.cora.plugin;
|
package net.yacy.cora.plugin;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.net.MalformedURLException;
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLClassLoader;
|
import java.net.URLClassLoader;
|
||||||
|
|
||||||
|
@ -47,11 +47,12 @@ public class ClassProvider {
|
||||||
URL[] urls;
|
URL[] urls;
|
||||||
try {
|
try {
|
||||||
urls = new URL[]{new URL("file", "", path)};
|
urls = new URL[]{new URL("file", "", path)};
|
||||||
final ClassLoader cl = new URLClassLoader(urls);
|
final URLClassLoader cl = new URLClassLoader(urls);
|
||||||
c = cl.loadClass(classname);
|
c = cl.loadClass(classname);
|
||||||
} catch (final MalformedURLException e) {
|
cl.close();
|
||||||
} catch (final ClassNotFoundException e) {
|
} catch (ClassNotFoundException | IOException e) {
|
||||||
}
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,6 +135,7 @@ public class TimeoutRequest<E> {
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
//System.out.println("PING socket close = " + (System.currentTimeMillis() - time) + " ms (" + host + ":" + port + ")"); time = System.currentTimeMillis();
|
//System.out.println("PING socket close = " + (System.currentTimeMillis() - time) + " ms (" + host + ":" + port + ")"); time = System.currentTimeMillis();
|
||||||
|
socket.close();
|
||||||
return Boolean.FALSE;
|
return Boolean.FALSE;
|
||||||
} catch (final UnknownHostException e) {
|
} catch (final UnknownHostException e) {
|
||||||
//System.out.println("PING socket UnknownHostException = " + (System.currentTimeMillis() - time) + " ms (" + host + ":" + port + ")"); time = System.currentTimeMillis();
|
//System.out.println("PING socket UnknownHostException = " + (System.currentTimeMillis() - time) + " ms (" + host + ":" + port + ")"); time = System.currentTimeMillis();
|
||||||
|
|
|
@ -1105,8 +1105,9 @@ public class HTTPClient implements Closeable {
|
||||||
// }
|
// }
|
||||||
// Close out connection manager
|
// Close out connection manager
|
||||||
try {
|
try {
|
||||||
HTTPClient.closeConnectionManager();
|
client.close();
|
||||||
} catch (final InterruptedException e) {
|
HTTPClient.closeConnectionManager();
|
||||||
|
} catch (final InterruptedException | IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,5 +138,6 @@ public class ZIPReader extends AbstractMap<String, ZipEntry> implements Map<Stri
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
zfile.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -282,6 +282,7 @@ public class LibraryProvider {
|
||||||
try {
|
try {
|
||||||
final ZipFile zip = new ZipFile(file);
|
final ZipFile zip = new ZipFile(file);
|
||||||
derewoTxtEntry = zip.getInputStream(zip.getEntry("derewo-v-100000t-2009-04-30-0.1"));
|
derewoTxtEntry = zip.getInputStream(zip.getEntry("derewo-v-100000t-2009-04-30-0.1"));
|
||||||
|
zip.close();
|
||||||
} catch (final ZipException e ) {
|
} catch (final ZipException e ) {
|
||||||
ConcurrentLog.logException(e);
|
ConcurrentLog.logException(e);
|
||||||
return list;
|
return list;
|
||||||
|
|
|
@ -153,7 +153,8 @@ public class MediawikiImporter extends Thread implements Importer {
|
||||||
return (System.currentTimeMillis() - this.start) / 1000L;
|
return (System.currentTimeMillis() - this.start) / 1000L;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@SuppressWarnings("resource")
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
this.start = System.currentTimeMillis();
|
this.start = System.currentTimeMillis();
|
||||||
final int threads = Math.max(2, Runtime.getRuntime().availableProcessors() - 1);
|
final int threads = Math.max(2, Runtime.getRuntime().availableProcessors() - 1);
|
||||||
|
|
|
@ -108,7 +108,8 @@ public class WarcImporter extends Thread implements Importer {
|
||||||
* @param f inputstream for the warc file
|
* @param f inputstream for the warc file
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void indexWarcRecords(InputStream f) throws IOException {
|
@SuppressWarnings("resource")
|
||||||
|
public void indexWarcRecords(InputStream f) throws IOException {
|
||||||
|
|
||||||
byte[] content;
|
byte[] content;
|
||||||
job = this;
|
job = this;
|
||||||
|
@ -146,6 +147,7 @@ public class WarcImporter extends Thread implements Importer {
|
||||||
bbuffer.append(c);
|
bbuffer.append(c);
|
||||||
}
|
}
|
||||||
content = bbuffer.getBytes();
|
content = bbuffer.getBytes();
|
||||||
|
bbuffer.close();
|
||||||
} else {
|
} else {
|
||||||
content = new byte[(int) http.getPayloadLength()];
|
content = new byte[(int) http.getPayloadLength()];
|
||||||
istream.read(content, 0, content.length);
|
istream.read(content, 0, content.length);
|
||||||
|
|
|
@ -478,6 +478,7 @@ public class apkParser extends AbstractParser implements Parser {
|
||||||
for (String s: resources) {
|
for (String s: resources) {
|
||||||
System.out.println(s);
|
System.out.println(s);
|
||||||
}
|
}
|
||||||
|
jf.close();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
package net.yacy.document.parser;
|
package net.yacy.document.parser;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -87,6 +88,7 @@ public class docParser extends AbstractParser implements Parser {
|
||||||
try {
|
try {
|
||||||
contents.append(extractor.getText()); // extractor gets all text incl. headers/footers
|
contents.append(extractor.getText()); // extractor gets all text incl. headers/footers
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
|
try {extractor.close();} catch (IOException e1) {}
|
||||||
throw new Parser.Failure("error in docParser, getText: " + e.getMessage(), location);
|
throw new Parser.Failure("error in docParser, getText: " + e.getMessage(), location);
|
||||||
}
|
}
|
||||||
String title = (contents.length() > 240) ? contents.substring(0,240) : contents.toString().trim();
|
String title = (contents.length() > 240) ? contents.substring(0,240) : contents.toString().trim();
|
||||||
|
@ -132,7 +134,7 @@ public class docParser extends AbstractParser implements Parser {
|
||||||
false,
|
false,
|
||||||
extractor.getSummaryInformation().getLastSaveDateTime() // maybe null
|
extractor.getSummaryInformation().getLastSaveDateTime() // maybe null
|
||||||
)};
|
)};
|
||||||
|
try {extractor.close();} catch (IOException e1) {}
|
||||||
return docs;
|
return docs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,6 +163,7 @@ public class docParser extends AbstractParser implements Parser {
|
||||||
try {
|
try {
|
||||||
contents.append(extractor.getText());
|
contents.append(extractor.getText());
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
|
try {extractor.close();} catch (IOException e1) {}
|
||||||
throw new Parser.Failure("error in docParser, getText: " + e.getMessage(), location);
|
throw new Parser.Failure("error in docParser, getText: " + e.getMessage(), location);
|
||||||
}
|
}
|
||||||
String title = (contents.length() > 240) ? contents.substring(0,240) : contents.toString().trim();
|
String title = (contents.length() > 240) ? contents.substring(0,240) : contents.toString().trim();
|
||||||
|
@ -206,7 +209,7 @@ public class docParser extends AbstractParser implements Parser {
|
||||||
false,
|
false,
|
||||||
extractor.getSummaryInformation().getLastSaveDateTime() // maybe null
|
extractor.getSummaryInformation().getLastSaveDateTime() // maybe null
|
||||||
)};
|
)};
|
||||||
|
try {extractor.close();} catch (IOException e1) {}
|
||||||
return docs;
|
return docs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,14 +25,10 @@
|
||||||
package net.yacy.document.parser.html;
|
package net.yacy.document.parser.html;
|
||||||
|
|
||||||
import net.yacy.search.Switchboard;
|
import net.yacy.search.Switchboard;
|
||||||
import org.json.JSONArray;
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.charset.Charset;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
package net.yacy.document.parser;
|
package net.yacy.document.parser;
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -122,6 +123,7 @@ public class pptParser extends AbstractParser implements Parser {
|
||||||
false,
|
false,
|
||||||
pptExtractor.getSummaryInformation().getLastSaveDateTime() // may be null
|
pptExtractor.getSummaryInformation().getLastSaveDateTime() // may be null
|
||||||
)};
|
)};
|
||||||
|
try {pptExtractor.close();} catch (IOException e1) {}
|
||||||
return docs;
|
return docs;
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
if (e instanceof InterruptedException) throw (InterruptedException) e;
|
if (e instanceof InterruptedException) throw (InterruptedException) e;
|
||||||
|
|
|
@ -85,6 +85,7 @@ public class vsdParser extends AbstractParser implements Parser {
|
||||||
final VisioTextExtractor extractor = new VisioTextExtractor(source);
|
final VisioTextExtractor extractor = new VisioTextExtractor(source);
|
||||||
contents = extractor.getText();
|
contents = extractor.getText();
|
||||||
summary = extractor.getSummaryInformation();
|
summary = extractor.getSummaryInformation();
|
||||||
|
extractor.close();
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
ConcurrentLog.warn("vsdParser", e.getMessage());
|
ConcurrentLog.warn("vsdParser", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,6 +117,7 @@ public class xlsParser extends AbstractParser implements Parser {
|
||||||
false,
|
false,
|
||||||
sumInfo.getLastSaveDateTime())};
|
sumInfo.getLastSaveDateTime())};
|
||||||
|
|
||||||
|
exceldoc.close();
|
||||||
return retdocs;
|
return retdocs;
|
||||||
|
|
||||||
} catch (IOException ex1) {
|
} catch (IOException ex1) {
|
||||||
|
|
|
@ -879,12 +879,15 @@ public class Crawler_p {
|
||||||
if((crawlingFileContent == null || crawlingFileContent.isEmpty()) && crawlingFile != null) {
|
if((crawlingFileContent == null || crawlingFileContent.isEmpty()) && crawlingFile != null) {
|
||||||
/* Let's report here detailed error to help user when he selected a wrong file */
|
/* Let's report here detailed error to help user when he selected a wrong file */
|
||||||
if(!crawlingFile.exists()) {
|
if(!crawlingFile.exists()) {
|
||||||
|
writer.close();
|
||||||
throw new FileNotFoundException(crawlingFile.getAbsolutePath() + " does not exists");
|
throw new FileNotFoundException(crawlingFile.getAbsolutePath() + " does not exists");
|
||||||
}
|
}
|
||||||
if(!crawlingFile.isFile()) {
|
if(!crawlingFile.isFile()) {
|
||||||
|
writer.close();
|
||||||
throw new FileNotFoundException(crawlingFile.getAbsolutePath() + " exists but is not a regular file");
|
throw new FileNotFoundException(crawlingFile.getAbsolutePath() + " exists but is not a regular file");
|
||||||
}
|
}
|
||||||
if(!crawlingFile.canRead()) {
|
if(!crawlingFile.canRead()) {
|
||||||
|
writer.close();
|
||||||
throw new IOException("Can not read : " + crawlingFile.getAbsolutePath());
|
throw new IOException("Can not read : " + crawlingFile.getAbsolutePath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,8 @@ import net.yacy.server.serverSwitch;
|
||||||
|
|
||||||
public class PerformanceQueues_p {
|
public class PerformanceQueues_p {
|
||||||
|
|
||||||
public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
|
@SuppressWarnings("deprecation")
|
||||||
|
public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
|
||||||
// return variable that accumulates replacements
|
// return variable that accumulates replacements
|
||||||
final Switchboard sb = (Switchboard) env;
|
final Switchboard sb = (Switchboard) env;
|
||||||
final serverObjects prop = new serverObjects();
|
final serverObjects prop = new serverObjects();
|
||||||
|
|
|
@ -48,7 +48,9 @@ public class ynetSearch {
|
||||||
// final String s = searchaddress+"&query="+post.get("search")+"&maximumRecords="+post.get("maximumRecords")+"&startRecord="+post.get("startRecord");
|
// final String s = searchaddress+"&query="+post.get("search")+"&maximumRecords="+post.get("maximumRecords")+"&startRecord="+post.get("startRecord");
|
||||||
final URL url = new URL(s);
|
final URL url = new URL(s);
|
||||||
is = url.openStream();
|
is = url.openStream();
|
||||||
final String httpout = new Scanner(is).useDelimiter( "\\Z" ).next();
|
Scanner scanner = new Scanner(is);
|
||||||
|
final String httpout = scanner.useDelimiter( "\\Z" ).next();
|
||||||
|
scanner.close();
|
||||||
prop.put("http", httpout);
|
prop.put("http", httpout);
|
||||||
} catch (final Exception e ) {
|
} catch (final Exception e ) {
|
||||||
prop.put("url", "error!");
|
prop.put("url", "error!");
|
||||||
|
|
|
@ -111,7 +111,7 @@ public class yacysearchitem {
|
||||||
final boolean authenticated = adminAuthenticated || user != null;
|
final boolean authenticated = adminAuthenticated || user != null;
|
||||||
|
|
||||||
final boolean extendedSearchRights = adminAuthenticated || (user != null && user.hasRight(UserDB.AccessRight.EXTENDED_SEARCH_RIGHT));
|
final boolean extendedSearchRights = adminAuthenticated || (user != null && user.hasRight(UserDB.AccessRight.EXTENDED_SEARCH_RIGHT));
|
||||||
final boolean bookmarkRights = adminAuthenticated || (user != null && user.hasRight(UserDB.AccessRight.BOOKMARK_RIGHT));
|
//final boolean bookmarkRights = adminAuthenticated || (user != null && user.hasRight(UserDB.AccessRight.BOOKMARK_RIGHT));
|
||||||
|
|
||||||
final int item = post.getInt("item", -1);
|
final int item = post.getInt("item", -1);
|
||||||
final RequestHeader.FileType fileType = header.fileType();
|
final RequestHeader.FileType fileType = header.fileType();
|
||||||
|
|
|
@ -280,6 +280,7 @@ public class YaCyDefaultServlet extends HttpServlet {
|
||||||
|
|
||||||
if (!hasClass && (resource == null || !resource.exists()) && !pathInContext.contains("..")) {
|
if (!hasClass && (resource == null || !resource.exists()) && !pathInContext.contains("..")) {
|
||||||
// try to get this in the alternative htDocsPath
|
// try to get this in the alternative htDocsPath
|
||||||
|
if (resource != null) resource.close();
|
||||||
resource = Resource.newResource(new File(this._htDocsPath, pathInContext));
|
resource = Resource.newResource(new File(this._htDocsPath, pathInContext));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1035,7 +1036,8 @@ public class YaCyDefaultServlet extends HttpServlet {
|
||||||
submitted.contains("Crawler_p") ||
|
submitted.contains("Crawler_p") ||
|
||||||
submitted.contains("ConfigBasic") ||
|
submitted.contains("ConfigBasic") ||
|
||||||
submitted.contains("Load_RSS_p");*/
|
submitted.contains("Load_RSS_p");*/
|
||||||
final boolean advanced_enabled =
|
@SuppressWarnings("unused")
|
||||||
|
final boolean advanced_enabled =
|
||||||
crawler_enabled ||
|
crawler_enabled ||
|
||||||
submitted.contains("IndexImportMediawiki_p") ||
|
submitted.contains("IndexImportMediawiki_p") ||
|
||||||
submitted.contains("CrawlStart");
|
submitted.contains("CrawlStart");
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class StartFromJava {
|
||||||
} while(!"STOP".equals(s));
|
} while(!"STOP".equals(s));
|
||||||
|
|
||||||
run.stop();
|
run.stop();
|
||||||
|
sc.close();
|
||||||
} catch(Exception ex) {
|
} catch(Exception ex) {
|
||||||
Logger.getLogger(StartFromJava.class.getName()).log(Level.SEVERE, null, ex);
|
Logger.getLogger(StartFromJava.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
}
|
}
|
||||||
|
|
|
@ -195,13 +195,19 @@ public final class yacy {
|
||||||
|
|
||||||
f = new File(dataHome, "DATA/yacy.running");
|
f = new File(dataHome, "DATA/yacy.running");
|
||||||
if (!f.createNewFile()) ConcurrentLog.severe("STARTUP", "WARNING: the file " + f + " can not be created!");
|
if (!f.createNewFile()) ConcurrentLog.severe("STARTUP", "WARNING: the file " + f + " can not be created!");
|
||||||
try { new FileOutputStream(f).write(Integer.toString(OS.getPID()).getBytes()); } catch (final Exception e) { } // write PID
|
try {
|
||||||
|
FileOutputStream fos = new FileOutputStream(f);
|
||||||
|
fos.write(Integer.toString(OS.getPID()).getBytes());
|
||||||
|
fos.close();
|
||||||
|
} catch (final Exception e) { } // write PID
|
||||||
f.deleteOnExit();
|
f.deleteOnExit();
|
||||||
FileChannel channel = null;
|
FileChannel channel = null;
|
||||||
FileLock lock = null;
|
FileLock lock = null;
|
||||||
try {
|
try {
|
||||||
channel = new RandomAccessFile(f,"rw").getChannel();
|
RandomAccessFile raf = new RandomAccessFile(f,"rw");
|
||||||
|
channel = raf.getChannel();
|
||||||
lock = channel.tryLock(); // lock yacy.running
|
lock = channel.tryLock(); // lock yacy.running
|
||||||
|
raf.close();
|
||||||
} catch (final Exception e) { }
|
} catch (final Exception e) { }
|
||||||
|
|
||||||
final String conf = "DATA/SETTINGS/yacy.conf".replace("/", File.separator);
|
final String conf = "DATA/SETTINGS/yacy.conf".replace("/", File.separator);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user