Skip to content

Commit

Permalink
CU-86b14j4e0_SRU2024_check-code-security-reports-at-GitHub-for-all-re…
Browse files Browse the repository at this point in the history
…pos (#201)

* CU-86b14j4e0_SRU2024_check-code-security-reports-at-GitHub-for-all-repos

* CU-86b14j4e0_SRU2024_check-code-security-reports-at-GitHub-for-all-repos

* CU-86b14j4e0_SRU2024_check-code-security-reports-at-GitHub-for-all-repos
  • Loading branch information
ptorres-prowide authored Sep 30, 2024
1 parent 084577d commit 8ac48f9
Show file tree
Hide file tree
Showing 59 changed files with 701 additions and 2,738 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,9 @@
import java.math.BigInteger;


import org.apache.commons.lang3.StringUtils;

import com.prowidesoftware.swift.model.field.SwiftParseUtils;
import com.prowidesoftware.swift.model.field.Field;
import com.prowidesoftware.swift.model.*;
import com.prowidesoftware.swift.utils.SwiftFormatUtils;
import org.apache.commons.lang3.StringUtils;

import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
Expand Down Expand Up @@ -185,19 +182,16 @@ public String getValue() {
*/
@Override
public String getValueDisplay(int component, Locale locale) {
if (component < 1 || component > 1) {
if (component != 1) {
throw new IllegalArgumentException("invalid component number " + component + " for field 122");
}
if (component == 1) {
//default format (as is)
return getComponent(1);
}
return null;
//default format (as is)
return getComponent(1);
}

/**
* Returns the field component types pattern.
*
* <p>
* This method returns a letter representing the type for each component in the Field. It supersedes
* the Components Pattern because it distinguishes between N (Number) and I (BigDecimal).
* @since 9.2.7
Expand Down Expand Up @@ -347,32 +341,14 @@ public Field122 setComponent1(String component1) {
return this;
}

/**
* Set the component1 from a Long object.
* <br>
* <em>If the component being set is a fixed length number, the argument will not be
* padded.</em> It is recommended for these cases to use the setComponent1(String)
* method.
*
* @see #setComponent1(String)
* @since 9.2.7
*
* @param component1 the Long with the Number Of Messages content to set
* @return the field object to enable build pattern
*/
public Field122 setComponent1(java.lang.Long component1) {
setComponent(1, SwiftFormatUtils.getLong(component1));
return this;
}

/**
* Alternative method setter for field's Number Of Messages (component 1) as Number
*
* <p>
* This method supports java constant value boxing for simpler coding styles (ex: 10 becomes an Integer)
*
* @param component1 the Number with the Number Of Messages content to set
* @return the field object to enable build pattern
* @see #setNumberOfMessages(java.lang.Long)
*/
public Field122 setComponent1(java.lang.Number component1) {

Expand Down Expand Up @@ -402,27 +378,13 @@ public Field122 setNumberOfMessages(String component1) {
return setComponent1(component1);
}

/**
* Set the Number Of Messages (component 1) from a Long object.
*
* @see #setComponent1(java.lang.Long)
*
* @param component1 Long with the Number Of Messages content to set
* @return the field object to enable build pattern
* @since 9.2.7
*/
public Field122 setNumberOfMessages(java.lang.Long component1) {
return setComponent1(component1);
}

/**
* Alternative method setter for field's Number Of Messages (component 1) as Number
*
* <p>
* This method supports java constant value boxing for simpler coding styles (ex: 10 becomes an Integer)
*
* @param component1 the Number with the Number Of Messages content to set
* @return the field object to enable build pattern
* @see #setNumberOfMessages(java.lang.Long)
*/
public Field122 setNumberOfMessages(java.lang.Number component1) {
return setComponent1(component1);
Expand Down Expand Up @@ -493,7 +455,7 @@ public static List<Field122> getAll(final SwiftTagListBlock block) {
return result;
}
final Tag[] arr = block.getTagsByName(NAME);
if (arr != null && arr.length > 0) {
if (arr != null) {
for (final Tag f : arr) {
result.add(new Field122(f));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,9 @@
import com.prowidesoftware.swift.model.field.AmountContainer;
import com.prowidesoftware.swift.model.field.AmountResolver;

import org.apache.commons.lang3.StringUtils;

import com.prowidesoftware.swift.model.field.SwiftParseUtils;
import com.prowidesoftware.swift.model.field.Field;
import com.prowidesoftware.swift.model.*;
import com.prowidesoftware.swift.utils.SwiftFormatUtils;
import org.apache.commons.lang3.StringUtils;

import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
Expand Down Expand Up @@ -220,21 +217,20 @@ public String getValueDisplay(int component, Locale locale) {
//default format (as is)
return getComponent(2);
}
if (component == 3) {
//amount, rate
java.text.NumberFormat f = java.text.NumberFormat.getNumberInstance(notNull(locale));
f.setMaximumFractionDigits(13);
BigDecimal n = getComponent3AsBigDecimal();
if (n != null) {
return f.format(n);
}
// This is the last component, return directly without `if`
//amount, rate
java.text.NumberFormat f = java.text.NumberFormat.getNumberInstance(notNull(locale));
f.setMaximumFractionDigits(13);
BigDecimal n = getComponent3AsBigDecimal();
if (n != null) {
return f.format(n);
}
return null;
}

/**
* Returns the field component types pattern.
*
* <p>
* This method returns a letter representing the type for each component in the Field. It supersedes
* the Components Pattern because it distinguishes between N (Number) and I (BigDecimal).
* @since 9.2.7
Expand Down Expand Up @@ -464,32 +460,13 @@ public Field13K setComponent3(String component3) {
return this;
}

/**
* Set the component3 from a BigDecimal object.
* <br>
* Parses the BigDecimal into a SWIFT amount with truncated zero decimals and mandatory decimal separator.
* <ul>
* <li>Example: 1234.00 -&gt; 1234,</li>
* <li>Example: 1234 -&gt; 1234,</li>
* <li>Example: 1234.56 -&gt; 1234,56</li>
* </ul>
* @since 9.2.7
*
* @param component3 the BigDecimal with the Quantity content to set
* @return the field object to enable build pattern
*/
public Field13K setComponent3(java.math.BigDecimal component3) {
setComponent(3, SwiftFormatUtils.getBigDecimal(component3));
return this;
}
/**
* Alternative method setter for field's Quantity (component 3) as Number
*
* <p>
* This method supports java constant value boxing for simpler coding styles (ex: 10.0 becomes an Float)
*
* @param component3 the Number with the Quantity content to set
* @return the field object to enable build pattern
* @see #setQuantity(java.math.BigDecimal)
*/
public Field13K setComponent3(java.lang.Number component3) {

Expand Down Expand Up @@ -521,27 +498,13 @@ public Field13K setQuantity(String component3) {
return setComponent3(component3);
}

/**
* Set the Quantity (component 3) from a BigDecimal object.
*
* @see #setComponent3(java.math.BigDecimal)
*
* @param component3 BigDecimal with the Quantity content to set
* @return the field object to enable build pattern
* @since 9.2.7
*/
public Field13K setQuantity(java.math.BigDecimal component3) {
return setComponent3(component3);
}

/**
* Alternative method setter for field's Quantity (component 3) as Number
*
* <p>
* This method supports java constant value boxing for simpler coding styles (ex: 10 becomes an Integer)
*
* @param component3 the Number with the Quantity content to set
* @return the field object to enable build pattern
* @see #setQuantity(java.math.BigDecimal)
*/
public Field13K setQuantity(java.lang.Number component3) {
return setComponent3(component3);
Expand All @@ -564,6 +527,7 @@ public List<BigDecimal> amounts() {
* @return the first amount as BigDecimal value. Can be null
* @see AmountResolver#amount(Field)
*/
@Override
public BigDecimal amount() {
return AmountResolver.amount(this);
}
Expand All @@ -575,6 +539,7 @@ public BigDecimal amount() {
*
* @return DSS component value or null if the DSS is not set or not available for this field.
*/
@Override
public String getDSS() {
return null;
}
Expand All @@ -585,6 +550,7 @@ public String getDSS() {
* @see #getDSS()
* @return true if DSS is present, false otherwise.
*/
@Override
public boolean isDSSPresent() {
return false;
}
Expand All @@ -599,6 +565,7 @@ public boolean isDSSPresent() {
*
* @return for generic fields returns the value of the conditional qualifier or null if not set or not applicable for this field.
*/
@Override
public String getConditionalQualifier() {
return getComponent(CONDITIONAL_QUALIFIER);
}
Expand Down Expand Up @@ -666,7 +633,7 @@ public static List<Field13K> getAll(final SwiftTagListBlock block) {
return result;
}
final Tag[] arr = block.getTagsByName(NAME);
if (arr != null && arr.length > 0) {
if (arr != null) {
for (final Tag f : arr) {
result.add(new Field13K(f));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,9 @@



import org.apache.commons.lang3.StringUtils;

import com.prowidesoftware.swift.model.field.SwiftParseUtils;
import com.prowidesoftware.swift.model.field.Field;
import com.prowidesoftware.swift.model.*;
import com.prowidesoftware.swift.utils.SwiftFormatUtils;
import org.apache.commons.lang3.StringUtils;

import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
Expand Down Expand Up @@ -178,19 +175,16 @@ public String getValue() {
*/
@Override
public String getValueDisplay(int component, Locale locale) {
if (component < 1 || component > 1) {
if (component != 1) {
throw new IllegalArgumentException("invalid component number " + component + " for field 14P");
}
if (component == 1) {
//default format (as is)
return getComponent(1);
}
return null;
//default format (as is)
return getComponent(1);
}

/**
* Returns the field component types pattern.
*
* <p>
* This method returns a letter representing the type for each component in the Field. It supersedes
* the Components Pattern because it distinguishes between N (Number) and I (BigDecimal).
* @since 9.2.7
Expand Down Expand Up @@ -373,7 +367,7 @@ public static List<Field14P> getAll(final SwiftTagListBlock block) {
return result;
}
final Tag[] arr = block.getTagsByName(NAME);
if (arr != null && arr.length > 0) {
if (arr != null) {
for (final Tag f : arr) {
result.add(new Field14P(f));
}
Expand All @@ -388,13 +382,11 @@ public static List<Field14P> getAll(final SwiftTagListBlock block) {
* @since 7.10.3
* @see Field#fromJson(String)
*/
@SuppressWarnings("unused")
public static Field14P fromJson(final String json) {

final Field14P field = new Field14P();



return field;
return new Field14P();
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,9 @@



import org.apache.commons.lang3.StringUtils;

import com.prowidesoftware.swift.model.field.SwiftParseUtils;
import com.prowidesoftware.swift.model.field.Field;
import com.prowidesoftware.swift.model.*;
import com.prowidesoftware.swift.utils.SwiftFormatUtils;
import org.apache.commons.lang3.StringUtils;

import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
Expand Down Expand Up @@ -178,19 +175,16 @@ public String getValue() {
*/
@Override
public String getValueDisplay(int component, Locale locale) {
if (component < 1 || component > 1) {
if (component != 1) {
throw new IllegalArgumentException("invalid component number " + component + " for field 14Q");
}
if (component == 1) {
//default format (as is)
return getComponent(1);
}
return null;
//default format (as is)
return getComponent(1);
}

/**
* Returns the field component types pattern.
*
* <p>
* This method returns a letter representing the type for each component in the Field. It supersedes
* the Components Pattern because it distinguishes between N (Number) and I (BigDecimal).
* @since 9.2.7
Expand Down Expand Up @@ -373,7 +367,7 @@ public static List<Field14Q> getAll(final SwiftTagListBlock block) {
return result;
}
final Tag[] arr = block.getTagsByName(NAME);
if (arr != null && arr.length > 0) {
if (arr != null) {
for (final Tag f : arr) {
result.add(new Field14Q(f));
}
Expand All @@ -388,13 +382,11 @@ public static List<Field14Q> getAll(final SwiftTagListBlock block) {
* @since 7.10.3
* @see Field#fromJson(String)
*/
@SuppressWarnings("unused")
public static Field14Q fromJson(final String json) {

final Field14Q field = new Field14Q();



return field;
return new Field14Q();
}


Expand Down
Loading

0 comments on commit 8ac48f9

Please sign in to comment.