Skip to content

Commit

Permalink
Refactore PGPSignatureSubpacketVector
Browse files Browse the repository at this point in the history
  • Loading branch information
vanitasvitae committed Oct 17, 2024
1 parent c34c9d3 commit bb731e2
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public boolean hasSubpacket(
public SignatureSubpacket[] getSubpackets(
int type)
{
List list = new ArrayList();
List<SignatureSubpacket> list = new ArrayList<>();

for (int i = 0; i != packets.length; i++)
{
Expand All @@ -126,28 +126,28 @@ public SignatureSubpacket[] getSubpackets(
}
}

return (SignatureSubpacket[])list.toArray(new SignatureSubpacket[]{});
return list.toArray(new SignatureSubpacket[0]);
}

public PGPSignatureList getEmbeddedSignatures()
throws PGPException
{
SignatureSubpacket[] sigs = getSubpackets(SignatureSubpacketTags.EMBEDDED_SIGNATURE);
ArrayList l = new ArrayList();
ArrayList<PGPSignature> l = new ArrayList<>();

for (int i = 0; i < sigs.length; i++)
for (SignatureSubpacket sig : sigs)
{
try
{
l.add(new PGPSignature(SignaturePacket.fromByteArray(sigs[i].getData())));
l.add(new PGPSignature(SignaturePacket.fromByteArray(sig.getData())));
}
catch (IOException e)
{
throw new PGPException("Unable to parse signature packet: " + e.getMessage(), e);
}
}

return new PGPSignatureList((PGPSignature[])l.toArray(new PGPSignature[l.size()]));
return new PGPSignatureList(l.toArray(new PGPSignature[0]));
}

public NotationData[] getNotationDataOccurrences()
Expand Down Expand Up @@ -179,7 +179,7 @@ public NotationData[] getNotationDataOccurences()
public NotationData[] getNotationDataOccurrences(String notationName)
{
NotationData[] notations = getNotationDataOccurrences();
List<NotationData> notationsWithName = new ArrayList<NotationData>();
List<NotationData> notationsWithName = new ArrayList<>();
for (int i = 0; i != notations.length; i++)
{
NotationData notation = notations[i];
Expand All @@ -188,7 +188,7 @@ public NotationData[] getNotationDataOccurrences(String notationName)
notationsWithName.add(notation);
}
}
return (NotationData[])notationsWithName.toArray(new NotationData[0]);
return notationsWithName.toArray(new NotationData[0]);
}

public long getIssuerKeyID()
Expand Down

0 comments on commit bb731e2

Please sign in to comment.