Commit 4e531cd0 authored by Dan Lipsa's avatar Dan Lipsa

ENH: CanReadFile does not fail for newer file version.

CanReadFile does not fail for newer file versions to enable clients (ParaView)
to distinguish between reader failures caused by a mismatch between the file
and the reader, and reader failures that cannot be fixed by changing the reader.

A warning will be printed when reading a file with a newer version than the reader.

Legacy readers already behave this way.
parent 0181ce42
......@@ -631,9 +631,9 @@ int vtkXMLReader::ReadVTKFile(vtkXMLDataElement* eVTKFile)
const char* version = eVTKFile->GetAttribute("version");
if (version && !this->CanReadFileVersionString(version))
{
vtkErrorMacro("File version: " << version << " is is higher than "
"this reader supports. Cannot read file.");
return 0;
vtkWarningMacro("File version: " << version << " is higher than "
"this reader supports " << vtkXMLReaderMajorVersion << "."
<< vtkXMLReaderMinorVersion);
}
::ReadStringVersion(version, this->FileMajorVersion, this->FileMinorVersion);
......@@ -839,18 +839,7 @@ int vtkXMLReader::CanReadFile(const char* name)
{
if (this->CanReadFileWithDataType(tester->GetFileDataType()))
{
const char* version = tester->GetFileVersion();
if (version)
{
if (this->CanReadFileVersionString(version))
{
result = 3;
}
}
else
{
result = 3;
}
result = 1;
}
}
......
......@@ -55,8 +55,11 @@ public:
void SetInputString(std::string s) { this->InputString = s; }
// Description:
// Test whether the file with the given name can be read by this
// reader.
// Test whether the file (type) with the given name can be read by this
// reader. If the file has a newer version than the reader, we still say
// we can read the file type and we fail later, when we try to read the file.
// This enables clients (ParaView) to distinguish between failures when we
// need to look for another reader and failures when we don't.
virtual int CanReadFile(const char* name);
// Description:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment