# HG changeset patch # User Sebastien Jodogne # Date 1559809168 -7200 # Node ID df0f1821b3de42671350c606f418744d4ebdc0ef # Parent d1445f2df123ebf2caea18f7d120f408bdb700a0 better fix diff -r d1445f2df123 -r df0f1821b3de Core/DicomParsing/DicomWebJsonVisitor.cpp --- a/Core/DicomParsing/DicomWebJsonVisitor.cpp Thu Jun 06 09:52:19 2019 +0200 +++ b/Core/DicomParsing/DicomWebJsonVisitor.cpp Thu Jun 06 10:19:28 2019 +0200 @@ -551,15 +551,6 @@ node[KEY_VALUE] = Json::arrayValue; for (size_t i = 0; i < tokens.size(); i++) { - /** - * The following call to "StripSpaces()" fixes the issue - * reported by Rana Asim Wajid on 2019-06-05 ("Error - * Exception while invoking plugin service 32: Bad file - * format"): - * https://groups.google.com/d/msg/orthanc-users/T32FovWPcCE/-hKFbfRJBgAJ - **/ - tokens[i] = Orthanc::Toolbox::StripSpaces(tokens[i]); - try { switch (vr) @@ -593,30 +584,45 @@ } case ValueRepresentation_IntegerString: - if (tokens[i].empty()) + { + /** + * The calls to "StripSpaces()" below fix the + * issue reported by Rana Asim Wajid on 2019-06-05 + * ("Error Exception while invoking plugin service + * 32: Bad file format"): + * https://groups.google.com/d/msg/orthanc-users/T32FovWPcCE/-hKFbfRJBgAJ + **/ + + std::string t = Orthanc::Toolbox::StripSpaces(tokens[i]); + if (t.empty()) { node[KEY_VALUE].append(Json::nullValue); } else { - int64_t value = boost::lexical_cast(tokens[i]); + int64_t value = boost::lexical_cast(t); node[KEY_VALUE].append(FormatInteger(value)); } - + break; + } case ValueRepresentation_DecimalString: - if (tokens[i].empty()) + { + std::string t = Orthanc::Toolbox::StripSpaces(tokens[i]); + if (t.empty()) { node[KEY_VALUE].append(Json::nullValue); } else { - double value = boost::lexical_cast(tokens[i]); + double value = boost::lexical_cast(t); node[KEY_VALUE].append(FormatDouble(value)); } + break; - + } + default: if (tokens[i].empty()) {