AVRO-4189: [Java] Use ClassUtils.forName() in FastReaderBuilder for consistency#3693
Merged
iemejia merged 1 commit intoapache:mainfrom Mar 31, 2026
Conversation
gszadovszky
reviewed
Mar 30, 2026
Contributor
gszadovszky
left a comment
There was a problem hiding this comment.
Thanks a lot for working on this, @iemejia.
| return Optional.of(data.getClassLoader().loadClass(clazz)); | ||
| } catch (ReflectiveOperationException e) { | ||
| return Optional.of(ClassUtils.forName(data.getClassLoader(), clazz)); | ||
| } catch (ClassNotFoundException | SecurityException e) { |
Contributor
There was a problem hiding this comment.
I'm wondering if it is a good practice here to swallow the SecurityException. It will be hard to analyze why the class loading is not working while the SecurityException contains a comprehensive explanation. WDYT?
Member
Author
There was a problem hiding this comment.
Oh you have a point I somehow did not remember that SecurityException was a RuntimeException. I will fix it.
FastReaderBuilder.findClass() was using data.getClassLoader().loadClass() directly, bypassing ClassUtils.forName() which is used everywhere else in the codebase. This change aligns FastReaderBuilder with the standard class loading path and adds tests for class loading behavior.
87bec1b to
a63fb2e
Compare
gszadovszky
approved these changes
Mar 31, 2026
iemejia
added a commit
to iemejia/avro
that referenced
this pull request
Apr 1, 2026
…onsistency (apache#3693) FastReaderBuilder.findClass() was using data.getClassLoader().loadClass() directly, bypassing ClassUtils.forName() which is used everywhere else in the codebase. This change aligns FastReaderBuilder with the standard class loading path and adds tests for class loading behavior.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I noticed that FastReaderBuilder.findClass() was using data.getClassLoader().loadClass() directly, bypassing ClassUtils.forName() which is used everywhere else in the codebase. This change aligns FastReaderBuilder with the standard class loading path and adds tests for class loading behavior.
What is the purpose of the change
(For example: This pull request improves file read performance by buffering data, fixing AVRO-XXXX.)
Verifying this change
(Please pick one of the following options)
This change is a trivial rework / code cleanup without any test coverage.
(or)
This change is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(example:)
Documentation