@@ -251,10 +251,10 @@ protected void processICCBasedColorSpace(PDColorSpace colorSpace)
251
251
// PDFBOX-2819: load ICC profile as a stream, not as a byte array because of java error
252
252
iccp = ICC_Profile .getInstance (is );
253
253
}
254
- PDColorSpace altpdcs = iccBased .getAlternateColorSpace ();
255
- if (altpdcs != null )
254
+ PDColorSpace alternateColorSpace = iccBased .getAlternateColorSpace ();
255
+ if (alternateColorSpace != null )
256
256
{
257
- ColorSpaces altCsId = ColorSpaces .valueOf (altpdcs .getName ());
257
+ ColorSpaces altCsId = ColorSpaces .valueOf (alternateColorSpace .getName ());
258
258
if (altCsId == ColorSpaces .Pattern )
259
259
{
260
260
context .addValidationError (new ValidationError (
@@ -280,7 +280,7 @@ protected void processICCBasedColorSpace(PDColorSpace colorSpace)
280
280
{
281
281
return ;
282
282
}
283
- validateICCProfileAlternateEntry (iccBased );
283
+ validateICCProfileAlternateEntry (iccBased , alternateColorSpace );
284
284
}
285
285
}
286
286
catch (IllegalArgumentException | ArrayIndexOutOfBoundsException e )
@@ -543,16 +543,16 @@ private boolean validateICCProfileNEntry(COSStream stream, ICC_Profile iccp)
543
543
return true ;
544
544
}
545
545
546
- private void validateICCProfileAlternateEntry (PDICCBased iccBased ) throws IOException
546
+ private void validateICCProfileAlternateEntry (
547
+ PDICCBased iccBased , PDColorSpace alternateColorSpace ) throws IOException
547
548
{
548
- PDColorSpace altCS = iccBased .getAlternateColorSpace ();
549
- if (altCS != null && altCS .getNumberOfComponents () != iccBased .getNumberOfComponents ())
549
+ if (alternateColorSpace .getNumberOfComponents () != iccBased .getNumberOfComponents ())
550
550
{
551
551
// https://github.com/veraPDF/veraPDF-library/issues/773
552
552
context .addValidationError (new ValidationError (ERROR_GRAPHIC_OUTPUT_INTENT_INVALID_ENTRY ,
553
553
"/N entry of ICC profile is different (" + iccBased .getNumberOfComponents ()
554
554
+ ") than alternate entry colorspace component count ("
555
- + altCS .getNumberOfComponents () + ")" ));
555
+ + alternateColorSpace .getNumberOfComponents () + ")" ));
556
556
}
557
557
}
558
558
}
0 commit comments