Skip to content

Commit ad59e53

Browse files
committed
Avoid redundant OID (re-)creation
1 parent 72b813d commit ad59e53

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

pkix/src/main/java/org/bouncycastle/cms/CMSAuthEnvelopedDataStreamGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public OutputStream open(
139139
OutputAEADEncryptor encryptor)
140140
throws CMSException, IOException
141141
{
142-
return doOpen(new ASN1ObjectIdentifier(CMSObjectIdentifiers.data.getId()), out, encryptor);
142+
return doOpen(CMSObjectIdentifiers.data, out, encryptor);
143143
}
144144

145145
private class CMSAuthEnvelopedDataOutputStream

pkix/src/main/java/org/bouncycastle/cms/CMSEnvelopedDataStreamGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public OutputStream open(
152152
OutputEncryptor encryptor)
153153
throws CMSException, IOException
154154
{
155-
return doOpen(new ASN1ObjectIdentifier(CMSObjectIdentifiers.data.getId()), out, encryptor);
155+
return doOpen(CMSObjectIdentifiers.data, out, encryptor);
156156
}
157157

158158
/**

pkix/src/main/jdk1.1/org/bouncycastle/cms/CMSAbsentContent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class CMSAbsentContent
1717

1818
public CMSAbsentContent()
1919
{
20-
this(new ASN1ObjectIdentifier(CMSObjectIdentifiers.data.getId()));
20+
this(CMSObjectIdentifiers.data);
2121
}
2222

2323
public CMSAbsentContent(

pkix/src/main/jdk1.1/org/bouncycastle/cms/CMSProcessableByteArray.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class CMSProcessableByteArray
2121
public CMSProcessableByteArray(
2222
byte[] bytes)
2323
{
24-
this(new ASN1ObjectIdentifier(CMSObjectIdentifiers.data.getId()), bytes);
24+
this(CMSObjectIdentifiers.data, bytes);
2525
}
2626

2727
public CMSProcessableByteArray(

pkix/src/main/jdk1.2/org/bouncycastle/cms/CMSAuthEnvelopedDataStreamGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public OutputStream open(
125125
OutputAEADEncryptor encryptor)
126126
throws CMSException, IOException
127127
{
128-
return doOpen(new ASN1ObjectIdentifier(CMSObjectIdentifiers.data.getId()), out, encryptor);
128+
return doOpen(CMSObjectIdentifiers.data, out, encryptor);
129129
}
130130

131131
private class CMSAuthEnvelopedDataOutputStream

util/src/test/java/org/bouncycastle/asn1/cms/test/OctetStringTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,9 @@ public void testNestedStructure()
156156
ByteArrayOutputStream bOut = new ByteArrayOutputStream();
157157

158158
BERSequenceGenerator sGen = new BERSequenceGenerator(bOut);
159-
160-
sGen.addObject(new ASN1ObjectIdentifier(CMSObjectIdentifiers.compressedData.getId()));
161-
159+
160+
sGen.addObject(CMSObjectIdentifiers.compressedData);
161+
162162
BERSequenceGenerator cGen = new BERSequenceGenerator(sGen.getRawOutputStream(), 0, true);
163163

164164
cGen.addObject(new ASN1Integer(0));

0 commit comments

Comments
 (0)