-
Notifications
You must be signed in to change notification settings - Fork 9.2k
HADOOP-19259. Upgrade to jackson 2.14.3 #7428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
steveloughran
merged 9 commits into
apache:trunk
from
pjfanning:HADOOP-19249-jackson2.14
Apr 16, 2025
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e411480
HADOOP-19259. Upgrade to jackson 2.14.3
pjfanning cacc90f
simplify exception catch
pjfanning f5c5bb6
refactor test code
pjfanning 9a9a8fb
remove exclusion
pjfanning fdb2ac5
Update LICENSE-binary
pjfanning 90ef640
remove jaxb-api - clashes with jakarta variant (v2)
pjfanning 28cf336
add tests for NetUtils
pjfanning 483bdfa
Update TestNetUtils.java
pjfanning 3e5714a
line length issues
pjfanning File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,7 +21,6 @@ | |
| import java.io.IOException; | ||
| import java.io.InputStream; | ||
| import java.io.OutputStream; | ||
| import java.lang.reflect.Constructor; | ||
| import java.net.BindException; | ||
| import java.net.InetAddress; | ||
| import java.net.InetSocketAddress; | ||
|
|
@@ -46,10 +45,6 @@ | |
|
|
||
| import javax.net.SocketFactory; | ||
|
|
||
| import org.apache.hadoop.security.AccessControlException; | ||
| import org.apache.hadoop.thirdparty.com.google.common.cache.Cache; | ||
| import org.apache.hadoop.thirdparty.com.google.common.cache.CacheBuilder; | ||
|
|
||
| import org.apache.commons.net.util.SubnetUtils; | ||
| import org.apache.commons.net.util.SubnetUtils.SubnetInfo; | ||
| import org.apache.hadoop.classification.InterfaceAudience; | ||
|
|
@@ -58,9 +53,13 @@ | |
| import org.apache.hadoop.fs.CommonConfigurationKeysPublic; | ||
| import org.apache.hadoop.ipc.Server; | ||
| import org.apache.hadoop.ipc.VersionedProtocol; | ||
| import org.apache.hadoop.security.AccessControlException; | ||
| import org.apache.hadoop.security.SecurityUtil; | ||
| import org.apache.hadoop.thirdparty.com.google.common.cache.Cache; | ||
| import org.apache.hadoop.thirdparty.com.google.common.cache.CacheBuilder; | ||
| import org.apache.hadoop.util.ReflectionUtils; | ||
| import org.apache.hadoop.util.Preconditions; | ||
| import org.apache.hadoop.util.dynamic.DynConstructors; | ||
|
|
||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|
|
@@ -941,10 +940,59 @@ public static IOException wrapException(final String destHost, | |
|
|
||
| } | ||
| } catch (IOException ex) { | ||
| return (IOException) new IOException("Failed on local exception: " | ||
| + exception + "; Host Details : " | ||
| + getHostDetailsAsString(destHost, destPort, localHost)) | ||
| .initCause(exception); | ||
| try { | ||
| return new IOException("Failed on local exception: " | ||
| + exception + "; Host Details : " | ||
| + getHostDetailsAsString(destHost, destPort, localHost), exception); | ||
| } catch (Exception ignore) { | ||
| // in worst case, return the original exception | ||
| return exception; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Return an @{@link IOException} of the same type as the input exception but with | ||
| * a modified exception message that includes the node name. | ||
| * | ||
| * @param ioe existing exception. | ||
| * @param nodeName name of the node. | ||
| * @return IOException | ||
| */ | ||
| public static IOException addNodeNameToIOException(final IOException ioe, final String nodeName) { | ||
| try { | ||
| final Throwable cause = ioe.getCause(); | ||
| IOException newIoe = null; | ||
| if (cause != null) { | ||
| try { | ||
| DynConstructors.Ctor<? extends IOException> ctor = | ||
| new DynConstructors.Builder() | ||
| .impl(ioe.getClass(), String.class, Throwable.class) | ||
| .buildChecked(); | ||
| newIoe = ctor.newInstance(nodeName + ": " + ioe.getMessage(), cause); | ||
| } catch (NoSuchMethodException e) { | ||
| // no matching constructor - try next approach below | ||
| } | ||
| } | ||
| if (newIoe == null) { | ||
| DynConstructors.Ctor<? extends IOException> ctor = | ||
| new DynConstructors.Builder() | ||
| .impl(ioe.getClass(), String.class) | ||
| .buildChecked(); | ||
| newIoe = ctor.newInstance(nodeName + ": " + ioe.getMessage()); | ||
| if (cause != null) { | ||
| try { | ||
| newIoe.initCause(cause); | ||
| } catch (Exception e) { | ||
| // Unable to initCause. Ignore the exception. | ||
| } | ||
| } | ||
| } | ||
| newIoe.setStackTrace(ioe.getStackTrace()); | ||
| return newIoe; | ||
| } catch (Exception e) { | ||
| // Unable to create new exception. Return the original exception. | ||
| return ioe; | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -957,9 +1005,22 @@ private static <T extends IOException> T wrapWithMessage( | |
| T exception, String msg) throws T { | ||
| Class<? extends Throwable> clazz = exception.getClass(); | ||
| try { | ||
| Constructor<? extends Throwable> ctor = clazz.getConstructor(String.class); | ||
| Throwable t = ctor.newInstance(msg); | ||
| return (T)(t.initCause(exception)); | ||
| try { | ||
| DynConstructors.Ctor<T> ctor = | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice to see this stuff being used. Lifted from parquet, also in iceberg, so I'd suspect Ryan Blue as the author |
||
| new DynConstructors.Builder() | ||
| .impl(clazz, String.class, Throwable.class) | ||
| .buildChecked(); | ||
| return ctor.newInstance(msg, exception); | ||
| } catch (NoSuchMethodException e) { | ||
| // no matching constructor - try next approach below | ||
| } | ||
| DynConstructors.Ctor<T> ctor = | ||
| new DynConstructors.Builder() | ||
| .impl(clazz, String.class) | ||
| .buildChecked(); | ||
| T newException = ctor.newInstance(msg); | ||
| newException.initCause(exception); | ||
| return newException; | ||
| } catch (NoSuchMethodException e) { | ||
| return exception; | ||
| } catch (Throwable e) { | ||
|
|
@@ -1114,7 +1175,7 @@ public static Set<Integer> getFreeSocketPorts(int numOfPorts) { | |
|
|
||
| /** | ||
| * Return an @{@link InetAddress} to bind to. If bindWildCardAddress is true | ||
| * than returns null. | ||
| * then returns null. | ||
| * | ||
| * @param localAddr local addr. | ||
| * @param bindWildCardAddress bind wildcard address. | ||
|
|
||
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dependency was removed during the move to jersey v2 - we now have rs-api dependency instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, JavaEE/JakartaEE API dependencies are a mess...