Liberty Change for CXF End
428686
@SuppressWarnings("unchecked")
    public static void injectConstructorProxies(Object o,
                                                AbstractResourceInfo cri,
                                                Message m) {

        Map<Class<?>, ThreadLocalProxy<?>> proxies = cri.getConstructorProxies();
        if (proxies != null) {
            for (Map.Entry<Class<?>, ThreadLocalProxy<?>> entry : proxies.entrySet()) {
                Object value = JAXRSUtils.createContextValue(m, entry.getKey(), entry.getKey());
                ((ThreadLocalProxy<Object>) entry.getValue()).set(value);
            }
        }
    }
102365
function replaceWithTemplateType(start, end) {
    var templateToken = {
      type: "Template",
      value: createTemplateValue(start, end),
      start: tokens[start].start,
      end: tokens[end].end,
      loc: {
        start: tokens[start].loc.start,
        end: tokens[end].loc.end
      }
    };

    // put new token in place of old tokens
    tokens.splice(start, end - start + 1, templateToken);
  }
518605
protected void activate(ComponentContext cc) {
        // Save bundle context for later usage
        BundleContext context = cc.getBundleContext();
        JMXMBeanServerDelegation.INSTANCE.context = context;

        // Create instance of JmxInitializer, set single instance of this class
        // into JmxInitializer as MBeanServer
        LibertyApplicationBusFactory busFactory = LibertyApplicationBusFactory.getInstance();
        jmxInitializer = new JMXBusInitializer(JMXMBeanServerDelegation.getInstance());
        busFactory.registerApplicationBusListener(jmxInitializer);
    }
87863
function xframeFactory(options) {
  options = options || {};

  var str = 'DENY';
  if (isString(options)) {
    str = options;
  } else {
    if (options.sameOrigin) {
      str = 'SAMEORIGIN';
    }
    if (options.allow) {
      if (options.sameOrigin) {
        throw new Error('Cannot specify both ALLOW-FROM and SAMEORIGIN');
      }

      str = 'ALLOW-FROM ' + options.allow;
    }
  }

  return function xframe(req, res, next) {
    res.setHeader(HEADER, str);
    next();
  };
}
611154
public void endElement(String namespaceURI, String localName, String qName) throws SAXException
    {
        if (localName.equalsIgnoreCase(TABLE))
        {
            if (startTable)
                if (m_record.getEditMode() == DBConstants.EDIT_ADD)
                {
                    try {
                        m_record.add();
                    } catch (DBException e) {
                        e.printStackTrace();
                    }
                }
            startTable = false;
        }
    }
115641
private static synchronized void addTransformer() {
        if (detailedTransformTrace && tc.isEntryEnabled())
            Tr.entry(tc, "addTransformer");

        if (registeredTransformer == null && instrumentation != null) {
            registeredTransformer = new LibertyRuntimeTransformer();
            instrumentation.addTransformer(registeredTransformer, true);
        }

        if (detailedTransformTrace && tc.isEntryEnabled())
            Tr.exit(tc, "addTransformer");
    }
1270013
protected static void replaceXrefsWithRelatedER(
		Collection<BioPAXElement> elements)
	{
		Set<EntityReference> ers = new HashSet<EntityReference>();
		Set<Xref> xrefs = new HashSet<Xref>();
		for (BioPAXElement element : elements)
		{
			if (element instanceof Xref)
			{
				xrefs.add((Xref) element);
				for (XReferrable able : ((Xref) element).getXrefOf())
				{
					if (able instanceof EntityReference)
					{
						ers.add((EntityReference) able);
					}
				}
			}
		}

		elements.removeAll(xrefs);
		for (EntityReference er : ers)
		{
			if (!elements.contains(er)) elements.add(er);
		}
	}
