logic: fixed crash in Java indexer tests on Linux

This commit is contained in:
mlangkabel
2017-09-28 19:39:36 +02:00
parent a11870ad77
commit 72ae4d5695
+11 -2
View File
@@ -4,6 +4,8 @@
#include "data/parser/ParseLocation.h" #include "data/parser/ParseLocation.h"
#include "data/parser/ParserClient.h" #include "data/parser/ParserClient.h"
#include <boost/filesystem.hpp>
class DumpParserClient : public ParserClient class DumpParserClient : public ParserClient
{ {
public: public:
@@ -43,9 +45,16 @@ public:
const ParseLocation& location) const ParseLocation& location)
{ {
std::string contextNameString = contextName.getQualifiedNameWithSignature(); std::string contextNameString = contextName.getQualifiedNameWithSignature();
if (FilePath(contextNameString).exists()) try
{ {
contextNameString = FilePath(contextNameString).fileName(); if (FilePath(contextNameString).exists())
{
contextNameString = FilePath(contextNameString).fileName();
}
}
catch (const boost::filesystem::filesystem_error& e)
{
// do nothing and use the old contectNameString
} }
m_dump += referenceKindToString(referenceKind) + " " + addLocationSuffix(contextNameString + " -> " + referencedName.getQualifiedNameWithSignature() + " [" + location.filePath.fileName(), location) + "]\n"; m_dump += referenceKindToString(referenceKind) + " " + addLocationSuffix(contextNameString + " -> " + referencedName.getQualifiedNameWithSignature() + " [" + location.filePath.fileName(), location) + "]\n";
} }