public ScriptingEngine newScriptingEngine( ScriptableDelegate child ) { try { return (ScriptingEngine) toScriptable( child ); } catch (Exception e) { HttpUnitUtils.handleException(e); throw new RuntimeException( e.toString() ); } }
public void associate( WebResponse response ) { try { JavaScript.run( response ); } catch (RuntimeException e) { throw e; } catch (Exception e) { HttpUnitUtils.handleException(e); throw new RuntimeException( e.toString() ); } }
WebApplet[] getAppletsInPage() { try { return _response.getApplets(); } catch (SAXException e) { HttpUnitUtils.handleException(e); // should never happen. return null; } }
public void associate( WebResponse response ) { try { JavaScript.run( response ); } catch (RuntimeException e) { throw e; } catch (Exception e) { HttpUnitUtils.handleException(e); throw new RuntimeException( e.toString() ); } }
public ScriptingEngine newScriptingEngine( ScriptableDelegate child ) { try { return (ScriptingEngine) toScriptable( child ); } catch (Exception e) { HttpUnitUtils.handleException(e); throw new RuntimeException( e.toString() ); } }
WebApplet[] getAppletsInPage() { try { return _response.getApplets(); } catch (SAXException e) { HttpUnitUtils.handleException(e); // should never happen. return null; } }
WebApplet[] getAppletsInPage() { try { return _response.getApplets(); } catch (SAXException e) { HttpUnitUtils.handleException(e); // should never happen. return null; } }
public ScriptingEngine newScriptingEngine( ScriptableDelegate child ) { try { return (ScriptingEngine) toScriptable( child ); } catch (Exception e) { HttpUnitUtils.handleException(e); throw new RuntimeException( e.toString() ); } }
public void associate( WebResponse response ) { try { JavaScript.run( response ); } catch (RuntimeException e) { throw e; } catch (Exception e) { HttpUnitUtils.handleException(e); throw new RuntimeException( e.toString() ); } }
/** * handle Exceptions * @param e - the exception to handle * @param badScript - the script that caused the problem */ static public void handleScriptException( Exception e, String badScript ) { final String errorMessage = badScript + " failed: " + e; if (!(e instanceof EcmaError) && !(e instanceof EvaluatorException)) { HttpUnitUtils.handleException(e); throw new RuntimeException( errorMessage ); } else if (JavaScript.isThrowExceptionsOnError()) { HttpUnitUtils.handleException(e); throw new ScriptException( errorMessage ); } else { _errorMessages.add( errorMessage ); } }
/** * handle Exceptions * @param e - the exception to handle * @param badScript - the script that caused the problem */ static public void handleScriptException( Exception e, String badScript ) { final String errorMessage = badScript + " failed: " + e; if (!(e instanceof EcmaError) && !(e instanceof EvaluatorException)) { HttpUnitUtils.handleException(e); throw new RuntimeException( errorMessage ); } else if (JavaScript.isThrowExceptionsOnError()) { HttpUnitUtils.handleException(e); throw new ScriptException( errorMessage ); } else { _errorMessages.add( errorMessage ); } }
/** * handle Exceptions * @param e - the exception to handle * @param badScript - the script that caused the problem */ static public void handleScriptException( Exception e, String badScript ) { final String errorMessage = badScript + " failed: " + e; if (!(e instanceof EcmaError) && !(e instanceof EvaluatorException)) { HttpUnitUtils.handleException(e); throw new RuntimeException( errorMessage ); } else if (JavaScript.isThrowExceptionsOnError()) { HttpUnitUtils.handleException(e); throw new ScriptException( errorMessage ); } else { _errorMessages.add( errorMessage ); } }
public void run() { while (_active) { try { handleNewConnection( getServerSocket().accept() ); Thread.sleep( 20 ); } catch (InterruptedIOException e) { } catch (IOException e) { System.out.println( "Error in pseudo server: " + e ); HttpUnitUtils.handleException(e); } catch (InterruptedException e) { System.out.println( "Interrupted. Shutting down" ); _active = false; } } try { if (_serverSocket != null) ServerSocketFactory.release( _serverSocket ); _serverSocket = null; } catch (IOException e) { } debug( "Pseudoserver shutting down" ); } };
public void run() { while (_active) { try { handleNewConnection( getServerSocket().accept() ); Thread.sleep( 20 ); } catch (InterruptedIOException e) { } catch (IOException e) { System.out.println( "Error in pseudo server: " + e ); HttpUnitUtils.handleException(e); } catch (InterruptedException e) { System.out.println( "Interrupted. Shutting down" ); _active = false; } } try { if (_serverSocket != null) ServerSocketFactory.release( _serverSocket ); _serverSocket = null; } catch (IOException e) { } debug( "Pseudoserver shutting down" ); } };
public void run() { while (_active) { try { handleNewConnection( getServerSocket().accept() ); Thread.sleep( 20 ); } catch (InterruptedIOException e) { } catch (IOException e) { System.out.println( "Error in pseudo server: " + e ); HttpUnitUtils.handleException(e); } catch (InterruptedException e) { System.out.println( "Interrupted. Shutting down" ); _active = false; } } try { if (_serverSocket != null) ServerSocketFactory.release( _serverSocket ); _serverSocket = null; } catch (IOException e) { } debug( "Pseudoserver shutting down" ); } };
void autoLoadServlets() { ArrayList autoLoadable = new ArrayList(); if (_defaultMapping != null && _defaultMapping.getConfiguration().isLoadOnStartup()) autoLoadable.add( _defaultMapping.getConfiguration() ); collectAutoLoadableServlets( autoLoadable, _exactMatches ); collectAutoLoadableServlets( autoLoadable, _extensions ); collectAutoLoadableServlets( autoLoadable, _urlTree ); if (autoLoadable.isEmpty()) return; Collections.sort( autoLoadable, new Comparator() { public int compare( Object o1, Object o2 ) { ServletConfiguration sc1 = (ServletConfiguration) o1; ServletConfiguration sc2 = (ServletConfiguration) o2; return (sc1.getLoadOrder() <= sc2.getLoadOrder()) ? -1 : +1; } }); for (Iterator iterator = autoLoadable.iterator(); iterator.hasNext();) { ServletConfiguration servletConfiguration = (ServletConfiguration) iterator.next(); try { servletConfiguration.getServlet(); } catch (Exception e) { HttpUnitUtils.handleException(e); throw new RuntimeException( "Unable to autoload servlet: " + servletConfiguration.getClassName() + ": " + e ); } } }
void autoLoadServlets() { ArrayList autoLoadable = new ArrayList(); if (_defaultMapping != null && _defaultMapping.getConfiguration().isLoadOnStartup()) autoLoadable.add( _defaultMapping.getConfiguration() ); collectAutoLoadableServlets( autoLoadable, _exactMatches ); collectAutoLoadableServlets( autoLoadable, _extensions ); collectAutoLoadableServlets( autoLoadable, _urlTree ); if (autoLoadable.isEmpty()) return; Collections.sort( autoLoadable, new Comparator() { public int compare( Object o1, Object o2 ) { ServletConfiguration sc1 = (ServletConfiguration) o1; ServletConfiguration sc2 = (ServletConfiguration) o2; return (sc1.getLoadOrder() <= sc2.getLoadOrder()) ? -1 : +1; } }); for (Iterator iterator = autoLoadable.iterator(); iterator.hasNext();) { ServletConfiguration servletConfiguration = (ServletConfiguration) iterator.next(); try { servletConfiguration.getServlet(); } catch (Exception e) { HttpUnitUtils.handleException(e); throw new RuntimeException( "Unable to autoload servlet: " + servletConfiguration.getClassName() + ": " + e ); } } }
void autoLoadServlets() { ArrayList autoLoadable = new ArrayList(); if (_defaultMapping != null && _defaultMapping.getConfiguration().isLoadOnStartup()) autoLoadable.add( _defaultMapping.getConfiguration() ); collectAutoLoadableServlets( autoLoadable, _exactMatches ); collectAutoLoadableServlets( autoLoadable, _extensions ); collectAutoLoadableServlets( autoLoadable, _urlTree ); if (autoLoadable.isEmpty()) return; Collections.sort( autoLoadable, new Comparator() { public int compare( Object o1, Object o2 ) { ServletConfiguration sc1 = (ServletConfiguration) o1; ServletConfiguration sc2 = (ServletConfiguration) o2; return (sc1.getLoadOrder() <= sc2.getLoadOrder()) ? -1 : +1; } }); for (Iterator iterator = autoLoadable.iterator(); iterator.hasNext();) { ServletConfiguration servletConfiguration = (ServletConfiguration) iterator.next(); try { servletConfiguration.getServlet(); } catch (Exception e) { HttpUnitUtils.handleException(e); throw new RuntimeException( "Unable to autoload servlet: " + servletConfiguration.getClassName() + ": " + e ); } } }
/** * get the received Page * @return the received page * @throws SAXException */ HTMLPage getReceivedPage() throws SAXException { if (_page == null) { try { _parsingPage = true; if (!isHTML()) throw new NotHTMLException( getContentType() ); _page = new HTMLPage( this, _frame, _baseURL, _baseTarget, getCharacterSet() ); _page.parse( getText(), _pageURL ); if (_page == null) throw new IllegalStateException( "replaceText called in the middle of getReceivedPage()" ); ((HTMLDocumentImpl) _page.getRootNode()).getWindow().setProxy( this ); } catch (IOException e) { HttpUnitUtils.handleException(e); throw new RuntimeException( e.toString() ); } finally { _parsingPage = false; } } return _page; }
/** * get the received Page * @return the received page * @throws SAXException */ HTMLPage getReceivedPage() throws SAXException { if (_page == null) { try { _parsingPage = true; if (!isHTML()) throw new NotHTMLException( getContentType() ); _page = new HTMLPage( this, _frame, _baseURL, _baseTarget, getCharacterSet() ); _page.parse( getText(), _pageURL ); if (_page == null) throw new IllegalStateException( "replaceText called in the middle of getReceivedPage()" ); ((HTMLDocumentImpl) _page.getRootNode()).getWindow().setProxy( this ); } catch (IOException e) { HttpUnitUtils.handleException(e); throw new RuntimeException( e.toString() ); } finally { _parsingPage = false; } } return _page; }