From ed11a2fe5f9a3dec5d91667a7f98e3d68df88756 Mon Sep 17 00:00:00 2001 From: Arne Seime Date: Mon, 23 Nov 2020 19:26:39 +0100 Subject: [PATCH] \#102 Message type detection more robust --- .../entur/schema2proto/generateproto/ProtoSerializer.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/schema2proto-lib/src/main/java/no/entur/schema2proto/generateproto/ProtoSerializer.java b/schema2proto-lib/src/main/java/no/entur/schema2proto/generateproto/ProtoSerializer.java index 352c67f0..c2a69d45 100644 --- a/schema2proto-lib/src/main/java/no/entur/schema2proto/generateproto/ProtoSerializer.java +++ b/schema2proto-lib/src/main/java/no/entur/schema2proto/generateproto/ProtoSerializer.java @@ -496,11 +496,10 @@ private void uppercaseMessageNames(Map packageToProtoFileMap, private CaseFormat getCaseFormatName(String s) throws IllegalFormatException { if (s.contains("_")) { - if (s.toUpperCase().equals(s)) { - return CaseFormat.UPPER_UNDERSCORE; - } - if (s.toLowerCase().equals(s)) { + if (Character.isLowerCase(s.charAt(0))) { return CaseFormat.LOWER_UNDERSCORE; + } else { + return CaseFormat.UPPER_UNDERSCORE; } } else if (s.contains("-")) { if (s.toLowerCase().equals(s)) {