1 2 24 25 26 27 28 29 package com.lutris.appserver.server.httpPresentation; 30 import java.io.IOException ; 31 32 import com.lutris.util.ChainedException; 33 34 35 41 public class HttpPresentationIOException extends IOException { 42 51 public static IOException rethrow(IOException except) 52 throws IOException { 53 if (except instanceof HttpPresentationIOException) { 54 return except; 55 } else { 56 return new HttpPresentationIOException(except); 57 } 58 } 59 60 61 65 private boolean trueIOException = false; 66 67 72 public HttpPresentationIOException(IOException except) { 73 super(except.getMessage()); 74 trueIOException = true; 75 } 76 77 82 public HttpPresentationIOException(String msg) { 83 super(msg); 84 } 85 86 91 public boolean isTrueIOException() { 92 return trueIOException; 93 } 94 95 104 public static boolean isClientIOException(Throwable except) { 105 Throwable scan = except; 106 while (scan != null) { 107 if ((scan instanceof HttpPresentationIOException) 108 && ((HttpPresentationIOException)scan).isTrueIOException()) { 109 return true; 110 } 111 if (scan instanceof ChainedException) { 112 scan = ((ChainedException)scan).getCause(); 113 } else { 114 return false; 115 } 116 } 117 return false; 118 } 119 120 } 121 | Popular Tags |