summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsgaebel <sgaebel@localhost.localdomain>2020-08-02 20:14:56 +0200
committersgaebel <sgaebel@localhost.localdomain>2020-08-03 20:44:31 +0200
commitfc03c4b4fed389f92b0ccceb427f6c4bc18f0aef (patch)
tree69eb392ba5cebaa874247ad42357a2bca0f39b43
parent4a495df63acd06a089872e09c2138cf4c200eac5 (diff)
removes some warning and unused objects
-rw-r--r--source/net/yacy/crawler/CrawlStacker.java1
-rw-r--r--source/net/yacy/document/importer/OAIListFriendsLoader.java7
-rw-r--r--source/net/yacy/document/parser/docParser.java14
-rw-r--r--source/net/yacy/peers/Protocol.java12
-rw-r--r--source/net/yacy/search/query/SearchEvent.java3
-rw-r--r--source/net/yacy/utils/translation/TranslatorXliff.java9
-rw-r--r--test/java/net/yacy/cora/document/feed/RSSFeedTest.java6
-rw-r--r--test/java/net/yacy/cora/document/id/DigestURLHashPerfTest.java2
-rw-r--r--test/java/net/yacy/search/ranking/ReferenceOrderTest.java12
9 files changed, 34 insertions, 32 deletions
diff --git a/source/net/yacy/crawler/CrawlStacker.java b/source/net/yacy/crawler/CrawlStacker.java
index 9f44933c6..883b09771 100644
--- a/source/net/yacy/crawler/CrawlStacker.java
+++ b/source/net/yacy/crawler/CrawlStacker.java
@@ -620,6 +620,7 @@ public final class CrawlStacker implements WorkflowTask<Request>{
// returns true if the url can be accepted according to network.unit.domain
if (urlhash == null) return "url is null";
// check if this is a local address and we are allowed to index local pages:
+ @SuppressWarnings("deprecation")
final boolean local = DigestURL.isLocal(urlhash);
if (this.acceptLocalURLs && local) return null;
if (this.acceptGlobalURLs && !local) return null;
diff --git a/source/net/yacy/document/importer/OAIListFriendsLoader.java b/source/net/yacy/document/importer/OAIListFriendsLoader.java
index 730189338..651513e9e 100644
--- a/source/net/yacy/document/importer/OAIListFriendsLoader.java
+++ b/source/net/yacy/document/importer/OAIListFriendsLoader.java
@@ -127,12 +127,10 @@ public class OAIListFriendsLoader implements Serializable {
private SAXParser saxParser;
private final InputStream stream;
private Attributes atts;
- private int recordCounter;
private final TreeMap<String, String> map;
public Parser(final byte[] b) {
this.map = new TreeMap<String, String>();
- this.recordCounter = 0;
this.buffer = new StringBuilder();
this.parsingValue = false;
this.atts = null;
@@ -164,14 +162,9 @@ public class OAIListFriendsLoader implements Serializable {
</BaseURLs>
*/
- public int getCounter() {
- return this.recordCounter;
- }
-
@Override
public void startElement(final String uri, final String name, final String tag, final Attributes atts) throws SAXException {
if ("baseURL".equals(tag)) {
- this.recordCounter++;
this.parsingValue = true;
this.atts = atts;
}
diff --git a/source/net/yacy/document/parser/docParser.java b/source/net/yacy/document/parser/docParser.java
index 2d3dd2bae..623639eee 100644
--- a/source/net/yacy/document/parser/docParser.java
+++ b/source/net/yacy/document/parser/docParser.java
@@ -32,6 +32,12 @@ import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
+import org.apache.poi.hwpf.HWPFDocumentCore;
+import org.apache.poi.hwpf.OldWordFileFormatException;
+import org.apache.poi.hwpf.extractor.Word6Extractor;
+import org.apache.poi.hwpf.extractor.WordExtractor;
+import org.apache.poi.poifs.filesystem.POIFSFileSystem;
+
import net.yacy.cora.document.id.DigestURL;
import net.yacy.cora.util.CommonPattern;
import net.yacy.document.AbstractParser;
@@ -39,12 +45,6 @@ import net.yacy.document.Document;
import net.yacy.document.Parser;
import net.yacy.document.VocabularyScraper;
-import org.apache.poi.hwpf.HWPFDocument;
-import org.apache.poi.hwpf.OldWordFileFormatException;
-import org.apache.poi.hwpf.extractor.Word6Extractor;
-import org.apache.poi.hwpf.extractor.WordExtractor;
-import org.apache.poi.poifs.filesystem.POIFSFileSystem;
-
public class docParser extends AbstractParser implements Parser {
public docParser() {
@@ -74,7 +74,7 @@ public class docParser extends AbstractParser implements Parser {
final WordExtractor extractor;
POIFSFileSystem poifs = null;
try {
- poifs = HWPFDocument.verifyAndBuildPOIFS(source); // to be able to delegate to parseOldWordDoc w/o source.ioException
+ poifs = HWPFDocumentCore.verifyAndBuildPOIFS(source); // to be able to delegate to parseOldWordDoc w/o source.ioException
extractor = new WordExtractor(poifs);
} catch (final OldWordFileFormatException isOldWordDoc) {
// if old version (Word6/Word95) delegate to old parser (as long as available in poi package)
diff --git a/source/net/yacy/peers/Protocol.java b/source/net/yacy/peers/Protocol.java
index 7c3fb3d5b..4260da7bf 100644
--- a/source/net/yacy/peers/Protocol.java
+++ b/source/net/yacy/peers/Protocol.java
@@ -1488,12 +1488,12 @@ public final class Protocol {
this.docs = docs;
}
- /**
- * Use this to stop writing operation. This thread will not stop immediately as Solr might be writing something.
- */
- public void stopWriting() {
- this.stop.set(true);
- }
+// /**
+// * Use this to stop writing operation. This thread will not stop immediately as Solr might be writing something.
+// */
+// public void stopWriting() {
+// this.stop.set(true);
+// }
@Override
public void run() {
diff --git a/source/net/yacy/search/query/SearchEvent.java b/source/net/yacy/search/query/SearchEvent.java
index 742c23ea0..b64223300 100644
--- a/source/net/yacy/search/query/SearchEvent.java
+++ b/source/net/yacy/search/query/SearchEvent.java
@@ -1976,6 +1976,9 @@ public final class SearchEvent implements ScoreMapUpdatesListener {
break;
case APP:
r += rentry.lapp() << this.query.ranking.coeff_cathasapp;
+ break;
+ default:
+ break;
}
// apply citation count
diff --git a/source/net/yacy/utils/translation/TranslatorXliff.java b/source/net/yacy/utils/translation/TranslatorXliff.java
index c8dacc0a1..260d9196f 100644
--- a/source/net/yacy/utils/translation/TranslatorXliff.java
+++ b/source/net/yacy/utils/translation/TranslatorXliff.java
@@ -27,6 +27,9 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package net.yacy.utils.translation;
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -37,10 +40,10 @@ import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map;
import java.util.TreeMap;
+
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.events.XMLEvent;
import net.yacy.cora.util.ConcurrentLog;
import net.yacy.data.Translator;
@@ -97,7 +100,7 @@ public class TranslatorXliff extends Translator {
while (xmlreader.hasNext()) {
int eventtype = xmlreader.next();
- if (eventtype == XMLEvent.START_ELEMENT) {
+ if (eventtype == START_ELEMENT) {
String ename = xmlreader.getLocalName();
// setup for 'file' section (get or add translationlist for this file)
@@ -120,7 +123,7 @@ public class TranslatorXliff extends Translator {
state = xmlreader.getAttributeValue(null, "state");
target = xmlreader.getElementText(); // TODO: in full blown xliff, target may contain sub-xml elements (but we use only text)
}
- } else if (eventtype == XMLEvent.END_ELEMENT) {
+ } else if (eventtype == END_ELEMENT) {
String ename = xmlreader.getLocalName();
// store source/target on finish of trans-unit
diff --git a/test/java/net/yacy/cora/document/feed/RSSFeedTest.java b/test/java/net/yacy/cora/document/feed/RSSFeedTest.java
index 287e3de87..782feb821 100644
--- a/test/java/net/yacy/cora/document/feed/RSSFeedTest.java
+++ b/test/java/net/yacy/cora/document/feed/RSSFeedTest.java
@@ -1,8 +1,8 @@
package net.yacy.cora.document.feed;
-import java.io.IOException;
+import static org.junit.Assert.assertNotNull;
+
import org.junit.Test;
-import static org.junit.Assert.*;
public class RSSFeedTest {
@@ -10,7 +10,7 @@ public class RSSFeedTest {
* Test of getChannel method, of class RSSFeed.
*/
@Test
- public void testGetChannel() throws IOException {
+ public void testGetChannel() {
RSSFeed feed = new RSSFeed(Integer.MAX_VALUE);
// channel is required in RSS 2.0 and accessed in code w/o != null checks
diff --git a/test/java/net/yacy/cora/document/id/DigestURLHashPerfTest.java b/test/java/net/yacy/cora/document/id/DigestURLHashPerfTest.java
index b2df145e4..f4a913429 100644
--- a/test/java/net/yacy/cora/document/id/DigestURLHashPerfTest.java
+++ b/test/java/net/yacy/cora/document/id/DigestURLHashPerfTest.java
@@ -62,7 +62,7 @@ public class DigestURLHashPerfTest {
System.out.println(urls.size() + " URLs loaded from " + inFile.getAbsolutePath());
- try (OutputStream outStream = args.length >= 2 ? new FileOutputStream(args[1]) : new NullOutputStream();
+ try (OutputStream outStream = args.length >= 2 ? new FileOutputStream(args[1]) : NullOutputStream.NULL_OUTPUT_STREAM;
OutputStreamWriter writer = new OutputStreamWriter(outStream, StandardCharsets.UTF_8.name());
BufferedWriter out = new BufferedWriter(writer);) {
diff --git a/test/java/net/yacy/search/ranking/ReferenceOrderTest.java b/test/java/net/yacy/search/ranking/ReferenceOrderTest.java
index 45036de3e..d8c767d0d 100644
--- a/test/java/net/yacy/search/ranking/ReferenceOrderTest.java
+++ b/test/java/net/yacy/search/ranking/ReferenceOrderTest.java
@@ -1,16 +1,18 @@
package net.yacy.search.ranking;
+import static org.junit.Assert.assertTrue;
+
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
+
+import org.apache.solr.common.SolrInputDocument;
+import org.junit.Test;
+
import net.yacy.cora.document.analysis.Classification;
import net.yacy.cora.document.id.DigestURL;
-import net.yacy.cora.util.SpaceExceededException;
import net.yacy.kelondro.data.meta.URIMetadataNode;
import net.yacy.search.schema.CollectionConfiguration;
-import org.apache.solr.common.SolrInputDocument;
-import static org.junit.Assert.assertTrue;
-import org.junit.Test;
public class ReferenceOrderTest {
@@ -20,7 +22,7 @@ public class ReferenceOrderTest {
* (only used if no Solr score supplied)
*/
@Test
- public void testCardinal_URIMetadataNode() throws MalformedURLException, IOException, SpaceExceededException {
+ public void testCardinal_URIMetadataNode() throws MalformedURLException, IOException {
File config = new File("defaults/solr.collection.schema");
CollectionConfiguration cc = new CollectionConfiguration(config, true);