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 2015/03/05 10:40:24 UTC

camel git commit: Fixed gae on windows

Repository: camel
Updated Branches:
  refs/heads/master 5163f6f69 -> 6465184d1


Fixed gae on windows


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/6465184d
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/6465184d
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/6465184d

Branch: refs/heads/master
Commit: 6465184d1af7dc9a6bbb77eb61e2d8023f2baabc
Parents: 5163f6f
Author: Claus Ibsen <cl...@gmail.com>
Authored: Thu Mar 5 10:41:38 2015 +0100
Committer: Claus Ibsen <cl...@gmail.com>
Committed: Thu Mar 5 10:41:38 2015 +0100

----------------------------------------------------------------------
 .../org/apache/camel/component/gae/auth/GAuthPk8Loader.java | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/6465184d/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthPk8Loader.java
----------------------------------------------------------------------
diff --git a/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthPk8Loader.java b/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthPk8Loader.java
index 5ec60ed..05da8e3 100644
--- a/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthPk8Loader.java
+++ b/components/camel-gae/src/main/java/org/apache/camel/component/gae/auth/GAuthPk8Loader.java
@@ -64,12 +64,19 @@ public class GAuthPk8Loader implements GAuthKeyLoader {
             IOHelper.close(is);
         }
 
+        // replace line feeds from windows to unix style
+        if (!System.lineSeparator().equals("\n")) {
+            str = str.replaceAll(System.lineSeparator(), "\n");
+        }
+
         if (str.contains(BEGIN) && str.contains(END)) {
             str = str.substring(BEGIN.length(), str.lastIndexOf(END));
         }
 
+        byte[] decoded = Base64.decode(str);
+
         KeyFactory factory = KeyFactory.getInstance("RSA");
-        return factory.generatePrivate(new PKCS8EncodedKeySpec(Base64.decode(str)));
+        return factory.generatePrivate(new PKCS8EncodedKeySpec(decoded));
     }
     
 }