SOQL - Order By not executing

Issue #1948 resolved
Clay Li created an issue

PhpStorm 2021.1.4, SOQL with “order by” was not sent to SFDC. Click green play button in SOQL window has no response. There were no logs and no message.

select Id, Name from Account order by Name

Commenting out the “order by”, click the green play button in SOQL window, the query is executed and data is shown.

select Id, Name from Account

Here’re the logs when executing the query with order by:

2021-07-28 11:35:38,608 [163293287] ERROR - llij.ide.plugins.PluginManager - begin 15, end 359, length 42
java.lang.StringIndexOutOfBoundsException: begin 15, end 359, length 42
at java.base/java.lang.String.checkBoundsBeginEnd(String.java:3319)
at java.base/java.lang.String.substring(String.java:1874)
at com.illuminatedcloud.intellij.toolwindow.soql.SoqlQueryToolWindow.validateQueryResultSetSize(SourceFile:402)
at com.illuminatedcloud.intellij.toolwindow.soql.SoqlQueryToolWindow.validate(SourceFile:295)
at com.illuminatedcloud.intellij.toolwindow.AbstractApexReplToolWindow.execute(SourceFile:413)
at com.illuminatedcloud.intellij.toolwindow.AbstractApexReplToolWindow$ExecuteAction.actionPerformed(SourceFile:822)
at com.intellij.openapi.actionSystem.ex.ActionUtil.lambda$performActionDumbAware$5(ActionUtil.java:273)
at com.intellij.util.SlowOperations.lambda$allowSlowOperations$0(SlowOperations.java:77)
at com.intellij.util.SlowOperations.allowSlowOperations(SlowOperations.java:64)
at com.intellij.util.SlowOperations.allowSlowOperations(SlowOperations.java:76)
at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:273)
at com.intellij.openapi.actionSystem.impl.ActionButton.actionPerformed(ActionButton.java:201)
at com.intellij.openapi.actionSystem.impl.ActionButton.performAction(ActionButton.java:174)
at com.intellij.openapi.actionSystem.impl.ActionButton.performAction(ActionButton.java:157)
at com.intellij.openapi.actionSystem.impl.ActionButton.processMouseEvent(ActionButton.java:469)
at java.desktop/java.awt.Component.processEvent(Component.java:6417)

Comments (9)

  1. Scott Wells repo owner

    There must be something else going on in that query editor as it's showing the ORDER BY clause as having a start index in the total query of 359 for a query that's only 42 characters long. For comparison, I just pasted that exact query (as copied straight from this issue) and it executed fine:

    Issue_1948.png

    I'm not at all saying there's not an issue here, but the nature of it confuses me. Minimally I'll validate that the ORDER BY index is within the bounds of the query which would allow this one to execute, but it means that it would skip that validation due to whatever is going on.

    Can you show me a screenshot of the editor when this happens, perhaps right after doing a Select All inside of it?

  2. Clay Li reporter

    There are other queries commented out in the window. Clean up the window and re-enter query to execute - works fine.

    Thanks Scott for the quick response!

  3. Scott Wells repo owner

    Also note that as a workaround, you can disable query result set size validation in the SOQL Query tool window settings.

  4. Scott Wells repo owner

    Clay, can you provide an example of the window contents that led to this issue? That way I can change the logic to fix the issue so that you don't have to remove other commented contents. That should be supported.

  5. Scott Wells repo owner

    Never mind. I reproduced it by adding a commented portion before the query. I'll include a fix in the next build. Thanks!

  6. Clay Li reporter

    Here’s a sample - removing “order by…” worked.

    //Select Id from PermissionSet
    select Id, Name from Account order by Name
    

  7. Log in to comment