Skip to content

Commit 248696c

Browse files
committed
Merge branch 'wss4j' of https://github.com/genexuslabs/JavaClasses into wss4j
2 parents 89c361a + edee89c commit 248696c

File tree

23 files changed

+791
-258
lines changed

23 files changed

+791
-258
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
| Branch | Status
2-
|---|---
3-
|master |[![](https://github.com/genexuslabs/JavaClasses/workflows/Build/badge.svg)](https://github.com/genexuslabs/JavaClasses/actions?query=workflow%3ABuild+branch%3Amaster)
4-
|beta |[![](https://github.com/genexuslabs/JavaClasses/workflows/Build/badge.svg?branch=beta)](https://github.com/genexuslabs/JavaClasses/actions?query=workflow%3ABuild+branch%3Abeta)
5-
61
# GeneXus Standard Classes for Java
7-
82
These are the source of the GeneXus Standard Classes for Java, valid since GeneXus 16 Upgrade 4.
93

4+
## Repo Status
5+
| Branch | Build | Security
6+
|---|---|---
7+
|master |[![](https://github.com/genexuslabs/JavaClasses/workflows/Build/badge.svg)](https://github.com/genexuslabs/JavaClasses/actions?query=workflow%3ABuild+branch%3Amaster)|[![CodeQL](https://github.com/genexuslabs/JavaClasses/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/genexuslabs/JavaClasses/actions/workflows/codeql-analysis.yml)
8+
|beta |[![](https://github.com/genexuslabs/JavaClasses/workflows/Build/badge.svg?branch=beta)](https://github.com/genexuslabs/JavaClasses/actions?query=workflow%3ABuild+branch%3Abeta)|[![CodeQL](https://github.com/genexuslabs/JavaClasses/actions/workflows/codeql-analysis.yml/badge.svg?branch=beta)](https://github.com/genexuslabs/JavaClasses/actions/workflows/codeql-analysis.yml)
9+
1010
## Modules
1111

1212
| Name | Description

common/src/main/java/com/genexus/CommonUtil.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public Object initialValue()
179179

180180
public static String removeAllQuotes(String fileName)
181181
{
182-
StringBuffer out = new StringBuffer();
182+
StringBuilder out = new StringBuilder();
183183
int len = fileName.length();
184184
for (int i = 0; i < len; i++)
185185
if (fileName.charAt(i) != '"')
@@ -1023,7 +1023,7 @@ public static String strReplace(String s, String subString, String replacement)
10231023
return s;
10241024

10251025
int index, start, subLength;
1026-
StringBuffer buf = new StringBuffer();
1026+
StringBuilder buf = new StringBuilder();
10271027
subLength = subString.length();
10281028

10291029
for (start = 0, index = s.indexOf(subString, start); index >= 0; start = index + subLength, index = s.indexOf(subString, start))
@@ -1080,7 +1080,7 @@ public static String replicate (char character, int size)
10801080
if (size <= 0)
10811081
return "";
10821082

1083-
StringBuffer ret = new StringBuffer(size);
1083+
StringBuilder ret = new StringBuilder(size);
10841084

10851085
for (int i = 0; i < size; i++)
10861086
{
@@ -1095,7 +1095,7 @@ public static String replicate (String character, int size, int a)
10951095
if (size <= 0)
10961096
return "";
10971097

1098-
StringBuffer ret = new StringBuffer(size);
1098+
StringBuilder ret = new StringBuilder(size);
10991099

11001100
for (int i = 0; i < size; i++)
11011101
{
@@ -1218,7 +1218,7 @@ public static long lval(String text)
12181218
}
12191219
catch (Exception e)
12201220
{
1221-
StringBuffer out = new StringBuffer();
1221+
StringBuilder out = new StringBuilder();
12221222

12231223
boolean first = true;
12241224
int len = text.length();
@@ -1282,8 +1282,8 @@ public static BigDecimal decimalVal(String text, String sDSep)
12821282
return BigDecimal.ZERO;
12831283
}
12841284

1285-
private static StringBuffer extractNumericStringValue(String text, String sDSep) {
1286-
StringBuffer out = new StringBuffer();
1285+
private static StringBuilder extractNumericStringValue(String text, String sDSep) {
1286+
StringBuilder out = new StringBuilder();
12871287

12881288
char dSep = (sDSep.length() > 0) ? sDSep.charAt(0) : '.';
12891289
boolean point = false;
@@ -1861,7 +1861,7 @@ protected static boolean in(String text , char c)
18611861

18621862
public static String getTimeFormat(String time)
18631863
{
1864-
StringBuffer ret = new StringBuffer(time);
1864+
StringBuilder ret = new StringBuilder(time);
18651865
char hora;
18661866
boolean app = false;
18671867
char append = ' ';
@@ -2337,7 +2337,7 @@ public static boolean contains(Object []arr, Object item)
23372337
public static String format(String value, String v1, String v2, String v3, String v4, String v5, String v6, String v7, String v8, String v9)
23382338
{
23392339
String[] vs = {v1, v2, v3, v4, v5, v6, v7, v8, v9};
2340-
StringBuffer stringBuilder = new StringBuffer();
2340+
StringBuilder stringBuilder = new StringBuilder();
23412341
int valueLength = value.length();
23422342
if (value != null && !value.equals(""))
23432343
{
@@ -2560,7 +2560,7 @@ public static String strUnexponentString(String num)
25602560
int point = num.indexOf('.');
25612561
int scale = num.length() - (point == -1 ? num.length () : point + 1) - scaleAdj;
25622562

2563-
StringBuffer val = new StringBuffer(point == -1 ? num : num.substring(0, point) + num.substring (point + 1));
2563+
StringBuilder val = new StringBuilder(point == -1 ? num : num.substring(0, point) + num.substring (point + 1));
25642564

25652565
// correct for negative scale as per BigDecimal javadoc
25662566
for(; scale<0; scale++)
@@ -2907,7 +2907,7 @@ public static String strori(double val, int digits, int decimals)
29072907
if (decimals < 0) decimals = 0;
29082908
if (digits < 0) digits = 0;
29092909

2910-
StringBuffer b = new StringBuffer();
2910+
StringBuilder b = new StringBuilder();
29112911
boolean hasSign = (val < 0);
29122912

29132913
if (hasSign)
@@ -3116,7 +3116,7 @@ public static String addLastPathSeparator(String dir) {
31163116
}
31173117

31183118
public static String quoteString(String in, boolean entities8bit, boolean encodeQuotes) {
3119-
StringBuffer out = new StringBuffer();
3119+
StringBuilder out = new StringBuilder();
31203120
for (int i = 0; i < in.length(); i++)
31213121
{
31223122
char currentChar = in.charAt(i);
@@ -3383,7 +3383,7 @@ public final static String hashtable2query(Hashtable hashtable)
33833383
if (hashtable == null)
33843384
return null;
33853385

3386-
StringBuffer qbuf = new StringBuffer();
3386+
StringBuilder qbuf = new StringBuilder();
33873387
for (Enumeration en = hashtable.keys(); en.hasMoreElements();) {
33883388
Object key = en.nextElement();
33893389
qbuf.append((key == null ? null : URLEncode((String)key,"UTF-8")) + "=" +

common/src/main/java/com/genexus/GXBaseList.java

Lines changed: 56 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,49 +5,39 @@
55
import com.genexus.internet.IGxJSONAble;
66
import com.genexus.internet.IGxJSONSerializable;
77

8-
public abstract class GXBaseList<T> extends Vector<T> implements Serializable, IGxJSONAble, IGxJSONSerializable, IGXAssigned
9-
{
8+
public abstract class GXBaseList<T> extends Vector<T> implements Serializable, IGxJSONAble, IGxJSONSerializable, IGXAssigned {
109
private boolean IsAssigned;
1110

12-
public GXBaseList()
13-
{
11+
public GXBaseList() {
1412
IsAssigned = true;
1513
}
1614

17-
public boolean getIsAssigned()
18-
{
15+
public boolean getIsAssigned() {
1916
return this.IsAssigned;
2017
}
21-
public void setIsAssigned(boolean bAssigned)
22-
{
18+
public void setIsAssigned(boolean bAssigned) {
2319
this.IsAssigned = bAssigned;
2420
}
25-
public void removeAllItems()
26-
{
21+
public void removeAllItems() {
2722
super.clear();
2823
IsAssigned = true;
2924
}
30-
public byte removeItem(int index)
31-
{
25+
public byte removeItem(int index) {
3226
T item = null;
33-
if(index > 0 && index <= size())
34-
{
27+
if(index > 0 && index <= size()) {
3528
item = super.remove((int)index - 1);//Vector.remove(int)
3629
IsAssigned = true;
3730
return (byte)1;
3831
}
3932
return (byte)0;
4033
}
41-
public byte removeElement(double index)
42-
{
43-
if(index > 0 && index <= size())
44-
{
34+
public byte removeElement(double index) {
35+
if(index > 0 && index <= size()) {
4536
super.remove((int)index - 1);//Vector.remove(int)
4637
IsAssigned = true;
4738
return (byte)1;
4839
}
49-
else
50-
{
40+
else {
5141
return (byte)0;
5242
}
5343
}
@@ -58,24 +48,62 @@ public void addObject(Object obj){
5848
IsAssigned = true;
5949
}
6050
@SuppressWarnings("unchecked")
61-
public void add(Object item, int index)
62-
{
63-
if(index < 1 || index > size())
64-
{
51+
public void add(Object item, int index) {
52+
if(index < 1 || index > size()) {
6553
add((T)item); //this.add, GXBCLevelCollection.add for example
6654
}
67-
else
68-
{
55+
else {
6956
super.add(index - 1, (T)item); //Vector insert element
7057
IsAssigned = true;
7158
}
7259
}
7360
@SuppressWarnings("unchecked")
74-
public void addBase( Object item)
75-
{
61+
public void addBase( Object item) {
7662
super.add((T)item);
7763
IsAssigned = true;
7864
}
65+
66+
public boolean addRange( GXBaseList<T> baseList, Number index) {
67+
if (baseList.size() == 0)
68+
return true;
69+
70+
boolean result;
71+
if (index == null) {
72+
result = addAll(baseList);
73+
}
74+
else {
75+
int nindex = index.intValue();
76+
if(nindex != 1 && (nindex < 0 || nindex > size() +1))
77+
return false;
78+
if (nindex == 0)
79+
nindex = 1;
80+
result = addAll(nindex -1, baseList);
81+
}
82+
IsAssigned = true;
83+
return result;
84+
}
85+
86+
public boolean removeRange( int index, Number count) {
87+
int colSize = size();
88+
if(index <= 0 || index > colSize || (count != null && index + count.intValue() > colSize))
89+
return false;
90+
int toIndex;
91+
if (count == null)
92+
toIndex = colSize;
93+
else
94+
toIndex = count.intValue();
95+
super.removeRange(index -1, toIndex);
96+
IsAssigned = true;
97+
return true;
98+
}
99+
100+
public boolean setElement( int index, T element) {
101+
if(index < 1 || index > size())
102+
return false;
103+
super.set(index -1, element);
104+
IsAssigned = true;
105+
return true;
106+
}
79107
}
80108

81109

common/src/main/java/com/genexus/GXSimpleCollection.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,5 +1352,17 @@ public boolean update(){
13521352
return false;
13531353
}
13541354

1355+
public boolean addRange( GXSimpleCollection<T> baseList, Number index) {
1356+
return super.addRange(baseList, index);
1357+
}
1358+
1359+
public boolean removeRange( int index, Number count) {
1360+
return super.removeRange(index, count);
1361+
}
1362+
1363+
public boolean setElement( int index, T element) {
1364+
return super.setElement(index, element);
1365+
}
1366+
13551367

13561368
}

common/src/main/java/com/genexus/util/DelimitedFilesSafe.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,7 @@ public byte dfrgdate(java.util.Date[] date, String fmt, String sep)
498498
String retstr;
499499
Date retdate = CommonUtil.nullDate();
500500
int year = 0, month = 0, day = 0;
501+
boolean getnexttoken = true;
501502

502503
if (dfropen_in_use)
503504
{
@@ -506,6 +507,8 @@ public byte dfrgdate(java.util.Date[] date, String fmt, String sep)
506507
String stringDelimitedField = actline.nextToken(fdel);
507508
if(fdel.equals(stringDelimitedField) || stringDelimitedField.equals(""))
508509
{ // Si el token debe estar vac�o...
510+
if (fdel.equals(stringDelimitedField))
511+
getnexttoken = false;
509512
stringDelimitedField = "";
510513
}
511514

@@ -563,7 +566,8 @@ else if (month < 1 || month > 12 || day < 1 || day > 31)
563566
date[0] = retdate;
564567
try
565568
{
566-
String stringDelimitedField = actline.nextToken(fdel);
569+
if (getnexttoken)
570+
actline.nextToken(fdel);
567571
}
568572
catch(Exception e)
569573
{//Se sabe que se puede leer un token que no existe al final de la linea

0 commit comments

Comments
 (0)