@@ -161,7 +161,7 @@ public StanfordCoreNLPServer(int port, int timeout, boolean strict) throws IOExc
161161 /**
162162 * Create a new Stanford CoreNLP Server, with the default parameters.
163163 *
164- * @throws IOException Thrown if we could not write the shutdown key to the a file.
164+ * @throws IOException Thrown if we could not write the shutdown key to a file.
165165 */
166166 public StanfordCoreNLPServer () throws IOException {
167167 this (null );
@@ -171,7 +171,7 @@ public StanfordCoreNLPServer() throws IOException {
171171 * Create a new Stanford CoreNLP Server with the default parameters and
172172 * pass in properties (server_id, ...).
173173 *
174- * @throws IOException Thrown if we could not write the shutdown key to the a file.
174+ * @throws IOException Thrown if we could not write the shutdown key to a file.
175175 */
176176 public StanfordCoreNLPServer (Properties props ) throws IOException {
177177 // set up default IO properties
@@ -203,8 +203,8 @@ public StanfordCoreNLPServer(Properties props) throws IOException {
203203 // log server's default properties
204204 TreeSet <String > defaultPropertyKeys = new TreeSet <>(this .defaultProps .stringPropertyNames ());
205205 log ("Server default properties:\n \t \t \t (Note: unspecified annotator properties are English defaults)\n " +
206- String . join ( " \n " , defaultPropertyKeys .stream ().map (
207- k -> String .format ("\t \t \t %s = %s" , k , this .defaultProps .get (k ))).collect (Collectors .toList () )));
206+ defaultPropertyKeys .stream ().map (
207+ k -> String .format ("\t \t \t %s = %s" , k , this .defaultProps .get (k ))).collect (Collectors .joining ( " \n " )));
208208
209209 this .serverExecutor = Executors .newFixedThreadPool (ArgumentParser .threads );
210210 this .corenlpExecutor = Executors .newFixedThreadPool (ArgumentParser .threads );
@@ -256,9 +256,9 @@ public StanfordCoreNLPServer(Properties props) throws IOException {
256256 *
257257 * @return A map of (key, value) pairs corresponding to the request parameters.
258258 *
259- * @throws UnsupportedEncodingException Thrown if we could not decode the URL with utf8.
259+ * @throws IllegalStateException Thrown if we could not decode the URL with utf8.
260260 */
261- private static Map <String , String > getURLParams (URI uri ) throws UnsupportedEncodingException {
261+ private static Map <String , String > getURLParams (URI uri ) {
262262 String query = uri .getRawQuery ();
263263 if (query != null ) {
264264 try {
@@ -485,9 +485,9 @@ private Properties getProperties(HttpExchange httpExchange) throws UnsupportedEn
485485
486486 // Load the default properties if resetDefault is false
487487 // If resetDefault is true, ignore server properties this server was started with,
488- // with the exception of the keys in serverIOProperties (i.e. don't reset IO properties)
488+ // except the keys in serverIOProperties (i.e., don't reset IO properties)
489489 Properties props = new Properties ();
490- if (! urlParams .getOrDefault ("resetDefault" , "false" ).toLowerCase (). equals ("true" ))
490+ if ( ! urlParams .getOrDefault ("resetDefault" , "false" ).equalsIgnoreCase ("true" ))
491491 defaultProps .forEach ((key1 , value ) -> props .setProperty (key1 .toString (), value .toString ()));
492492 else {
493493 // if resetDefault is called, still maintain the serverIO properties (e.g. inputFormat, outputFormat, prettyPrint)
@@ -521,8 +521,9 @@ private Properties getProperties(HttpExchange httpExchange) throws UnsupportedEn
521521 languageSpecificProperties .load (is );
522522 PropertiesUtils .overWriteProperties (props ,languageSpecificProperties );
523523 // don't enforce requirements for non-English
524- if (!LanguageInfo .getLanguageFromString (language ).equals (LanguageInfo .HumanLanguage .ENGLISH ))
525- props .setProperty ("enforceRequirements" , "false" );
524+ if ( ! LanguageInfo .HumanLanguage .ENGLISH .equals (LanguageInfo .getLanguageFromString (language ))) {
525+ props .setProperty ("enforceRequirements" , "false" );
526+ }
526527 // check if the server is set to use the srparser, and if so,
527528 // set the parse.model to be srparser.model
528529 // also, check properties for the srparser.model prop
@@ -800,7 +801,7 @@ public void handle(HttpExchange httpExchange) throws IOException {
800801
801802
802803 /**
803- * Sending the appropriate shutdown key will gracefully shutdown the server.
804+ * Sending the appropriate shutdown key will gracefully shut down the server.
804805 * This key is, by default, saved into the local file /tmp/corenlp.shutdown on the
805806 * machine the server was run from.
806807 */
@@ -1120,7 +1121,7 @@ public void handle(HttpExchange httpExchange) throws IOException {
11201121 String pattern = params .get ("pattern" );
11211122 // (get whether to filter / find)
11221123 String filterStr = params .getOrDefault ("filter" , "false" );
1123- final boolean filter = filterStr .trim ().isEmpty () || "true" .equalsIgnoreCase (filterStr . toLowerCase () );
1124+ final boolean filter = filterStr .trim ().isEmpty () || "true" .equalsIgnoreCase (filterStr );
11241125 // (create the matcher)
11251126 final TokenSequencePattern regex = TokenSequencePattern .compile (pattern );
11261127
@@ -1248,10 +1249,10 @@ public void handle(HttpExchange httpExchange) throws IOException {
12481249 String pattern = params .get ("pattern" );
12491250 // (get whether to filter / find)
12501251 String filterStr = params .getOrDefault ("filter" , "false" );
1251- final boolean filter = filterStr .trim ().isEmpty () || "true" .equalsIgnoreCase (filterStr . toLowerCase () );
1252+ final boolean filter = filterStr .trim ().isEmpty () || "true" .equalsIgnoreCase (filterStr );
12521253 // (in case of find, get whether to only keep unique matches)
12531254 String uniqueStr = params .getOrDefault ("unique" , "false" );
1254- final boolean unique = uniqueStr .trim ().isEmpty () || "true" .equalsIgnoreCase (uniqueStr . toLowerCase () );
1255+ final boolean unique = uniqueStr .trim ().isEmpty () || "true" .equalsIgnoreCase (uniqueStr );
12551256 // (create the matcher)
12561257 final SemgrexPattern regex = SemgrexPattern .compile (pattern );
12571258 final SemanticGraphCoreAnnotations .DependenciesType dependenciesType =
@@ -1501,8 +1502,10 @@ protected class SceneGraphHandler implements HttpHandler {
15011502 /**
15021503 * Create a new SceneGraphHandler.
15031504 * <br>
1504- * It's not clear what a callback would do with this, since there's no Annotation at the end of a SceneGraph call, so we just skip it
1505- * @param callback The callback to call when annotation has finished.
1505+ * It's not clear what a callback would do with this, since there's no Annotation at the end of a SceneGraph call,
1506+ * so we just skip it.
1507+ *
1508+ * @param authenticator The callback to call when annotation has finished.
15061509 */
15071510 public SceneGraphHandler (Predicate <Properties > authenticator ) {
15081511 this .authenticator = authenticator ;
0 commit comments