Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 3 package org.jgroups; 4 5 import java.io.PrintStream ; 6 import java.io.PrintWriter ; 7 8 import java.util.StringTokenizer ; 9 10 14 public class ChannelException extends Exception { 15 private static final boolean IS_JAVA_13; 17 18 static { 19 String javaSpecVersion= 22 System.getProperty("java.specification.version"); 23 24 StringTokenizer tokenizer=new StringTokenizer (javaSpecVersion, "."); 25 26 int majorVersion=Integer.parseInt(tokenizer.nextToken()); 27 int minorVersion=Integer.parseInt(tokenizer.nextToken()); 28 29 if(majorVersion == 1 && minorVersion == 3) { 30 IS_JAVA_13=true; 31 } 32 else { 33 IS_JAVA_13=false; 34 } 35 } 36 37 private Throwable _cause; 39 40 public ChannelException() { 41 super(); 42 } 43 44 public ChannelException(String reason) { 45 super(reason); 46 } 47 48 public ChannelException(String reason, Throwable cause) { 49 super(reason); 50 _cause = cause; 51 } 52 53 public String toString() { 54 return "ChannelException: " + getMessage(); 55 } 56 57 67 public Throwable getCause() { 68 return _cause; 69 } 70 71 74 75 82 public void printStackTrace() { 83 printStackTrace(System.err); 84 } 85 86 95 public void printStackTrace(PrintStream ps) { 96 synchronized (ps) { 97 super.printStackTrace(ps); 98 99 if (IS_JAVA_13) { 100 printCauseStackTrace(ps); 101 } 102 } 103 } 104 105 114 public void printStackTrace(PrintWriter pw) { 115 synchronized (pw) { 116 super.printStackTrace(pw); 117 118 if (IS_JAVA_13) { 119 printCauseStackTrace(pw); 120 } 121 } 122 } 123 124 private void printCauseStackTrace(PrintStream ps) { 125 if (_cause != null) { 126 ps.print("Caused by: "); 127 _cause.printStackTrace(ps); 128 } 129 } 130 131 private void printCauseStackTrace(PrintWriter pw) { 132 if (_cause != null) { 133 pw.print("Caused by: "); 134 _cause.printStackTrace(pw); 135 } 136 } 137 } 138
| Popular Tags
|