338628
public static void mergeHandlerChains(PortComponent portComp,
                                          EndpointInfo endpointInfo) {

        if (endpointInfo == null || portComp == null) {
            return;
        }

        HandlerChainsInfo hChainsInfo = new HandlerChainsInfo();

        List<HandlerChain> handlerChains = portComp.getHandlerChains();

        if (handlerChains == null || handlerChains.size() == 0) {
            return;
        }

        for (HandlerChain hChain : handlerChains) {

            HandlerChainInfo chainInfo = new HandlerChainInfo();

            // set portQName and serviceQName
            QName qName = convertDDQNameToQName(hChain.getPortNamePattern());
            if (qName != null) {
                // If endpointInfo's portQName could match the
                // handlerChain's portName, just ignore the followed
                // handlers
                if (!JaxWsUtils.matchesQName(qName, endpointInfo.getWsdlPort(),
                                             true)) {
                    continue;
                }
                chainInfo.setPortNamePattern(qName);
            }

            qName = convertDDQNameToQName(hChain.getServiceNamePattern());
            if (qName != null) {
                if (!JaxWsUtils.matchesQName(qName, endpointInfo
                                .getWsdlService(), true)) {
                    continue;
                }
                chainInfo.setServiceNamePattern(qName);
            }
            // set protocol bindings
            List<String> bindings = hChain.getProtocolBindings();
            boolean include = false;
            if (bindings != null) {
                for (String binding : bindings) {
                    if (JaxWsUtils.singleProtocolMatches(binding, endpointInfo
                                    .getProtocolBinding())) {
                        include |= true;
                    }
                    chainInfo.addProtocolBinding(JaxWsUtils.getProtocolByToken(binding));
                }
                // if the binding protocol is not support, just ignore the
                // handlers
                if (!include && !bindings.isEmpty()) {
                    continue;
                }
            }
            // set handlers
            for (Handler handler : hChain.getHandlers()) {

                HandlerInfo hInfo = new HandlerInfo();

                // handler-class
                String handlerClass = handler.getHandlerClassName();

                if (handlerClass == null || "".equals(handlerClass)) {
                    Tr.warning(tc, "warn.dd.invalid.handler", "<handler-class>", endpointInfo.getPortComponentName());
                    continue;
                }

                // handler-name
                String handlerName = handler.getHandlerName();

                if (handlerName == null || "".equals(handlerName)) {
                    Tr.warning(tc, "warn.dd.invalid.handler", "<handler-name>", endpointInfo.getPortComponentName());
                    continue;
                }

                hInfo.setHandlerClass(handlerClass);
                hInfo.setHandlerName(handlerName);

                // port-name
                List<String> portNames = handler.getPortNames();

                for (String portName : portNames) {
                    hInfo.addPortName(portName);
                }

                // soap-role
                List<String> soapRoles = handler.getSoapRoles();

                for (String soapRole : soapRoles) {
                    hInfo.addSoapRole(soapRole);
                }

                // soap-header
                List<com.ibm.ws.javaee.dd.common.QName> soapHeaders = handler
                                .getSoapHeaders();

                for (com.ibm.ws.javaee.dd.common.QName soapHeader : soapHeaders) {
                    hInfo.addSoapHeader(new XsdQNameInfo(new QName(
                                                                   soapHeader.getNamespaceURI(), soapHeader
                                                                                   .getLocalPart()), ""));// no id info...
                }

                // init-param(rpc)
                List<ParamValue> initParams = handler.getInitParams();

                for (ParamValue pv : initParams) {
                    hInfo.addInitParam(new ParamValueInfo(pv.getName(), pv
                                    .getValue()));
                }

                chainInfo.addHandlerInfo(hInfo);
            }

            hChainsInfo.addHandlerChainInfo(chainInfo);
        }

        if (!hChainsInfo.getHandlerChainInfos().isEmpty()) {
            /**
             * According to the behavior of tWAS, just replace the handlerChain
             * from @HandlerChain
             * 
             * site here: 582987 per JSR 109 6.2.2.3, handler chains specified
             * in the dd override handler chain annotations. We can not have
             * both HCannotations and HCtypes set in the dbc, so wipe out the
             * annotations here
             */
            endpointInfo.setHandlerChainsInfo(hChainsInfo);
        }
    }
1088786
private void configureJMXetricAgent() throws XPathExpressionException,
			Exception {
		// Gets the config for the samplers
		NodeList samples = getXmlNodeList("/jmxetric-config/sample",
				inputSource);
		for (int i = 0; i < samples.getLength(); i++) {
			Node sample = samples.item(i);
			MBeanSampler mbSampler = makeMBeanSampler(sample);
			agent.addSampler(mbSampler);
		}
	}
853368
public void endContextClassLoader(ClassLoader raClassLoader, ClassLoader previousClassLoader) {
        if (raClassLoader != null) {
            AccessController.doPrivileged(new GetAndSetContextClassLoader(previousClassLoader));
        }
    }
