[ 
https://issues.apache.org/jira/browse/SOLR-14226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17025365#comment-17025365
 ] 

Chris M. Hostetter commented on SOLR-14226:
-------------------------------------------

>From a test i'm in the process of trying to write...

{code:java}
  public void testEchoStreamFail() throws Exception {
    final SolrStream solrStream = new SolrStream(solrUrl,
                                                 params("qt", "/stream", 
                                                        "expr", "echo(hello 
world)"));
    solrStream.setCredentials("bogus_user", "bogus_pass");
    SolrException e = expectThrows(SolrException.class, () -> {
        final List<Tuple> ignored = getTuples(solrStream);
      });
    assertEquals(401, e.code());
  }

{code}

{noformat}
   [junit4]    > Throwable #1: junit.framework.AssertionFailedError: Unexpected 
exception type, expected SolrException but got java.io.IOException: --> 
http://127.0.0.1:35337/solr/collection_x: An exception has occurred on the 
server, refer to server log for details.
   [junit4]    >        at 
__randomizedtesting.SeedInfo.seed([F7287DED4A9F66CA:B866576F16986894]:0)
   [junit4]    >        at 
org.apache.lucene.util.LuceneTestCase.expectThrows(LuceneTestCase.java:2752)
   [junit4]    >        at 
org.apache.lucene.util.LuceneTestCase.expectThrows(LuceneTestCase.java:2740)
   [junit4]    >        at 
org.apache.solr.client.solrj.io.stream.CloudAuthStreamTest.testEchoStreamFail(CloudAuthStreamTest.java:208)
   [junit4]    >        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   [junit4]    >        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   [junit4]    >        at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   [junit4]    >        at 
java.base/java.lang.reflect.Method.invoke(Method.java:566)
   [junit4]    >        at java.base/java.lang.Thread.run(Thread.java:834)
   [junit4]    > Caused by: java.io.IOException: --> 
http://127.0.0.1:35337/solr/collection_x: An exception has occurred on the 
server, refer to server log for details.
   [junit4]    >        at 
org.apache.solr.client.solrj.io.stream.SolrStream.read(SolrStream.java:232)
   [junit4]    >        at 
org.apache.solr.client.solrj.io.stream.CloudAuthStreamTest.getTuples(CloudAuthStreamTest.java:221)
   [junit4]    >        at 
org.apache.solr.client.solrj.io.stream.CloudAuthStreamTest.lambda$testEchoStreamFail$3(CloudAuthStreamTest.java:209)
   [junit4]    >        at 
org.apache.lucene.util.LuceneTestCase._expectThrows(LuceneTestCase.java:2870)
   [junit4]    >        at 
org.apache.lucene.util.LuceneTestCase.expectThrows(LuceneTestCase.java:2745)
   [junit4]    >        ... 41 more
   [junit4]    > Caused by: org.noggit.JSONParser$ParseException: JSON Parse 
Error: char=<,position=0 AFTER='<' BEFORE='html> <head> <meta 
http-equiv="Content-'
   [junit4]    >        at org.noggit.JSONParser.err(JSONParser.java:452)
   [junit4]    >        at 
org.noggit.JSONParser.handleNonDoubleQuoteString(JSONParser.java:819)
   [junit4]    >        at org.noggit.JSONParser.next(JSONParser.java:1026)
   [junit4]    >        at org.noggit.JSONParser.nextEvent(JSONParser.java:1073)
   [junit4]    >        at 
org.apache.solr.client.solrj.io.stream.JSONTupleStream.expect(JSONTupleStream.java:98)
   [junit4]    >        at 
org.apache.solr.client.solrj.io.stream.JSONTupleStream.advanceToDocs(JSONTupleStream.java:180)
   [junit4]    >        at 
org.apache.solr.client.solrj.io.stream.JSONTupleStream.next(JSONTupleStream.java:78)
   [junit4]    >        at 
org.apache.solr.client.solrj.io.stream.SolrStream.read(SolrStream.java:201)
{noformat}

> SolrStream reports AuthN/AuthZ failures (401|403) as IOException w/o details
> ----------------------------------------------------------------------------
>
>                 Key: SOLR-14226
>                 URL: https://issues.apache.org/jira/browse/SOLR-14226
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: SolrJ, streaming expressions
>            Reporter: Chris M. Hostetter
>            Priority: Major
>
> If you try to use the SolrJ {{SolrStream}} class to making a streaming 
> expression request to a solr node, any authentication or authorization 
> failures will be swallowed and a eneric "IOException" will be thrown.
> (evidently due to a pars error trying to read the body of the response w/o 
> consulting the HTTP status?)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to