I'm looking for the equivalent word in the dabase by the ContextQuery method, and when a equivalent word is null the program must try to use the next index from words and add it up to the current to make it a two word, if the two word is still null the program will make it a three word looking for the next 2 values. And i'm getting a NullPointerException everytime
    for (int i = 0; i < words.size(); i++)
      {           
          try {
            temp = QueryWithContext.query(words.get(i));
            if(temp == null && temp.isEmpty() && words.size() >= i+1)
            {
            QueryWithContext.query(words.get(i)+" "+words.get(i+1));
            temp = QueryWithContext.query(words.get(i)+" "+words.get(i+1));
                if(temp == null && temp.isEmpty());
                    {
                    temp = words.get(i);
                    }
            }
            else if(temp == null && temp.isEmpty() && words.size() >= i+2)
            {
                temp = QueryWithContext.query(words.get(i)+" "+words.get(i+1)+" "+words.get(i+2));
                if(temp == null && temp.isEmpty());
                {
                temp = words.get(i);
                }
            }
            System.out.println(temp);
            holder = holder +" "+ temp;
            counter++;
      }
 
     
    