562543
private void addCamelContextToRegistar(Endpoint endpoint) {
        Bus bus = null;
        try {
            if (endpoint instanceof CxfEndpoint) {
                // getBus creates a new one if none
                bus = ((CxfEndpoint) endpoint).getBus();

            } else if (endpoint instanceof CxfRsEndpoint) {
                JAXRSServerFactoryBean jaxrsServerFactoryBean = CamelContextHelper.lookup(endpoint.getCamelContext(), ((CxfRsEndpoint) endpoint).getBeanId(), JAXRSServerFactoryBean.class);
                if (jaxrsServerFactoryBean != null) {
                    bus = jaxrsServerFactoryBean.getBus();
                }
            }
        } catch (Exception e) {
            // nothing special
        }
        if (bus != null) {
            log.debug("Linking bus={} with {}" + bus.getId(), endpoint.getCamelContext());
            locatorRegistrar.getRegistrar(bus).setCamelContext(endpoint.getCamelContext());
        }
    }
1264146
public static void setBundleRendererContext(ServletRequest request, String resourceType,
			BundleRendererContext ctx) {
		String globalBundleAddedAttributeName = BUNDLE_RENDERER_CONTEXT_ATTR_PREFIX + resourceType;
		request.setAttribute(globalBundleAddedAttributeName, ctx);
	}
1075303
private void modifyEndNodes(final Principal user, final NodeInterface startNode, final NodeInterface endNode, final RelationshipInterface rel, final boolean isDeletion) {

		// only modify if nodes are accessible
		if (startNode != null && endNode != null) {

			final RelationshipType relType = rel.getRelType();

			if (RelType.OWNS.equals(relType)) {

				modifyOwner(startNode);
				modifyOwner(endNode);
				return;
			}

			if (RelType.SECURITY.equals(relType)) {

				modifySecurity(startNode);
				modifySecurity(endNode);
				return;
			}

			if (RelType.IS_AT.equals(relType)) {

				modifyLocation(startNode);
				modifyLocation(endNode);
				return;
			}

			final Relation relation  = Relation.getInstance((Class)rel.getClass());
			final PropertyKey source = relation.getSourceProperty();
			final PropertyKey target = relation.getTargetProperty();
			final Object sourceValue = source != null && source.isCollection() ? new LinkedList<>() : null;
			final Object targetValue = target != null && target.isCollection() ? new LinkedList<>() : null;

			modify(user, startNode, target, null, targetValue);
			modify(user, endNode, source, null, sourceValue);

			if (source != null && target != null) {

				if (isDeletion) {

					// update removed properties
					getState(startNode).remove(target, endNode);
					getState(endNode).remove(source, startNode);

				} else {


					// update added properties
					getState(startNode).add(target, endNode);
					getState(endNode).add(source, startNode);
				}

			} else {

				// dont log so much..
				//logger.warn("No properties registered for {}: source: {}, target: {}", rel.getClass(), source, target);
			}
		}
	}
739027
@Override
	public void endElement(String uri, String localName, String qName) throws SAXException {
		if(localName.equals("sessionid")) {
			String session = characters.toString();
			configs.put(session, session);

			log.info("Found Session '" + session + "'");	// with href: " + atts.getValue("href")
		}
		characters.setLength(0);
	}
