Removed recursive call
@@ -39,19 +39,20 @@ static TrustPacket readOptionalTrustPacket(
BCPGInputStream pIn)
throws IOException
{
- if (pIn.nextPacketTag() == PacketTags.TRUST)
- {
- return (TrustPacket)pIn.readPacket();
- }
- else if (pIn.nextPacketTag() == PacketTags.MARKER)
+ int tag = pIn.nextPacketTag();
+ while (tag == PacketTags.MARKER)
{
pIn.readPacket();
- return readOptionalTrustPacket(pIn);
+ tag = pIn.nextPacketTag();
}
- else
+
+ if (tag == PacketTags.TRUST)
{
- return null;
+ return (TrustPacket)pIn.readPacket();
}
+
+ return null;
+
}
static List readSignaturesAndTrust(
@@ -66,10 +67,12 @@ static List readSignaturesAndTrust(
|| pIn.nextPacketTag() == PacketTags.MARKER)
{
Packet packet = pIn.readPacket();
- if (packet instanceof MarkerPacket) {
+ if (packet instanceof MarkerPacket)
+ {
continue;
}
- if (packet instanceof SignaturePacket) {
+ if (packet instanceof SignaturePacket)
+ {
SignaturePacket signaturePacket = (SignaturePacket)packet;
TrustPacket trustPacket = readOptionalTrustPacket(pIn);
@@ -98,7 +101,8 @@ static void readUserIDs(
|| pIn.nextPacketTag() == PacketTags.MARKER)
{
Packet obj = pIn.readPacket();
- if (obj instanceof MarkerPacket) {
+ if (obj instanceof MarkerPacket)
+ {
continue;
}
