Skip to content

Commit

Permalink
Reimplement Case insensitive in GxProperties (#878)
Browse files Browse the repository at this point in the history
* Reimplement Case insensitive in GxProperties
Issue: 109185

* Reimplement Case insensitive in GxProperties
Issue: 109185
  • Loading branch information
iroqueta committed Jun 24, 2024
1 parent b9cfa86 commit d1a36e5
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions common/src/main/java/com/genexus/util/GXProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

public class GXProperties implements IGxJSONSerializable {
private LinkedHashMap < String, GXProperty > properties = new LinkedHashMap < > ();
private LinkedHashMap < String, GXProperty > originalProperties = new LinkedHashMap < > ();
private boolean eof;
private int lastElement;

Expand All @@ -27,9 +26,8 @@ public void set(String name, String value) {
public void add(String name, String value) { this.put(name, value); }

public void put(String name, String value) {
originalProperties.put(name, new GXProperty(name, value));
name = name.toLowerCase();
properties.put(name, new GXProperty(name, value));
String lowerName = name.toLowerCase();
properties.put(lowerName, new GXProperty(name, value));
}

public String toString() {
Expand All @@ -45,7 +43,6 @@ public String get(String name) {
}

public void remove(String name) {
originalProperties.remove(name);
name = name.toLowerCase();
properties.remove(name);
}
Expand All @@ -57,7 +54,7 @@ public boolean containsKey(String name) {

public GXProperty item(int i) {
int counter = 0;
for (Map.Entry < String, GXProperty > entry: originalProperties.entrySet()) {
for (Map.Entry < String, GXProperty > entry: properties.entrySet()) {
if (counter++ == i) {
return entry.getValue();
}
Expand All @@ -75,14 +72,13 @@ public int count() {

public void clear() {
properties.clear();
originalProperties.clear();
}

public GXProperty first() {
eof = false;
if (count() > 0) {
lastElement = 0;
return originalProperties.entrySet().iterator().next().getValue();
return properties.entrySet().iterator().next().getValue();
} else {
eof = true;
return null;
Expand Down

0 comments on commit d1a36e5

Please sign in to comment.