0

I am getting the following error when running my code from Developer Console.

public static void findShortestSubstring(String stringObj)
{
    Integer stringLength = stringObj.length();
    List<String> vowelList = New List<String>();
    vowelList.add('a');
    vowelList.add('e');
    vowelList.add('i');
    vowelList.add('o');
    vowelList.add('u');
    //Set to hold all possible words startting with Vowel and ending with consonant
    Set<String> allWordsSet = New Set<String>();

    //Looping over each charachter in the main string
    for(Integer i=0;i<stringLength;i++)
    {
        if(vowelList.contains(stringObj.substring(i, i+1))) 
        {
            Integer j=i;
            while(j<stringLength)
            {
                Integer startPosition = j;
                String subString = '';
                for(Integer x = startPosition;x<=stringLength;x++)
                {
                    substring += stringObj.substring(x,x+1);
                    startPosition++;
                }
                if(vowelList.contains(subString.substring(j, j+1)) && !vowelList.contains(subString.substring(startPosition,startPosition+1)))
                    allWordsSet.add(subString);

                j++;
            }

        }
    }

    System.Debug('Le All Words Set: '+allWordsSet);
}

I am getting the following error Message: Line: undefined, Column: undefined Response to EXEC was : Session expired or invalid. HTTP CODE[401]

Please help me debug this error.

1 Answer 1

2

That error doesn't seem to have anything to do with the code you've posted.

Given that you're executing this via the developer console, the error message itself gives you a strong hint at what's wrong (emphasis mine)

Line: undefined, Column: undefined Response to EXEC was : Session expired or invalid. HTTP CODE[401]

You need a valid session to do anything in the developer console, and your session has timed out.

Copy/paste your code to a temporary location, and close your Execute Anonymous window and the Developer Console. Then, go back to the login page for your org and log in again (if you have a browser tab for a page in your org, refreshing it should bring you back to the login page as well).

After logging in, open the developer console and the execute anonymous window again, and your error should disappear.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .