Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException if a parsed file has no Intents and ICC_SHOW_VARS is enabled #4

Open
jeandersonbc opened this issue Mar 15, 2016 · 1 comment
Labels

Comments

@jeandersonbc
Copy link
Collaborator

In case a parsed file has no Intents AND the flag ICC_SHOW_VARS is set to TRUE, then the application throws a runtime exception (NullPointerException) at line 110 from Main.java.

The exception occurs because if there's no intents, the first loop will be skipped. By skipping the loop on intents.entrySet(), the reference info is never initialized.

Consequentially, if the following if-statement if (ICC_SHOW_VARS) is enabled, the System.out.printf command is going to reference info.type, halting the execution.

See the following lines for reference:

Main.java

      // printing the intents
      Map<String, IntentInfo> intents = resultsEntry.getValue().intentsST.getMap();
      IntentInfo info = null;

      for(Map.Entry<String, IntentInfo> intentEntry : intents.entrySet())
      {
        info = intentEntry.getValue();

        if ((info.isExplicit() && ICC_SHOW_EXPLICIT_INTENTS) ||
            (!info.isExplicit() && ICC_SHOW_IMPLICIT_INTENTS))
        {
          System.out.println(String.format("%s:\n%s\n----------", intentEntry.getKey(), intentEntry.getValue()));
        }
      }

      // printing the vars
      if (ICC_SHOW_VARS)
      {
        Map<String, VarInfo> vars = resultsEntry.getValue().varsST.getMap();

        for(Map.Entry<String, VarInfo> varEntry : vars.entrySet())
        {
          String name = varEntry.getKey();
          VarInfo varInfo = varEntry.getValue();

          System.out.printf("%s %s = %s\n", info.type, name, varInfo.value);
        }
      }
@jeandersonbc
Copy link
Collaborator Author

I talked about this with @leopoldomt and we think we should not invest time on this now. A quickfix is just to set the ICC_SHOW_VARS flag to false, so we focus on more important things right now.

@jeandersonbc jeandersonbc changed the title NullPointerException if there's no Intents and ICC_SHOW_VARS is enabled NullPointerException if a parsed file has no Intents and ICC_SHOW_VARS is enabled Mar 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant