File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
marklogic-spark-api/src/main/java/com/marklogic/spark/core/classifier Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change 1111import com .marklogic .spark .dom .DOMHelper ;
1212import com .smartlogic .classificationserver .client .ClassificationConfiguration ;
1313import com .smartlogic .cloud .CloudException ;
14+ import com .smartlogic .cloud .Token ;
1415import com .smartlogic .cloud .TokenFetcher ;
1516import org .w3c .dom .Document ;
1617
1920import java .net .URL ;
2021import java .util .HashMap ;
2122import java .util .Map ;
23+ import java .util .Objects ;
2224
2325public abstract class TextClassifierFactory {
2426
@@ -65,7 +67,9 @@ protected static ClassificationConfiguration buildClassificationConfiguration(Co
6567 private static String generateApiToken (ConfigHelper configHelper , String apiKey ) {
6668 TokenFetcher tokenFetcher = new TokenFetcher (configHelper .getTokenUrl ().toString (), apiKey );
6769 try {
68- return tokenFetcher .getAccessToken ().getAccess_token ();
70+ Token token = tokenFetcher .getAccessToken ();
71+ Objects .requireNonNull (token );
72+ return token .getAccess_token ();
6973 } catch (CloudException e ) {
7074 throw new ConnectorException (String .format ("Unable to generate token for classifying text; cause: %s" , e .getMessage ()), e );
7175 }
You can’t perform that action at this time.
0 commit comments