diff options
author | Matt Windsor <mattwindsor@btinternet.com> | 2011-03-23 15:16:34 +0000 |
---|---|---|
committer | Matt Windsor <mattwindsor@btinternet.com> | 2011-03-23 15:16:34 +0000 |
commit | cb0a78131286b1a312351308d2cb6e59ed122fef (patch) | |
tree | 280ff409c85cc4e80e43a3ed14f648d15d077397 | |
parent | 5e6649f0524a28e5d53aea174da5e512e614f377 (diff) |
common: Moved from json-simple to jackson as JSON backend; changes include less confusing decoder code and the possibility to migrate to decoding/encoding directly to object representations. backend: Fixed JSON encoding code which was directly calling JSON backend instead of using ProtocolUtils.
-rw-r--r-- | lib/jackson-core-asl-1.7.4.jar | bin | 0 -> 207557 bytes | |||
-rw-r--r-- | lib/jackson-mapper-asl-1.7.4.jar | bin | 0 -> 629861 bytes | |||
-rw-r--r-- | lib/json_simple-1.1.jar | bin | 16046 -> 0 bytes | |||
-rw-r--r-- | src/uk/org/ury/backend/handlers/LibraryRequestHandler.java | 9 | ||||
-rw-r--r-- | src/uk/org/ury/backend/server/AbstractRequestHandler.java | 8 | ||||
-rw-r--r-- | src/uk/org/ury/backend/server/HttpHandler.java | 7 | ||||
-rw-r--r-- | src/uk/org/ury/backend/server/Server.java | 2 | ||||
-rw-r--r-- | src/uk/org/ury/backend/server/exceptions/HandleFailureException.java | 65 | ||||
-rw-r--r-- | src/uk/org/ury/common/library/LibraryUtils.java | 231 | ||||
-rw-r--r-- | src/uk/org/ury/common/protocol/ProtocolUtils.java | 51 | ||||
-rw-r--r-- | src/uk/org/ury/common/protocol/exceptions/DecodeFailureException.java | 47 | ||||
-rw-r--r-- | src/uk/org/ury/common/protocol/exceptions/EncodeFailureException.java | 35 | ||||
-rw-r--r-- | src/uk/org/ury/frontend/client/Client.java | 18 | ||||
-rw-r--r-- | src/uk/org/ury/frontend/client/test/ClientTest.java | 4 | ||||
-rw-r--r-- | src/uk/org/ury/frontend/modules/library/LibraryViewer.java | 2 |
15 files changed, 273 insertions, 206 deletions
diff --git a/lib/jackson-core-asl-1.7.4.jar b/lib/jackson-core-asl-1.7.4.jar Binary files differnew file mode 100644 index 0000000..f4e6dfd --- /dev/null +++ b/lib/jackson-core-asl-1.7.4.jar diff --git a/lib/jackson-mapper-asl-1.7.4.jar b/lib/jackson-mapper-asl-1.7.4.jar Binary files differnew file mode 100644 index 0000000..8a79d8d --- /dev/null +++ b/lib/jackson-mapper-asl-1.7.4.jar diff --git a/lib/json_simple-1.1.jar b/lib/json_simple-1.1.jar Binary files differdeleted file mode 100644 index f395f41..0000000 --- a/lib/json_simple-1.1.jar +++ /dev/null diff --git a/src/uk/org/ury/backend/handlers/LibraryRequestHandler.java b/src/uk/org/ury/backend/handlers/LibraryRequestHandler.java index 25423f6..b175485 100644 --- a/src/uk/org/ury/backend/handlers/LibraryRequestHandler.java +++ b/src/uk/org/ury/backend/handlers/LibraryRequestHandler.java @@ -16,7 +16,6 @@ import org.apache.http.HttpStatus; import org.apache.http.entity.StringEntity; import org.apache.http.protocol.HTTP; import org.apache.http.protocol.HttpContext; -import org.json.simple.JSONValue; import uk.org.ury.backend.database.DatabaseDriver; import uk.org.ury.backend.database.UserClass; @@ -35,7 +34,9 @@ import uk.org.ury.common.library.LibraryUtils; import uk.org.ury.common.library.exceptions.EmptySearchException; import uk.org.ury.common.library.item.LibraryItem; import uk.org.ury.common.protocol.Directive; +import uk.org.ury.common.protocol.ProtocolUtils; import uk.org.ury.common.protocol.Status; +import uk.org.ury.common.protocol.exceptions.EncodeFailureException; /** * A request handler for library queries. @@ -178,11 +179,13 @@ public class LibraryRequestHandler extends AbstractRequestHandler { StringEntity entity = null; try { - entity = new StringEntity(JSONValue.toJSONString(content)); + entity = new StringEntity(ProtocolUtils.encode(content)); } catch (UnsupportedEncodingException e) { throw new HandlerSetupFailureException(getClass().getName(), e); + } catch (EncodeFailureException e) { + throw new HandleFailureException(e); } - + entity.setContentType(HTTP.PLAIN_TEXT_TYPE); response.setEntity(entity); } diff --git a/src/uk/org/ury/backend/server/AbstractRequestHandler.java b/src/uk/org/ury/backend/server/AbstractRequestHandler.java index 53517d7..e545651 100644 --- a/src/uk/org/ury/backend/server/AbstractRequestHandler.java +++ b/src/uk/org/ury/backend/server/AbstractRequestHandler.java @@ -18,7 +18,6 @@ import org.apache.http.entity.StringEntity; import org.apache.http.protocol.HTTP; import org.apache.http.protocol.HttpContext; import org.apache.http.protocol.HttpRequestHandler; -import org.json.simple.JSONValue; import uk.org.ury.backend.server.exceptions.BadRequestException; import uk.org.ury.backend.server.exceptions.HandleFailureException; @@ -28,7 +27,9 @@ import uk.org.ury.backend.server.exceptions.HandlingException; import uk.org.ury.backend.server.exceptions.NotAHandlerException; import uk.org.ury.backend.server.exceptions.UnknownFunctionException; import uk.org.ury.common.protocol.Directive; +import uk.org.ury.common.protocol.ProtocolUtils; import uk.org.ury.common.protocol.Status; +import uk.org.ury.common.protocol.exceptions.EncodeFailureException; /** * An abstract request handler for HttpCore, providing basic functionality such @@ -138,10 +139,13 @@ public abstract class AbstractRequestHandler implements HttpRequestHandler { content.put(Directive.STATUS.toString(), Status.ERROR.toString()); content.put(Directive.REASON.toString(), reason); - entity = new StringEntity(JSONValue.toJSONString(content)); + entity = new StringEntity(ProtocolUtils.encode(content)); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); + } catch (EncodeFailureException e) { + // TODO Auto-generated catch block + e.printStackTrace(); } if (entity != null) { diff --git a/src/uk/org/ury/backend/server/HttpHandler.java b/src/uk/org/ury/backend/server/HttpHandler.java index ed94d3d..2792cd7 100644 --- a/src/uk/org/ury/backend/server/HttpHandler.java +++ b/src/uk/org/ury/backend/server/HttpHandler.java @@ -51,7 +51,6 @@ import org.apache.http.entity.StringEntity; import org.apache.http.protocol.HTTP; import org.apache.http.protocol.HttpContext; import org.apache.http.protocol.HttpRequestHandler; -import org.json.simple.JSONValue; import uk.org.ury.backend.server.exceptions.BadRequestException; import uk.org.ury.backend.server.exceptions.HandleFailureException; @@ -59,7 +58,9 @@ import uk.org.ury.backend.server.exceptions.HandlerNotFoundException; import uk.org.ury.backend.server.exceptions.HandlerSetupFailureException; import uk.org.ury.backend.server.exceptions.NotAHandlerException; import uk.org.ury.common.protocol.Directive; +import uk.org.ury.common.protocol.ProtocolUtils; import uk.org.ury.common.protocol.Status; +import uk.org.ury.common.protocol.exceptions.EncodeFailureException; /** * @author Matt Windsor, Apache Software Foundation @@ -193,9 +194,11 @@ public class HttpHandler extends AbstractRequestHandler implements StringEntity entity = null; try { - entity = new StringEntity(JSONValue.toJSONString(content)); + entity = new StringEntity(ProtocolUtils.encode(content)); } catch (UnsupportedEncodingException e) { throw new HandlerSetupFailureException(className, e); + } catch (EncodeFailureException e) { + throw new HandleFailureException(e); } entity.setContentType(HTTP.PLAIN_TEXT_TYPE); diff --git a/src/uk/org/ury/backend/server/Server.java b/src/uk/org/ury/backend/server/Server.java index 57a0030..d1f7384 100644 --- a/src/uk/org/ury/backend/server/Server.java +++ b/src/uk/org/ury/backend/server/Server.java @@ -50,7 +50,7 @@ public class Server { } /** - * Run the server. + * Runs the server. */ private void run() { Thread thread = null; diff --git a/src/uk/org/ury/backend/server/exceptions/HandleFailureException.java b/src/uk/org/ury/backend/server/exceptions/HandleFailureException.java index 0efb7a3..adff78c 100644 --- a/src/uk/org/ury/backend/server/exceptions/HandleFailureException.java +++ b/src/uk/org/ury/backend/server/exceptions/HandleFailureException.java @@ -4,43 +4,42 @@ package uk.org.ury.backend.server.exceptions; /** - * Generic exception thrown when a server request handler fails to - * handle a request. + * Generic exception thrown when a server request handler fails to handle a + * request. * * @author Matt Windsor */ +public class HandleFailureException extends HandlingException { -public class HandleFailureException extends HandlingException -{ - - /** - * Change this! ---v - */ - - private static final long serialVersionUID = -397479334359858162L; + /** + * Change this! ---v + */ + private static final long serialVersionUID = -397479334359858162L; + /** + * Constructs a new HandleFailureException with a default reason. + */ + public HandleFailureException() { + super("Server request handler failed to handle the request."); + } - /** - * Construct a new HandleFailureException with a - * default reason. - */ - - public - HandleFailureException () - { - super ("Server request handler failed to handle the request."); - } - - - /** - * Construct a new HandleFailureException. - * - * @param reason The explanation for the exception. - */ - - public - HandleFailureException (String reason) - { - super (reason); - } + /** + * Constructs a new HandleFailureException. + * + * @param reason + * The explanation for the exception. + */ + public HandleFailureException(String reason) { + super(reason); + } + + /** + * Constructs a new HandleFailureException with a chained exception. + * + * @param cause + * The chained exception. + */ + public HandleFailureException(Throwable cause) { + super("Request handler failed: " + cause.getMessage(), cause); + } } diff --git a/src/uk/org/ury/common/library/LibraryUtils.java b/src/uk/org/ury/common/library/LibraryUtils.java index 335b8b5..572d448 100644 --- a/src/uk/org/ury/common/library/LibraryUtils.java +++ b/src/uk/org/ury/common/library/LibraryUtils.java @@ -1,6 +1,14 @@ -/** +/* + * LibraryUtils.java + * ----------------- + * + * Part of the URY Common Packages + * + * V0.00 2011/03/23 * + * (C) 2011 URY Computing */ + package uk.org.ury.common.library; import java.sql.ResultSet; @@ -16,129 +24,108 @@ import uk.org.ury.common.library.exceptions.EmptySearchException; import uk.org.ury.common.library.item.LibraryItem; import uk.org.ury.common.library.item.LibraryItemProperty; - - /** - * A set of common utility routines to facilitate the extraction of - * library items from the library areas of the URY database. + * A set of common utility routines to facilitate the extraction of library + * items from the library areas of the URY database. * - * @author Matt Windsor + * @author Matt Windsor */ +public class LibraryUtils { + /** + * Performs a library search. + * + * @param db + * The database to query. + * + * @param search + * The search fragment to include in the search. Can be empty or + * null. + * + * @throws IllegalArgumentException + * if the search term is are null. + * + * @throws QueryFailureException + * if the database backend yielded an error while executing the + * search query. + * + * @throws EmptySearchException + * if the search term is empty (to be handled as a user error). + * + * @return a list of LibraryItems matching the search terms. + */ + public static List<LibraryItem> search(DatabaseDriver db, String search) + throws QueryFailureException, EmptySearchException { + if (db == null) + throw new IllegalArgumentException("Database handle is null."); + + if (search == null) + throw new IllegalArgumentException("Search string is null."); + + List<LibraryItem> results = new ArrayList<LibraryItem>(); + + // Return empty set if the search term is null. + + if (search.equals("")) + throw new EmptySearchException(); + + ResultSet rs = null; + + Object[] params = { "%" + search + "%", "%" + search + "%", + "%" + search + "%" }; + + try { + rs = db.executeQuery( + "SELECT r.title AS album, t.title," + + " t.artist, recordlabel AS label, status, media AS medium, format," + + " datereleased, EXTRACT(EPOCH FROM dateadded) as dateadded," + + " EXTRACT(EPOCH FROM datetime_lastedit) AS dateedited," + + " shelfletter, shelfnumber, cdid, digitised, clean" + + " FROM rec_record AS r" + + " INNER JOIN rec_track AS t ON (r.recordid = t.recordid)" + + " WHERE t.title ILIKE ?" + + " OR t.artist ILIKE ?" + + " OR r.title ILIKE ?" + + " ORDER BY digitised DESC, medium ASC, r.title ASC," + + " t.artist ASC, t.title ASC;", params, 50); + } catch (SQLException e) { + throw new QueryFailureException(e.getMessage()); + } + + try { + while (rs.next()) { + results.add(translateRow(rs)); + } + } catch (SQLException e) { + throw new QueryFailureException(e.getMessage()); + } + + return results; + } + + /** + * Translates a row retrieved from the database into a LibraryItem. + * + * @param rs + * The result-set, or database cursor, pointing to the row to + * translate. + * + * @return A new LibraryItem containing the properties extracted from the + * translated row. + */ + private static LibraryItem translateRow(ResultSet rs) { + // Translate SQL columns into a list of properties. + + Map<LibraryItemProperty, String> properties = new HashMap<LibraryItemProperty, String>(); + + for (LibraryItemProperty p : LibraryItemProperty.values()) { + try { + properties.put(p, rs.getString(p.sql)); + } catch (SQLException e) { + // Ignore this, as it is almost certainly just a non-existent + // property. + } + } -public class LibraryUtils -{ - /** - * Perform a library search. - * - * @param db The database to query. - * - * @param search The search fragment to include in the search. - * Can be empty or null. - * - * @throws IllegalArgumentException if the search term is - * are null. - * - * @throws QueryFailureException if the database backend - * yielded an error while executing the search - * query. - * - * @throws EmptySearchException if the search term is - * empty (to be handled as a user error). - * - * @return a list of LibraryItems matching the search terms. - */ - - public static List<LibraryItem> - search (DatabaseDriver db, String search) - throws QueryFailureException, EmptySearchException - { - if (db == null) - throw new IllegalArgumentException ("Database handle is null."); - - if (search == null) - throw new IllegalArgumentException ("Search string is null."); - - List<LibraryItem> results = new ArrayList<LibraryItem> (); - - - // Return empty set if the search term is null. - - if (search.equals("")) - throw new EmptySearchException (); - - - ResultSet rs = null; - - Object[] params = {"%" + search + "%", "%" + search + "%", "%" + search + "%"}; - - try - { - rs = db.executeQuery ( - "SELECT r.title AS album, t.title," - + " t.artist, recordlabel AS label, status, media AS medium, format," - + " datereleased, EXTRACT(EPOCH FROM dateadded) as dateadded," - + " EXTRACT(EPOCH FROM datetime_lastedit) AS dateedited," - + " shelfletter, shelfnumber, cdid, digitised, clean" - + " FROM rec_record AS r" - + " INNER JOIN rec_track AS t ON (r.recordid = t.recordid)" - + " WHERE t.title ILIKE ?" - + " OR t.artist ILIKE ?" - + " OR r.title ILIKE ?" - + " ORDER BY digitised DESC, medium ASC, r.title ASC," - + " t.artist ASC, t.title ASC;", params, 50); - } - catch (SQLException e) - { - throw new QueryFailureException (e.getMessage ()); - } - - try - { - while (rs.next ()) - { - results.add (translateRow (rs)); - } - } - catch (SQLException e) - { - throw new QueryFailureException (e.getMessage ()); - } - - return results; - } - - - /** - * Translate a row retrieved from the database into a LibraryItem. - * - * @param rs The result-set, or database cursor, pointing to the - * row to translate. - * - * @return A new LibraryItem containing the properties extracted - * from the translated row. - */ - - private static LibraryItem - translateRow (ResultSet rs) - { - // Translate SQL columns into a list of properties. - - Map<LibraryItemProperty, String> properties = new HashMap<LibraryItemProperty, String> (); - - for (LibraryItemProperty p : LibraryItemProperty.values ()) - { - try - { - properties.put (p, rs.getString (p.sql)); - } - catch (SQLException e) - { - // Ignore this, as it is almost certainly just a non-existent - // property. - } - } - - - return new LibraryItem (properties); - } + return new LibraryItem(properties); + } } diff --git a/src/uk/org/ury/common/protocol/ProtocolUtils.java b/src/uk/org/ury/common/protocol/ProtocolUtils.java index 8686eb7..37e8c75 100644 --- a/src/uk/org/ury/common/protocol/ProtocolUtils.java +++ b/src/uk/org/ury/common/protocol/ProtocolUtils.java @@ -1,14 +1,23 @@ -/** +/* + * ProtocolUtils.java + * ------------------ + * + * Part of the URY Common Packages * + * V0.00 2011/03/23 + * + * (C) 2011 URY Computing */ + package uk.org.ury.common.protocol; import java.util.Map; -import org.json.simple.JSONObject; -import org.json.simple.JSONValue; +import org.codehaus.jackson.map.ObjectMapper; +import org.codehaus.jackson.type.TypeReference; import uk.org.ury.common.protocol.exceptions.DecodeFailureException; +import uk.org.ury.common.protocol.exceptions.EncodeFailureException; import uk.org.ury.common.protocol.exceptions.InvalidMessageException; /** @@ -18,8 +27,9 @@ import uk.org.ury.common.protocol.exceptions.InvalidMessageException; * @author Matt Windsor * */ - public class ProtocolUtils { + private static final ObjectMapper mapper = new ObjectMapper(); + /** * Encode a key-value map into a protocol string. * @@ -33,13 +43,21 @@ public class ProtocolUtils { * directives. * * @return A string containing the encoded representation of the map. + * + * @throws EncodeFailureException + * if the encoding engine fails to encode the map as a string. */ - public static String encode(Map<String, Object> items) { - return JSONValue.toJSONString(items); + public static String encode(Map<String, Object> items) + throws EncodeFailureException { + try { + return mapper.writeValueAsString(items); + } catch (Exception e) { + throw new EncodeFailureException(e); + } } /** - * Decode a protocol string into a key-value map. + * Decodes a protocol string into a key-value map. * * @param string * The string to decode. @@ -47,19 +65,18 @@ public class ProtocolUtils { * @return A key-value map mapping directives to strings, lists and maps. * * @throws DecodeFailureException - * if the decoding engine returns something other than a map. + * if the decoding engine fails to decode the string. */ - public static Map<?, ?> decode(String string) throws DecodeFailureException { - Object result = JSONValue.parse(string); - - if (result instanceof JSONObject) - return (JSONObject) result; - else - throw new DecodeFailureException("Result not a map."); + public static Map<String, Object> decode(String string) throws DecodeFailureException { + try { + return mapper.readValue(string, new TypeReference<Map<String, Object>>() {}); + } catch (Exception e) { + throw new DecodeFailureException(e); + } } /** - * Check if a response is flagged as having OK status. + * Checks if a response is flagged as having OK status. * * @param response * The response message, as a key-value map (eg in decoded @@ -71,7 +88,7 @@ public class ProtocolUtils { * @throws InvalidMessageException * if the response is invalid (eg the status is missing). */ - public static boolean responseIsOK(Map<?, ?> response) + public static boolean responseIsOK(Map<String, Object> response) throws InvalidMessageException { if (response.containsKey(Directive.STATUS.toString()) == false) throw new InvalidMessageException("No status line in response."); diff --git a/src/uk/org/ury/common/protocol/exceptions/DecodeFailureException.java b/src/uk/org/ury/common/protocol/exceptions/DecodeFailureException.java index 978ca7b..3047fd7 100644 --- a/src/uk/org/ury/common/protocol/exceptions/DecodeFailureException.java +++ b/src/uk/org/ury/common/protocol/exceptions/DecodeFailureException.java @@ -1,32 +1,35 @@ -/** +/* + * DecodeFailureException.java + * --------------------------- + * + * Part of the URY Common Package + * + * V0.00 2011/03/23 * + * (C) 2011 URY Computing */ -package uk.org.ury.common.protocol.exceptions; +package uk.org.ury.common.protocol.exceptions; /** * Exception thrown when the protocol decoder fails. * - * @author Matt Windsor + * @author Matt Windsor */ +public class DecodeFailureException extends Exception { + /** + * + */ + private static final long serialVersionUID = -4080891009444990296L; -public class DecodeFailureException extends Exception -{ - /** - * - */ - private static final long serialVersionUID = -3972492943653273528L; - - - /** - * Construct a new DecodeFailureException with a reason. - * - * @param reason The reason for throwing the exception. - */ - - public - DecodeFailureException (String reason) - { - super (reason); - } + /** + * Construct a new DecodeFailureException with a chained exception. + * + * @param cause + * The exception to chain. + */ + public DecodeFailureException(Throwable cause) { + super("Decoding engine failed with reason: " + cause.getMessage(), + cause); + } } diff --git a/src/uk/org/ury/common/protocol/exceptions/EncodeFailureException.java b/src/uk/org/ury/common/protocol/exceptions/EncodeFailureException.java new file mode 100644 index 0000000..f99ca79 --- /dev/null +++ b/src/uk/org/ury/common/protocol/exceptions/EncodeFailureException.java @@ -0,0 +1,35 @@ +/* + * EncodeFailureException.java + * --------------------------- + * + * Part of the URY Common Package + * + * V0.00 2011/03/23 + * + * (C) 2011 URY Computing + */ + +package uk.org.ury.common.protocol.exceptions; + +/** + * Exception thrown when the protocol encoder fails. + * + * @author Matt Windsor + */ +public class EncodeFailureException extends Exception { + /** + * + */ + private static final long serialVersionUID = 8651419347999155020L; + + /** + * Construct a new EncodeFailureException with a chained exception. + * + * @param cause + * The exception to chain. + */ + public EncodeFailureException(Throwable cause) { + super("Encoding engine failed with reason: " + cause.getMessage(), + cause); + } +} diff --git a/src/uk/org/ury/frontend/client/Client.java b/src/uk/org/ury/frontend/client/Client.java index 9606d89..bbf0001 100644 --- a/src/uk/org/ury/frontend/client/Client.java +++ b/src/uk/org/ury/frontend/client/Client.java @@ -1,3 +1,14 @@ +/* + * Client.java + * ----------- + * + * Part of the URY Frontend Platform + * + * V0.00 2011/03/23 + * + * (C) 2011 URY Computing + */ + package uk.org.ury.frontend.client; import java.io.BufferedReader; @@ -13,6 +24,11 @@ import java.util.Map; import uk.org.ury.common.protocol.ProtocolUtils; import uk.org.ury.common.protocol.exceptions.DecodeFailureException; +/** + * An implementation of a client to communicate with the URY Server. + * + * @author Matt Windsor + */ public class Client { /** * Get a raw response from the server. @@ -26,7 +42,7 @@ public class Client { * @throws DecodeFailureException * if the decode failed. */ - public Map<?, ?> get(String file) throws DecodeFailureException { + public Map<String, Object> get(String file) throws DecodeFailureException { URL url = null; URLConnection uc = null; String result = ""; diff --git a/src/uk/org/ury/frontend/client/test/ClientTest.java b/src/uk/org/ury/frontend/client/test/ClientTest.java index d75a0ac..377fbe7 100644 --- a/src/uk/org/ury/frontend/client/test/ClientTest.java +++ b/src/uk/org/ury/frontend/client/test/ClientTest.java @@ -43,10 +43,10 @@ public class ClientTest { public void testGet() { Client client = new Client(); - Map<?, ?> response = null; + Map<String, Object> response = null; try { - response = client.get("/server/ServerRequestHandler?function=test"); + response = client.get("/backend/server/ServerRequestHandler?function=test"); } catch (DecodeFailureException e) { e.printStackTrace(); } diff --git a/src/uk/org/ury/frontend/modules/library/LibraryViewer.java b/src/uk/org/ury/frontend/modules/library/LibraryViewer.java index c4a3630..793751b 100644 --- a/src/uk/org/ury/frontend/modules/library/LibraryViewer.java +++ b/src/uk/org/ury/frontend/modules/library/LibraryViewer.java @@ -97,7 +97,7 @@ public class LibraryViewer extends AbstractFrontendModule { throw new EmptySearchException(); Client cl = new Client(); - Map<?, ?> response = null; + Map<String, Object> response = null; libraryList.clear(); try { |