THYRODLReader.MergeRODLs fails with AV starting from RemObjects SDK rel. 1533

Hi,

issue is related to changes in uROMSXMLImpl.pas, starting with release 1533, specifically here:

function TROMSXMLNode.GetNodesByName(const aNodeName: UnicodeString): IXMLNodeList;
var
  l_list: IXMLDOMNodeList;
begin
  l_list := fNode.selectNodes(aNodeName);
  if (l_list <> nil) and (l_list.length > 0) then
    Result := TROMSXMLNodeList.Create(l_list, fDoc)
  else
    Result := nil;
end;

Starting with 1533, function returns NIL if no node was found… releases before 1533 returns valid not-NIL interface, where Count=0. Due this, AV error is raised in Hydra.RO.RODLReader.pas, here:

procedure THYRODLReader.MergeRODLs(var MainRODL: string; const SubRODLs: array of string);
..
  procedure ReadNode(AMainRootNode, ARootNode: IXMLNode; s_NodeItems, s_NodeItem: wideString{$IFDEF DEBUGMODE_MERGERODL}; AErrorNode, ADuplicateNode: IXMLNode{$ENDIF});
  begin
  ..
            MainList := MainSectionNode.GetNodesByName(s_NodeItem);
//FIX >>>
            if MainList<>Nil then
//<<< FIX
            for j := 0 to MainList.Count - 1 do
              if MainList.Nodes[j].GetAttributeValue(s_NodeName, '') = nodeName then begin
                Node := MainList.Nodes[j];
                Break;
              end;
            if Node = nil then
              AddNode(MainSectionNode, List.Nodes[i])
  ..
  end
..
end;

Regards from Prague,
Jan

Logged as bugs://D19235.

Hi,

Thx for report.
I’ll return old behavior of TROMSXMLNode.GetNodesByName

…just for the record, see comment for GetNodesByName, in uROMSXMLImpl.pas:

type
  { TROMSXMLNode }
  TROMSXMLNode = class(TInterfacedObject, IXMLNode)
  protected
  ..
    function GetNodesByName(const aNodeName : UnicodeString) : IXMLNodeList; // Returns NIL if none are found or exception. Up to you.
  ..
  end;

This comment is placed here for years, many releases before 1533… so I’m not sure what behavior is intended as correct… what function have to return in case that no nodes are found…

Regards from Prague,
Jan

Hi,

other places of code can be related to GetNodesByName so “cheap” workaround is return pre .1533 behavior

…agree. In such case, consider to remove/change this comment :slightly_smiling_face:

Jan

bugs://D19235 was closed as fixed.