fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From my...@apache.org
Subject [fineract-cn-lang] 18/49: Fixing index out of range exception.
Date Mon, 22 Jan 2018 15:01:13 GMT
This is an automated email from the ASF dual-hosted git repository.

myrle pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract-cn-lang.git

commit 293ec3758b6abfac5a4f873118ec6a438424001b
Author: myrle-krantz <mkrantz@mifos.org>
AuthorDate: Wed Apr 26 16:10:31 2017 +0200

    Fixing index out of range exception.
---
 src/main/java/io/mifos/core/lang/security/RsaKeyPairFactory.java | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/main/java/io/mifos/core/lang/security/RsaKeyPairFactory.java b/src/main/java/io/mifos/core/lang/security/RsaKeyPairFactory.java
index 7aa0098..f385d69 100644
--- a/src/main/java/io/mifos/core/lang/security/RsaKeyPairFactory.java
+++ b/src/main/java/io/mifos/core/lang/security/RsaKeyPairFactory.java
@@ -61,7 +61,14 @@ public final class RsaKeyPairFactory {
 
   private static String createKeyTimestampNow() {
     final String timestamp = DateConverter.toIsoString(LocalDateTime.now(Clock.systemUTC()));
-    final String timestampWithoutNanos = timestamp.substring(0, timestamp.indexOf("."));
+    final int index = timestamp.indexOf(".");
+    final String timestampWithoutNanos;
+    if (index > 0) {
+      timestampWithoutNanos = timestamp.substring(0, index);
+    }
+    else {
+      timestampWithoutNanos = timestamp;
+    }
     return timestampWithoutNanos.replace(':', '_');
   }
 

-- 
To stop receiving notification emails like this one, please contact
myrle@apache.org.

Mime
View raw message