mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0024852: Crash on storage of an Ocaf document in XML file format
Blanks are removed. A check is implemented to correct a GUID in case of presence of the blanks. Test case for issues CR24852
This commit is contained in:
parent
5ec5d80d0e
commit
bf4bf038c8
@ -481,7 +481,15 @@ Standard_Boolean CDF_Application::FindReaderFromFormat(const TCollection_Extende
|
|||||||
ResourceName+=".RetrievalPlugin";
|
ResourceName+=".RetrievalPlugin";
|
||||||
|
|
||||||
if(UTL::Find(Resources(),ResourceName)) {
|
if(UTL::Find(Resources(),ResourceName)) {
|
||||||
thePluginId=UTL::GUID(UTL::Value(Resources(),ResourceName));
|
// Get GUID as a string.
|
||||||
|
TCollection_ExtendedString strPluginId = UTL::Value(Resources(),ResourceName);
|
||||||
|
|
||||||
|
// If the GUID (as a string) contains blanks, remove them.
|
||||||
|
if (strPluginId.Search(' ') != -1)
|
||||||
|
strPluginId.RemoveAll(' ');
|
||||||
|
|
||||||
|
// Convert to GUID.
|
||||||
|
thePluginId=UTL::GUID(strPluginId);
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
}
|
}
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
|
@ -1187,7 +1187,16 @@ void CDM_Document::LoadResources()
|
|||||||
theResourceName+="StoragePlugin";
|
theResourceName+="StoragePlugin";
|
||||||
TCollection_ExtendedString thePluginId;
|
TCollection_ExtendedString thePluginId;
|
||||||
FIND(theDocumentResource,theResourceName,myStoragePluginWasFound,thePluginId);
|
FIND(theDocumentResource,theResourceName,myStoragePluginWasFound,thePluginId);
|
||||||
if(myStoragePluginWasFound) myStoragePlugin=UTL::GUID(thePluginId);
|
if(myStoragePluginWasFound)
|
||||||
|
{
|
||||||
|
// Check whether the GUID (as a string) contains blanks before and after the string.
|
||||||
|
// If it is so, remove them.
|
||||||
|
if (thePluginId.Search(' ') != -1)
|
||||||
|
thePluginId.RemoveAll(' ');
|
||||||
|
|
||||||
|
// Convert to GUID.
|
||||||
|
myStoragePlugin=UTL::GUID(thePluginId);
|
||||||
|
}
|
||||||
myResourcesAreLoaded=Standard_True;
|
myResourcesAreLoaded=Standard_True;
|
||||||
|
|
||||||
// cout << "resource Loaded: " << "Format: " << theFormat << ", FileExtension:" << myFileExtension << ", DataType:" << myDataType << ", VersionDataType:" << myVersionDataType << ", Description:" << myDescription << ", Domain:" << myDomain << endl;
|
// cout << "resource Loaded: " << "Format: " << theFormat << ", FileExtension:" << myFileExtension << ", DataType:" << myDataType << ", VersionDataType:" << myVersionDataType << ", Description:" << myDescription << ", Domain:" << myDomain << endl;
|
||||||
|
@ -23,8 +23,8 @@ BinXCAF.RetrievalPlugin: a78ff497-a779-11d5-aab4-0050044b1af1
|
|||||||
!
|
!
|
||||||
XmlOcaf.Description: Xml Document Version 1.0
|
XmlOcaf.Description: Xml Document Version 1.0
|
||||||
XmlOcaf.FileExtension: xml
|
XmlOcaf.FileExtension: xml
|
||||||
XmlOcaf.StoragePlugin: 03a56820-8269-11d5-aab2-0050044b1af1
|
XmlOcaf.StoragePlugin: 03a56820-8269-11d5-aab2-0050044b1af1
|
||||||
XmlOcaf.RetrievalPlugin: 03a56822-8269-11d5-aab2-0050044b1af1
|
XmlOcaf.RetrievalPlugin: 03a56822-8269-11d5-aab2-0050044b1af1
|
||||||
!
|
!
|
||||||
! standard attributes
|
! standard attributes
|
||||||
!
|
!
|
||||||
|
18
tests/bugs/caf/bug24852
Executable file
18
tests/bugs/caf/bug24852
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
puts "=========="
|
||||||
|
puts "OCC24852"
|
||||||
|
puts "=========="
|
||||||
|
puts ""
|
||||||
|
########################################################
|
||||||
|
# Crash on storage of an Ocaf document in XML file format
|
||||||
|
########################################################
|
||||||
|
|
||||||
|
NewDocument D XmlOcaf
|
||||||
|
|
||||||
|
set File ${imagedir}/bug24852_test.xml
|
||||||
|
|
||||||
|
if { [catch {set res [SaveAs D ${File}]}] != 0 } {
|
||||||
|
puts "Error : Crash on storage of an Ocaf document in XML file format"
|
||||||
|
} else {
|
||||||
|
puts "OK : Storage of an Ocaf document in XML file format is good"
|
||||||
|
file delete ${File}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user