Read in web.xml the optional STACKTRACE_LENGTH config and set it in StacktraceConfigurationManager
@param sc
434761
public void readStacktraceConfig(@Observes @Initialized(ApplicationScoped.class) ServletContext sc) {
		String stacktrace;
		if(ocelotConfigurationsStack.isUnsatisfied()) {
			stacktrace = sc.getInitParameter(Constants.Options.STACKTRACE_LENGTH);
			if(stacktrace==null) {
				stacktrace = DEFAULTSTACKTRACE;
			} else {
				logger.debug("Read '{}' option in web.xml : '{}'.", Constants.Options.STACKTRACE_LENGTH, stacktrace);
			}
		} else {
			stacktrace = ocelotConfigurationsStack.get();
			logger.debug("Read '{}' option from producer : '{}'.", Constants.Options.STACKTRACE_LENGTH, stacktrace);
		}
		int stacktracelenght = Integer.parseInt(stacktrace);
		logger.debug("'{}' value : '{}'.", Constants.Options.STACKTRACE_LENGTH, stacktracelenght);
		setStacktracelength(stacktracelenght);
	}
645007
public void checkSkipReadForFixLengthPart(AbstractPagedInputView source) throws IOException {
		// skip if there is no enough size.
		// Note: Use currentSegmentLimit instead of segmentSize.
		int available = source.getCurrentSegmentLimit() - source.getCurrentPositionInSegment();
		if (available < getSerializedRowFixedPartLength()) {
			source.advance();
		}
	}
754072
private static StackTraceElementsFiller getStackTraceElementsFiller() {
		try {
			Method method = VMStack.class.getDeclaredMethod("fillStackTraceElements", Thread.class, StackTraceElement[].class);
			method.setAccessible(true);
			StackTraceElement[] trace = new StackTraceElement[STACK_TRACE_SIZE];
			method.invoke(null, Thread.currentThread(), trace);
			for (int i = 0; i < STACK_TRACE_SIZE; ++i) {
				StackTraceElement element = trace[i];
				if (element != null && AndroidRuntime.class.getName().equals(element.getClassName())
					&& "getStackTraceElementsFiller".equals(element.getMethodName())) {
					return new StackTraceElementsFiller(method, i);
				}
			}
			return new StackTraceElementsFiller(null, -1);
		} catch (NoClassDefFoundError error) {
			return new StackTraceElementsFiller(null, -1);
		} catch (Exception ex) {
			return new StackTraceElementsFiller(null, -1);
		}
	}
374892
protected void scanJspConfig() throws IOException, SAXException {
        JspConfigDescriptor jspConfigDescriptor = context.getJspConfigDescriptor();
        if (jspConfigDescriptor == null) {
            return;
        }

        Collection<TaglibDescriptor> descriptors = jspConfigDescriptor.getTaglibs();
        for (TaglibDescriptor descriptor : descriptors) {
            if (descriptor == null) {
                continue;
            }
            String taglibURI = descriptor.getTaglibURI();
            String resourcePath = descriptor.getTaglibLocation();
            // Note: Whilst the Servlet 2.4 DTD implies that the location must
            // be a context-relative path starting with '/', JSP.7.3.6.1 states
            // explicitly how paths that do not start with '/' should be
            // handled.
            if (!resourcePath.startsWith("/")) {
                resourcePath = WEB_INF + resourcePath;
            }
            if (uriTldResourcePathMap.containsKey(taglibURI)) {
                LOG.warn(Localizer.getMessage(MSG + ".webxmlSkip", resourcePath, taglibURI));
                continue;
            }

            if (LOG.isTraceEnabled()) {
                LOG.trace(Localizer.getMessage(MSG + ".webxmlAdd", resourcePath, taglibURI));
            }

            URL url = context.getResource(resourcePath);
            if (url != null) {
                TldResourcePath tldResourcePath;
                if (resourcePath.endsWith(".jar")) {
                    // if the path points to a jar file, the TLD is presumed to
                    // be
                    // inside at META-INF/taglib.tld
                    tldResourcePath = new TldResourcePath(url, resourcePath, "META-INF/taglib.tld");
                } else {
                    tldResourcePath = new TldResourcePath(url, resourcePath);
                }
                // parse TLD but store using the URI supplied in the descriptor
                TaglibXml tld = tldParser.parse(tldResourcePath);
                uriTldResourcePathMap.put(taglibURI, tldResourcePath);
                tldResourcePathTaglibXmlMap.put(tldResourcePath, tld);
                if (tld.getListeners() != null) {
                    listeners.addAll(tld.getListeners());
                }
            } else {
                LOG.warn(Localizer.getMessage(MSG + ".webxmlFailPathDoesNotExist", resourcePath, taglibURI));
                continue;
            }
        }
    }
886163
public static void checkIfORC(FileSystem fs, Path path) throws IOException {
    // hardcoded to 40 because "SEQ-org.apache.hadoop.hive.ql.io.RCFile", the header, is of 40 chars
    final int buffLen = 40;
    final byte header[] = new byte[buffLen];
    final FSDataInputStream file = fs.open(path);
    final long fileLength = fs.getFileStatus(path).getLen();
    int sizeToBeRead = buffLen;
    if (buffLen > fileLength) {
      sizeToBeRead = (int)fileLength;
    }

    IOUtils.readFully(file, header, 0, sizeToBeRead);
    file.close();

    final String headerString = new String(header);
    if (headerString.startsWith("ORC")) {
      LOG.error("Error while parsing the footer of the file : " + path);
    } else {
      throw new NotAnORCFileException("Input file = " + path + " , header = " + headerString);
    }
  }