155492
function endCompiling(schema, root, baseId) {
  /* jshint validthis: true */
  var i = compIndex.call(this, schema, root, baseId);
  if (i >= 0) this._compilations.splice(i, 1);
}
371444
@FFDCIgnore(value = { NoSuchMethodException.class, NumberFormatException.class, Exception.class })
    // Liberty Change for CXF End
    @SuppressWarnings("unchecked")
    public static <T> T handleParameter(String value,
                                        boolean decoded,
                                        Class<T> pClass,
                                        Type genericType,
                                        Annotation[] paramAnns,
                                        ParameterType pType,
                                        Message message) {
        if (value == null) {
            return null;
        }

        //fix new Date("") throw exception defect
        if (value.isEmpty() && genericType == Date.class) {
            return null;
        }

        if (pType == ParameterType.PATH) {
            if (PathSegment.class.isAssignableFrom(pClass)) {
                return pClass.cast(new PathSegmentImpl(value, decoded));
            } else if (!MessageUtils.isTrue(
                            message.getContextualProperty(IGNORE_MATRIX_PARAMETERS))) {
                value = new PathSegmentImpl(value, false).getPath();
            }
        }

        value = decodeValue(value, decoded, pType);

        Object result = null;
        try {
            result = createFromParameterHandler(value, pClass, genericType, paramAnns, message);
        } catch (IllegalArgumentException nfe) {
            throw createParamConversionException(pType, nfe);
        }
        if (result != null) {
            T theResult = null;
            if (pClass.isPrimitive()) {
                theResult = (T) result;
            } else {
                theResult = pClass.cast(result);
            }
            return theResult;
        }
        if (Number.class.isAssignableFrom(pClass) && "".equals(value)) {
            //pass empty string to boxed number type will result in 404
            return null;
        }
        if (Boolean.class == pClass) {
            // allow == checks for Boolean object
            pClass = (Class<T>) Boolean.TYPE;
        }
        if (pClass.isPrimitive()) {
            try {
                @SuppressWarnings("unchecked")
                T ret = (T) PrimitiveUtils.read(value, pClass);
                // cannot us pClass.cast as the pClass is something like
                // Boolean.TYPE (representing the boolean primitive) and
                // the object is a Boolean object
                return ret;
            } catch (NumberFormatException nfe) {
                throw createParamConversionException(pType, nfe);
            }
        }

        boolean adapterHasToBeUsed = false;
        Class<?> cls = pClass;
        Class<?> valueType = JAXBUtils.getValueTypeFromAdapter(pClass, pClass, paramAnns);
        if (valueType != cls) {
            cls = valueType;
            adapterHasToBeUsed = true;
        }
        if (pClass == String.class && !adapterHasToBeUsed) {
            return pClass.cast(value);
        }
        // check constructors accepting a single String value
        try {
            Constructor<?> c = cls.getConstructor(new Class<?>[] { String.class });
            result = c.newInstance(new Object[] { value });
        } catch (NoSuchMethodException ex) {
            // try valueOf
        } catch (WebApplicationException ex) {
            throw ex;
        } catch (Exception ex) {
            Throwable t = getOrThrowActualException(ex);
            Tr.warning(tc, new org.apache.cxf.common.i18n.Message("CLASS_CONSTRUCTOR_FAILURE",
                            BUNDLE,
                            pClass.getName()).toString());
            Response r = JAXRSUtils.toResponse(HttpUtils.getParameterFailureStatus(pType));
            throw ExceptionUtils.toHttpException(t, r);
        }
        if (result == null) {
            // check for valueOf(String) static methods
            String[] methodNames = cls.isEnum()
                            ? new String[] { "fromString", "fromValue", "valueOf" }
                            : new String[] { "valueOf", "fromString" };
            result = evaluateFactoryMethods(value, pType, result, cls, methodNames);
        }

        if (adapterHasToBeUsed) {
            // as the last resort, try XmlJavaTypeAdapters
            Object valueToReplace = result != null ? result : value;
            try {
                result = JAXBUtils.convertWithAdapter(valueToReplace, pClass, paramAnns);
            } catch (Throwable ex) {
                result = null;
            }
        }

        if (result == null) {
            reportServerError("WRONG_PARAMETER_TYPE", pClass.getName());
        }

        return pClass.cast(result);
    }
