diff --git a/java/packagescanner.go b/java/packagescanner.go index 6cc9a6320..bb7907fc3 100644 --- a/java/packagescanner.go +++ b/java/packagescanner.go @@ -24,7 +24,6 @@ import ( "github.com/quay/claircore" "github.com/quay/claircore/indexer" "github.com/quay/claircore/java/jar" - "github.com/quay/claircore/pkg/tarfs" ) var ( @@ -116,15 +115,9 @@ func (s *Scanner) Scan(ctx context.Context, layer *claircore.Layer) ([]*claircor if err := ctx.Err(); err != nil { return nil, err } - - r, err := layer.Reader() + sys, err := layer.FS() if err != nil { - return nil, err - } - defer r.Close() - sys, err := tarfs.New(r) - if err != nil { - return nil, err + return nil, fmt.Errorf("java: unable to open layer: %w", err) } ars, err := archives(ctx, sys) diff --git a/java/reposcanner.go b/java/reposcanner.go index bfbf64da6..fb5f43ced 100644 --- a/java/reposcanner.go +++ b/java/reposcanner.go @@ -4,16 +4,13 @@ package java import ( "context" - "errors" "fmt" - "io" "runtime/trace" "github.com/quay/zlog" "github.com/quay/claircore" "github.com/quay/claircore/indexer" - "github.com/quay/claircore/pkg/tarfs" ) var ( @@ -53,21 +50,11 @@ func (rs *RepoScanner) Scan(ctx context.Context, layer *claircore.Layer) ([]*cla if err := ctx.Err(); err != nil { return nil, err } - - r, err := layer.Reader() + sys, err := layer.FS() if err != nil { - return nil, err - } - defer r.Close() - ra, ok := r.(io.ReaderAt) - if !ok { - err := errors.New("unable to coerce to io.ReaderAt") - return nil, fmt.Errorf("opening layer failed: %w", err) - } - sys, err := tarfs.New(ra) - if err != nil { - return nil, err + return nil, fmt.Errorf("java: unable to open layer: %w", err) } + ars, err := archives(ctx, sys) if err != nil { return nil, err