Skip to content

Commit 274b8f3

Browse files
authored
Do not use std::regex during static initialization (#1346)
Bacause it leads to std::bad_cast exception. Relates-To: OAM-1620 Signed-off-by: Mykola Malik <[email protected]>
1 parent b8afbd4 commit 274b8f3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

olp-cpp-sdk-authentication/src/AuthenticationCredentials.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019-2021 HERE Europe B.V.
2+
* Copyright (C) 2019-2022 HERE Europe B.V.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,7 +25,7 @@
2525
#include <vector>
2626

2727
namespace {
28-
const std::regex kRegex{"\\s*=\\s*"};
28+
const std::string kRegexString = "\\s*=\\s*";
2929
const std::string kHereAccessKeyId = "here.access.key.id";
3030
const std::string kHereAccessKeySecret = "here.access.key.secret";
3131
const std::string kHereTokenEndpointUrl = "here.token.endpoint.url";
@@ -56,6 +56,8 @@ namespace authentication {
5656

5757
boost::optional<AuthenticationCredentials>
5858
AuthenticationCredentials::ReadFromStream(std::istream& stream) {
59+
static const std::regex kRegex{kRegexString};
60+
5961
std::string access_key_id;
6062
std::string access_key_secret;
6163
std::string token_endpoint_url;

0 commit comments

Comments
 (0)