Program: 143373
Project: 143373
Buggy source:
public void browserUpdatesReceived(Object jsonValue,PropertyDescription pd,IBrowserConverterContext dataConverterContext){
  PushToServerEnum pushToServer=BrowserConverterContext.getPushToServerValue(dataConverterContext);
  if (getFoundset() == null)   return;
  try {
    if (jsonValue instanceof JSONArray) {
      JSONArray arr=(JSONArray)jsonValue;
      for (int i=0; i < arr.length(); i++) {
        JSONObject update=(JSONObject)arr.get(i);
        if (update.has("String_Node_Str")) {
          JSONObject newViewport=update.getJSONObject("String_Node_Str");
          viewPort.setBounds(newViewport.getInt(START_INDEX),newViewport.getInt(SIZE));
        }
        if (update.has(PREFERRED_VIEWPORT_SIZE)) {
          viewPort.setPreferredViewportSize(update.getInt(PREFERRED_VIEWPORT_SIZE));
        }
 else         if (update.has("String_Node_Str")) {
          viewPort.loadExtraRecords(update.getInt("String_Node_Str"));
        }
 else         if (update.has("String_Node_Str")) {
          JSONArray columns=update.getJSONArray("String_Node_Str");
          StringBuilder sort=new StringBuilder();
          Map<String,String> dp=dataproviders.size() > 0 ? dataproviders : linkedChildComponentToColumn;
          String dataProviderID=null;
          boolean sortAscending=true;
          for (int j=0; j < columns.length(); j++) {
            JSONObject sortColumn=columns.getJSONObject(j);
            String name=sortColumn.getString("String_Node_Str");
            if (dp.containsKey(name)) {
              sort.append(dp.get(name));
              sort.append("String_Node_Str" + sortColumn.getString("String_Node_Str"));
              if (dataProviderID == null) {
                dataProviderID=dp.get(name);
                sortAscending="String_Node_Str".equalsIgnoreCase(sortColumn.getString("String_Node_Str"));
              }
              if (j < columns.length() - 1)               sort.append("String_Node_Str");
            }
          }
          IWebFormController fc=getFormUI().getController();
          if (fc != null && fc.getForm().getOnSortCmdMethodID() > 0 && dataProviderID != null) {
            JSEvent event=new JSEvent();
            event.setFormName(fc.getName());
            fc.executeFunction(String.valueOf(fc.getForm().getOnSortCmdMethodID()),Utils.arrayMerge((new Object[]{dataProviderID,Boolean.valueOf(sortAscending),event}),Utils.parseJSExpressions(fc.getForm().getInstanceMethodArguments("String_Node_Str"))),true,null,false,"String_Node_Str");
          }
 else {
            try {
              foundset.setSort(sort.toString());
            }
 catch (            ServoyException e) {
              Debug.error("String_Node_Str" + sort.toString(),e);
            }
          }
        }
 else         if (update.has("String_Node_Str")) {
          JSONArray jsonSelectedIndexes=update.getJSONArray("String_Node_Str");
          int[] newSelectedIndexes=new int[jsonSelectedIndexes.length()];
          for (int j=newSelectedIndexes.length - 1; j >= 0; j--) {
            newSelectedIndexes[j]=jsonSelectedIndexes.getInt(j);
          }
          getListSelectionListener().pause();
          try {
            if (newSelectedIndexes.length == 1) {
              foundset.setSelectedIndex(newSelectedIndexes[0]);
            }
 else {
              foundset.setSelectedIndexes(newSelectedIndexes);
            }
          }
  finally {
            getListSelectionListener().resume();
            if (!Arrays.equals(foundset.getSelectedIndexes(),newSelectedIndexes)) {
              changeMonitor.selectionChanged();
            }
          }
        }
 else         if (update.has("String_Node_Str")) {
          this.selectionRequestMsgid=update.getInt("String_Node_Str");
          JSONArray jsonSelectedIndexes=update.getJSONArray("String_Node_Str");
          int[] newSelectedIndexes=new int[jsonSelectedIndexes.length()];
          for (int j=newSelectedIndexes.length - 1; j >= 0; j--) {
            newSelectedIndexes[j]=jsonSelectedIndexes.getInt(j);
          }
          int[] oldSelection=foundset.getSelectedIndexes();
          getListSelectionListener().pause();
          try {
            if (newSelectedIndexes.length == 1) {
              foundset.setSelectedIndex(newSelectedIndexes[0]);
            }
 else {
              foundset.setSelectedIndexes(newSelectedIndexes);
            }
          }
  finally {
            getListSelectionListener().resume();
            if (!Arrays.equals(oldSelection,foundset.getSelectedIndexes())) {
              changeMonitor.selectionChanged();
              changeMonitor.selectionAccepted();
            }
 else {
              if (!Arrays.equals(oldSelection,newSelectedIndexes)) {
                changeMonitor.selectionDenied();
              }
 else               changeMonitor.selectionAccepted();
            }
          }
        }
 else         if (update.has(ViewportDataChangeMonitor.VIEWPORT_CHANGED)) {
          if (PushToServerEnum.allow.compareTo(pushToServer) <= 0) {
            JSONObject dataChangeJSON=(JSONObject)update.get(ViewportDataChangeMonitor.VIEWPORT_CHANGED);
            String rowIDValue=dataChangeJSON.getString(ROW_ID_COL_KEY);
            String dataProviderName=dataproviders.get(dataChangeJSON.getString(DATAPROVIDER_KEY));
            Object value=dataChangeJSON.get(VALUE_KEY);
            if (foundset != null) {
              Pair<String,Integer> splitHashAndIndex=splitPKHashAndIndex(rowIDValue);
              int recordIndex=foundset.getRecordIndex(splitHashAndIndex.getLeft(),splitHashAndIndex.getRight().intValue());
              if (recordIndex != -1) {
                IWebFormUI formUI=getFormUI();
                IRecordInternal record=foundset.getRecord(recordIndex);
                PropertyDescription dataProviderPropDesc=NGUtils.getDataProviderPropertyDescription(dataProviderName,foundset.getTable(),false);
                value=JSONUtils.fromJSONUnwrapped(null,value,dataProviderPropDesc,dataConverterContext);
                changeMonitor.pauseRowUpdateListener(splitHashAndIndex.getLeft());
                try {
                  if (record.startEditing()) {
                    try {
                      record.setValue(dataProviderName,value);
                    }
 catch (                    IllegalArgumentException e) {
                      formUI.getController().getApplication().reportError("String_Node_Str" + dataProviderName + "String_Node_Str"+ value+ "String_Node_Str",e);
                    }
                  }
                }
  finally {
                  changeMonitor.resumeRowUpdateListener();
                  if (!Utils.equalObjects(record.getValue(dataProviderName),value)) {
                    changeMonitor.recordsUpdated(recordIndex,recordIndex,foundset.getSize(),viewPort);
                  }
                }
              }
 else {
                Debug.error("String_Node_Str" + rowIDValue + "String_Node_Str"+ dataProviderName+ "String_Node_Str"+ value+ "String_Node_Str");
              }
            }
          }
 else {
            log.error("String_Node_Str" + pd + "String_Node_Str");
            changeMonitor.viewPortCompletelyChanged();
          }
        }
      }
    }
  }
 catch (  JSONException e) {
    Debug.error("String_Node_Str" + this.toString() + "String_Node_Str"+ jsonValue,e);
  }
}

