File tree Expand file tree Collapse file tree
msgpack-core/src/main/java/org/msgpack/core/buffer Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,23 +59,26 @@ enum DirectBufferConstructorType {
5959
6060 boolean hasUnsafe = false ;
6161 try {
62- Class .forName ("sun.misc.Unsafe" );
63- hasUnsafe = true ;
62+ hasUnsafe = Class .forName ("sun.misc.Unsafe" ) != null ;
6463 }
65- catch (ClassNotFoundException e ) {
64+ catch (Exception e ) {
6665 }
6766
6867 // Detect android VM
6968 boolean isAndroid = System .getProperty ("java.runtime.name" , "" ).toLowerCase ().contains ("android" );
7069
70+ // Is Google App Engine?
71+ boolean isGAE = System .getProperty ("com.google.appengine.runtime.version" ) != null ;
72+
7173 // For Java6, android and JVM that has no Unsafe class, use Universal MessageBuffer
7274 boolean useUniversalBuffer =
7375 Boolean .parseBoolean (System .getProperty ("msgpack.universal-buffer" , "false" ))
7476 || isAndroid
77+ || isGAE
7578 || !isJavaAtLeast7
7679 || !hasUnsafe ;
7780
78- // We need to use reflection to find MessageBuffer implementation classes because
81+ // We need to use reflection to find MessageBuffer implementation classes abecause
7982 // importing these classes creates TypeProfile and adds some overhead to method calls.
8083 String bufferClsName ;
8184 if (useUniversalBuffer ) {
You can’t perform that action at this time.
0 commit comments