Details
-
Type:
Bug
-
Status:
Ready for QA
(View Workflow)
-
Priority:
Urgent
-
Resolution: Unresolved
-
Component/s: FN
-
Labels:None Labels
-
Customer:OMAN-Tel
Description
getAllPendingTasks is failed on OLD FN .80
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://server.api.nep.mobinets.com/">
<soapenv:Header/>
<soapenv:Body>
<ser:getAllPendingTasks/>
</soapenv:Body>
</soapenv:Envelope>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>Error while loading Tasks No enum constant com.mobinets.nep.fn.model.nep.persist.enums.FnWoTaskStatus.Completed; nested exception is java.lang.IllegalArgumentException: No enum constant com.mobinets.nep.fn.model.nep.persist.enums.FnWoTaskStatus.Completed</faultstring>
<detail>
<ns1:NepFault xmlns:ns1="http://server.api.nep.mobinets.com/">
<errorCode xsi:type="xs:int" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns2="http://server.api.nep.mobinets.com/">1</errorCode>
</ns1:NepFault>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>
Activity
- All
- Comments
- Work Log
- History
- Activity
- Links Hierarchy
- Transitions
- Trace
During the investigation of the NullPointerException occurring in the getAllPendingTasks API, we identified that the issue was caused by inconsistent data in the database.
Root Cause :
Some records in FN_WO_TASK were linked to work orders whose subscriber_id referenced subscribers that do not exist in the FN_SUBSCRIBER table.
This situation likely occurred due to a manual deletion of subscriber records directly from the database without cleaning or updating the related records in FN_WORK_ORDER and FN_WO_TASK, resulting in orphaned references.
Resolution Applied
We identified and removed the affected tasks whose work orders referenced non-existent subscribers.
Verification Query :
SELECT t.id AS task_id, t.task_name, w.id AS wo_id, w.subscriber_id
FROM FN_WO_TASK t
JOIN FN_WORK_ORDER w ON t.wo_id = w.id
LEFT JOIN SUBSCRIBER s ON w.subscriber_id = s.id
WHERE w.subscriber_id IS NOT NULL
AND s.id IS NULL;
Cleanup Query Executed
DELETE FROM FN_WO_TASK
WHERE wo_id IN (
SELECT w.id
FROM FN_WORK_ORDER w
LEFT JOIN SUBSCRIBER s ON w.subscriber_id = s.id
WHERE w.subscriber_id IS NOT NULL
AND s.id IS NULL
);
Optionally, orphaned work orders can also be removed:
DELETE FROM FN_WORK_ORDER
WHERE subscriber_id IS NOT NULL
AND subscriber_id NOT IN (SELECT id FROM SUBSCRIBER);