You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2022/09/22 07:08:38 UTC

[camel] branch camel-3.18.x updated: [CAMEL-18530] Camel box cannot authorize

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch camel-3.18.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-3.18.x by this push:
     new e5046ba224c [CAMEL-18530] Camel box cannot authorize
e5046ba224c is described below

commit e5046ba224c12f18518a494c839147d37d363be5
Author: Croway <fe...@gmail.com>
AuthorDate: Tue Sep 20 13:53:46 2022 +0200

    [CAMEL-18530] Camel box cannot authorize
---
 .../component/box/internal/BoxConnectionHelper.java      | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/components/camel-box/camel-box-component/src/main/java/org/apache/camel/component/box/internal/BoxConnectionHelper.java b/components/camel-box/camel-box-component/src/main/java/org/apache/camel/component/box/internal/BoxConnectionHelper.java
index be976b1c40b..b7ad7ee3b5e 100644
--- a/components/camel-box/camel-box-component/src/main/java/org/apache/camel/component/box/internal/BoxConnectionHelper.java
+++ b/components/camel-box/camel-box-component/src/main/java/org/apache/camel/component/box/internal/BoxConnectionHelper.java
@@ -139,16 +139,16 @@ public final class BoxConnectionHelper {
             //parse request_token from javascript from head, it is the first script in the header
             final String requestTokenScript = consentPage.select("script").first().html();
             final Matcher m = Pattern.compile("var\\s+request_token\\s+=\\s+'([^'].+)'.*").matcher(requestTokenScript);
+            String requestToken = "";
             if (m.find()) {
-                final String requestToken = m.group(1);
-                response = addProxy(consentForm.submit(), proxy)
-                        .data("request_token", requestToken)
-                        .followRedirects(false)
-                        .cookies(cookies)
-                        .execute();
-            } else {
-                throw new IllegalArgumentException("Error authorizing application: Can not parse request token.");
+                requestToken = m.group(1);
             }
+            response = addProxy(consentForm.submit(), proxy)
+                    .data("request_token", requestToken)
+                    .followRedirects(false)
+                    .cookies(cookies)
+                    .execute();
+
             final String location = response.header("Location");
 
             final Map<String, String> params = new HashMap<>();