Program: 117016
Project: 117016
Buggy source:
private AppConfig(Context context){
  this.context=context;
  this.appConfigJsBridge=new AppConfigJsBridge();
  InputStream is=null;
  InputStream jsonIs=null;
  try {
    if (fileForOTAconfig().exists()) {
      InputStream otaIS=null;
      try {
        otaIS=new BufferedInputStream(new FileInputStream(fileForOTAconfig()));
        ByteArrayOutputStream baos=new ByteArrayOutputStream();
        IOUtils.copy(otaIS,baos);
        baos.close();
        this.json=new JSONObject(baos.toString("String_Node_Str"));
      }
 catch (      Exception e) {
        Log.e(TAG,e.getMessage(),e);
        IOUtils.close(otaIS);
      }
    }
    if (this.json == null) {
      jsonIs=context.getAssets().open("String_Node_Str");
      ByteArrayOutputStream baos=new ByteArrayOutputStream();
      IOUtils.copy(jsonIs,baos);
      IOUtils.close(baos);
      this.json=new JSONObject(baos.toString("String_Node_Str"));
    }
    this.regexInternalExternal=new ArrayList<Pattern>();
    this.regexIsInternal=new ArrayList<Boolean>();
    JSONObject general=this.json.optJSONObject("String_Node_Str");
    if (general != null) {
      this.initialUrl=optString(general,"String_Node_Str");
      initialHost=Uri.parse(this.initialUrl).getHost();
      if (initialHost.startsWith("String_Node_Str")) {
        initialHost=initialHost.substring("String_Node_Str".length());
      }
      this.appName=optString(general,"String_Node_Str");
      String forceUserAgent=optString(general,"String_Node_Str");
      if (forceUserAgent != null && !forceUserAgent.isEmpty()) {
        this.userAgent=forceUserAgent;
      }
 else {
        String userAgentAdd=optString(general,"String_Node_Str");
        if (userAgentAdd == null)         userAgentAdd="String_Node_Str";
        WebView wv=new WebView(context);
        StringBuilder sb=new StringBuilder(wv.getSettings().getUserAgentString());
        sb.append("String_Node_Str");
        sb.append(userAgentAdd);
        this.userAgent=sb.toString();
      }
      this.publicKey=optString(general,"String_Node_Str");
      this.deviceRegKey=optString(general,"String_Node_Str");
      this.forceSessionCookieExpiry=general.optInt("String_Node_Str",0);
    }
    JSONObject forms=this.json.optJSONObject("String_Node_Str");
    if (forms != null) {
      JSONObject search=forms.optJSONObject("String_Node_Str");
      if (search != null && search.optBoolean("String_Node_Str",false)) {
        this.searchTemplateUrl=optString(search,"String_Node_Str");
      }
      JSONObject loginConfig=forms.optJSONObject("String_Node_Str");
      if (loginConfig != null && loginConfig.optBoolean("String_Node_Str",false)) {
        this.loginConfig=loginConfig;
        this.loginUrl=optString(loginConfig,"String_Node_Str");
        this.loginIsFirstPage=loginConfig.optBoolean("String_Node_Str",false);
      }
      JSONObject signupConfig=forms.optJSONObject("String_Node_Str");
      if (signupConfig != null && signupConfig.optBoolean("String_Node_Str",false)) {
        this.signupConfig=signupConfig;
        this.signupUrl=optString(signupConfig,"String_Node_Str");
      }
    }
    JSONObject navigation=this.json.optJSONObject("String_Node_Str");
    if (navigation != null) {
      JSONObject sidebarNav=navigation.optJSONObject("String_Node_Str");
      processSidebarNavigation(sidebarNav);
      JSONObject navigationLevels=navigation.optJSONObject("String_Node_Str");
      processNavigationLevels(navigationLevels);
      JSONObject navigationTitles=navigation.optJSONObject("String_Node_Str");
      processNavigationTitles(navigationTitles);
      this.profilePickerJS=optString(navigation,"String_Node_Str");
      JSONObject regexInternalExternal=navigation.optJSONObject("String_Node_Str");
      if (regexInternalExternal != null) {
        JSONArray rules=regexInternalExternal.optJSONArray("String_Node_Str");
        if (rules != null) {
          for (int i=0; i < rules.length(); i++) {
            JSONObject entry=rules.optJSONObject(i);
            if (entry != null && entry.has("String_Node_Str") && entry.has("String_Node_Str")) {
              String regex=optString(entry,"String_Node_Str");
              boolean internal=entry.optBoolean("String_Node_Str",true);
              if (regex != null) {
                this.regexInternalExternal.add(Pattern.compile(regex));
                this.regexIsInternal.add(internal);
              }
            }
          }
        }
      }
      JSONObject tabNavigation=navigation.optJSONObject("String_Node_Str");
      processTabNavigation(tabNavigation);
      JSONObject actionConfig=navigation.optJSONObject("String_Node_Str");
      processActions(actionConfig);
      this.showRefreshButton=navigation.optBoolean("String_Node_Str",true);
    }
    JSONObject styling=this.json.optJSONObject("String_Node_Str");
    this.customCSS=optString(styling,"String_Node_Str");
    this.forceViewportWidth=styling.optDouble("String_Node_Str",Double.NaN);
    this.interceptHtml=this.customCSS != null || !Double.isNaN(this.forceViewportWidth) || this.forceSessionCookieExpiry > 0;
    this.showActionBar=styling.optBoolean("String_Node_Str",true);
    this.androidTheme=optString(styling,"String_Node_Str");
    String sideBackColor=AppConfig.optString(styling,"String_Node_Str");
    this.sidebarBackgroundColor=LeanUtils.parseColor(sideBackColor);
    String sideForeColor=AppConfig.optString(styling,"String_Node_Str");
    this.sidebarForegroundColor=LeanUtils.parseColor(sideForeColor);
    String tintColor=AppConfig.optString(styling,"String_Node_Str");
    this.tintColor=LeanUtils.parseColor(tintColor);
    this.interactiveDelay=styling.optDouble("String_Node_Str",Double.NaN);
    this.hideTitleInActionBar=styling.optBoolean("String_Node_Str",false);
    this.showLogoInActionBar=styling.optBoolean("String_Node_Str",this.hideTitleInActionBar);
    String actionBarForegroundColor=AppConfig.optString(styling,"String_Node_Str");
    this.actionbarForegroundColor=LeanUtils.parseColor(actionBarForegroundColor);
    if (this.actionbarForegroundColor == null) {
      if (this.androidTheme == null)       this.actionbarForegroundColor=Color.WHITE;
 else       if (this.androidTheme.equalsIgnoreCase("String_Node_Str"))       this.actionbarForegroundColor=Color.BLACK;
 else       this.actionbarForegroundColor=Color.WHITE;
    }
    JSONObject permissions=this.json.optJSONObject("String_Node_Str");
    if (permissions != null) {
      this.usesGeolocation=permissions.optBoolean("String_Node_Str",false);
    }
    JSONObject services=this.json.optJSONObject("String_Node_Str");
    if (services != null) {
      JSONObject push=services.optJSONObject("String_Node_Str");
      this.pushNotifications=push != null && push.optBoolean("String_Node_Str",false);
      JSONObject analytics=services.optJSONObject("String_Node_Str");
      if (analytics != null && analytics.optBoolean("String_Node_Str",false)) {
        this.idsite_test=analytics.optInt("String_Node_Str",Integer.MIN_VALUE);
        this.idsite_prod=analytics.optInt("String_Node_Str",Integer.MIN_VALUE);
        if (this.idsite_test == Integer.MIN_VALUE || this.idsite_prod == Integer.MIN_VALUE) {
          Log.w(TAG,"String_Node_Str");
          this.analytics=false;
        }
 else {
          this.analytics=true;
        }
      }
    }
    JSONObject performance=this.json.optJSONObject("String_Node_Str");
    if (performance != null) {
      processWebViewPools(performance.optJSONArray("String_Node_Str"));
    }
    this.allowZoom=this.json.optBoolean("String_Node_Str",true);
    this.updateConfigJS=optString(this.json,"String_Node_Str");
  }
 catch (  Exception e) {
    Log.e(TAG,e.getMessage(),e);
  }
 finally {
    IOUtils.close(is);
    IOUtils.close(jsonIs);
  }
}