773767
@Override
    public Reader bootstrapInput(ReaderConfig cfg, boolean mainDoc, int xmlVersion)
        throws IOException, XMLStreamException
    {
        /* First order of business: allocate input buffer. Not done during
         * construction for simplicity; that way config object need not be
         * passed before actual bootstrap method is called
         */
        /* Let's make sure buffer is at least 6 chars (to know '<?xml '
         * prefix), and preferably big enough to contain the whole declaration,
         *  but not too long to waste space -- it won't be reused
         * by the real input reader.
         */
        mCharBuffer = (cfg == null) ? new char[128] : cfg.allocSmallCBuffer(128); // 128 chars should be enough

        initialLoad(7);

        /* Only need 6 for signature ("<?xml\s"), but there may be a leading
         * BOM in there... and a valid xml declaration has to be longer
         * than 7 chars anyway (although, granted, shortest valid xml docl
         * is just 4 chars... "<a/>")
         */
        if (mInputEnd >= 7) {
            char c = mCharBuffer[mInputPtr];
            
            // BOM to skip?
            if (c == CHAR_BOM_MARKER) {
                c = mCharBuffer[++mInputPtr];
            }
            if (c == '<') {
                if (mCharBuffer[mInputPtr+1] == '?'
                    && mCharBuffer[mInputPtr+2] == 'x'
                    && mCharBuffer[mInputPtr+3] == 'm'
                    && mCharBuffer[mInputPtr+4] == 'l'
                    && mCharBuffer[mInputPtr+5] <= CHAR_SPACE) {
                    // Yup, got the declaration ok!
                    mInputPtr += 6; // skip declaration
                    readXmlDecl(mainDoc, xmlVersion);
                    
                    if (mFoundEncoding != null && mInputEncoding != null) {
                        verifyXmlEncoding(cfg);
                    }
                }
            } else {
                /* We may also get something that would be invalid xml
                 * ("garbage" char; neither '<' nor space). If so, and
                 * it's one of "well-known" cases, we can not only throw
                 * an exception but also indicate a clue as to what is likely
                 * to be wrong.
                 */
                /* Specifically, UTF-8 read via, say, ISO-8859-1 reader, can
                 * "leak" marker (0xEF, 0xBB, 0xBF). While we could just eat
                 * it, there's bound to be other problems cropping up, so let's
                 * inform about the problem right away.
                 */
                if (c == 0xEF) {
                    throw new WstxIOException("Unexpected first character (char code 0xEF), not valid in xml document: could be mangled UTF-8 BOM marker. Make sure that the Reader uses correct encoding or pass an InputStream instead");
                }
            }
        }
 
        /* Ok, now; do we have unused chars we have read that need to
         * be merged in?
         */
        if (mInputPtr < mInputEnd) {
            return new MergedReader(cfg, mIn, mCharBuffer, mInputPtr, mInputEnd);
        }

        return mIn;
    }
923893
@Override
    public long getContentSize(Context ctx) throws StreamIOException {
        try {
            // For new or modified datastreams, the new bytestream hasn't yet been
            // committed. However, we need to access it in order to compute
            // the datastream checksum
            if (DSLocation.startsWith(UPLOADED_SCHEME)) {
                // TODO: refactor to use proper temp file management - FCREPO-718
                // for now, just get the file directly (see also DefaultManagement.getTempStream(...))
                String internalId = DSLocation.substring(UPLOADED_SCHEME.length());
                File uploadedFile = new File(getTempUploadDir(), internalId);
                // check it has not been automatically purged (see DefaultManagement.purgeUploadedFiles())
                if (uploadedFile.exists()) {
                    return uploadedFile.length();
                } else {
                    throw new StreamIOException("Uploaded file " + DSLocation + " no longer exists.");
                }

            } else if (DSLocation.startsWith(TEMP_SCHEME)) {
                // TODO: refactor to use proper temp file management - FCREPO-718
                String fileName = DSLocation.substring(TEMP_SCHEME.length());
                File tempFile = new File(fileName);
                // check it has not been removed elsewhere (should not happen)
                if (tempFile.exists()) {
                    return tempFile.length();
                } else {
                    throw new StreamIOException("Temp file " + DSLocation + " no longer exists.");
                }
            } else if (Datastream.DS_LOCATION_TYPE_INTERNAL.equals(DSLocationType)) {
                ILowlevelStorage llstore = getLLStore();
                if (s_llsizable) {
                    return ((ISizable)llstore).getDatastreamSize(DSLocation);
                } else {
                    return 0;
                }
            } else if (Datastream.DS_LOCATION_TYPE_URL.equals(DSLocationType)) {
                // Managed content can have URL dsLocation on ingest
                ValidationUtility.validateURL(DSLocation, this.DSControlGrp);
                // If validation has succeeded, assume an external resource.
                // Fetch it, store it locally, update DSLocation
                if (ctx == null) {
                    ctx = ReadOnlyContext.getContext(null, null, "", false);
                    // changed from below, which sets noOp to true, seems to cause an AuthZ permitted exception
                    // in PolicyEnforcementPoint.enforce(...)
                    // ctx = ReadOnlyContext.EMPTY;
                }
               ContentManagerParams params = new ContentManagerParams(DSLocation);
                params.setContext(ctx);
                MIMETypedStream stream = getExternalContentManager()
                        .getExternalContent(params);

                // TODO: refactor temp file management - see FCREPO-718; for now create temp file and write to it
                // note - don't use temp upload directory, use (container's) temp dir (upload dir is for uploads)
                File tempFile = File.createTempFile("managedcontentupdate", null);
                OutputStream os = new FileOutputStream(tempFile);
                StreamUtility.pipeStream(stream.getStream(), os, 32768);
                DSLocation = TEMP_SCHEME + tempFile.getAbsolutePath();
                return tempFile.length();
            }
        } catch (Throwable th) {
            throw new StreamIOException("[DatastreamManagedContent] returned "
                    + " the error: \"" + th.getClass().getName()
                    + "\". Reason: " + th.getMessage(), th);
        }
        throw new StreamIOException("[DatastreamManagedContent] could not resolve dsLocation " + DSLocation + " dsLocationType " + DSLocationType);
    }
