question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hi,

I ran into an interesting issue. If the jar files are very large the order of the files (ZipEntries) matter. If the classes come first then they can be found in a scan. If the classes come last they will not be found.

Here’s a script and a unit test that shows the issue:

src/test/resources/makeBigJar.sh

#!/usr/bin/env bash

mkdir -p tmp/;
cd tmp;
jar -xf ../record.jar

#ASSET_DIR="zz" # Works
ASSET_DIR="aa" # Doesn't Works

mkdir -p ${ASSET_DIR}
cd ${ASSET_DIR}

for number in {1..23}; do
  echo "Making file ${number}"
  ## make a bunch of big files that won't compress
  dd if=/dev/urandom of="output${number}.bin" bs=1024 count=102400 2> /dev/null
done

cd ..
echo "Building big jar"
jar -cf ../bigjar.jar *

//Copy of the RecordTest Test src/test/java/io/github/classgraph/issues/BigFileTest.java

public class BigFileTest {
    /** The jar URL. */
    private static final URL jarURL = RecordTest.class.getClassLoader().getResource("bigjar.jar");

    /**
     * Test records (JDK 14+).
     *
     * @throws Exception
     *             the exception
     */
    @Test
    public void recordJar() throws Exception {
        try (ScanResult scanResult = new ClassGraph().overrideClassLoaders(new URLClassLoader(new URL[] { jarURL }))
            .enableAllInfo().scan()) {
            final ClassInfoList classInfoList = scanResult.getAllRecords();
            assertThat(classInfoList).isNotEmpty();
            final ClassInfo classInfo = classInfoList.get(0);
            final FieldInfo fieldInfo = classInfo.getFieldInfo("x");
            assertThat(fieldInfo).isNotNull();
        }
    }
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
cwmccanncommented, May 1, 2021

Thanks for the quick turn around on this issue! I can confirm the fix is working on my end as well.

0reactions
lukehutchcommented, May 1, 2021

I try to make bugfixing a top priority always! Thanks for confirming the fix!

Read more comments on GitHub >

github_iconTop Results From Across the Web

8 Common Problems For Large File Transfer | Raysync
8 Common Problems For Large File Transfer · Time limit · Solution: · Lack of visibility · Solution: · Restricted file type ·...
Read more >
Common problems with large file uploads - Filestack Blog
Common problems with large file uploads · Browser limitations: · Server configuration issues: · Memory issues: · Timeout issues:.
Read more >
They all shall pass: a guide to handling large file uploads
1. Low upload speed and latency ... The larger a file, the more bandwidth and time it takes to upload. This rule seems...
Read more >
Top 5 Fixes for File Is Too Large for the Destination File ...
Top 5 Fixes for File Is Too Large for the Destination File System Error on Windows 10 · 1. Format Storage to NTFS...
Read more >
Fix 'File Is Too Large for Destination File System ... - EaseUS
To fix the "File is too large for the destination file system" error, you have to format the destination drive to NTFS for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found