Examples of NSForwardException


Examples of com.webobjects.foundation.NSForwardException

            if(node.getNodeType() == Node.ELEMENT_NODE) {
                parseNode(node);
            }
        }
      } catch(Exception ex) {
          throw new NSForwardException(ex);
      }
    }
View Full Code Here

Examples of com.webobjects.foundation.NSForwardException

            }
            byte[] bytes;
            try {
                bytes = contentString.getBytes(CharEncoding.UTF_8);
            } catch (UnsupportedEncodingException e) {
                throw new NSForwardException(e, "Can't convert string to UTF-8...you should get a better VM");
            }
            InputStream stream = new ByteArrayInputStream(bytes);

            EGSimpleTableParser parser = new EGSimpleTableParser(stream, fonts(), styles());
            try {
              NSData data = parser.data();
              if((hasBinding("data") && canSetValueForBinding("data")) ||
                 (hasBinding("stream") && canSetValueForBinding("stream"))
                 ) {
                  if(hasBinding("data")) {
                      setValueForBinding(data, "data");
                  }
                  if(hasBinding("stream")) {
                      setValueForBinding(data.stream(), "stream");
                  }
                  response.appendContentString(contentString);
              } else {
                  String fileName = fileName();
                  if(fileName == null) {
                      fileName = "results.xls";
                  }
                 
                  response.disableClientCaching();
                  response.appendHeader(String.valueOf( data.length()), "Content-Length" );
                  response.setContent(data); // Changed by ishimoto because it was sooooo buggy and didn't work in Japanese
 
                  response.setHeader("inline; filename=\"" + fileName + "\"", "content-disposition");
                  response.setHeader("application/vnd.ms-excel", "content-type");
              }
        } catch (Exception ex) {
          if (ex.getCause() instanceof SAXParseException) {
            SAXParseException parseException = (SAXParseException)ex.getCause();
            String logMessage = "'"+context().page().getClass().getName()+"' caused a SAXParseException";
            logMessage += "\nMessage: '"+parseException.getMessage()+"'";
            // weird but true, getLineNumber is off by 1 (for display purposes I think - mhast)
            logMessage += "\nLine   : "+(parseException.getLineNumber() - 1);
            logMessage += "\nColumn : "+parseException.getColumnNumber();
            logMessage += "\n--- content begin ---";
            logMessage += addLineNumbers(contentString);
            logMessage += "--- content end ---";
            log.error(logMessage);
            throw new NSForwardException(ex);
          }
          // else don't handle exception just pass it forward
          else {
            throw new NSForwardException(ex);
          }
        }
        } else {
            super.appendToResponse(response, context);
        }
View Full Code Here

Examples of com.webobjects.foundation.NSForwardException

        ERXJDBCConnectionBroker broker = null;
        try {
            broker = new ERXJDBCConnectionBroker(dict);
        } catch(Exception ex) {
            log.error("Error while creating broker: " + broker, ex);
            throw new NSForwardException(ex, "Error while creating broker: " + broker);
        }
        return broker;
    }
View Full Code Here

Examples of com.webobjects.foundation.NSForwardException

                    // Add a new connections to the pool
                    if (activeConnections < maximumConnections) {
                        try {
                            createWrapper();
                        } catch (SQLException e) {
                            throw new NSForwardException(e, "Error: Unable to create new connection");
                        }
                    }
                }

                try {
View Full Code Here

Examples of com.webobjects.foundation.NSForwardException

                }
                if(getConnection().getAutoCommit()) {
                  getConnection().setAutoCommit(false);
                }
            } catch (SQLException e) {
                throw new NSForwardException(e, "Could not set read only to false for connection: "+ this);
            } finally {
                setStatus(BUSY);
            }
        }
View Full Code Here

Examples of com.webobjects.foundation.NSForwardException

                    log.error("Could not ping connection " + c + ", reason: " + e.getMessage(), e);
                } finally {
                    try {
                        c.rollback();
                    } catch (SQLException e1) {
                        throw new NSForwardException(e1, "could not rollback connection!");
                    }
                }
                setStatus(FREE);
            }
        }
View Full Code Here

Examples of com.webobjects.foundation.NSForwardException

            sqlHelper = (ERXSQLHelper) Class.forName(sqlHelperClassName).newInstance();
          }
          _sqlHelperMap.put(databaseProductName, sqlHelper);
        }
        catch (Exception e) {
          throw new NSForwardException(e, "Failed to create sql helper for the database with the product name '" + databaseProductName + "'.");
        }
      }
      return sqlHelper;
    }
  }
View Full Code Here

Examples of com.webobjects.foundation.NSForwardException

        protected int doPerform(EOAdaptorChannel channel) {
          try {
            ERXJDBCUtilities.executeUpdate(channel, "SET TRANSACTION ISOLATION LEVEL SERIALIZABLE, LOCKING PESSIMISTIC");
          }
          catch (SQLException e) {
            throw new NSForwardException(e);
          }
          return 0;
        }
      };
      action.perform(ec, model.name());
View Full Code Here

Examples of com.webobjects.foundation.NSForwardException

        protected int doPerform(EOAdaptorChannel channel) {
          try {
            ERXJDBCUtilities.executeUpdate(channel, sql);
          }
          catch (SQLException e) {
            throw new NSForwardException(e);
          }
          return 0;
        }
      };
      action.perform(ec, model.name());
View Full Code Here

Examples of com.webobjects.foundation.NSForwardException

      if (isUsingWebServer()) {
        // Check our host name keys in our preferred order instead of Apple WO 5.4.3 default header check logic.
        serverName = remoteHostName();

        if ((serverName == null) || (serverName.length() == 0) || serverName.equals(UNKNOWN_HOST))
          throw new NSForwardException(new WOURLFormatException("<" + super.getClass().getName() + ">: Unable to build complete url as no server name was provided in the headers of the request."));
      }
      else {
        serverName = WOApplication.application().host();
      }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.