1012263
private void cleanStackTrace() {
    StackTraceElement[] realTrace = getStackTrace();
    StackTraceElement[] trace = new StackTraceElement[realTrace.length - 1];
    StackTraceElement top = realTrace[0];
    trace[0] = new StackTraceElement(top.getClassName(),
        getMethodName(realTrace[2].getMethodName()),
        top.getFileName(), top.getLineNumber());
    System.arraycopy(realTrace, 2, trace, 1, realTrace.length - 2);
    setStackTrace(trace);
  }
703042
public void setContentLength(int len) {
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {  //306998.15
            logger.entering(CLASS_NAME,"setContentLength", "length --> " + String.valueOf(len) + " ["+this+"]");
        }

        // d151464 - check the include flag
        WebAppDispatcherContext dispatchContext = (WebAppDispatcherContext) getRequest().getWebAppDispatcherContext();
        if (dispatchContext.isInclude() == true) {
            if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {  //306998.15
                logger.logp(Level.FINE, CLASS_NAME,"setContentLength", nls.getString("Illegal.from.included.servlet", "Illegal from included servlet"), "setContentLength length --> " + String.valueOf(len));  //311717
            }
        }
        else
        {
            if (_response!=null) {
                if (!_response.isCommitted()) {
                    _response.setContentLength(len);
                }
            }
            _contentLength = len;
            // LIBERTY _bufferedOut.setLimit(_contentLength = len);
            _bufferedWriter.setLimitLong(_contentLength);
            //still want to try to set the header even if the response is committed to throw the warning
            setIntHeader(HEADER_CONTENT_LENGTH, len);
        }
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {  //306998.15
            logger.exiting(CLASS_NAME,"setContentLength");
        }
    }
