-
Notifications
You must be signed in to change notification settings - Fork 1.3k
NUTCH-3130 Address deprecated API usage across Nutch codebase and build #869
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -101,7 +101,7 @@ private static String normalize(final String str) { | |
| * <li>CoNtEntType gives Content-Type</li> | ||
| * <li>ConTnTtYpe gives Content-Type</li> | ||
| * </ul> | ||
| * If no matching with a well-known metadata name is found, then the original | ||
| * If no well-known metadata name match is found, then the original | ||
| * name is returned. | ||
| * | ||
| * @param name | ||
|
|
@@ -115,7 +115,7 @@ public static String getNormalizedName(final String name) { | |
| if ((value == null) && (normalized != null)) { | ||
| int threshold = Math.min(3, searched.length() / TRESHOLD_DIVIDER); | ||
| for (int i = 0; i < normalized.length && value == null; i++) { | ||
| if (StringUtils.getLevenshteinDistance(searched, normalized[i]) < threshold) { | ||
| if (StringUtils.compareIgnoreCase(searched, normalized[i]) < threshold) { //.getLevenshteinDistance(searched, normalized[i]) < threshold) { | ||
|
Member
Author
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. I still need to investigate whether this is a suitable replacement and also need to remove thie comment.
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.
Changing the behavior in opposite to the name does not seem the right way. If we want to keep the class, we need to use LevenshteinDistance. |
||
| value = NAMES_IDX.get(normalized[i]); | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -88,9 +88,4 @@ public PluginDescriptor getDescriptor() { | |
| private void setDescriptor(PluginDescriptor descriptor) { | ||
| fDescriptor = descriptor; | ||
| } | ||
|
|
||
| @Override | ||
| protected void finalize() throws Throwable { | ||
| shutDown(); | ||
|
Member
Author
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. I'm not sure we can simply remove the call to shutdown. I need to further investigate options and confirm.
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. Same for me. |
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ | |
|
|
||
| import java.lang.invoke.MethodHandles; | ||
| import java.lang.reflect.Array; | ||
| import java.lang.ref.Cleaner; | ||
| import java.lang.reflect.Constructor; | ||
| import java.lang.reflect.InvocationTargetException; | ||
| import java.lang.reflect.Method; | ||
|
|
@@ -70,6 +71,8 @@ public class PluginRepository implements URLStreamHandlerFactory { | |
|
|
||
| protected static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); | ||
|
|
||
| private static final Cleaner CLEANER = Cleaner.create(); | ||
|
|
||
| /** | ||
| * @param conf a populated {@link Configuration} | ||
| * @throws RuntimeException if a fatal runtime error is encountered | ||
|
|
@@ -98,13 +101,22 @@ public PluginRepository(Configuration conf) throws RuntimeException { | |
| try { | ||
| installExtensions(this.fRegisteredPlugins); | ||
| } catch (PluginRuntimeException e) { | ||
| LOG.error("Could not install extensions.", e.toString()); | ||
| LOG.error("Could not install extensions. {}", e.toString()); | ||
|
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. +1 Or: |
||
| throw new RuntimeException(e.getMessage()); | ||
| } | ||
|
|
||
| registerURLStreamHandlerFactory(); | ||
|
|
||
| displayStatus(); | ||
|
|
||
| // Register cleanup action with Cleaner | ||
| CLEANER.register(this, () -> { | ||
| try { | ||
| shutDownActivatedPlugins(); | ||
| } catch (PluginRuntimeException e) { | ||
| LOG.error("Error during cleanup of activated plugins", e); | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -313,19 +325,6 @@ public Plugin getPluginInstance(PluginDescriptor pDescriptor) | |
| } | ||
| } | ||
|
|
||
| /** | ||
| * Attempts to shut down all activated plugins. | ||
| * @deprecated | ||
| * @see <a href="https://openjdk.java.net/jeps/421">JEP 421: Deprecate Finalization for Removal</a> | ||
| * @see java.lang.Object#finalize() | ||
| * @deprecated | ||
| */ | ||
| @Override | ||
| @Deprecated | ||
| public void finalize() throws Throwable { | ||
| shutDownActivatedPlugins(); | ||
| } | ||
|
|
||
| /** | ||
| * Shuts down all plugins | ||
| * | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.