Fixed version (ground truth):
private AppConfig(Context context){
  this.context=context;
  this.appConfigJsBridge=new AppConfigJsBridge();
  InputStream is=null;
  InputStream jsonIs=null;
  try {
    if (fileForOTAconfig().exists()) {
      InputStream otaIS=null;
      try {
        otaIS=new BufferedInputStream(new FileInputStream(fileForOTAconfig()));
        ByteArrayOutputStream baos=new ByteArrayOutputStream();
        IOUtils.copy(otaIS,baos);
        baos.close();
        this.json=new JSONObject(baos.toString("String_Node_Str"));
      }
 catch (      Exception e) {
        Log.e(TAG,e.getMessage(),e);
        IOUtils.close(otaIS);
      }
    }
    if (this.json == null) {
      jsonIs=context.getAssets().open("String_Node_Str");
      ByteArrayOutputStream baos=new ByteArrayOutputStream();
      IOUtils.copy(jsonIs,baos);
      IOUtils.close(baos);
      this.json=new JSONObject(baos.toString("String_Node_Str"));
    }
    this.regexInternalExternal=new ArrayList<Pattern>();
    this.regexIsInternal=new ArrayList<Boolean>();
    JSONObject general=this.json.optJSONObject("String_Node_Str");
    if (general != null) {
      this.initialUrl=optString(general,"String_Node_Str");
      initialHost=Uri.parse(this.initialUrl).getHost();
      if (initialHost.startsWith("String_Node_Str")) {
        initialHost=initialHost.substring("String_Node_Str".length());
      }
      this.appName=optString(general,"String_Node_Str");
      String forceUserAgent=optString(general,"String_Node_Str");
      if (forceUserAgent != null && !forceUserAgent.isEmpty()) {
        this.userAgent=forceUserAgent;
      }
 else {
        String userAgentAdd=optString(general,"String_Node_Str");
        if (userAgentAdd == null)         userAgentAdd="String_Node_Str";
        WebView wv=new WebView(context);
        StringBuilder sb=new StringBuilder(wv.getSettings().getUserAgentString());
        sb.append("String_Node_Str");
        sb.append(userAgentAdd);
        this.userAgent=sb.toString();
      }
      this.publicKey=optString(general,"String_Node_Str");
      this.deviceRegKey=optString(general,"String_Node_Str");
      this.forceSessionCookieExpiry=general.optInt("String_Node_Str",0);
      if (this.forceSessionCookieExpiry > 0)       this.interceptHtml=true;
      processUserAgentRegexes(general.optJSONArray("String_Node_Str"));
    }
    JSONObject forms=this.json.optJSONObject("String_Node_Str");
    if (forms != null) {
      JSONObject search=forms.optJSONObject("String_Node_Str");
      if (search != null && search.optBoolean("String_Node_Str",false)) {
        this.searchTemplateUrl=optString(search,"String_Node_Str");
      }
      JSONObject loginConfig=forms.optJSONObject("String_Node_Str");
      if (loginConfig != null && loginConfig.optBoolean("String_Node_Str",false)) {
        this.loginConfig=loginConfig;
        this.loginUrl=optString(loginConfig,"String_Node_Str");
        this.loginIsFirstPage=loginConfig.optBoolean("String_Node_Str",false);
      }
      JSONObject signupConfig=forms.optJSONObject("String_Node_Str");
      if (signupConfig != null && signupConfig.optBoolean("String_Node_Str",false)) {
        this.signupConfig=signupConfig;
        this.signupUrl=optString(signupConfig,"String_Node_Str");
      }
    }
    JSONObject navigation=this.json.optJSONObject("String_Node_Str");
    if (navigation != null) {
      JSONObject sidebarNav=navigation.optJSONObject("String_Node_Str");
      processSidebarNavigation(sidebarNav);
      JSONObject navigationLevels=navigation.optJSONObject("String_Node_Str");
      processNavigationLevels(navigationLevels);
      JSONObject navigationTitles=navigation.optJSONObject("String_Node_Str");
      processNavigationTitles(navigationTitles);
      this.profilePickerJS=optString(navigation,"String_Node_Str");
      JSONObject regexInternalExternal=navigation.optJSONObject("String_Node_Str");
      if (regexInternalExternal != null) {
        JSONArray rules=regexInternalExternal.optJSONArray("String_Node_Str");
        if (rules != null) {
          for (int i=0; i < rules.length(); i++) {
            JSONObject entry=rules.optJSONObject(i);
            if (entry != null && entry.has("String_Node_Str") && entry.has("String_Node_Str")) {
              String regex=optString(entry,"String_Node_Str");
              boolean internal=entry.optBoolean("String_Node_Str",true);
              if (regex != null) {
                this.regexInternalExternal.add(Pattern.compile(regex));
                this.regexIsInternal.add(internal);
              }
            }
          }
        }
      }
      JSONObject tabNavigation=navigation.optJSONObject("String_Node_Str");
      processTabNavigation(tabNavigation);
      JSONObject actionConfig=navigation.optJSONObject("String_Node_Str");
      processActions(actionConfig);
      this.showRefreshButton=navigation.optBoolean("String_Node_Str",true);
    }
    JSONObject styling=this.json.optJSONObject("String_Node_Str");
    this.customCSS=optString(styling,"String_Node_Str");
    if (this.customCSS != null)     this.interceptHtml=true;
    this.forceViewportWidth=styling.optDouble("String_Node_Str",Double.NaN);
    if (!Double.isNaN(this.forceViewportWidth))     this.interceptHtml=true;
    this.showActionBar=styling.optBoolean("String_Node_Str",true);
    this.androidTheme=optString(styling,"String_Node_Str");
    String sideBackColor=AppConfig.optString(styling,"String_Node_Str");
    this.sidebarBackgroundColor=LeanUtils.parseColor(sideBackColor);
    String sideForeColor=AppConfig.optString(styling,"String_Node_Str");
    this.sidebarForegroundColor=LeanUtils.parseColor(sideForeColor);
    String tintColor=AppConfig.optString(styling,"String_Node_Str");
    this.tintColor=LeanUtils.parseColor(tintColor);
    this.interactiveDelay=styling.optDouble("String_Node_Str",Double.NaN);
    this.hideTitleInActionBar=styling.optBoolean("String_Node_Str",false);
    this.showLogoInActionBar=styling.optBoolean("String_Node_Str",this.hideTitleInActionBar);
    String actionBarForegroundColor=AppConfig.optString(styling,"String_Node_Str");
    this.actionbarForegroundColor=LeanUtils.parseColor(actionBarForegroundColor);
    if (this.actionbarForegroundColor == null) {
      if (this.androidTheme == null)       this.actionbarForegroundColor=Color.WHITE;
 else       if (this.androidTheme.equalsIgnoreCase("String_Node_Str"))       this.actionbarForegroundColor=Color.BLACK;
 else       this.actionbarForegroundColor=Color.WHITE;
    }
    JSONObject permissions=this.json.optJSONObject("String_Node_Str");
    if (permissions != null) {
      this.usesGeolocation=permissions.optBoolean("String_Node_Str",false);
    }
    JSONObject services=this.json.optJSONObject("String_Node_Str");
    if (services != null) {
      JSONObject push=services.optJSONObject("String_Node_Str");
      this.pushNotifications=push != null && push.optBoolean("String_Node_Str",false);
      JSONObject analytics=services.optJSONObject("String_Node_Str");
      if (analytics != null && analytics.optBoolean("String_Node_Str",false)) {
        this.idsite_test=analytics.optInt("String_Node_Str",Integer.MIN_VALUE);
        this.idsite_prod=analytics.optInt("String_Node_Str",Integer.MIN_VALUE);
        if (this.idsite_test == Integer.MIN_VALUE || this.idsite_prod == Integer.MIN_VALUE) {
          Log.w(TAG,"String_Node_Str");
          this.analytics=false;
        }
 else {
          this.analytics=true;
        }
      }
    }
    JSONObject performance=this.json.optJSONObject("String_Node_Str");
    if (performance != null) {
      processWebViewPools(performance.optJSONArray("String_Node_Str"));
    }
    this.allowZoom=this.json.optBoolean("String_Node_Str",true);
    this.updateConfigJS=optString(this.json,"String_Node_Str");
  }
 catch (  Exception e) {
    Log.e(TAG,e.getMessage(),e);
  }
 finally {
    IOUtils.close(is);
    IOUtils.close(jsonIs);
  }
}