815211
static public void setPropertiesInSMC(SessionManagerConfig smc, Map<String, Object> xtpProperties) {
        final String methodName = "setPropertiesInSMC";
        final String invalidPropFoundMessage = "SessionContext.invalidPropertyFound";
        final String invalidCloneSeparatorMessage = "SessionContext.invalidCloneSeparator";
        String strProp = null;
        Boolean booleanProp;
        Integer integerProp = null;

        boolean baseServerLevelConfig = smc.isUsingWebContainerSM();

        setDefaultConfiguration(smc, xtpProperties);

        // id length - has upper case D for system property...maintain for
        // compatibility
        final String propIdLengthForSys = "HttpSessionIDLength";
        final String propIdLength = "idLength";
        int idLength = -1;

        Object propIdLengthValue = xtpProperties.get(propIdLength);
        if (propIdLengthValue instanceof Integer) {
            integerProp = (Integer) propIdLengthValue;
        } else {
            strProp = (String) propIdLengthValue;
            if (strProp == null) {
                strProp = getSystemProperty(propIdLength);
                // look for different case on system property
                if (strProp == null) {
                    strProp = getSystemProperty(propIdLengthForSys);
                }
            }
        }

        if (integerProp != null || strProp != null) {
            try {
                if (integerProp != null) {
                    idLength = integerProp.intValue();
                } else {
                    idLength = Integer.parseInt(strProp);
                }
                if ((idLength < 8) || (idLength > 128)) {
                    if (idLength < 8)
                        idLength = 8;
                    if (idLength > 128)
                        idLength = 128;
                    LoggingUtil.SESSION_LOGGER_CORE.logp(Level.WARNING, methodClassName, methodName, "SessionContext.valueOutOfRange", new Object[] { propIdLength, strProp,
                                                                                                                                                     new Integer(idLength) });
                }
                if (shouldSetAndDoLogging(propIdLength, true, baseServerLevelConfig, xtpProperties, new Integer(idLength), new Integer(SessionManagerConfig.getSessionIDLength()),
                                          false)) {
                    SessionManagerConfig.setSessionIDLength(idLength);
                }
            } catch (NumberFormatException nfe) {
                LoggingUtil.SESSION_LOGGER_CORE.logp(Level.WARNING, methodClassName, methodName, invalidPropFoundMessage, new Object[] { propIdLength, strProp });
            }
        }

        // id reuse - reuse incoming id even if its not in use by another webapp
        final String propIdReuse = "HttpSessionIdReuse";
        strProp = getStringProperty(propIdReuse, xtpProperties);
        if (strProp != null) {
            booleanProp = Boolean.valueOf(strProp);
            if (shouldSetAndDoLogging(propIdReuse, true, baseServerLevelConfig, xtpProperties, booleanProp, Boolean.valueOf(SessionManagerConfig.isIdReuse()), false)) {
                SessionManagerConfig.setIdReuse(booleanProp.booleanValue());
            }
        }

        // track gc
        final String propTrackGC = "HttpSessionTrackGC";
        strProp = getStringProperty(propTrackGC, xtpProperties);
        if (strProp != null) {
            booleanProp = Boolean.valueOf(strProp);
            if (shouldSetAndDoLogging(propTrackGC, false, baseServerLevelConfig, xtpProperties, booleanProp, null, false)) {
                smc.setTrackGCCount(booleanProp.booleanValue());
            }
        }

        // reaper poll interval - override how often inval thread runs
        final String propReaperPollInt = "HttpSessionReaperPollInterval";
        strProp = getStringProperty(propReaperPollInt, xtpProperties);
        long longProp = -1;
        try {
            if (strProp != null) {
                if (shouldSetAndDoLogging(propReaperPollInt, false, baseServerLevelConfig, xtpProperties, strProp, null, false)) {
                    longProp = new Long(strProp).longValue();
                    smc.setReaperPollInterval(longProp);
                }
            }
        } catch (NumberFormatException nfe) {
            LoggingUtil.SESSION_LOGGER_CORE.logp(Level.SEVERE, methodClassName, methodName, invalidPropFoundMessage, new Object[] { propReaperPollInt, strProp });
        }

        // use invalidated id - default to true for better performance
        final String propUseRecentInvalId = "UseInvalidatedId";
        strProp = getStringProperty(propUseRecentInvalId, xtpProperties);
        if (strProp != null) {
            booleanProp = Boolean.valueOf(strProp);
            if (shouldSetAndDoLogging(propUseRecentInvalId, false, baseServerLevelConfig, xtpProperties, booleanProp, null, false)) {
                smc.setCheckRecentlyInvalidList(booleanProp.booleanValue());
            }
        }

        // debug session crossover
        final String propDebugSessCross = "DebugSessionCrossover";
        strProp = getStringProperty(propDebugSessCross, xtpProperties);
        if (strProp != null) {
            booleanProp = Boolean.valueOf(strProp);
            if (shouldSetAndDoLogging(propDebugSessCross, false, baseServerLevelConfig, xtpProperties, booleanProp, null, false)) {
                smc.setDebugSessionCrossover(booleanProp.booleanValue());
                if (baseServerLevelConfig || xtpProperties.get(propDebugSessCross) != null) {
                    if (booleanProp.booleanValue() == true) {
                        LoggingUtil.SESSION_LOGGER_CORE.logp(Level.INFO, methodClassName, methodName, "SessionContext.DebugCrossoverEnabled");
                    }
                }
            }
        }

        // url rewrite identifier
        final String propSessRewrite = "SessionRewriteIdentifier";
        strProp = getStringProperty(propSessRewrite, xtpProperties);
        if (strProp != null) {
            if (shouldSetAndDoLogging(propSessRewrite, false, baseServerLevelConfig, xtpProperties, strProp, null, false)) {
                smc.setSessUrlRewritePrefix(";" + strProp + "=");
            }
        }

        // clone id
        final String propHttpSessionCloneId = "HttpSessionCloneId";
        strProp = getStringProperty(propHttpSessionCloneId, xtpProperties);
        if (strProp != null) {
            if (shouldSetAndDoLogging(propHttpSessionCloneId, true, baseServerLevelConfig, xtpProperties, strProp, SessionManagerConfig.getCloneId(),
                                      strProp.equals(SessionManagerConfig.getCloneId()))) {
                SessionManagerConfig.setCloneId(strProp);
                SessionManagerConfig.setCloneIdPropertySet(true);
            }
        }

        // no additional session info - eliminates cache and clone on base server
        final String propNoAddSessInfo = "NoAdditionalSessionInfo";
        strProp = getStringProperty(propNoAddSessInfo, xtpProperties);
        if (strProp != null) {
            booleanProp = Boolean.valueOf(strProp);
            if (shouldSetAndDoLogging(propNoAddSessInfo, true, baseServerLevelConfig, xtpProperties, booleanProp, Boolean.valueOf(SessionManagerConfig.isTurnOffCacheId()), false)) {
                SessionManagerConfig.setTurnOffCacheId(booleanProp.booleanValue());
                SessionManagerConfig.setTurnOffCloneId(booleanProp.booleanValue());
                if (smc.isUsingMemory()) {
                    SessionManagerConfig.setCacheIdLength(0);
                }
            }
        }

        // session id max length (including all clones)
        final String propSessIdMax = "SessionIdentifierMaxLength";
        strProp = getStringProperty(propSessIdMax, xtpProperties);
        if (strProp != null) {
            try {
                int maxLength = Integer.parseInt(strProp);
                if (shouldSetAndDoLogging(propSessIdMax, true, baseServerLevelConfig, xtpProperties, new Integer(maxLength),
                                          new Integer(SessionManagerConfig.getMaxSessionIdentifierLength()), false)) {
                    SessionManagerConfig.setMaxSessionIdentifierLength(maxLength);
                }
            } catch (NumberFormatException nfe) {
                LoggingUtil.SESSION_LOGGER_CORE.logp(Level.WARNING, methodClassName, methodName, invalidPropFoundMessage, new Object[] { propSessIdMax, strProp });
            }
        }

        // clone separator change
        final String propCloneSepChange = "CloneSeparatorChange";
        strProp = getStringProperty(propCloneSepChange, xtpProperties);
        if (strProp != null) {
            booleanProp = Boolean.valueOf(strProp);
            if (shouldSetAndDoLogging(propCloneSepChange, true, baseServerLevelConfig, xtpProperties, booleanProp,
                                      Boolean.valueOf('+' == SessionManagerConfig.getCloneSeparator()),
                                      false)) {
                if (booleanProp.booleanValue()) {
                    SessionManagerConfig.setCloneSeparator('+');
                }
            }
        }

        // PM02068 Property for changing CloneSeparator.  
        final String propCloneSeparator = "CloneSeparator";
        strProp = getStringProperty(propCloneSeparator, xtpProperties);
        if (strProp != null) {
            // Must be exactly one char, and cannot be space
            if ((strProp.length() == 1) && (strProp.trim().length() == 1)) {
                if (shouldSetAndDoLogging(propCloneSeparator, true, baseServerLevelConfig, xtpProperties, strProp, null, false)) {
                    char charProp = strProp.charAt(0);
                    SessionManagerConfig.setCloneSeparator(charProp);
                }
            } else {
                LoggingUtil.SESSION_LOGGER_CORE.logp(Level.WARNING, methodClassName, methodName, invalidCloneSeparatorMessage,
                                                     new Object[] { strProp });
            }
        }

        // no affinity switch back - stick to new server after failover
        final String propNoAffSwitch = "NoAffinitySwitchBack";
        strProp = getStringProperty(propNoAffSwitch, xtpProperties);
        if (strProp != null) {
            booleanProp = Boolean.valueOf(strProp);
            if (shouldSetAndDoLogging(propNoAffSwitch, true, baseServerLevelConfig, xtpProperties, booleanProp, Boolean.valueOf(SessionManagerConfig.isNoAffinitySwitchBack()),
                                      false)) {
                SessionManagerConfig.setNoAffinitySwitchBack(booleanProp.booleanValue());
            }
        }

        // use oracle BLOB, rather than long raw, for medium db column
        final String propUseOracleBlob = "UseOracleBLOB";
        strProp = getStringProperty(propUseOracleBlob, xtpProperties);
        if (strProp != null) {
            booleanProp = Boolean.valueOf(strProp);
            if (shouldSetAndDoLogging(propUseOracleBlob, false, baseServerLevelConfig, xtpProperties, booleanProp, null, false)) {
                smc.setUseOracleBlob(booleanProp.booleanValue());
            }
        }

        // START: PM37139 Users who set this property to true should have already created their own index, so we skip index creation
        final String propSessionTableSkipIndexCreation = "SessionTableSkipIndexCreation";
        strProp = getStringProperty(propSessionTableSkipIndexCreation, xtpProperties);
        if (strProp != null) {
            booleanProp = Boolean.valueOf(strProp);
            if (shouldSetAndDoLogging(propSessionTableSkipIndexCreation, false, baseServerLevelConfig, xtpProperties, booleanProp, null, false)) {
                smc.setSessionTableSkipIndexCreation(booleanProp.booleanValue());
            }
        }
        // END: PM37139

        // START: PM57590
        final String propCheckSessionNewOnIsValidRequest = "CheckSessionNewOnIsValidRequest";
        strProp = getStringProperty(propCheckSessionNewOnIsValidRequest, xtpProperties);
        if (strProp != null) {
            booleanProp = Boolean.valueOf(strProp);
            if (shouldSetAndDoLogging(propCheckSessionNewOnIsValidRequest, false, baseServerLevelConfig, xtpProperties, booleanProp, null, false)) {
                smc.setCheckSessionNewOnIsValidRequest(booleanProp.booleanValue());
            }
        }
        // END: PM57590     

        // if the data source has a non default schema name, then we need to mark it as so
        final String propUsingCurrentSchemaCustomProperty = "UsingCustomSchemaName";
        strProp = getStringProperty(propUsingCurrentSchemaCustomProperty, xtpProperties);
        if (strProp != null) {
            booleanProp = Boolean.valueOf(strProp);
            if (shouldSetAndDoLogging(propUsingCurrentSchemaCustomProperty, false, baseServerLevelConfig, xtpProperties, booleanProp, null, false)) {
                smc.setUsingCustomSchemaName(booleanProp.booleanValue());
            }
        }

        // hide session values (in trace output)
        final String propHideSessVals = "HideSessionValues";
        strProp = getStringProperty(propHideSessVals, xtpProperties);
        if (strProp != null) {
            booleanProp = Boolean.valueOf(strProp);
            if (shouldSetAndDoLogging(propHideSessVals, true, baseServerLevelConfig, xtpProperties, booleanProp, Boolean.valueOf(SessionManagerConfig.isHideSessionValues()), false)) {
                SessionManagerConfig.setHideSessionValues(booleanProp.booleanValue());
                SessionManagerConfig.setHideSessionValuesPropertySet(true);
            }
        }

        // do remote invalidations - forces inval even if scheduled session inval
        // (twice a day) is enabled
        final String propDoRemoteInval = "DoRemoteInvalidations";
        strProp = getStringProperty(propDoRemoteInval, xtpProperties);
        if (strProp != null) {
            booleanProp = Boolean.valueOf(strProp);
            if (shouldSetAndDoLogging(propDoRemoteInval, true, baseServerLevelConfig, xtpProperties, booleanProp, Boolean.valueOf(SessionManagerConfig.isDoRemoteInvalidations()),
                                      false)) {
                SessionManagerConfig.setDoRemoteInvalidations(booleanProp.booleanValue());
            }
        }
        // session table name
        final String propSessTable = "SessionTableName";
        strProp = getStringProperty(propSessTable, xtpProperties);
        if (strProp != null) {
            if (shouldSetAndDoLogging(propSessTable, false, baseServerLevelConfig, xtpProperties, strProp, null, false)) {
                smc.setTableNameValue(strProp);
            }
        }

        // zOS Base Server Replication
        final String propZosBaseServerReplication = "HttpSessionEnableUnmanagedServerReplication";
        strProp = getStringProperty(propZosBaseServerReplication, xtpProperties);
        if (strProp != null) {
            booleanProp = Boolean.valueOf(strProp);
            if (shouldSetAndDoLogging(propZosBaseServerReplication, false, baseServerLevelConfig, xtpProperties, booleanProp, null, false)) {
                smc.setZosBaseServerReplicationEnabled(booleanProp.booleanValue());
            }
        }

        // servlet 21 compatibility -- aka global sessions
        final String propServlet21SessionCompat = "Servlet21SessionCompatibility";
        strProp = getStringProperty(propServlet21SessionCompat, xtpProperties);
        if (strProp != null) {
            booleanProp = Boolean.valueOf(strProp);
            if (shouldSetAndDoLogging(propServlet21SessionCompat, true, baseServerLevelConfig, xtpProperties, booleanProp,
                                      Boolean.valueOf(SessionManagerConfig.getServlet21SessionCompatibility()), false)) {
                SessionManagerConfig.setServlet21SessionCompatibility(booleanProp.booleanValue());
            }
        }

        // always encode the url even if cookies enabled is set
        final String propAlwaysEncode = "AlwaysEncodeURL";
        strProp = getStringProperty(propAlwaysEncode, xtpProperties);
        if (strProp != null) {
            booleanProp = Boolean.valueOf(strProp);
            if (shouldSetAndDoLogging(propAlwaysEncode, true, baseServerLevelConfig, xtpProperties, booleanProp, Boolean.valueOf(SessionManagerConfig.isAlwaysEncodeURL()), false)) {
                SessionManagerConfig.setAlwaysEncodeURL(booleanProp.booleanValue());
            }
        }
        
        // START: PM81933 Check session cookie name on EncodeURL method
        final String propCheckSessionCookieNameOnEncodeURL = "CheckSessionCookieNameOnEncodeURL";
        strProp = getStringProperty(propCheckSessionCookieNameOnEncodeURL, xtpProperties);
        if (strProp != null) {
            booleanProp = Boolean.valueOf(strProp);
            if (shouldSetAndDoLogging(propCheckSessionCookieNameOnEncodeURL, true, baseServerLevelConfig, xtpProperties, booleanProp, Boolean.valueOf(SessionManagerConfig.checkSessionCookieNameOnEncodeURL()), false)) {
                SessionManagerConfig.setCheckSessionCookieNameOnEncodeURL(booleanProp.booleanValue());
            }
        }
        // END: PM81933        

        // Optimizes the Version Increments if the in-memory session is the same as
        // the one stored on the backend. This property only applies to non-EOS
        // writes since we will always do this for EOS.
        final String propOptimizeCacheIdIncrements = "OptimizeCacheIdIncrements";
        strProp = getStringProperty(propOptimizeCacheIdIncrements, xtpProperties);
        if (strProp != null) {
            booleanProp = Boolean.valueOf(strProp);
            if (shouldSetAndDoLogging(propOptimizeCacheIdIncrements, false, baseServerLevelConfig, xtpProperties, booleanProp, null, false)) {
                smc.setOptimizeCacheIdIncrements(booleanProp.booleanValue());
            }
        }

        // only checks the cache vs the backend for updating the lastAccessedTime
        // during the preInvoke metho
        final String propOnlyCheckInCacheDuringPreInvoke = "OnlyCheckInCacheDuringPreInvoke";
        strProp = getStringProperty(propOnlyCheckInCacheDuringPreInvoke, xtpProperties);
        if (strProp != null) {
            booleanProp = Boolean.valueOf(strProp);
            if (shouldSetAndDoLogging(propOnlyCheckInCacheDuringPreInvoke, false, baseServerLevelConfig, xtpProperties, booleanProp, null, false)) {
                smc.setOnlyCheckInCacheDuringPreInvoke(booleanProp.booleanValue());
            }
        }

        // can be used to disable hot failover by setting to false - default is true
        final String propEnableHotFailover = "EnableHotFailover";
        strProp = getStringProperty(propEnableHotFailover, xtpProperties);
        if (strProp != null) {
            booleanProp = Boolean.valueOf(strProp);
            if (shouldSetAndDoLogging(propEnableHotFailover, true, baseServerLevelConfig, xtpProperties, booleanProp, Boolean.valueOf(SessionManagerConfig.isEnableHotFailover()),
                                      false)) {
                SessionManagerConfig.setEnableHotFailover(booleanProp.booleanValue());
            }
        }

        // PK38538 Begin
        final String propForceSessionInvalidationMultiple = "ForceSessionInvalidationMultiple";
        strProp = getStringProperty(propForceSessionInvalidationMultiple, xtpProperties);
        if (strProp != null) {
            try {
                int invalMult = new Integer(strProp).intValue();
                if (shouldSetAndDoLogging(propForceSessionInvalidationMultiple, false, baseServerLevelConfig, xtpProperties, new Integer(invalMult), null, false)) {
                    smc.setForceSessionInvalidationMultiple(invalMult);
                }
            } catch (NumberFormatException nfe) {
                LoggingUtil.SESSION_LOGGER_CORE.logp(Level.WARNING, methodClassName, methodName, invalidPropFoundMessage, new Object[] { propForceSessionInvalidationMultiple,
                                                                                                                                        strProp });
            }
        } // PK38538 End
        
        //PI73188 Start
        final String propModifyActiveCountOnInvalidatedSession = "ModifyActiveCountOnInvalidatedSession";
        strProp = getStringProperty(propModifyActiveCountOnInvalidatedSession, xtpProperties);
        if (strProp != null) {
            booleanProp = Boolean.valueOf(strProp);
            if (shouldSetAndDoLogging(propModifyActiveCountOnInvalidatedSession, true, baseServerLevelConfig, xtpProperties, booleanProp, null, false)) {
                smc.setModifyActiveCountOnInvalidatedSession(booleanProp.booleanValue());
            }
        }
        //PI73188 End
        
        
        final String propPersistSessionAfterPassivation = "PersistSessionAfterPassivation";
        strProp = getStringProperty(propPersistSessionAfterPassivation, xtpProperties);
        if (strProp != null) {
            booleanProp = Boolean.valueOf(strProp);
            if (shouldSetAndDoLogging(propPersistSessionAfterPassivation, false, baseServerLevelConfig, xtpProperties, booleanProp, null, false)) {
                smc.setPersistSessionAfterPassivation(booleanProp.booleanValue());
            }
        }

        final String propUsingApplicationSessionsAndInvalidateAll = "UsingApplicationSessionsAndInvalidateAll";
        strProp = getStringProperty(propUsingApplicationSessionsAndInvalidateAll, xtpProperties);
        if (strProp != null) {
            booleanProp = Boolean.valueOf(strProp);
            if (shouldSetAndDoLogging(propUsingApplicationSessionsAndInvalidateAll, true, baseServerLevelConfig, xtpProperties, booleanProp,
                                      Boolean.valueOf(SessionManagerConfig.getUsingApplicationSessionsAndInvalidateAll()), false)) {
                SessionManagerConfig.setUsingApplicationSessionsAndInvalidateAll(booleanProp.booleanValue());
            }
        }

        final String propUsingApplicationSessionsAlwaysRetrieve = "UsingApplicationSessionsAlwaysRetrieve";
        strProp = getStringProperty(propUsingApplicationSessionsAlwaysRetrieve, xtpProperties);
        if (strProp != null) {
            booleanProp = Boolean.valueOf(strProp);
            if (shouldSetAndDoLogging(propUsingApplicationSessionsAlwaysRetrieve, true, baseServerLevelConfig, xtpProperties, booleanProp,
                                      Boolean.valueOf(SessionManagerConfig.getUsingApplicationSessionsAlwaysRetrieve()), false)) {
                SessionManagerConfig.setUsingApplicationSessionsAlwaysRetrieve(booleanProp.booleanValue());
            }
        }

        // clone id
        final String propSIPCookieName = "SIPCookieName";
        strProp = getStringProperty(propSIPCookieName, xtpProperties);
        if (strProp != null) {
            if (shouldSetAndDoLogging(propSIPCookieName, true, baseServerLevelConfig, xtpProperties, strProp, SessionManagerConfig.getSipSessionCookieName(),
                                      strProp.equals(SessionManagerConfig.getSipSessionCookieName()))) {
                SessionManagerConfig.setSipSessionCookieName(strProp);
            }
        }
        
        //Property that allows the thread scheduler to be changed
        final String newScheduler= "UseSeparateSessionInvalidatorThreadPool";
        strProp = getStringProperty(newScheduler, xtpProperties);
        if(strProp != null){
            booleanProp=Boolean.valueOf(strProp);
            if (shouldSetAndDoLogging(newScheduler, false, baseServerLevelConfig, xtpProperties, booleanProp, null, false)) {
                smc.setUseSeparateSessionInvalidatorThreadPool(booleanProp.booleanValue());
            }
        }        

        //PM74718 Property to control how long to delay the start of the invalidation alarm.
        final String invalidatorAlarmDelay = "DelayInvalidationAlarmDuringServerStartup";
        strProp = getStringProperty(invalidatorAlarmDelay, xtpProperties);
        if (strProp != null) {
            try {
                Integer delayProp = Integer.valueOf(strProp);
                if (shouldSetAndDoLogging(invalidatorAlarmDelay, false, baseServerLevelConfig, xtpProperties, delayProp, null, false)) {
                    smc.setDelayForInvalidationAlarmDuringServerStartup(delayProp.intValue());
                }
            } catch (NumberFormatException nfe) {
                LoggingUtil.SESSION_LOGGER_CORE.logp(Level.WARNING, methodClassName, methodName, invalidPropFoundMessage,new Object[] {invalidatorAlarmDelay, strProp});
            }
        }

        // PK80439 Property for preventing session ids longer than the permissible length getting created
        final String propForceSessionIdLengthCheck = "ForceSessionIdLengthCheck";
        strProp = getStringProperty(propForceSessionIdLengthCheck, xtpProperties);
        if (strProp != null) {
            booleanProp = Boolean.valueOf(strProp);
            if (shouldSetAndDoLogging(propForceSessionIdLengthCheck, false, baseServerLevelConfig, xtpProperties, booleanProp, null, false)) {
                smc.setForceSessionIdLengthCheck(booleanProp.booleanValue());
            }
        }
        // PK80439 End

        // PM04304 Property for ignoring case while comparing session owner and authorized user
        final String securityUserIgnoreCase = "SecurityUserIgnoreCase";
        strProp = getStringProperty(securityUserIgnoreCase, xtpProperties);
        if (strProp != null) {
            booleanProp = Boolean.valueOf(strProp);
            if (shouldSetAndDoLogging(securityUserIgnoreCase, false, baseServerLevelConfig, xtpProperties, booleanProp, null, false)) {
                smc.setSecurityUserIgnoreCase(booleanProp.booleanValue());
            }
        }

        //712446
        final String throwSecurityExceptionOnGetSessionFalse = "ThrowSecurityExceptionOnGetSessionFalse";
        strProp = getStringProperty(throwSecurityExceptionOnGetSessionFalse, xtpProperties);
        if (strProp != null) {
            booleanProp = Boolean.valueOf(strProp);
            if (shouldSetAndDoLogging(throwSecurityExceptionOnGetSessionFalse, false, baseServerLevelConfig, xtpProperties, booleanProp, null, false)) {
                smc.setThrowSecurityExceptionOnGetSessionFalse(booleanProp.booleanValue());
            }
        }

        final String invalidateOnUnauthorizedSessionRequestException = "InvalidateOnUnauthorizedSessionRequestException";
        strProp = getStringProperty(invalidateOnUnauthorizedSessionRequestException, xtpProperties);
        if (strProp != null) {
            booleanProp = Boolean.valueOf(strProp);
            if (shouldSetAndDoLogging(invalidateOnUnauthorizedSessionRequestException, false, baseServerLevelConfig, xtpProperties, booleanProp, null, false))
                smc.setInvalidateOnUnauthorizedSessionRequestException(booleanProp.booleanValue());
        }
        
        
        // PI18177 We will check incoming cloneIds against this string, needs HttpSessionCloneId to be set to take effect
        final String expectedCloneIds = "ExpectedCloneIds";
        strProp = getStringProperty(expectedCloneIds, xtpProperties);
        if (strProp != null) {
            if (shouldSetAndDoLogging(expectedCloneIds, true, baseServerLevelConfig, xtpProperties, strProp, null, false)) {
                SessionManagerConfig.setExpectedCloneIds(strProp);
                SessionManagerConfig.setExpectedCloneIdsPropertySet(true);
            }
        }
        
        // Feature 68570 Begin
        final String propConnectionRetryCount = "ConnectionRetryCount";
        strProp = getStringProperty(propConnectionRetryCount, xtpProperties);
        if (strProp != null) {
            try {
                int retryCount = new Integer(strProp).intValue();
                if (shouldSetAndDoLogging(propConnectionRetryCount, false, baseServerLevelConfig, xtpProperties, new Integer(retryCount), null, false)) {
                    smc.setConnectionRetryCount(retryCount);
                }
            } catch (NumberFormatException nfe) {
                LoggingUtil.SESSION_LOGGER_CORE.logp(Level.WARNING, methodClassName, methodName, invalidPropFoundMessage, new Object[] { propConnectionRetryCount,
                                                                                                                                        strProp });
            }
        } // Feature 68570 End

    }
