View Issue Details

IDProjectCategoryView StatusLast Update
0002968SymmetricDSBugpublic2017-02-01 16:19
Reporterwluciano Assigned Tochenson  
Prioritynormal 
Status closedResolutionfixed 
Product Version3.8.14 
Target Version3.8.15Fixed in Version3.8.15 
Summary0002968: java.lang.NullPointerException in getForeignTableRows when foreign key is null
Description[gruposidra-cloud] - AcknowledgeService - The outgoing batch node01-0000 failed: [FK,-900] The INSERT statement conflicted with the FOREIGN KEY constraint "FK_TB1_TB2". The conflict occurred in database "DB01", table "dbo.TB2", column 'Oid'.
[xxx] - DataService - reloadMissingForeignKeyRows for nodeId 'node01' dataId '1' table 'TB1'
[gruposidra-cloud] - SymmetricServlet - Error while processing POST request for externalId: null, node: node01 at xxx.xxx.xxx.xxx (xxx.xxx.xxx.xxx) with path: /xxx/ack
[xxx] - SymmetricServlet -
java.lang.NullPointerException
        at org.jumpmind.util.LinkedCaseInsensitiveMap.putAll(LinkedCaseInsensitiveMap.java:109)
        at org.jumpmind.symmetric.service.impl.DataService.getForeignTableRows(DataService.java:1634)
        at org.jumpmind.symmetric.service.impl.DataService.reloadMissingForeignKeyRows(DataService.java:1565)
        at org.jumpmind.symmetric.service.impl.AcknowledgeService.ack(AcknowledgeService.java:129)
        at org.jumpmind.symmetric.web.AckUriHandler.ack(AckUriHandler.java:69)
        at org.jumpmind.symmetric.web.AckUriHandler.handle(AckUriHandler.java:64)
[gruposidra-cloud] - ConcurrentConnectionManager - Reserving connection for /sync/gruposidra-cloud/push paradaRomanaEX



Steps To ReproduceWhen one node tries to reload missing ForeignKeyRows, if the values of the foreign columns are null, in one of the referenced tables, the system don't validate that and tries to put a null result to the list.
Additional InformationI applied a temporary fix to this:

From this:
Row foreignRow = new Row(foreignTable.getColumnCount());
if (foreignTable.getForeignKeyCount() > 0) {
    DmlStatement selectSt = platform.createDmlStatement(DmlType.SELECT, foreignTable, null);
    Map<String, Object> values = sqlTemplate.queryForMap(selectSt.getSql(),
        whereRow.toArray(foreignTable.getPrimaryKeyColumnNames()));
    foreignRow.putAll(values);

To this:
Row foreignRow = new Row(foreignTable.getColumnCount());
if (foreignTable.getForeignKeyCount() > 0) {
    DmlStatement selectSt = platform.createDmlStatement(DmlType.SELECT, foreignTable, null);
    Map<String, Object> values = sqlTemplate.queryForMap(selectSt.getSql(),
        whereRow.toArray(foreignTable.getPrimaryKeyColumnNames()));
    if (values != null) {
        foreignRow.putAll(values);
    }

TagsNo tags attached.

Activities

There are no notes attached to this issue.

Related Changesets

SymmetricDS: 3.8 73b3a916

2017-01-25 07:44:13

chenson

Details Diff
0002968: java.lang.NullPointerException in getForeignTableRows when
foreign key is null
Affected Issues
0002968
mod - symmetric-util/src/main/java/org/jumpmind/util/LinkedCaseInsensitiveMap.java Diff File

Issue History

Date Modified Username Field Change
2017-01-24 12:46 wluciano New Issue
2017-01-25 12:44 chenson Assigned To => chenson
2017-01-25 12:44 chenson Status new => assigned
2017-01-25 12:45 chenson Fixed in Version => 3.8.15
2017-01-25 12:45 chenson Target Version => 3.8.15
2017-01-25 12:45 chenson Status assigned => resolved
2017-01-25 12:45 chenson Resolution open => fixed
2017-01-25 13:00 chenson Changeset attached => SymmetricDS 3.8 73b3a916
2017-02-01 16:19 chenson Status resolved => closed