Fixed version (ground truth):
public void browserUpdatesReceived(Object jsonValue,PropertyDescription pd,IBrowserConverterContext dataConverterContext){
  PushToServerEnum pushToServer=BrowserConverterContext.getPushToServerValue(dataConverterContext);
  if (getFoundset() == null)   return;
  try {
    if (jsonValue instanceof JSONArray) {
      JSONArray arr=(JSONArray)jsonValue;
      for (int i=0; i < arr.length(); i++) {
        JSONObject update=(JSONObject)arr.get(i);
        if (update.has("String_Node_Str")) {
          JSONObject newViewport=update.getJSONObject("String_Node_Str");
          viewPort.setBounds(newViewport.getInt(START_INDEX),newViewport.getInt(SIZE));
        }
        if (update.has(PREFERRED_VIEWPORT_SIZE)) {
          viewPort.setPreferredViewportSize(update.getInt(PREFERRED_VIEWPORT_SIZE));
        }
 else         if (update.has("String_Node_Str")) {
          viewPort.loadExtraRecords(update.getInt("String_Node_Str"));
        }
 else         if (update.has("String_Node_Str")) {
          JSONArray columns=update.getJSONArray("String_Node_Str");
          StringBuilder sort=new StringBuilder();
          Map<String,String> dp=dataproviders.size() > 0 ? dataproviders : linkedChildComponentToColumn;
          String dataProviderID=null;
          boolean sortAscending=true;
          for (int j=0; j < columns.length(); j++) {
            JSONObject sortColumn=columns.getJSONObject(j);
            String name=sortColumn.getString("String_Node_Str");
            if (dp.containsKey(name)) {
              sort.append(dp.get(name));
              sort.append("String_Node_Str" + sortColumn.getString("String_Node_Str"));
              if (dataProviderID == null) {
                dataProviderID=dp.get(name);
                sortAscending="String_Node_Str".equalsIgnoreCase(sortColumn.getString("String_Node_Str"));
              }
              if (j < columns.length() - 1)               sort.append("String_Node_Str");
            }
          }
          IWebFormController fc=getFormUI().getController();
          if (fc != null && fc.getForm().getOnSortCmdMethodID() > 0 && dataProviderID != null) {
            JSEvent event=new JSEvent();
            event.setFormName(fc.getName());
            fc.executeFunction(String.valueOf(fc.getForm().getOnSortCmdMethodID()),Utils.arrayMerge((new Object[]{dataProviderID,Boolean.valueOf(sortAscending),event}),Utils.parseJSExpressions(fc.getForm().getInstanceMethodArguments("String_Node_Str"))),true,null,false,"String_Node_Str");
          }
 else {
            try {
              foundset.setSort(sort.toString());
            }
 catch (            ServoyException e) {
              Debug.error("String_Node_Str" + sort.toString(),e);
            }
          }
        }
 else         if (update.has("String_Node_Str")) {
          JSONArray jsonSelectedIndexes=update.getJSONArray("String_Node_Str");
          int[] newSelectedIndexes=new int[jsonSelectedIndexes.length()];
          for (int j=newSelectedIndexes.length - 1; j >= 0; j--) {
            newSelectedIndexes[j]=jsonSelectedIndexes.getInt(j);
          }
          getListSelectionListener().pause();
          try {
            if (newSelectedIndexes.length == 1) {
              foundset.setSelectedIndex(newSelectedIndexes[0]);
            }
 else {
              foundset.setSelectedIndexes(newSelectedIndexes);
            }
          }
  finally {
            getListSelectionListener().resume();
            if (!Arrays.equals(foundset.getSelectedIndexes(),newSelectedIndexes)) {
              changeMonitor.selectionChanged();
            }
          }
        }
 else         if (update.has("String_Node_Str")) {
          this.selectionRequestMsgid=update.getInt("String_Node_Str");
          JSONArray jsonSelectedIndexes=update.getJSONArray("String_Node_Str");
          int[] newSelectedIndexes=new int[jsonSelectedIndexes.length()];
          for (int j=newSelectedIndexes.length - 1; j >= 0; j--) {
            newSelectedIndexes[j]=jsonSelectedIndexes.getInt(j);
          }
          int[] oldSelection=foundset.getSelectedIndexes();
          getListSelectionListener().pause();
          try {
            if (newSelectedIndexes.length == 1) {
              foundset.setSelectedIndex(newSelectedIndexes[0]);
            }
 else {
              foundset.setSelectedIndexes(newSelectedIndexes);
            }
          }
  finally {
            getListSelectionListener().resume();
            if (!Arrays.equals(oldSelection,foundset.getSelectedIndexes())) {
              changeMonitor.selectionChanged();
              changeMonitor.selectionAccepted();
            }
 else {
              if (!Arrays.equals(oldSelection,newSelectedIndexes)) {
                changeMonitor.selectionDenied();
              }
 else               changeMonitor.selectionAccepted();
            }
          }
        }
 else         if (update.has(ViewportDataChangeMonitor.VIEWPORT_CHANGED)) {
          if (PushToServerEnum.allow.compareTo(pushToServer) <= 0) {
            JSONObject dataChangeJSON=(JSONObject)update.get(ViewportDataChangeMonitor.VIEWPORT_CHANGED);
            String rowIDValue=dataChangeJSON.getString(ROW_ID_COL_KEY);
            String dataProviderName=dataproviders.get(dataChangeJSON.getString(DATAPROVIDER_KEY));
            Object value=dataChangeJSON.get(VALUE_KEY);
            if (foundset != null) {
              Pair<String,Integer> splitHashAndIndex=splitPKHashAndIndex(rowIDValue);
              int recordIndex=foundset.getRecordIndex(splitHashAndIndex.getLeft(),splitHashAndIndex.getRight().intValue());
              if (recordIndex != -1) {
                IWebFormUI formUI=getFormUI();
                IRecordInternal record=foundset.getRecord(recordIndex);
                PropertyDescription dataProviderPropDesc=NGUtils.getDataProviderPropertyDescription(dataProviderName,foundset.getTable(),false);
                ValueReference<Boolean> returnValueAdjustedIncommingValueForRow=new ValueReference<Boolean>(Boolean.FALSE);
                value=JSONUtils.fromJSONUnwrapped(null,value,dataProviderPropDesc,dataConverterContext,returnValueAdjustedIncommingValueForRow);
                changeMonitor.pauseRowUpdateListener(splitHashAndIndex.getLeft());
                try {
                  if (record.startEditing()) {
                    try {
                      record.setValue(dataProviderName,value);
                    }
 catch (                    IllegalArgumentException e) {
                      formUI.getController().getApplication().reportError("String_Node_Str" + dataProviderName + "String_Node_Str"+ value+ "String_Node_Str",e);
                    }
                  }
                }
  finally {
                  changeMonitor.resumeRowUpdateListener();
                  if (!Utils.equalObjects(record.getValue(dataProviderName),value) || returnValueAdjustedIncommingValueForRow.value.booleanValue()) {
                    changeMonitor.recordsUpdated(recordIndex,recordIndex,foundset.getSize(),viewPort);
                  }
                }
              }
 else {
                Debug.error("String_Node_Str" + rowIDValue + "String_Node_Str"+ dataProviderName+ "String_Node_Str"+ value+ "String_Node_Str");
              }
            }
          }
 else {
            log.error("String_Node_Str" + pd + "String_Node_Str");
            changeMonitor.viewPortCompletelyChanged();
          }
        }
      }
    }
  }
 catch (  JSONException e) {
    Debug.error("String_Node_Str" + this.toString() + "String_Node_Str"+ jsonValue,e);
  }
}