1144468
public static StackTraceElement determineCauseStackTraceElementsn(Throwable e)
	{
		
		if(e.getCause() != null)
			return determineCauseStackTraceElementsn(e.getCause());
		
		StackTraceElement[] stackTraceElements = e.getStackTrace();
		
		if(stackTraceElements == null || stackTraceElements.length == 0)
			return null;

		
		return stackTraceElements[0];
		
	}
1256037
@Override
    public void printStackTrace(final PrintStream s) {
        super.printStackTrace(s);
        if (mRootCause != null) {
            s.println("--- ROOT CAUSE ---");
            mRootCause.printStackTrace(s);
        }
    }
341984
protected void initSessionConfig(XmlParser.Node node)
    {
        XmlParser.Node tNode=node.get("session-timeout");
        if(tNode!=null)
        {
            int timeout=Integer.parseInt(tNode.toString(false,true));
            getWebApplicationHandler().setSessionInactiveInterval(timeout*60);
        }
    }
613973
private void ensureLength(FieldDescriptorDef fieldDef, String checkLevel)
    {
        if (!fieldDef.hasProperty(PropertyHelper.OJB_PROPERTY_LENGTH))
        {
            String defaultLength = JdbcTypeHelper.getDefaultLengthFor(fieldDef.getProperty(PropertyHelper.OJB_PROPERTY_JDBC_TYPE));

            if (defaultLength != null)
            {
                LogHelper.warn(true,
                               FieldDescriptorConstraints.class,
                               "ensureLength",
                               "The field "+fieldDef.getName()+" in class "+fieldDef.getOwner().getName()+" has no length setting though its jdbc type requires it (in most databases); using default length of "+defaultLength);
                fieldDef.setProperty(PropertyHelper.OJB_PROPERTY_LENGTH, defaultLength);
            }
        }
    }
