Mercurial > hg > orthanc
comparison Core/DicomParsing/DicomWebJsonVisitor.cpp @ 3391:df0f1821b3de
better fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 06 Jun 2019 10:19:28 +0200 |
parents | eb57b7cd5f21 |
children | 0a0e7eca95ae |
comparison
equal
deleted
inserted
replaced
3390:d1445f2df123 | 3391:df0f1821b3de |
---|---|
549 Toolbox::TokenizeString(tokens, truncated, '\\'); | 549 Toolbox::TokenizeString(tokens, truncated, '\\'); |
550 | 550 |
551 node[KEY_VALUE] = Json::arrayValue; | 551 node[KEY_VALUE] = Json::arrayValue; |
552 for (size_t i = 0; i < tokens.size(); i++) | 552 for (size_t i = 0; i < tokens.size(); i++) |
553 { | 553 { |
554 /** | |
555 * The following call to "StripSpaces()" fixes the issue | |
556 * reported by Rana Asim Wajid on 2019-06-05 ("Error | |
557 * Exception while invoking plugin service 32: Bad file | |
558 * format"): | |
559 * https://groups.google.com/d/msg/orthanc-users/T32FovWPcCE/-hKFbfRJBgAJ | |
560 **/ | |
561 tokens[i] = Orthanc::Toolbox::StripSpaces(tokens[i]); | |
562 | |
563 try | 554 try |
564 { | 555 { |
565 switch (vr) | 556 switch (vr) |
566 { | 557 { |
567 case ValueRepresentation_PersonName: | 558 case ValueRepresentation_PersonName: |
591 node[KEY_VALUE].append(value); | 582 node[KEY_VALUE].append(value); |
592 break; | 583 break; |
593 } | 584 } |
594 | 585 |
595 case ValueRepresentation_IntegerString: | 586 case ValueRepresentation_IntegerString: |
596 if (tokens[i].empty()) | 587 { |
588 /** | |
589 * The calls to "StripSpaces()" below fix the | |
590 * issue reported by Rana Asim Wajid on 2019-06-05 | |
591 * ("Error Exception while invoking plugin service | |
592 * 32: Bad file format"): | |
593 * https://groups.google.com/d/msg/orthanc-users/T32FovWPcCE/-hKFbfRJBgAJ | |
594 **/ | |
595 | |
596 std::string t = Orthanc::Toolbox::StripSpaces(tokens[i]); | |
597 if (t.empty()) | |
597 { | 598 { |
598 node[KEY_VALUE].append(Json::nullValue); | 599 node[KEY_VALUE].append(Json::nullValue); |
599 } | 600 } |
600 else | 601 else |
601 { | 602 { |
602 int64_t value = boost::lexical_cast<int64_t>(tokens[i]); | 603 int64_t value = boost::lexical_cast<int64_t>(t); |
603 node[KEY_VALUE].append(FormatInteger(value)); | 604 node[KEY_VALUE].append(FormatInteger(value)); |
604 } | 605 } |
605 | 606 |
606 break; | 607 break; |
608 } | |
607 | 609 |
608 case ValueRepresentation_DecimalString: | 610 case ValueRepresentation_DecimalString: |
609 if (tokens[i].empty()) | 611 { |
612 std::string t = Orthanc::Toolbox::StripSpaces(tokens[i]); | |
613 if (t.empty()) | |
610 { | 614 { |
611 node[KEY_VALUE].append(Json::nullValue); | 615 node[KEY_VALUE].append(Json::nullValue); |
612 } | 616 } |
613 else | 617 else |
614 { | 618 { |
615 double value = boost::lexical_cast<double>(tokens[i]); | 619 double value = boost::lexical_cast<double>(t); |
616 node[KEY_VALUE].append(FormatDouble(value)); | 620 node[KEY_VALUE].append(FormatDouble(value)); |
617 } | 621 } |
622 | |
618 break; | 623 break; |
619 | 624 } |
625 | |
620 default: | 626 default: |
621 if (tokens[i].empty()) | 627 if (tokens[i].empty()) |
622 { | 628 { |
623 node[KEY_VALUE].append(Json::nullValue); | 629 node[KEY_VALUE].append(Json::nullValue); |
624 } | 630 } |