Skip to content

Commit

Permalink
jar: skip corrupt jar file
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Frost <[email protected]>
  • Loading branch information
frostmar authored and crozzy committed Aug 30, 2023
1 parent 9ed6e65 commit c494b27
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions java/packagescanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ func (s *Scanner) Scan(ctx context.Context, layer *claircore.Layer) ([]*claircor
infos, err := jar.Parse(ctx, n, z)
switch {
case err == nil:
case errors.Is(err, jar.ErrUnidentified) || errors.Is(err, jar.ErrNotAJar):
// If there's an error that's one of the "known" reasons (e.g. not a
// read error or a malformed file), just log it and continue on.
case errors.Is(err, jar.ErrUnidentified) || errors.Is(err, jar.ErrNotAJar) || errors.Is(err, zip.ErrFormat):
// If there's an error that's one of the "known" reasons (e.g. not a read error),
// just log it and continue on.
zlog.Info(ctx).
AnErr("reason", err).
Msg("skipping jar")
Expand Down

0 comments on commit c494b27

Please sign in to comment.