1047530
@Override
    public void setContentLengthLong (long len) {
        String methodName = "setContentLengthLong";
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { 
            logger.entering(CLASS_NAME, methodName, "length --> " + String.valueOf(len) + " ["+this+"]");
        }

        // check the include flag
        WebAppDispatcherContext dispatchContext = (WebAppDispatcherContext) getRequest().getWebAppDispatcherContext();
        if (dispatchContext.isInclude() == true) {
            if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
                logger.logp(Level.FINE, CLASS_NAME, methodName, nls.getString("Illegal.from.included.servlet", "Illegal from included servlet"), methodName + " length --> " + String.valueOf(len));  //311717
            }
        }
        else
        {
            if (_response!=null) {
                if (!_response.isCommitted()) {
                    ((IResponse31)_response).setContentLengthLong(len);
                }
            }
            _contentLength = len;
            
            _bufferedWriter.setLimitLong(_contentLength);
            //still want to try to set the header even if the response is committed to throw the warning
            setHeader(HEADER_CONTENT_LENGTH, Long.toString(_contentLength)); // TODO SERVLET 3.1 - Need "long" implementation??
        }
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {  //306998.15
            logger.exiting(CLASS_NAME, methodName);
        }
       
    }
240071
@Override
    public void error(VirtualConnection vc, TCPReadRequestContext rsc, IOException ioe) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "error() called: " + vc);
        }

        HttpInboundLink myLink = (HttpInboundLink) (vc == null ? null : vc.getStateMap().get(CallbackIDs.CALLBACK_HTTPICL));
        if (myLink == null)
        {

            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "error: myLink is null");

            }

        }

        else {

            HttpInboundServiceContextImpl isc = myLink.getHTTPContext();
            isc.setPersistent(false);
            myLink.setFilterCloseExceptions(true);
            // if there was no data in the 2nd or later request, then just close
            // as this would be a timeout on the persist read. All other cases
            // we should send the 408 Request Timeout error page back
            if ((myLink.isFirstRequest() || myLink.isPartiallyParsed())
                && (ioe instanceof SocketTimeoutException)) {
                try {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "Error, sending 408 timeout back");
                    }
                    if (isc.getHttpConfig().getDebugLog().isEnabled(DebugLog.Level.WARN)) {
                        isc.getHttpConfig().getDebugLog().log(DebugLog.Level.WARN, HttpMessages.MSG_READ_FAIL, isc);
                    }
                    isc.setHeadersParsed();
                    isc.sendError(StatusCodes.REQ_TIMEOUT.getHttpError());
                } catch (MessageSentException mse) {
                    FFDCFilter.processException(mse, getClass().getName() + ".error", "152");
                    // shouldn't be possible since we're timing out during the
                    // read for the inbound request
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "MessageSent error during ICL read error");
                    }
                    myLink.close(vc, ioe);
                }
            } else {
                // this is during the read for a secondary request message with no
                // current parse taking place.
                myLink.close(vc, ioe);
            }
        }
    }
