From 02b9820e7d2dd3062e47673b48ace87b7af3c428 Mon Sep 17 00:00:00 2001 From: Tor-Einar Skog <tor-einar.skog@nibio.no> Date: Tue, 17 Apr 2018 10:00:32 +0200 Subject: [PATCH] Added control of ModelID string length --- src/main/java/no/nibio/vips/model/ModelId.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/no/nibio/vips/model/ModelId.java b/src/main/java/no/nibio/vips/model/ModelId.java index bdbd83c..8acc67c 100755 --- a/src/main/java/no/nibio/vips/model/ModelId.java +++ b/src/main/java/no/nibio/vips/model/ModelId.java @@ -39,7 +39,16 @@ public class ModelId { this.setId(theId); } - private void setId(String theId) { + private void setId(String theId){ + theId = theId.trim(); + if(theId.length() < 10) + { + theId = theId + new String(new char[10-theId.length()]).replace("\0", "X"); + } + else if(theId.length() > 10) + { + theId = theId.substring(0, 10); + } this.id = theId.toCharArray(); } -- GitLab