List of usage examples for org.apache.commons.lang SystemUtils LINE_SEPARATOR
String LINE_SEPARATOR
To view the source code for org.apache.commons.lang SystemUtils LINE_SEPARATOR.
Click Source Link
The line.separator
System Property.
From source file:nl.nn.adapterframework.pipes.MessageSendingPipe.java
public PipeRunResult doPipe(Object input, IPipeLineSession session) throws PipeRunException { String originalMessage = input.toString(); String result = null;/*from ww w. ja va2s . c om*/ String correlationID = session.getMessageId(); if (getInputWrapper() != null) { log.debug(getLogPrefix(session) + "wrapping input"); PipeRunResult wrapResult = pipeProcessor.processPipe(getPipeLine(), inputWrapper, correlationID, input, session); if (wrapResult != null && !wrapResult.getPipeForward().getName().equals("success")) { return wrapResult; } else { input = wrapResult.getResult(); } log.debug(getLogPrefix(session) + "input after wrapping [" + input.toString() + "]"); } if (getInputValidator() != null) { log.debug(getLogPrefix(session) + "validating input"); PipeRunResult validationResult = pipeProcessor.processPipe(getPipeLine(), inputValidator, correlationID, input, session); if (validationResult != null && !validationResult.getPipeForward().getName().equals("success")) { return validationResult; } } if (StringUtils.isNotEmpty(getStubFileName())) { ParameterList pl = getParameterList(); result = returnString; if (pl != null) { ParameterResolutionContext prc = new ParameterResolutionContext((String) input, session); Map params; try { params = prc.getValueMap(pl); } catch (ParameterException e1) { throw new PipeRunException(this, getLogPrefix(session) + "got exception evaluating parameters", e1); } String sfn = null; if (params != null && params.size() > 0) { sfn = (String) params.get(STUBFILENAME); } if (sfn != null) { try { result = Misc.resourceToString(ClassUtils.getResourceURL(classLoader, sfn), SystemUtils.LINE_SEPARATOR); log.info(getLogPrefix(session) + "returning result from dynamic stub [" + sfn + "]"); } catch (Throwable e) { throw new PipeRunException(this, getLogPrefix(session) + "got exception loading result from stub [" + sfn + "]", e); } } else { log.info(getLogPrefix(session) + "returning result from static stub [" + getStubFileName() + "]"); } } else { log.info(getLogPrefix(session) + "returning result from static stub [" + getStubFileName() + "]"); } } else { Map threadContext = new HashMap(); try { String messageID = null; // sendResult has a messageID for async senders, the result for sync senders int retryInterval = getRetryMinInterval(); String sendResult = null; boolean replyIsValid = false; int retriesLeft = 0; if (getMaxRetries() > 0) { retriesLeft = getMaxRetries() + 1; } else { retriesLeft = 1; } while (retriesLeft-- >= 1 && !replyIsValid) { try { sendResult = sendMessage(input, session, correlationID, getSender(), threadContext); if (retryTp != null) { String retry = retryTp.transform(sendResult, null); if (retry.equalsIgnoreCase("true")) { if (retriesLeft >= 1) { retryInterval = increaseRetryIntervalAndWait(session, retryInterval, "xpathRetry result [" + retry + "], retries left [" + retriesLeft + "]"); } } else { replyIsValid = true; } } else { replyIsValid = true; } } catch (TimeOutException toe) { if (retriesLeft >= 1) { retryInterval = increaseRetryIntervalAndWait(session, retryInterval, "timeout occured, retries left [" + retriesLeft + "]"); } else { throw toe; } } catch (SenderException se) { if (retriesLeft >= 1) { retryInterval = increaseRetryIntervalAndWait(session, retryInterval, "exception [" + (se != null ? se.getMessage() : "") + "] occured, retries left [" + retriesLeft + "]"); } else { throw se; } } } if (!replyIsValid) { throw new PipeRunException(this, getLogPrefix(session) + "invalid reply message is received"); } if (getSender().isSynchronous()) { if (log.isInfoEnabled()) { log.info(getLogPrefix(session) + "sent message to [" + getSender().getName() + "] synchronously"); } result = sendResult; } else { messageID = sendResult; if (log.isInfoEnabled()) { log.info(getLogPrefix(session) + "sent message to [" + getSender().getName() + "] messageID [" + messageID + "] correlationID [" + correlationID + "] linkMethod [" + getLinkMethod() + "]"); } // if linkMethod is MESSAGEID overwrite correlationID with the messageID // as this will be used with the listener if (getLinkMethod().equalsIgnoreCase("MESSAGEID")) { correlationID = sendResult; if (log.isDebugEnabled()) log.debug(getLogPrefix(session) + "setting correlationId to listen for to messageId [" + correlationID + "]"); } } ITransactionalStorage messageLog = getMessageLog(); if (messageLog != null) { long messageLogStartTime = System.currentTimeMillis(); String messageTrail = "no audit trail"; if (auditTrailTp != null) { if (isUseInputForExtract()) { messageTrail = auditTrailTp.transform(originalMessage, null); } else { messageTrail = auditTrailTp.transform((String) input, null); } } else { if (StringUtils.isNotEmpty(getAuditTrailSessionKey())) { messageTrail = (String) (session.get(getAuditTrailSessionKey())); } } String storedMessageID = messageID; if (storedMessageID == null) { storedMessageID = "-"; } if (correlationIDTp != null) { if (StringUtils.isNotEmpty(getCorrelationIDSessionKey())) { String sourceString = (String) (session.get(getCorrelationIDSessionKey())); correlationID = correlationIDTp.transform(sourceString, null); } else { if (isUseInputForExtract()) { correlationID = correlationIDTp.transform(originalMessage, null); } else { correlationID = correlationIDTp.transform((String) input, null); } } if (StringUtils.isEmpty(correlationID)) { correlationID = "-"; } } String label = null; if (labelTp != null) { if (isUseInputForExtract()) { label = labelTp.transform(originalMessage, null); } else { label = labelTp.transform((String) input, null); } } if (sender instanceof MailSender) { String messageInMailSafeForm = (String) session.get("messageInMailSafeForm"); if (hideRegex != null) { if (getHideMethod().equalsIgnoreCase("FIRSTHALF")) { messageInMailSafeForm = Misc.hideFirstHalf(messageInMailSafeForm, hideRegex); } else { messageInMailSafeForm = Misc.hideAll(messageInMailSafeForm, hideRegex); } } messageLog.storeMessage(storedMessageID, correlationID, new Date(), messageTrail, label, messageInMailSafeForm); } else { String message = (String) input; if (hideRegex != null) { if (getHideMethod().equalsIgnoreCase("FIRSTHALF")) { message = Misc.hideFirstHalf(message, hideRegex); } else { message = Misc.hideAll(message, hideRegex); } } messageLog.storeMessage(storedMessageID, correlationID, new Date(), messageTrail, label, message); } long messageLogEndTime = System.currentTimeMillis(); long messageLogDuration = messageLogEndTime - messageLogStartTime; StatisticsKeeper sk = getPipeLine().getPipeStatistics(messageLog); sk.addValue(messageLogDuration); } if (sender instanceof MailSender) { session.remove("messageInMailSafeForm"); } if (getListener() != null) { result = listenerProcessor.getMessage(getListener(), correlationID, session); } else { result = sendResult; } if (result == null) { result = ""; } if (timeoutPending) { timeoutPending = false; throwEvent(PIPE_CLEAR_TIMEOUT_MONITOR_EVENT); } } catch (TimeOutException toe) { throwEvent(PIPE_TIMEOUT_MONITOR_EVENT); if (!timeoutPending) { timeoutPending = true; } PipeForward timeoutForward = findForward(TIMEOUTFORWARD); log.warn(getLogPrefix(session) + "timeout occured"); if (timeoutForward == null) { if (StringUtils.isEmpty(getResultOnTimeOut())) { timeoutForward = findForward(EXCEPTIONFORWARD); } else { timeoutForward = getForward(); } } if (timeoutForward != null) { String resultmsg; if (StringUtils.isNotEmpty(getResultOnTimeOut())) { resultmsg = getResultOnTimeOut(); } else { if (input instanceof String) { resultmsg = new ErrorMessageFormatter().format(getLogPrefix(session), toe, this, (String) input, session.getMessageId(), 0); } else { if (input == null) { input = "null"; } resultmsg = new ErrorMessageFormatter().format(getLogPrefix(session), toe, this, input.toString(), session.getMessageId(), 0); } } return new PipeRunResult(timeoutForward, resultmsg); } throw new PipeRunException(this, getLogPrefix(session) + "caught timeout-exception", toe); } catch (Throwable t) { throwEvent(PIPE_EXCEPTION_MONITOR_EVENT); PipeForward exceptionForward = findForward(EXCEPTIONFORWARD); if (exceptionForward != null) { log.warn(getLogPrefix(session) + "exception occured, forwarding to exception-forward [" + exceptionForward.getPath() + "], exception:\n", t); String resultmsg; if (input instanceof String) { resultmsg = new ErrorMessageFormatter().format(getLogPrefix(session), t, this, (String) input, session.getMessageId(), 0); } else { if (input == null) { input = "null"; } resultmsg = new ErrorMessageFormatter().format(getLogPrefix(session), t, this, input.toString(), session.getMessageId(), 0); } return new PipeRunResult(exceptionForward, resultmsg); } throw new PipeRunException(this, getLogPrefix(session) + "caught exception", t); } } if (!validResult(result)) { PipeForward illegalResultForward = findForward(ILLEGALRESULTFORWARD); return new PipeRunResult(illegalResultForward, result); } if (getOutputValidator() != null) { log.debug(getLogPrefix(session) + "validating response"); long validationStartTime = System.currentTimeMillis(); PipeRunResult validationResult = pipeProcessor.processPipe(getPipeLine(), outputValidator, correlationID, result, session); if (validationResult != null && !validationResult.getPipeForward().getName().equals("success")) { return validationResult; } } if (getOutputWrapper() != null) { log.debug(getLogPrefix(session) + "wrapping response"); PipeRunResult wrapResult = pipeProcessor.processPipe(getPipeLine(), outputWrapper, correlationID, result, session); if (wrapResult != null && !wrapResult.getPipeForward().getName().equals("success")) { return wrapResult; } else { result = wrapResult.getResult().toString(); } log.debug(getLogPrefix(session) + "response after wrapping [" + result + "]"); } if (isStreamResultToServlet()) { byte[] bytes = Base64.decodeBase64(new String(result)); try { String contentType = (String) session.get("contentType"); if (StringUtils.isNotEmpty(contentType)) { RestListenerUtils.setResponseContentType(session, contentType); } RestListenerUtils.writeToResponseOutputStream(session, bytes); } catch (IOException e) { throw new PipeRunException(this, getLogPrefix(session) + "caught exception", e); } return new PipeRunResult(getForward(), ""); } else { return new PipeRunResult(getForward(), result); } }
From source file:nl.nn.adapterframework.pipes.RhinoPipe.java
/** * checks for correct configuration, and translates the fileName to a file, * to check existence. If a fileName was specified, the contents of the file * is used as java-script function library. After evaluation the result is returned via * <code>Pipeline</code>.//from www . j av a 2s . c o m * * @throws ConfigurationException */ public void configure() throws ConfigurationException { super.configure(); if (StringUtils.isNotEmpty(getFileName()) && !isLookupAtRuntime()) { URL resource = null; try { resource = ClassUtils.getResourceURL(classLoader, getFileName()); } catch (Throwable e) { throw new ConfigurationException( getLogPrefix(null) + "got exception searching for [" + getFileName() + "]", e); } if (resource == null) { throw new ConfigurationException( getLogPrefix(null) + "cannot find resource [" + getFileName() + "]"); } try { fileInput = Misc.resourceToString(resource, SystemUtils.LINE_SEPARATOR); } catch (Throwable e) { throw new ConfigurationException( getLogPrefix(null) + "got exception loading [" + getFileName() + "]", e); } } if ((StringUtils.isEmpty(fileInput)) && inputString == null) { // No input from file or input string. Only from session-keys? throw new ConfigurationException(getLogPrefix(null) + "has neither fileName nor inputString specified"); } if (StringUtils.isEmpty(jsfunctionName)) { // Cannot run the code in factory without any function start point throw new ConfigurationException(getLogPrefix(null) + "JavaScript functionname not specified!"); } }
From source file:nl.nn.adapterframework.pipes.RhinoPipe.java
public PipeRunResult doPipe(Object input, IPipeLineSession session) throws PipeRunException { //INIT//from w w w. ja v a 2s.co m String eol = System.getProperty("line.separator"); if (input == null) { //No input from previous pipes. We will use filename and or string input. if ((StringUtils.isEmpty(fileInput)) && inputString == null && isLookupAtRuntime()) { // No input from file or input string. Nowhere to GO! throw new PipeRunException(this, getLogPrefix(session) + "No input specified anywhere. No string input, no file input and no previous pipe input"); } } if (!(input instanceof String)) { throw new PipeRunException(this, getLogPrefix(session) + "got an invalid type as input, expected String, got " + input.getClass().getName()); } inputString = (String) input; //Default console bindings. Used to map javascript commands to java commands as CONSTANT //Console bindings do not work in Rhino. To print from jslib use java.lang.System.out.print("halllo world!"); //Get the input from the file at Run Time if (StringUtils.isNotEmpty(getFileName()) && isLookupAtRuntime()) { URL resource = null; try { resource = ClassUtils.getResourceURL(classLoader, getFileName()); } catch (Throwable e) { throw new PipeRunException(this, getLogPrefix(session) + "got exception searching for [" + getFileName() + "]", e); } if (resource == null) { throw new PipeRunException(this, getLogPrefix(session) + "cannot find resource [" + getFileName() + "]"); } try { fileInput = Misc.resourceToString(resource, SystemUtils.LINE_SEPARATOR); } catch (Throwable e) { throw new PipeRunException(this, getLogPrefix(session) + "got exception loading [" + getFileName() + "]", e); } } //Get all params as input if (getParameterList() != null) { ParameterResolutionContext prc = new ParameterResolutionContext((String) input, session); ParameterValueList pvl; try { pvl = prc.getValues(getParameterList()); } catch (ParameterException e) { throw new PipeRunException(this, getLogPrefix(session) + "exception extracting parameters", e); } for (int i = 0; i < pvl.size(); i++) { ParameterValue pv = pvl.getParameterValue(i); paramsInput = pv.asStringValue("") + eol + paramsInput; } } String javascriptcode = "Packages.java;" + eol; if (fileInput != null) { javascriptcode = javascriptcode + fileInput; } if (paramsInput != null) { javascriptcode = paramsInput + eol + javascriptcode; } String stringResult = (String) javascriptcode; stringResult = "INPUTSTREAM used in case of ERROR" + eol + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + eol + stringResult; //Start your engines //Rhino engine Ok. Context cx = Context.enter(); Scriptable scope = cx.initStandardObjects(); if (isDebug()) { System.out.println("debug active"); cx.setLanguageVersion(Context.VERSION_1_2); cx.setGeneratingDebug(true); } //Load javascript factory with javascript functions from file, stringinput and paraminput String jsResult = ""; try { cx.evaluateString(scope, javascriptcode, "jsScript", 1, null); Function fct = (Function) scope.get(jsfunctionName, scope); // Object result = fct.call(cx, scope, scope, new Object[]{jsfunctionArguments}); Object result = fct.call(cx, scope, scope, new Object[] { input }); if (isDebug()) { System.out.println(cx.jsToJava(result, String.class)); } ; jsResult = (String) cx.jsToJava(result, String.class); } catch (org.mozilla.javascript.EcmaError ex) { throw new PipeRunException(this, "org.mozilla.javascript.EcmaError -> ", ex); //System.out.println(ex.getMessage()); } finally { Context.exit(); } //Use the result if (!(jsResult instanceof String)) { } else { if ((String) jsResult != null) { stringResult = (String) jsResult; } } if (StringUtils.isEmpty(getSessionKey())) { return new PipeRunResult(getForward(), stringResult); } else { session.put(getSessionKey(), stringResult); return new PipeRunResult(getForward(), input); } }
From source file:nl.nn.adapterframework.senders.FixedResultSender.java
/** * checks for correct configuration, and translates the fileName to * a file, to check existence. /*from www . j a va 2 s . c om*/ * If a fileName was specified, the contents of the file is put in the * <code>returnString</code>, so that allways the <code>returnString</code> * may be returned. * @throws ConfigurationException */ public void configure() throws ConfigurationException { super.configure(); if (StringUtils.isNotEmpty(fileName)) { try { returnString = Misc.resourceToString(ClassUtils.getResourceURL(classLoader, fileName), SystemUtils.LINE_SEPARATOR); } catch (Throwable e) { throw new ConfigurationException( "Pipe [" + getName() + "] got exception loading [" + fileName + "]", e); } } if ((StringUtils.isEmpty(fileName)) && returnString == null) { // allow an empty returnString to be specified throw new ConfigurationException( "Pipe [" + getName() + "] has neither fileName nor returnString specified"); } if (StringUtils.isNotEmpty(replaceFrom)) { returnString = replace(returnString, replaceFrom, replaceTo); } }
From source file:nl.nn.adapterframework.util.XmlUtils.java
public static String getVersionInfo() { StringBuilder sb = new StringBuilder(); sb.append(AppConstants.getInstance().getProperty("application.name") + " " + AppConstants.getInstance().getProperty("application.version")).append(SystemUtils.LINE_SEPARATOR); sb.append("XML tool version info:").append(SystemUtils.LINE_SEPARATOR); SAXParserFactory spFactory = getSAXParserFactory(); sb.append("SAXParserFactory-class =").append(spFactory.getClass().getName()) .append(SystemUtils.LINE_SEPARATOR); DocumentBuilderFactory domFactory1 = getDocumentBuilderFactory(false); sb.append("DocumentBuilderFactory1-class =").append(domFactory1.getClass().getName()) .append(SystemUtils.LINE_SEPARATOR); DocumentBuilderFactory domFactory2 = getDocumentBuilderFactory(true); sb.append("DocumentBuilderFactory2-class =").append(domFactory2.getClass().getName()) .append(SystemUtils.LINE_SEPARATOR); TransformerFactory tFactory1 = getTransformerFactory(false); sb.append("TransformerFactory1-class =").append(tFactory1.getClass().getName()) .append(SystemUtils.LINE_SEPARATOR); TransformerFactory tFactory2 = getTransformerFactory(true); sb.append("TransformerFactory2-class =").append(tFactory2.getClass().getName()) .append(SystemUtils.LINE_SEPARATOR); sb.append("Apache-XML tool version info:").append(SystemUtils.LINE_SEPARATOR); try {//from w ww.ja va 2s . c o m sb.append("Xerces-Version=").append(org.apache.xerces.impl.Version.getVersion()) .append(SystemUtils.LINE_SEPARATOR); } catch (Throwable t) { sb.append("Xerces-Version not found (").append(t.getClass().getName()).append(": ") .append(t.getMessage()).append(")").append(SystemUtils.LINE_SEPARATOR); } try { String xalanVersion; if (IbisContext.getApplicationServerType().startsWith("WAS")) { xalanVersion = nl.nn.org.apache.xalan.Version.getVersion(); } else { xalanVersion = org.apache.xalan.Version.getVersion(); } sb.append("Xalan-Version=" + xalanVersion + SystemUtils.LINE_SEPARATOR); } catch (Throwable t) { sb.append("Xalan-Version not found (").append(t.getClass().getName()).append(": ") .append(t.getMessage()).append(")").append(SystemUtils.LINE_SEPARATOR); } try { // sb.append("XmlCommons-Version="+org.apache.xmlcommons.Version.getVersion()+SystemUtils.LINE_SEPARATOR); } catch (Throwable t) { sb.append("XmlCommons-Version not found (").append(t.getClass().getName()).append(": ") .append(t.getMessage()).append(")").append(SystemUtils.LINE_SEPARATOR); } return sb.toString(); }
From source file:org.apache.archiva.indexer.maven.search.AbstractMavenRepositorySearch.java
public String niceDisplay(SearchResults searchResults) throws Exception { StringBuilder sb = new StringBuilder(); for (SearchResultHit hit : searchResults.getHits()) { sb.append(hit.toString()).append(SystemUtils.LINE_SEPARATOR); }/*w ww . j a va2 s .co m*/ return sb.toString(); }
From source file:org.apache.archiva.redback.role.DefaultRoleManager.java
public void loadApplication(ModelApplication app) throws RoleManagerException { if (unblessedModel == null) { unblessedModel = new RedbackRoleModel(); }//from w ww.j av a2s .c o m unblessedModel.addApplication(app); if (modelValidator.validate(unblessedModel)) { blessedModel = unblessedModel; } else { StringBuilder stringBuilder = new StringBuilder("Role Model Validation Errors:"); for (String error : modelValidator.getValidationErrors()) { stringBuilder.append(error).append(SystemUtils.LINE_SEPARATOR); } log.error(stringBuilder.toString()); throw new RoleManagerException( "Role Model Validation Error " + SystemUtils.LINE_SEPARATOR + stringBuilder.toString()); } modelProcessor.process(blessedModel); knownResources.put(app.getId(), app); }
From source file:org.apache.cocoon.bean.CocoonBean.java
/** * Print a description of the software before running */// w w w . ja v a2s . c om public static String getProlog() { String lSep = SystemUtils.LINE_SEPARATOR; StringBuffer msg = new StringBuffer(); msg.append("------------------------------------------------------------------------ ").append(lSep); msg.append(Constants.NAME).append(" ").append(Constants.VERSION).append(lSep); msg.append("Copyright (c) ").append(Constants.YEAR) .append(" Apache Software Foundation. All rights reserved.").append(lSep); msg.append("------------------------------------------------------------------------ ").append(lSep) .append(lSep); return msg.toString(); }
From source file:org.apache.cocoon.Cocoon.java
/** * Log debug information about the current environment. * * @param environment an <code>Environment</code> value *///from ww w . ja v a 2s . c o m protected void debug(Environment environment, boolean internal) { String lineSeparator = SystemUtils.LINE_SEPARATOR; Map objectModel = environment.getObjectModel(); Request request = ObjectModelHelper.getRequest(objectModel); Session session = request.getSession(false); StringBuffer msg = new StringBuffer(); msg.append("DEBUGGING INFORMATION:").append(lineSeparator); if (internal) { msg.append("INTERNAL "); } msg.append("REQUEST: ").append(request.getRequestURI()).append(lineSeparator).append(lineSeparator); msg.append("CONTEXT PATH: ").append(request.getContextPath()).append(lineSeparator); msg.append("SERVLET PATH: ").append(request.getServletPath()).append(lineSeparator); msg.append("PATH INFO: ").append(request.getPathInfo()).append(lineSeparator).append(lineSeparator); msg.append("REMOTE HOST: ").append(request.getRemoteHost()).append(lineSeparator); msg.append("REMOTE ADDRESS: ").append(request.getRemoteAddr()).append(lineSeparator); msg.append("REMOTE USER: ").append(request.getRemoteUser()).append(lineSeparator); msg.append("REQUEST SESSION ID: ").append(request.getRequestedSessionId()).append(lineSeparator); msg.append("REQUEST PREFERRED LOCALE: ").append(request.getLocale().toString()).append(lineSeparator); msg.append("SERVER HOST: ").append(request.getServerName()).append(lineSeparator); msg.append("SERVER PORT: ").append(request.getServerPort()).append(lineSeparator).append(lineSeparator); msg.append("METHOD: ").append(request.getMethod()).append(lineSeparator); msg.append("CONTENT LENGTH: ").append(request.getContentLength()).append(lineSeparator); msg.append("PROTOCOL: ").append(request.getProtocol()).append(lineSeparator); msg.append("SCHEME: ").append(request.getScheme()).append(lineSeparator); msg.append("AUTH TYPE: ").append(request.getAuthType()).append(lineSeparator).append(lineSeparator); msg.append("CURRENT ACTIVE REQUESTS: ").append(activeRequestCount).append(lineSeparator); // log all of the request parameters Enumeration e = request.getParameterNames(); msg.append("REQUEST PARAMETERS:").append(lineSeparator).append(lineSeparator); while (e.hasMoreElements()) { String p = (String) e.nextElement(); msg.append("PARAM: '").append(p).append("' ").append("VALUES: '"); String[] params = request.getParameterValues(p); for (int i = 0; i < params.length; i++) { msg.append("[" + params[i] + "]"); if (i != (params.length - 1)) { msg.append(", "); } } msg.append("'").append(lineSeparator); } // log all of the header parameters Enumeration e2 = request.getHeaderNames(); msg.append("HEADER PARAMETERS:").append(lineSeparator).append(lineSeparator); while (e2.hasMoreElements()) { String p = (String) e2.nextElement(); msg.append("PARAM: '").append(p).append("' ").append("VALUES: '"); Enumeration e3 = request.getHeaders(p); while (e3.hasMoreElements()) { msg.append("[" + e3.nextElement() + "]"); if (e3.hasMoreElements()) { msg.append(", "); } } msg.append("'").append(lineSeparator); } msg.append(lineSeparator).append("SESSION ATTRIBUTES:").append(lineSeparator).append(lineSeparator); // log all of the session attributes if (session != null) { // Fix bug #12139: Session can be modified while still // being enumerated here synchronized (session) { e = session.getAttributeNames(); while (e.hasMoreElements()) { String p = (String) e.nextElement(); msg.append("PARAM: '").append(p).append("' ").append("VALUE: '").append(session.getAttribute(p)) .append("'").append(lineSeparator); } } } getLogger().debug(msg.toString()); }
From source file:org.apache.cocoon.components.treeprocessor.sitemap.HandleErrorsNode.java
public final boolean invoke(Environment env, InvokeContext context) throws Exception { if (getLogger().isInfoEnabled()) { getLogger().info("Processing handle-errors at " + getLocation()); }//from w w w .j av a2 s.c om if (statusCode == -1) { // No 'type' attribute : new Cocoon 2.1 behaviour, no implicit generator try { return invokeNodes(this.children, env, context); } catch (ProcessingException e) { // Handle the various cases related to the transition from implicit generators in handle-errors to // explicit ones, in order to provide meaningful messages that will ease the migration if (e.getMessage().indexOf("Must set a generator before adding") != -1) { env.getObjectModel().remove(Constants.NOTIFYING_OBJECT); throw new ProcessingException( "Incomplete pipeline: 'handle-error' without a 'type' must include a generator, at " + getLocation() + SystemUtils.LINE_SEPARATOR + "Either add a generator (preferred) or a type='500' attribute (deprecated) on 'handle-errors'"); } // Rethrow the exception throw e; } } else { // A 'type' attribute is present : add the implicit generator context.getProcessingPipeline().setGenerator("<notifier>", "", Parameters.EMPTY_PARAMETERS, Parameters.EMPTY_PARAMETERS); try { return invokeNodes(this.children, env, context); } catch (ProcessingException e) { if (e.getMessage().indexOf("Generator already set") != -1) { env.getObjectModel().remove(Constants.NOTIFYING_OBJECT); throw new ProcessingException( "Error: 'handle-error' with a 'type' attribute has an implicit generator, at " + getLocation() + SystemUtils.LINE_SEPARATOR + "Please remove the 'type' attribute on 'handle-error'"); } // Rethrow the exception throw e; } } }