mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-16 16:28:48 +10:00
Merge pull request #581 from emeroad/master
fix static analysis warning
This commit is contained in:
-4
@@ -86,10 +86,6 @@ public class JavaAssistByteCodeInstrumentor implements ByteCodeInstrumentor {
|
||||
this.retransformEventTrigger = null;
|
||||
}
|
||||
|
||||
public JavaAssistByteCodeInstrumentor(Agent agent, InterceptorRegistryBinder interceptorRegistryBinder) {
|
||||
this(agent, interceptorRegistryBinder, null, null);
|
||||
}
|
||||
|
||||
public JavaAssistByteCodeInstrumentor(Agent agent, InterceptorRegistryBinder interceptorRegistryBinder, final String bootStrapJar, RetransformEventTrigger retransformEventTrigger) {
|
||||
if (interceptorRegistryBinder == null) {
|
||||
throw new NullPointerException("interceptorRegistryBinder must not be null");
|
||||
|
||||
+22
-12
@@ -71,11 +71,16 @@ public class JarProfilerPluginClassLoader implements ProfilerPluginClassLoader {
|
||||
}
|
||||
|
||||
private final URL pluginJarURL;
|
||||
private final String pluginJarURLExternalForm;
|
||||
private final JarFile pluginJar;
|
||||
|
||||
|
||||
private JarProfilerPluginClassLoader(URL pluginJarURL, JarFile pluginJar) {
|
||||
if (pluginJarURL == null) {
|
||||
throw new NullPointerException("pluginJarURL must not be null");
|
||||
}
|
||||
this.pluginJarURL = pluginJarURL;
|
||||
this.pluginJarURLExternalForm = pluginJarURL.toExternalForm();
|
||||
this.pluginJar = pluginJar;
|
||||
}
|
||||
|
||||
@@ -97,18 +102,23 @@ public class JarProfilerPluginClassLoader implements ProfilerPluginClassLoader {
|
||||
}
|
||||
|
||||
private Class<?> loadFromURLClassLoader(URLClassLoader classLoader, String className) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, ClassNotFoundException {
|
||||
URL[] urls = classLoader.getURLs();
|
||||
|
||||
boolean hasPluginJar = false;
|
||||
for (URL url : urls) {
|
||||
if (url.equals(pluginJarURL)) {
|
||||
hasPluginJar = true;
|
||||
break;
|
||||
final URL[] urls = classLoader.getURLs();
|
||||
if (urls != null) {
|
||||
|
||||
boolean hasPluginJar = false;
|
||||
for (URL url : urls) {
|
||||
// if (url.equals(pluginJarURL)) { fix very slow
|
||||
// http://michaelscharf.blogspot.com/2006/11/javaneturlequals-and-hashcode-make.html
|
||||
final String externalForm = url.toExternalForm();
|
||||
if (pluginJarURLExternalForm.equals(externalForm)) {
|
||||
hasPluginJar = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasPluginJar) {
|
||||
ADD_URL.invoke(classLoader, pluginJarURL);
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasPluginJar) {
|
||||
ADD_URL.invoke(classLoader, pluginJarURL);
|
||||
}
|
||||
|
||||
return classLoader.loadClass(className);
|
||||
@@ -128,7 +138,7 @@ public class JarProfilerPluginClassLoader implements ProfilerPluginClassLoader {
|
||||
|
||||
try {
|
||||
c = classLoader.loadClass(className);
|
||||
} catch (ClassNotFoundException e) {
|
||||
} catch (ClassNotFoundException ignore) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
+7
-4
@@ -17,6 +17,7 @@
|
||||
package com.navercorp.pinpoint.profiler.sender;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.DatagramSocket;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.DatagramChannel;
|
||||
@@ -103,12 +104,13 @@ public class SpanStreamUdpSender extends AbstractDataSender {
|
||||
|
||||
private DatagramChannel createChannel(String host, int port, int timeout, int sendBufferSize) {
|
||||
try {
|
||||
DatagramChannel datagramChannel = DatagramChannel.open();
|
||||
datagramChannel.socket().setSoTimeout(timeout);
|
||||
datagramChannel.socket().setSendBufferSize(sendBufferSize);
|
||||
final DatagramChannel datagramChannel = DatagramChannel.open();
|
||||
final DatagramSocket socket = datagramChannel.socket();
|
||||
socket.setSoTimeout(timeout);
|
||||
socket.setSendBufferSize(sendBufferSize);
|
||||
|
||||
if (logger.isWarnEnabled()) {
|
||||
final int checkSendBufferSize = datagramChannel.socket().getSendBufferSize();
|
||||
final int checkSendBufferSize = socket.getSendBufferSize();
|
||||
if (sendBufferSize != checkSendBufferSize) {
|
||||
logger.warn("DatagramChannel.setSendBufferSize() error. {}!={}", sendBufferSize, checkSendBufferSize);
|
||||
}
|
||||
@@ -267,6 +269,7 @@ public class SpanStreamUdpSender extends AbstractDataSender {
|
||||
if (remainingLength != sentBufferSize) {
|
||||
logger.warn("sent buffer {}/{}.", sentBufferSize, remainingLength);
|
||||
} else {
|
||||
// TODO need check ????
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public final class ListUtils {
|
||||
public static <V> V get(List<V> list, int index, V defaultValue) {
|
||||
try {
|
||||
return list.get(index);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception ignore) {
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
|
||||
@@ -40,7 +40,7 @@ public class StreamRedirector implements Runnable {
|
||||
while ((read = in.read(buffer)) > 0) {
|
||||
out.write(buffer, 0, read);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
} catch (IOException ignore) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user