593165
public void endElement(String uri, String name, String qName)
    {
        boolean isDebug = logger.isDebugEnabled();
        try
        {
            switch (getLiteralId(qName))
            {
                case MAPPING_REPOSITORY:
                    {
                        if (isDebug) logger.debug(" < " + tags.getTagById(MAPPING_REPOSITORY));
                        this.m_CurrentAttrContainer = null;
                        m_CurrentCLD = null;
                        break;
                    }
                case CLASS_DESCRIPTOR:
                    {
                        if (isDebug) logger.debug("  < " + tags.getTagById(CLASS_DESCRIPTOR));
                        m_CurrentCLD = null;
                        this.m_CurrentAttrContainer = null;
                        break;
                    }
                case OBJECT_CACHE:
                    {
                        if(m_CurrentAttrContainer != null)
                        {
                            if (isDebug) logger.debug("     < " + tags.getTagById(OBJECT_CACHE));
                        }
                        this.m_CurrentAttrContainer = m_CurrentCLD;
                        break;
                    }
                case CLASS_EXTENT:
                    {
                        break;
                    }
                case FIELD_DESCRIPTOR:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(FIELD_DESCRIPTOR));
                        m_CurrentFLD = null;
                        m_CurrentAttrContainer = m_CurrentCLD;
                        break;
                    }
                case REFERENCE_DESCRIPTOR:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(REFERENCE_DESCRIPTOR));
                        m_CurrentORD = null;
                        m_CurrentAttrContainer = m_CurrentCLD;
                        break;
                    }
                case FOREIGN_KEY:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(FOREIGN_KEY));
                        break;
                    }
                case COLLECTION_DESCRIPTOR:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(COLLECTION_DESCRIPTOR));
                        m_CurrentCOD = null;
                        m_CurrentAttrContainer = m_CurrentCLD;
                        break;
                    }
                case INVERSE_FK:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(INVERSE_FK));
                        break;
                    }
                case ORDERBY :
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(ORDERBY));
                        break;
                    }
                case FK_POINTING_TO_THIS_CLASS:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(FK_POINTING_TO_THIS_CLASS));
                        break;
                    }
                case FK_POINTING_TO_ITEMS_CLASS:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(FK_POINTING_TO_ITEMS_CLASS));
                        break;
                    }
                case ATTRIBUTE:
                    {
                        if(m_CurrentAttrContainer != null)
                        {
                            if (isDebug) logger.debug("      < " + tags.getTagById(ATTRIBUTE));
                        }
                        break;
                    }
                case DOCUMENTATION:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(DOCUMENTATION));
                        break;
                    }
//                case SEQUENCE_MANAGER:
//                    {
//                        // currently not used on class-descriptor level
//                        // if (isDebug) logger.debug("    < " + tags.getTagById(SEQUENCE_MANAGER));
//                        this.m_CurrentAttrContainer = null;
//                        break;
//                    }
//                case CONNECTION_POOL:
//                    {
//                        // not used on class-descriptor level
//                        // if (isDebug) logger.debug("    < " + tags.getTagById(CONNECTION_POOL));
//                        this.m_CurrentAttrContainer = null;
//                        break;
//                    }
//                case JDBC_CONNECTION_DESCRIPTOR:
//                    {
//                        // not used on class-descriptor level
//                        // if (isDebug) logger.debug("    < " + tags.getTagById(JDBC_CONNECTION_DESCRIPTOR));
//                        this.m_CurrentAttrContainer = null;
//                        break;
//                    }
                case QUERY_CUSTOMIZER:
                    {
                        m_CurrentAttrContainer = m_CurrentCOD;
                        break;
                    }
                case INDEX_DESCRIPTOR:
                    {
                        m_CurrentCLD.getIndexes().add(m_CurrentIndexDescriptor);
                        m_CurrentIndexDescriptor = null;
                        break;
                    }
                case INDEX_COLUMN:
                    {
                        // ignore; all processing done in startElement
                        break;
                    }
                case INSERT_PROCEDURE:
                {
                    if (isDebug) logger.debug("    < " + tags.getTagById(INSERT_PROCEDURE));
                    m_CurrentCLD.setInsertProcedure((InsertProcedureDescriptor)m_CurrentProcedure);
                    m_CurrentProcedure = null;
                    break;
                }
                case UPDATE_PROCEDURE:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(UPDATE_PROCEDURE));
                        m_CurrentCLD.setUpdateProcedure((UpdateProcedureDescriptor)m_CurrentProcedure);
                        m_CurrentProcedure = null;
                        break;
                    }
                case DELETE_PROCEDURE:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(DELETE_PROCEDURE));
                        m_CurrentCLD.setDeleteProcedure((DeleteProcedureDescriptor)m_CurrentProcedure);
                        m_CurrentProcedure = null;
                        break;
                    }
                case CONSTANT_ARGUMENT:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(CONSTANT_ARGUMENT));
                        break;
                    }
                case RUNTIME_ARGUMENT:
                    {
                        if (isDebug) logger.debug("    < " + tags.getTagById(RUNTIME_ARGUMENT));
                        break;
                    }

                    // handle failure:
                default :
                    {
                        logger.debug("Ignoring unused Element " + qName);
                    }
            }
        }
        catch (Exception ex)
        {
            if(ex instanceof MetadataException) throw (MetadataException) ex;
            else throw new MetadataException("Exception when reading metadata information,"+
                    " please check your repository.xml file", ex);
        }
    }