Skip to content

Commit

Permalink
fix: bug in vobject update
Browse files Browse the repository at this point in the history
  • Loading branch information
Nolife999 committed Oct 22, 2024
1 parent a7e961c commit dff421b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,15 @@ public LineObject clone() {
public Iterator<String> iterator() {
return this.d.iterator();
}

/**
* returns the value in cell at position pos
* If position is out of range, return null
* @param pos
* @return
*/
public String getCell(int pos)
{
return (pos<d.size())?d.get(pos):null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,8 @@ public void update(VObject currentData) {
reqUpdate.append(" WHERE ");

comma = false;
for (int j = 0; j < currentData.getContent().get(lineToBeUpdated).d.size(); j++) {

for (int j = 0; j < v0.getContent().get(lineToBeUpdated).d.size(); j++) {
String label = v0.getHeadersDLabel().get(j);
if (nativeFieldsList.contains(label)) {
if (comma) {
Expand All @@ -777,6 +778,7 @@ public void update(VObject currentData) {
comma = true;

String oldValue = v0.getContent().get(lineToBeUpdated).d.get(j);

if (ManipString.isStringNull(oldValue)) {
reqUpdate.append(label + " IS NULL");
} else {
Expand All @@ -786,7 +788,8 @@ public void update(VObject currentData) {
}

// Updates value in v0
String newValue = currentData.getContent().get(lineToBeUpdated).d.get(j);
String newValue = currentData.getContent().get(lineToBeUpdated).getCell(j);

if (newValue != null) {
v0.getContent().get(lineToBeUpdated).d.set(j, newValue);
}
Expand Down

0 comments on commit dff421b

Please sign in to comment.