You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ctakes.apache.org by ja...@apache.org on 2017/03/07 16:42:32 UTC

svn commit: r1785856 - /ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/ctakes/dictionary/lookup2/util/UmlsUserApprover.java

Author: james-masanz
Date: Tue Mar  7 16:42:32 2017
New Revision: 1785856

URL: http://svn.apache.org/viewvc?rev=1785856&view=rev
Log:
CTAKES-396 - skip contacting UMLS validator service and improve error message if user did not set UMLS password or user ID 

Modified:
    ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/ctakes/dictionary/lookup2/util/UmlsUserApprover.java

Modified: ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/ctakes/dictionary/lookup2/util/UmlsUserApprover.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/ctakes/dictionary/lookup2/util/UmlsUserApprover.java?rev=1785856&r1=1785855&r2=1785856&view=diff
==============================================================================
--- ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/ctakes/dictionary/lookup2/util/UmlsUserApprover.java (original)
+++ ctakes/trunk/ctakes-dictionary-lookup-fast/src/main/java/org/apache/ctakes/dictionary/lookup2/util/UmlsUserApprover.java Tue Mar  7 16:42:32 2017
@@ -61,6 +61,8 @@ public enum UmlsUserApprover {
    static final private Logger DOT_LOGGER = Logger.getLogger( "ProgressAppender" );
    static final private Logger EOL_LOGGER = Logger.getLogger( "ProgressDone" );
 
+   static final private String CHANGEME = "CHANGEME";
+   
    // cache of valid users
    static private final Collection<String> _validUsers = new ArrayList<>();
 
@@ -118,6 +120,20 @@ public enum UmlsUserApprover {
          LOGGER.error( "Could not encode URL for " + user + " with vendor license " + vendor );
          return false;
       }
+      
+      // Potentially someone could have a user ID of CHANGEME or a password of CHANGEME but don't allow those
+      // to make it easy for us to detect that the user or password was not set correctly.
+      if (user.equals(CHANGEME)) {
+    	  LOGGER.info( "Not checking UMLS Account for user " + user + ":" );
+    	  LOGGER.error("  User " + CHANGEME + " not allowed, verify you are setting " + USER_PARAM + " or " + UMLSUSER_PARAM + " properly.");
+    	  return false;
+      }
+      if (pass.equals(CHANGEME)) {
+    	  LOGGER.info( "Not checking UMLS Account for user " + user + " password " + pass );
+    	  LOGGER.error("  Password " + CHANGEME + " not allowed, verify you are setting " + PASS_PARAM + " or " + UMLSPW_PARAM + " properly.");
+    	  return false;
+      }
+
       final Timer timer = new Timer();
       try {
          LOGGER.info( "Checking UMLS Account at " + umlsUrl + " for user " + user + ":" );