Skip to content

Commit

Permalink
pinpoint-apm#1276 Tighten up checks in Thrift interceptors
Browse files Browse the repository at this point in the history
  • Loading branch information
Xylus committed Dec 1, 2015
1 parent 5ee7367 commit 05470ee
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,11 @@ public void after(Object target, Object[] args, Object result, Throwable throwab
logger.afterInterceptor(target, args, result, throwable);
}
// Unset server marker
Object iprot = args[1];
if (validateInputProtocol(iprot)) {
((ServerMarkerFlagFieldAccessor)iprot)._$PINPOINT$_setServerMarkerFlag(false);
if (args.length != 4) {
Object iprot = args[1];
if (validateInputProtocol(iprot)) {
((ServerMarkerFlagFieldAccessor) iprot)._$PINPOINT$_setServerMarkerFlag(false);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,15 @@ protected boolean validate(Object target, Object[] args, Object result) {

// Retrieve the socket information from the trans_ field of the given instance.
protected final Socket getRootSocket(Object target) {
TNonblockingTransport inTrans = ((TNonblockingTransportFieldGetter)target)._$PINPOINT$_getTNonblockingTransport();
if (inTrans != null) {
if (inTrans instanceof SocketFieldAccessor) {
return ((SocketFieldAccessor)inTrans)._$PINPOINT$_getSocket();
} else {
if (isDebug) {
logger.debug("Invalid target object. Need field accessor({}).", SocketFieldAccessor.class.getName());
if (target instanceof TNonblockingTransportFieldGetter) {
TNonblockingTransport inTrans = ((TNonblockingTransportFieldGetter) target)._$PINPOINT$_getTNonblockingTransport();
if (inTrans != null) {
if (inTrans instanceof SocketFieldAccessor) {
return ((SocketFieldAccessor) inTrans)._$PINPOINT$_getSocket();
} else {
if (isDebug) {
logger.debug("Invalid target object. Need field accessor({}).", SocketFieldAccessor.class.getName());
}
}
}
}
Expand Down

0 comments on commit 05470ee

Please sign in to comment.