Program: 145449
Project: 145449
Buggy source:
@Override protected SqlQuery getNewEntry(final String aQueryId) throws Exception {
  ApplicationElement ae=appCache.get(aQueryId);
  if (ae != null && ae.getType() == ClientConstants.ET_COMPONENT) {
    final String aDatasourceId=aQueryId;
    SqlQuery query=new SqlQuery(ScriptedDatabasesClient.this){
      @Override public SqlCompiledQuery compile() throws UnboundSqlParameterException, Exception {
        SqlCompiledQuery compiled=new SqlCompiledQuery(ScriptedDatabasesClient.this,aDatasourceId,aQueryId,JAVASCRIPT_QUERY_CONTENTS,getParameters(),getFields(),Collections.<String>emptySet(),Collections.<String>emptySet());
        return compiled;
      }
      @Override public boolean isPublicAccess(){
        return true;
      }
    }
;
    PlatypusScriptedResource.executeScriptResource(aQueryId);
    JSObject schemaContainer=ScriptUtils.createModule(aQueryId);
    if (schemaContainer != null) {
      Fields fields=new Fields();
      query.setFields(fields);
      query.setEntityId(aQueryId);
      query.setDbId(aDatasourceId);
      Object oSchema=schemaContainer.hasMember("String_Node_Str") ? schemaContainer.getMember("String_Node_Str") : null;
      if (oSchema instanceof JSObject) {
        readScriptFields(aQueryId,(JSObject)oSchema,fields);
        Parameters params;
        Object oParams=schemaContainer.hasMember("String_Node_Str") ? schemaContainer.getMember("String_Node_Str") : null;
        if (oParams instanceof JSObject) {
          params=new Parameters();
          readScriptFields(aQueryId,(JSObject)oParams,params);
        }
 else {
          ApplicationElement moduleQuery=getAppCache().get(aQueryId);
          ApplicationModel<?,?,?,?> model=Dom2ModelDocument.transform(ScriptedDatabasesClient.this,moduleQuery.getContent());
          params=model != null ? model.getParameters() : new Parameters();
        }
        params.toCollection().stream().forEach((p) -> {
          query.putParameter(p.getName(),p.getTypeInfo(),null);
        }
);
        return query;
      }
 else {
        throw new IllegalStateException("String_Node_Str" + aQueryId + "String_Node_Str");
      }
    }
 else {
      throw new IllegalStateException("String_Node_Str" + aQueryId + "String_Node_Str");
    }
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override protected SqlQuery getNewEntry(final String aQueryId) throws Exception {
  ApplicationElement ae=appCache.get(aQueryId);
  if (ae != null && ae.getType() == ClientConstants.ET_COMPONENT) {
    final String aDatasourceId=aQueryId;
    SqlQuery query=new SqlQuery(ScriptedDatabasesClient.this){
      @Override public SqlCompiledQuery compile() throws UnboundSqlParameterException, Exception {
        SqlCompiledQuery compiled=new SqlCompiledQuery(ScriptedDatabasesClient.this,aDatasourceId,aQueryId,JAVASCRIPT_QUERY_CONTENTS,getParameters(),getFields(),Collections.<String>emptySet(),Collections.<String>emptySet());
        return compiled;
      }
      @Override public boolean isPublicAccess(){
        return true;
      }
    }
;
    JSObject schemaContainer=createModule(aQueryId);
    if (schemaContainer != null) {
      Fields fields=new Fields();
      query.setFields(fields);
      query.setEntityId(aQueryId);
      query.setDbId(aDatasourceId);
      Object oSchema=schemaContainer.hasMember("String_Node_Str") ? schemaContainer.getMember("String_Node_Str") : null;
      if (oSchema instanceof JSObject) {
        readScriptFields(aQueryId,(JSObject)oSchema,fields);
        Parameters params;
        Object oParams=schemaContainer.hasMember("String_Node_Str") ? schemaContainer.getMember("String_Node_Str") : null;
        if (oParams instanceof JSObject) {
          params=new Parameters();
          readScriptFields(aQueryId,(JSObject)oParams,params);
        }
 else {
          ApplicationElement moduleQuery=getAppCache().get(aQueryId);
          ApplicationModel<?,?,?,?> model=Dom2ModelDocument.transform(ScriptedDatabasesClient.this,moduleQuery.getContent());
          params=model != null ? model.getParameters() : new Parameters();
        }
        params.toCollection().stream().forEach((p) -> {
          query.putParameter(p.getName(),p.getTypeInfo(),null);
        }
);
        return query;
      }
 else {
        throw new IllegalStateException("String_Node_Str" + aQueryId + "String_Node_Str");
      }
    }
 else {
      throw new IllegalStateException("String_Node_Str" + aQueryId + "String_Node_Str");
    }
  }
 else {
    return null;
  }
}