Skip to content

Commit

Permalink
Merge branch 'wss4j' of https://github.com/genexuslabs/JavaClasses in…
Browse files Browse the repository at this point in the history
…to wss4j
  • Loading branch information
sgrampone committed Mar 26, 2024
2 parents 89c361a + edee89c commit 248696c
Show file tree
Hide file tree
Showing 23 changed files with 791 additions and 258 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
| Branch | Status
|---|---
|master |[![](https://github.com/genexuslabs/JavaClasses/workflows/Build/badge.svg)](https://github.com/genexuslabs/JavaClasses/actions?query=workflow%3ABuild+branch%3Amaster)
|beta |[![](https://github.com/genexuslabs/JavaClasses/workflows/Build/badge.svg?branch=beta)](https://github.com/genexuslabs/JavaClasses/actions?query=workflow%3ABuild+branch%3Abeta)

# GeneXus Standard Classes for Java

These are the source of the GeneXus Standard Classes for Java, valid since GeneXus 16 Upgrade 4.

## Repo Status
| Branch | Build | Security
|---|---|---
|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)
|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)

## Modules

| Name | Description
Expand Down
26 changes: 13 additions & 13 deletions common/src/main/java/com/genexus/CommonUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public Object initialValue()

public static String removeAllQuotes(String fileName)
{
StringBuffer out = new StringBuffer();
StringBuilder out = new StringBuilder();
int len = fileName.length();
for (int i = 0; i < len; i++)
if (fileName.charAt(i) != '"')
Expand Down Expand Up @@ -1023,7 +1023,7 @@ public static String strReplace(String s, String subString, String replacement)
return s;

int index, start, subLength;
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();
subLength = subString.length();

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

StringBuffer ret = new StringBuffer(size);
StringBuilder ret = new StringBuilder(size);

for (int i = 0; i < size; i++)
{
Expand All @@ -1095,7 +1095,7 @@ public static String replicate (String character, int size, int a)
if (size <= 0)
return "";

StringBuffer ret = new StringBuffer(size);
StringBuilder ret = new StringBuilder(size);

for (int i = 0; i < size; i++)
{
Expand Down Expand Up @@ -1218,7 +1218,7 @@ public static long lval(String text)
}
catch (Exception e)
{
StringBuffer out = new StringBuffer();
StringBuilder out = new StringBuilder();

boolean first = true;
int len = text.length();
Expand Down Expand Up @@ -1282,8 +1282,8 @@ public static BigDecimal decimalVal(String text, String sDSep)
return BigDecimal.ZERO;
}

private static StringBuffer extractNumericStringValue(String text, String sDSep) {
StringBuffer out = new StringBuffer();
private static StringBuilder extractNumericStringValue(String text, String sDSep) {
StringBuilder out = new StringBuilder();

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

public static String getTimeFormat(String time)
{
StringBuffer ret = new StringBuffer(time);
StringBuilder ret = new StringBuilder(time);
char hora;
boolean app = false;
char append = ' ';
Expand Down Expand Up @@ -2337,7 +2337,7 @@ public static boolean contains(Object []arr, Object item)
public static String format(String value, String v1, String v2, String v3, String v4, String v5, String v6, String v7, String v8, String v9)
{
String[] vs = {v1, v2, v3, v4, v5, v6, v7, v8, v9};
StringBuffer stringBuilder = new StringBuffer();
StringBuilder stringBuilder = new StringBuilder();
int valueLength = value.length();
if (value != null && !value.equals(""))
{
Expand Down Expand Up @@ -2560,7 +2560,7 @@ public static String strUnexponentString(String num)
int point = num.indexOf('.');
int scale = num.length() - (point == -1 ? num.length () : point + 1) - scaleAdj;

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

// correct for negative scale as per BigDecimal javadoc
for(; scale<0; scale++)
Expand Down Expand Up @@ -2907,7 +2907,7 @@ public static String strori(double val, int digits, int decimals)
if (decimals < 0) decimals = 0;
if (digits < 0) digits = 0;

StringBuffer b = new StringBuffer();
StringBuilder b = new StringBuilder();
boolean hasSign = (val < 0);

if (hasSign)
Expand Down Expand Up @@ -3116,7 +3116,7 @@ public static String addLastPathSeparator(String dir) {
}

public static String quoteString(String in, boolean entities8bit, boolean encodeQuotes) {
StringBuffer out = new StringBuffer();
StringBuilder out = new StringBuilder();
for (int i = 0; i < in.length(); i++)
{
char currentChar = in.charAt(i);
Expand Down Expand Up @@ -3383,7 +3383,7 @@ public final static String hashtable2query(Hashtable hashtable)
if (hashtable == null)
return null;

StringBuffer qbuf = new StringBuffer();
StringBuilder qbuf = new StringBuilder();
for (Enumeration en = hashtable.keys(); en.hasMoreElements();) {
Object key = en.nextElement();
qbuf.append((key == null ? null : URLEncode((String)key,"UTF-8")) + "=" +
Expand Down
84 changes: 56 additions & 28 deletions common/src/main/java/com/genexus/GXBaseList.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,49 +5,39 @@
import com.genexus.internet.IGxJSONAble;
import com.genexus.internet.IGxJSONSerializable;

public abstract class GXBaseList<T> extends Vector<T> implements Serializable, IGxJSONAble, IGxJSONSerializable, IGXAssigned
{
public abstract class GXBaseList<T> extends Vector<T> implements Serializable, IGxJSONAble, IGxJSONSerializable, IGXAssigned {
private boolean IsAssigned;

public GXBaseList()
{
public GXBaseList() {
IsAssigned = true;
}

public boolean getIsAssigned()
{
public boolean getIsAssigned() {
return this.IsAssigned;
}
public void setIsAssigned(boolean bAssigned)
{
public void setIsAssigned(boolean bAssigned) {
this.IsAssigned = bAssigned;
}
public void removeAllItems()
{
public void removeAllItems() {
super.clear();
IsAssigned = true;
}
public byte removeItem(int index)
{
public byte removeItem(int index) {
T item = null;
if(index > 0 && index <= size())
{
if(index > 0 && index <= size()) {
item = super.remove((int)index - 1);//Vector.remove(int)
IsAssigned = true;
return (byte)1;
}
return (byte)0;
}
public byte removeElement(double index)
{
if(index > 0 && index <= size())
{
public byte removeElement(double index) {
if(index > 0 && index <= size()) {
super.remove((int)index - 1);//Vector.remove(int)
IsAssigned = true;
return (byte)1;
}
else
{
else {
return (byte)0;
}
}
Expand All @@ -58,24 +48,62 @@ public void addObject(Object obj){
IsAssigned = true;
}
@SuppressWarnings("unchecked")
public void add(Object item, int index)
{
if(index < 1 || index > size())
{
public void add(Object item, int index) {
if(index < 1 || index > size()) {
add((T)item); //this.add, GXBCLevelCollection.add for example
}
else
{
else {
super.add(index - 1, (T)item); //Vector insert element
IsAssigned = true;
}
}
@SuppressWarnings("unchecked")
public void addBase( Object item)
{
public void addBase( Object item) {
super.add((T)item);
IsAssigned = true;
}

public boolean addRange( GXBaseList<T> baseList, Number index) {
if (baseList.size() == 0)
return true;

boolean result;
if (index == null) {
result = addAll(baseList);
}
else {
int nindex = index.intValue();
if(nindex != 1 && (nindex < 0 || nindex > size() +1))
return false;
if (nindex == 0)
nindex = 1;
result = addAll(nindex -1, baseList);
}
IsAssigned = true;
return result;
}

public boolean removeRange( int index, Number count) {
int colSize = size();
if(index <= 0 || index > colSize || (count != null && index + count.intValue() > colSize))
return false;
int toIndex;
if (count == null)
toIndex = colSize;
else
toIndex = count.intValue();
super.removeRange(index -1, toIndex);
IsAssigned = true;
return true;
}

public boolean setElement( int index, T element) {
if(index < 1 || index > size())
return false;
super.set(index -1, element);
IsAssigned = true;
return true;
}
}


Expand Down
12 changes: 12 additions & 0 deletions common/src/main/java/com/genexus/GXSimpleCollection.java
Original file line number Diff line number Diff line change
Expand Up @@ -1352,5 +1352,17 @@ public boolean update(){
return false;
}

public boolean addRange( GXSimpleCollection<T> baseList, Number index) {
return super.addRange(baseList, index);
}

public boolean removeRange( int index, Number count) {
return super.removeRange(index, count);
}

public boolean setElement( int index, T element) {
return super.setElement(index, element);
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@ public byte dfrgdate(java.util.Date[] date, String fmt, String sep)
String retstr;
Date retdate = CommonUtil.nullDate();
int year = 0, month = 0, day = 0;
boolean getnexttoken = true;

if (dfropen_in_use)
{
Expand All @@ -506,6 +507,8 @@ public byte dfrgdate(java.util.Date[] date, String fmt, String sep)
String stringDelimitedField = actline.nextToken(fdel);
if(fdel.equals(stringDelimitedField) || stringDelimitedField.equals(""))
{ // Si el token debe estar vac�o...
if (fdel.equals(stringDelimitedField))
getnexttoken = false;
stringDelimitedField = "";
}

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

0 comments on commit 248696c

Please sign in to comment.