Skip to content

Commit

Permalink
Merge pull request #252 from neicnordic/refactor/replace-isEmpty
Browse files Browse the repository at this point in the history
replace deprecated method in StringUtils isEmpty with hasLength
  • Loading branch information
Parisa68 authored Jan 4, 2024
2 parents b0a91d5 + b61acef commit ac3292e
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private InputStream getPlaintextResponse(byte[] header, InputStream bodyInputStr
ByteArrayInputStream headerInputStream = new ByteArrayInputStream(header);
SequenceInputStream sequenceInputStream = new SequenceInputStream(headerInputStream, bodyInputStream);
Crypt4GHInputStream crypt4GHInputStream;
if (!StringUtils.isEmpty(startCoordinate) && !StringUtils.isEmpty(endCoordinate)) {
if (StringUtils.hasLength(startCoordinate) && StringUtils.hasLength(endCoordinate)) {
DataEditList dataEditList = new DataEditList(new long[]{Long.parseLong(startCoordinate), Long.parseLong(endCoordinate)});
crypt4GHInputStream = new Crypt4GHInputStream(sequenceInputStream, dataEditList, privateKey);
} else {
Expand All @@ -109,7 +109,7 @@ private InputStream getPlaintextResponse(byte[] header, InputStream bodyInputStr
private InputStream getEncryptedResponse(byte[] header, InputStream bodyInputStream, PrivateKey privateKey, String startCoordinate, String endCoordinate, String publicKey) throws GeneralSecurityException, IOException {
PublicKey recipientPublicKey = KeyUtils.getInstance().readPublicKey(publicKey);
Header newHeader = Crypt4GHUtils.getInstance().setRecipient(header, privateKey, recipientPublicKey);
if (!StringUtils.isEmpty(startCoordinate) && !StringUtils.isEmpty(endCoordinate)) {
if (StringUtils.hasLength(startCoordinate) && StringUtils.hasLength(endCoordinate)) {
DataEditList dataEditList = new DataEditList(new long[]{Long.parseLong(startCoordinate), Long.parseLong(endCoordinate)});
HeaderPacket dataEditListHeaderPacket = new X25519ChaCha20IETFPoly1305HeaderPacket(dataEditList, privateKey, recipientPublicKey);
newHeader.getHeaderPackets().add(dataEditListHeaderPacket);
Expand Down

0 comments on commit ac3292e

Please sign in to comment.