nifi-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [nifi-minifi-cpp] adamdebreceni commented on a change in pull request #797: MINIFICPP-1231 - General property validation + use them in MergeContent.
Date Tue, 16 Jun 2020 13:03:24 GMT

adamdebreceni commented on a change in pull request #797:
URL: https://github.com/apache/nifi-minifi-cpp/pull/797#discussion_r440831812



##########
File path: libminifi/include/core/state/Value.h
##########
@@ -86,35 +87,57 @@ class Value {
   }
 
   virtual bool getValue(uint32_t &ref) {
-    const auto negative = string_value.find_first_of('-') != std::string::npos;
-     if (negative) {
-       return false;
-     }
-    ref = std::stoul(string_value);
+    try {
+      uint32_t value;
+      utils::ValueParser(string_value).parseUInt32(value).parseEnd();
+      ref = value;
+    } catch(const utils::ParseException&) {
+      return false;
+    }

Review comment:
       they are not ment to be more general, they are ment to be correct, all these conversion
methods are incorrect as they all happily convert `"1banana"` to `1`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message