removes some deprecation-warnings

This commit is contained in:
sgaebel 2020-07-29 00:11:41 +02:00
parent dd9d4b1188
commit 4a495df63a
4 changed files with 11 additions and 10 deletions

View File

@ -81,11 +81,11 @@ public class FlatJSONResponseWriter implements QueryResponseWriter, EmbeddedSolr
for (int i = 0; i < sz; i++) {
int id = iterator.nextDoc();
Document doc = searcher.doc(id);
writeDoc(writer, schema, null, doc.getFields(), (includeScore ? iterator.score() : 0.0f), includeScore);
writeDoc(writer, schema, doc.getFields());
}
}
private static final void writeDoc(final Writer writer, final IndexSchema schema, final String name, final List<IndexableField> fields, final float score, final boolean includeScore) throws IOException {
private static final void writeDoc(final Writer writer, final IndexSchema schema, final List<IndexableField> fields) throws IOException {
JSONObject json = new JSONObject();
int sz = fields.size();
@ -110,7 +110,7 @@ public class FlatJSONResponseWriter implements QueryResponseWriter, EmbeddedSolr
JSONObject j = new JSONObject();
String sv = value.stringValue();
setValue(j, type.getTypeName(), "x", sv); //sf.write(this, null, f1);
a.put(j.get("x"));
a.put(j.opt("x"));
} else {
setValue(json, type.getTypeName(), value.name(), value.stringValue());
}
@ -121,7 +121,7 @@ public class FlatJSONResponseWriter implements QueryResponseWriter, EmbeddedSolr
String sv = fields.get(i).stringValue();
JSONObject j = new JSONObject();
setValue(j, type.getTypeName(), "x", sv); //sf.write(this, null, f1);
a.put(j.get("x"));
a.put(j.opt("x"));
}
}
fidx1 = fidx2;

View File

@ -611,6 +611,7 @@ public class RequestHeader extends HeaderFramework implements HttpServletRequest
}
@Override
@SuppressWarnings("deprecation")
public String getScheme() {
// here we can directly check original request first, as scheme is not expected to be changed
if (_request != null) {

View File

@ -2196,7 +2196,8 @@ public final class Switchboard extends serverSwitch {
if ((json.opt("index") != null && json.length() == 1) || json.length() == 0) continue;
SolrInputDocument surrogate = new SolrInputDocument();
for (String key: json.keySet()) {
Object o = json.get(key);
Object o = json.opt(key);
if (o == null) continue;
if (o instanceof JSONArray) {
// transform this into a list
JSONArray a = (JSONArray) o;
@ -3915,10 +3916,6 @@ public final class Switchboard extends serverSwitch {
}
}
public void initBookmarks(@SuppressWarnings("unused") boolean b) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
public class receiptSending implements Runnable
{
private final Seed initiatorPeer;

View File

@ -67,6 +67,7 @@ public class YaCyDefaultServletTest {
* custom "CONNECTION_PROP_PROTOCOL" header indicates the protocol
*/
@Test
@SuppressWarnings("deprecation")
public void testGetContextCustomProtocolHeader() {
RequestHeader header = new RequestHeader();
header.put(HeaderFramework.HOST, "myhost.com:8443");
@ -84,6 +85,7 @@ public class YaCyDefaultServletTest {
* custom "CONNECTION_PROP_PROTOCOL" indicates the protocol
*/
@Test
@SuppressWarnings("deprecation")
public void testGetContextDefaultPortCustomProtocolHeader() {
RequestHeader header = new RequestHeader();
header.put(HeaderFramework.HOST, "myhost.com");
@ -99,7 +101,8 @@ public class YaCyDefaultServletTest {
/**
* getContext() : reverse proxy serving HTTPS, YaCy serving HTTP
*/
@Test
@Test
@SuppressWarnings("deprecation")
public void testGetContextReverseProxy() {
/* Different protocols : HTTPS on proxy, HTTP on peer */
RequestHeader header = new RequestHeader();