Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

removed warnings

Michael Peter Christen4d29f59a2784
diff --git a/htroot/api/ymarks/get_ymark.java b/htroot/api/ymarks/get_ymark.java
index 74922a461..c22db1f36 100644
--- a/htroot/api/ymarks/get_ymark.java
+++ b/htroot/api/ymarks/get_ymark.java
@@ -13,7 +13,6 @@ import de.anomic.data.UserDB;
import de.anomic.data.ymark.YMarkCrawlStart;
import de.anomic.data.ymark.YMarkDate;
import de.anomic.data.ymark.YMarkEntry;
-import de.anomic.data.ymark.YMarkRDF;
import de.anomic.data.ymark.YMarkTables;
import de.anomic.data.ymark.YMarkTables.TABLES;
import de.anomic.data.ymark.YMarkUtil;
diff --git a/source/de/anomic/data/ymark/YMarkCrawlStart.java b/source/de/anomic/data/ymark/YMarkCrawlStart.java
index 4efc2ac32..573b31f0f 100644
--- a/source/de/anomic/data/ymark/YMarkCrawlStart.java
+++ b/source/de/anomic/data/ymark/YMarkCrawlStart.java
@@ -90,10 +90,7 @@ public class YMarkCrawlStart extends HashMap<String,String>{
}
public boolean hasSchedule() {
- if(!this.isEmpty() && this.date_next_exec.after(new Date()))
- return true;
- else
- return false;
+ return (!this.isEmpty() && this.date_next_exec.after(new Date()));
}
public boolean isRunning(final CrawlSwitchboard crawler) {
diff --git a/source/net/yacy/dbtest.java b/source/net/yacy/dbtest.java
index c36d454e7..e01ec8b9c 100644
--- a/source/net/yacy/dbtest.java
+++ b/source/net/yacy/dbtest.java
@@ -267,7 +267,7 @@ public class dbtest {
System.out.println("*** YaCy Database Test");
// print out command line
boolean assertionenabled = false;
- assert assertionenabled = true;
+ assert (assertionenabled = true) == true; // compare to true to remove warning: "Possible accidental assignement"
if (assertionenabled) System.out.println("*** Asserts are enabled"); else System.out.println("*** HINT: YOU SHOULD ENABLE ASSERTS! (include -ea in start arguments");
final long mb = MemoryControl.available() / 1024 / 1024;
System.out.println("*** RAM = " + mb + " MB");
diff --git a/source/net/yacy/kelondro/blob/TablesColumnBLOBIndex.java b/source/net/yacy/kelondro/blob/TablesColumnBLOBIndex.java
index 98710f848..8370abb3c 100644
--- a/source/net/yacy/kelondro/blob/TablesColumnBLOBIndex.java
+++ b/source/net/yacy/kelondro/blob/TablesColumnBLOBIndex.java
@@ -39,19 +39,19 @@ import de.anomic.data.ymark.YMarkUtil;
public class TablesColumnBLOBIndex extends TablesColumnIndex{
// Map<ColumnName, Map<ColumnValue, T<PrimaryKey>>>
- private final BEncodedHeap index;
+ private final BEncodedHeap index;
private final static byte SEPERATOR = (byte) ',';
-
- public TablesColumnBLOBIndex(final BEncodedHeap bheap) {
+
+ public TablesColumnBLOBIndex(final BEncodedHeap bheap) {
super(TablesColumnIndex.INDEXTYPE.BLOB);
- this.index = bheap;
+ this.index = bheap;
}
-
+
public static Collection<byte[]> byteToCollection(final byte[] b) {
final Collection<byte[]> PKset = ByteBuffer.split(b, SEPERATOR);
return PKset;
}
-
+
public static byte[] CollectionToByte(final Collection<byte[]> bc) {
final ByteBuffer buf = new ByteBuffer(15 * bc.size());
final Iterator<byte[]> iter = bc.iterator();
@@ -59,9 +59,12 @@ public class TablesColumnBLOBIndex extends TablesColumnIndex{
buf.append(iter.next());
buf.append(SEPERATOR);
}
- return buf.getBytes();
+ byte[] b = buf.getBytes();
+ try {buf.close(); } catch (IOException e) {}
+ return b;
}
-
+
+ @Override
public void deleteIndex(final String columnName) {
final byte[] column = YMarkUtil.getKeyId(columnName);
try {
@@ -72,16 +75,17 @@ public class TablesColumnBLOBIndex extends TablesColumnIndex{
Log.logException(e);
}
}
-
- protected void insertPK(final String columnName, final String columnValue, final byte[] pk) {
+
+ @Override
+ protected void insertPK(final String columnName, final String columnValue, final byte[] pk) {
Map<String, byte[]> valueIdxMap;
- Collection<byte[]> PKset;
+ Collection<byte[]> PKset;
final byte[] column = YMarkUtil.getKeyId(columnName);
try {
valueIdxMap = this.index.get(column);
- if(valueIdxMap != null) {
+ if(valueIdxMap != null) {
if(valueIdxMap.containsKey(columnValue)) {
- PKset = byteToCollection(valueIdxMap.get(columnValue));
+ PKset = byteToCollection(valueIdxMap.get(columnValue));
if(!ByteBuffer.contains(PKset, pk)) {
PKset.add(pk);
}
@@ -95,29 +99,30 @@ public class TablesColumnBLOBIndex extends TablesColumnIndex{
PKset.add(pk);
valueIdxMap = new ConcurrentHashMap<String, byte[]>();
}
- valueIdxMap.put(columnValue, CollectionToByte(PKset));
+ valueIdxMap.put(columnValue, CollectionToByte(PKset));
this.index.insert(column, valueIdxMap);
return;
} catch (IOException e) {
Log.logException(e);
} catch (SpaceExceededException e) {
Log.logException(e);
- }
+ }
}
-
- protected void removePK(final byte[] pk) {
- final Iterator<Map.Entry<byte[], Map<String, byte[]>>> niter = this.index.iterator();
+
+ @Override
+ protected void removePK(final byte[] pk) {
+ final Iterator<Map.Entry<byte[], Map<String, byte[]>>> niter = this.index.iterator();
while (niter.hasNext()) {
final Map.Entry<byte[], Map<String,byte[]>> entry = niter.next();
final Iterator<Map.Entry<String, byte[]>> viter = entry.getValue().entrySet().iterator();
while(viter.hasNext()) {
final Map.Entry<String, byte[]> columnValue = viter.next();
final Collection<byte[]> PKset = byteToCollection(columnValue.getValue());
- ByteBuffer.remove(PKset, pk);
+ ByteBuffer.remove(PKset, pk);
if(PKset.isEmpty()) {
- viter.remove();
+ viter.remove();
} else {
- columnValue.setValue(CollectionToByte(PKset));
+ columnValue.setValue(CollectionToByte(PKset));
}
}
try {
@@ -129,16 +134,19 @@ public class TablesColumnBLOBIndex extends TablesColumnIndex{
}
}
}
-
- public void clear() {
+
+ @Override
+ public void clear() {
this.index.clear();
}
-
- public Collection<String> columns() {
+
+ @Override
+ public Collection<String> columns() {
return this.index.columns();
}
-
- public Set<String> keySet(final String columnName) {
+
+ @Override
+ public Set<String> keySet(final String columnName) {
final byte[] column = YMarkUtil.getKeyId(columnName);
// a TreeSet is used to get sorted set of keys (e.g. folders)
if(this.index.containsKey(column)) {
@@ -149,11 +157,12 @@ public class TablesColumnBLOBIndex extends TablesColumnIndex{
} catch (SpaceExceededException e) {
Log.logException(e);
}
- }
+ }
return new TreeSet<String>();
}
-
- public boolean containsKey(final String columnName, final String key) {
+
+ @Override
+ public boolean containsKey(final String columnName, final String key) {
final byte[] column = YMarkUtil.getKeyId(columnName);
if(this.index.containsKey(column)) {
try {
@@ -166,13 +175,15 @@ public class TablesColumnBLOBIndex extends TablesColumnIndex{
}
return false;
}
-
- public boolean hasIndex(final String columnName) {
+
+ @Override
+ public boolean hasIndex(final String columnName) {
final byte[] column = YMarkUtil.getKeyId(columnName);
return this.index.containsKey(column);
}
-
- public Collection<byte[]> get(final String columnName, final String key) {
+
+ @Override
+ public Collection<byte[]> get(final String columnName, final String key) {
final byte[] column = YMarkUtil.getKeyId(columnName);
// deserialize
try {
@@ -184,8 +195,9 @@ public class TablesColumnBLOBIndex extends TablesColumnIndex{
}
return new ArrayList<byte[]>();
}
-
- public int size(final String columnName) {
+
+ @Override
+ public int size(final String columnName) {
final byte[] column = YMarkUtil.getKeyId(columnName);
if(this.index.containsKey(column)) {
try {
@@ -197,9 +209,10 @@ public class TablesColumnBLOBIndex extends TablesColumnIndex{
}
}
return -1;
- }
-
- public int size() {
+ }
+
+ @Override
+ public int size() {
return this.index.size();
}
}
\ No newline at end of file
diff --git a/source/net/yacy/kelondro/util/MemoryStrategy.java b/source/net/yacy/kelondro/util/MemoryStrategy.java
index 165d29bcb..e6d8a58bf 100644
--- a/source/net/yacy/kelondro/util/MemoryStrategy.java
+++ b/source/net/yacy/kelondro/util/MemoryStrategy.java
@@ -131,6 +131,6 @@ public abstract class MemoryStrategy {
/**
* set the memory to be available for properState - StandardMemoryStrategy only
*/
- protected void setProperMbyte(final long mbyte) {
+ protected void setProperMbyte(@SuppressWarnings("unused") final long mbyte) {
}
}
diff --git a/source/net/yacy/search/query/SearchEvent.java b/source/net/yacy/search/query/SearchEvent.java
index a2bb30c96..99ec90e17 100644
--- a/source/net/yacy/search/query/SearchEvent.java
+++ b/source/net/yacy/search/query/SearchEvent.java
@@ -581,7 +581,7 @@ public final class SearchEvent {
public void run() {
try {
boolean aquired;
- while ( aquired = this.trigger.tryAcquire(3000, TimeUnit.MILLISECONDS) ) {
+ while ( (aquired = this.trigger.tryAcquire(3000, TimeUnit.MILLISECONDS)) == true ) { // compare to true to remove warning: "Possible accidental assignement"
if ( !aquired || MemoryControl.shortStatus()) {
break;
}
diff --git a/source/net/yacy/yacy.java b/source/net/yacy/yacy.java
index b9e44cd7e..baf683171 100644
--- a/source/net/yacy/yacy.java
+++ b/source/net/yacy/yacy.java
@@ -587,7 +587,7 @@ public final class yacy {
// check assertion status
//ClassLoader.getSystemClassLoader().setDefaultAssertionStatus(true);
boolean assertionenabled = false;
- assert assertionenabled = true;
+ assert (assertionenabled = true) == true; // compare to true to remove warning: "Possible accidental assignement"
if (assertionenabled) System.out.println("Asserts are enabled");
// check memory amount