535094
private void initWebClientConfig() {
        m_webClientConfig = new WebClientConfiguration();

        if (getParameter("httpClientTimeoutSecs") != null)
            m_webClientConfig.setTimeoutSecs(Integer.parseInt(getParameter("httpClientTimeoutSecs")));

        if (getParameter("httpClientSocketTimeoutSecs") != null)
            m_webClientConfig.setSockTimeoutSecs(Integer.parseInt(getParameter("httpClientSocketTimeoutSecs")));

        if (getParameter("httpClientMaxConnectionsPerHost") != null)
            m_webClientConfig.setMaxConnPerHost(Integer.parseInt(getParameter("httpClientMaxConnectionsPerHost")));

        if (getParameter("httpClientMaxTotalConnections") != null)
            m_webClientConfig.setMaxTotalConn(Integer.parseInt(getParameter("httpClientMaxTotalConnections")));

        if (getParameter("httpClientFollowRedirects") != null)
            m_webClientConfig.setFollowRedirects(Boolean.parseBoolean(getParameter("httpClientFollowRedirects")));

        if (getParameter("httpClientMaxFollowRedirects") != null)
            m_webClientConfig.setMaxRedirects(Integer.parseInt(getParameter("httpClientMaxFollowRedirects")));

        if (getParameter("httpClientUserAgent") != null)
            m_webClientConfig.setUserAgent(getParameter("httpClientUserAgent"));
    }