package shade.memcached

import java.io.{InputStream, ObjectInputStream, ObjectStreamClass}
import scala.reflect.ClassTag
import scala.util.control.NonFatal

/**
 * Object input stream which tries the thread local class loader.
 *
 * Thread Local class loader is used by SBT to avoid polluting system class loader when
 * running different tasks.
 *
 * This allows deserialization of classes from sub-projects during something like
 * Play's test/run modes.
 */
class GenericCodecObjectInputStream(classTag: ClassTag[_], in: InputStream)
  extends ObjectInputStream(in) {

  private def classTagClassLoader =
    classTag.runtimeClass.getClassLoader
  private def threadLocalClassLoader =
    Thread.currentThread().getContextClassLoader

  override protected def resolveClass(desc: ObjectStreamClass): Class[_] = {
    try classTagClassLoader.loadClass(desc.getName) catch {
      case NonFatal(_) =>
        try super.resolveClass(desc) catch {
          case NonFatal(_) =>
            threadLocalClassLoader.loadClass(desc.getName)
        }
    }
  }
}

package shade.memcached

import java.io.{ObjectStreamClass, InputStream, ObjectInputStream}

import scala.reflect.ClassTag
import scala.util.Try

/**
 * Object input stream which tries the thread local class loader.
 *
 * Thread Local class loader is used by SBT to avoid polluting system class loader when
 * running different tasks.
 *
 * This allows deserialisation of classes from subprojects during something like
 * Play's test/run modes.
 */
class GenericCodecObjectInputStream(classTag: ClassTag[_], in: InputStream) extends ObjectInputStream(in) {

  private def classTagClassLoader = classTag.runtimeClass.getClassLoader
  private def threadLocalClassLoader = Thread.currentThread().getContextClassLoader

  override protected def resolveClass(desc: ObjectStreamClass): Class[_] = {
    Try(classTagClassLoader.loadClass(desc.getName)).
      orElse(Try(super.resolveClass(desc))).
      getOrElse(threadLocalClassLoader.loadClass(desc.getName))
  }
}

--- 
+++ 
@@ -1,9 +1,8 @@
 package shade.memcached
 
-import java.io.{ObjectStreamClass, InputStream, ObjectInputStream}
-
+import java.io.{InputStream, ObjectInputStream, ObjectStreamClass}
 import scala.reflect.ClassTag
-import scala.util.Try
+import scala.util.control.NonFatal
 
 /**
  * Object input stream which tries the thread local class loader.
@@ -11,17 +10,24 @@
  * Thread Local class loader is used by SBT to avoid polluting system class loader when
  * running different tasks.
  *
- * This allows deserialisation of classes from subprojects during something like
+ * This allows deserialization of classes from sub-projects during something like
  * Play's test/run modes.
  */
-class GenericCodecObjectInputStream(classTag: ClassTag[_], in: InputStream) extends ObjectInputStream(in) {
+class GenericCodecObjectInputStream(classTag: ClassTag[_], in: InputStream)
+  extends ObjectInputStream(in) {
 
-  private def classTagClassLoader = classTag.runtimeClass.getClassLoader
-  private def threadLocalClassLoader = Thread.currentThread().getContextClassLoader
+  private def classTagClassLoader =
+    classTag.runtimeClass.getClassLoader
+  private def threadLocalClassLoader =
+    Thread.currentThread().getContextClassLoader
 
   override protected def resolveClass(desc: ObjectStreamClass): Class[_] = {
-    Try(classTagClassLoader.loadClass(desc.getName)).
-      orElse(Try(super.resolveClass(desc))).
-      getOrElse(threadLocalClassLoader.loadClass(desc.getName))
+    try classTagClassLoader.loadClass(desc.getName) catch {
+      case NonFatal(_) =>
+        try super.resolveClass(desc) catch {
+          case NonFatal(_) =>
+            threadLocalClassLoader.loadClass(desc.getName)
+        }
+    }
   }
 }
Replace Try with regular try/catch
