code
stringlengths
73
34.1k
label
stringclasses
1 value
@GET @Path("/verifyInjectedOptionalCustomMissing") @Produces(MediaType.APPLICATION_JSON) public JsonObject verifyInjectedOptionalCustomMissing() { boolean pass = false; String msg; // custom-missing Optional<Long> customValue = custom.getValue(); if(customValue == null) { msg = "custom-missing value is null, FAIL"; } else if(!customValue.isPresent()) { msg = "custom-missing PASS"; pass = true; } else { msg = String.format("custom: %s != %s", null, customValue.get()); } JsonObject result = Json.createObjectBuilder() .add("pass", pass) .add("msg", msg) .build(); return result; }
java
public static void addExtendedProperty(String propName, String dataType, boolean multiValued, Object defaultValue) { if (dataType == null || "null".equalsIgnoreCase(dataType)) return; if (extendedPropertiesDataType.containsKey(propName)) { Tr.warning(tc, WIMMessageKey.DUPLICATE_PROPERTY_EXTENDED, new Object[] { propName, "PersonAccount" }); return; } if (getPropertyNames("PersonAccount").contains(propName)) { Tr.warning(tc, WIMMessageKey.DUPLICATE_PROPERTY_ENTITY, new Object[] { propName, "PersonAccount" }); return; } extendedPropertiesDataType.put(propName, dataType); if (defaultValue != null) extendedPropertiesDefaultValue.put(propName, defaultValue); if (multiValued) extendedMultiValuedProperties.add(propName); }
java
private static String depluralize(String s) { if (s.endsWith("ies")) { return s.substring(0, s.length() - 3) + 'y'; } if (s.endsWith("s")) { return s.substring(0, s.length() - 1); } return s; }
java
private static String hyphenatedToCamelCase(String s) { Matcher m = Pattern.compile("(?:^|-)([a-z])").matcher(s); StringBuilder b = new StringBuilder(); int last = 0; for (; m.find(); last = m.end()) { b.append(s, last, m.start()).append(Character.toUpperCase(m.group(1).charAt(0))); } return b.append(s, last, s.length()).toString(); }
java
private static String upperCaseFirstChar(String s) { return Character.toUpperCase(s.charAt(0)) + s.substring(1); }
java
private static List<TypeMirror> getAnnotationClassValues(Element member, Annotation annotation, String annotationMemberName) { for (AnnotationMirror annotationMirror : member.getAnnotationMirrors()) { if (((TypeElement) annotationMirror.getAnnotationType().asElement()).getQualifiedName().contentEquals(annotation.annotationType().getName())) { for (Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> entry : annotationMirror.getElementValues().entrySet()) { if (entry.getKey().getSimpleName().contentEquals(annotationMemberName)) { @SuppressWarnings({ "unchecked", "rawtypes" }) List<AnnotationValue> types = (List) entry.getValue().getValue(); TypeMirror[] result = new TypeMirror[types.size()]; for (int i = 0; i < types.size(); i++) { result[i] = (TypeMirror) types.get(i).getValue(); } return Arrays.asList(result); } } return Collections.emptyList(); } } throw new IllegalStateException(annotation.annotationType().getName() + " not found in " + member); }
java
public ViewScopeContextualStorage getContextualStorage( BeanManager beanManager, String viewScopeId) { ViewScopeContextualStorage contextualStorage = storageMap.get(viewScopeId); if (contextualStorage == null) { synchronized (this) { contextualStorage = storageMap.get(viewScopeId); if (contextualStorage == null) { contextualStorage = new ViewScopeContextualStorage(beanManager); storageMap.put(viewScopeId, contextualStorage); } } } return contextualStorage; }
java
public AuthConfigProvider setProvider(ProviderService providerService) { AuthConfigProvider authConfigProvider = null; if (providerService != null) { authConfigProvider = providerService.getAuthConfigProvider(this); registerConfigProvider(authConfigProvider, null, null, null); } else { removeRegistration(defaultRegistrationID.toString()); } return authConfigProvider; }
java
protected BeanO doActivation(EJBThreadData threadData, ContainerTx tx, BeanId beanId, boolean takeInvocationRef) throws RemoteException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "doActivation", new Object[] { tx, beanId, new Boolean(takeInvocationRef) }); } BeanO bean = null; Throwable exception = null; MasterKey key = new MasterKey(beanId); boolean activate = false; boolean pushedCallbackBeanO = false; try { synchronized (locks.getLock(key)) { if ((bean = (BeanO) cache.find(key)) == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "Bean not in cache"); bean = beanId.getHome().createBeanO(threadData, tx, beanId); // d630940 pushedCallbackBeanO = true; cache.insert(key, bean); bean.ivCacheKey = key; // d199233 activate = true; } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "Found bean in cache"); // Set the found BeanO as the 'Callback' BeanO, as this is the // BeanO that is becoming the active beanO for the thread. // This will allow methods called by customer code (like Timer // methods) to determine the state of the BeanO that is making // the call. d168509 threadData.pushCallbackBeanO(bean); // d630940 pushedCallbackBeanO = true; } } boolean pin = false; if (activate) { bean.activate(beanId, tx); // d114677 } pin = bean.enlist(tx); // d114677 if (takeInvocationRef && pin) { // We need to take an additional reference cache.pin(key); } else if (!takeInvocationRef && !pin) { // Need to drop reference taken by find or insert cache.unpin(key); } } catch (RemoteException e) { FFDCFilter.processException(e, CLASS_NAME + ".doActivation", "123", this); exception = e; throw e; } catch (RuntimeException e) { FFDCFilter.processException(e, CLASS_NAME + ".doActivation", "129", this); exception = e; throw e; } finally { if (exception != null) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) Tr.event(tc, "doActivation: exception raised", exception); } if (exception != null && bean != null) { if (pushedCallbackBeanO) { threadData.popCallbackBeanO(); } bean.destroy(); if (activate) { // Synchronize to insure that a temp pin obtained by getBean // doesn't cause the remove to fail due to too many pins. PQ53065 synchronized (locks.getLock(key)) { cache.remove(key, true); bean.ivCacheKey = null; // d199233 } } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "doActivation", bean); } return bean; }
java
@Override public Entry<BatchPartitionWorkUnit, Future<?>> startPartition(PartitionPlanConfig partitionPlanConfig, Step step, PartitionReplyQueue partitionReplyQueue, boolean isRemoteDispatch) { BatchPartitionWorkUnit workUnit = createPartitionWorkUnit(partitionPlanConfig, step, partitionReplyQueue, isRemoteDispatch); Future<?> futureWork = runPartition(workUnit); // TODO: issue "partition.started" message ? return new AbstractMap.SimpleEntry<BatchPartitionWorkUnit, Future<?>>(workUnit, futureWork); }
java
protected void setConversation(Conversation conversation) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setConversation", conversation); con = conversation; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setConversation"); }
java
protected CommsByteBuffer jfapExchange(CommsByteBuffer buffer, int sendSegmentType, int priority, boolean canPoolOnReceive) throws SIConnectionDroppedException, SIConnectionLostException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "jfapExchange", new Object[]{buffer, sendSegmentType, priority, canPoolOnReceive}); boolean success = false; CommsByteBuffer rcvBuffer = null; try { if (buffer == null) { // The data list cannot be null SIErrorException e = new SIErrorException( nls.getFormattedMessage("NULL_DATA_LIST_PASSED_IN_SICO1046", null, null) ); FFDCFilter.processException(e, CLASS_NAME + ".JFAPExchange", CommsConstants.JFAPCOMMUNICATOR_EXCHANGE_01, this); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, e.getMessage(), e); throw e; } int reqNum = getRequestNumber(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { SibTr.debug(this, tc, "About to Exchange segment " + "conversation: "+ con + " " + JFapChannelConstants.getSegmentName(sendSegmentType) + " - " + sendSegmentType + " (0x" + Integer.toHexString(sendSegmentType) + ") " + "using request number " + reqNum); SibTr.debug(this, tc, con.getFullSummary()); } ReceivedData rd = con.exchange(buffer, sendSegmentType, reqNum, priority, canPoolOnReceive); rcvBuffer = getCommsByteBuffer(rd); int rcvSegmentType = rcvBuffer.getReceivedDataSegmentType(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Exchange completed successfully. " + "Segment returned " + JFapChannelConstants.getSegmentName(rcvSegmentType) + " - " + rcvSegmentType + " (0x" + Integer.toHexString(rcvSegmentType) + ")"); success = true; } finally { if (!success && TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Exchange failed."); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "jfapExchange", rcvBuffer); } return rcvBuffer; }
java
protected void jfapSend(CommsByteBuffer buffer, int sendSegType, int priority, boolean canPoolOnReceive, ThrottlingPolicy throttlingPolicy) throws SIConnectionDroppedException, SIConnectionLostException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "jfapSend", new Object[]{buffer, sendSegType, priority, canPoolOnReceive}); if (buffer == null) { // The data list cannot be null SIErrorException e = new SIErrorException( nls.getFormattedMessage("NULL_DATA_LIST_PASSED_IN_SICO1046", null, null) ); FFDCFilter.processException(e, CLASS_NAME + ".JFAPSend", CommsConstants.JFAPCOMMUNICATOR_SEND_01, this); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, e.getMessage(), e); throw e; } int reqNum = 0; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { SibTr.debug(this, tc, "About to Send segment " + "conversation: "+ con + " " + JFapChannelConstants.getSegmentName(sendSegType) + " - " + sendSegType + " (0x" + Integer.toHexString(sendSegType) + ") " + "using request number " + reqNum); SibTr.debug(this, tc, con.getFullSummary()); } con.send(buffer, sendSegType, reqNum, priority, canPoolOnReceive, throttlingPolicy, null); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "jfapSend"); }
java
private short getClientCapabilities() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getClientCapabilities"); short capabilities = CommsConstants.CAPABILITIES_DEFAULT; // Allow the use of a runtime property to alter the capability that we require a non-java // bootstrap to locate an ME boolean nonJavaBootstrap = CommsUtils.getRuntimeBooleanProperty(CommsConstants.CAPABILITIY_REQUIRES_NONJAVA_BOOTSTRAP_KEY, CommsConstants.CAPABILITIY_REQUIRES_NONJAVA_BOOTSTRAP_DEF); if (nonJavaBootstrap) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Requesting non-java bootstrap"); // This bit is off by default, so turn it on capabilities |= CommsConstants.CAPABILITIY_REQUIRES_NONJAVA_BOOTSTRAP; } // Allow the use of a runtime property to alter the capability that we require JMF messages boolean jmfMessagesOnly = CommsUtils.getRuntimeBooleanProperty(CommsConstants.CAPABILITIY_REQUIRES_JMF_ENCODING_KEY, CommsConstants.CAPABILITIY_REQUIRES_JMF_ENCODING_DEF); if (jmfMessagesOnly) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Requesting JMF Only"); // This bit is off by default, so turn it on capabilities |= CommsConstants.CAPABILITIY_REQUIRES_JMF_ENCODING; } // Allow the use of a runtime property to alter the capability that we require JMS messages boolean jmsMessagesOnly = CommsUtils.getRuntimeBooleanProperty(CommsConstants.CAPABILITIY_REQUIRES_JMS_MESSAGES_KEY, CommsConstants.CAPABILITIY_REQUIRES_JMS_MESSAGES_DEF); if (jmsMessagesOnly) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Requesting JMS Only"); // This bit is off by default, so turn it on capabilities |= CommsConstants.CAPABILITIY_REQUIRES_JMS_MESSAGES; } // Allow the use of a runtime property to turn off optimized transactions. boolean disableOptimizedTx = CommsUtils.getRuntimeBooleanProperty(CommsConstants.DISABLE_OPTIMIZED_TX_KEY, CommsConstants.DISABLE_OPTIMIZED_TX); if (disableOptimizedTx) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Disabling use of optimized transactions"); // This bit is set on by default, so we must turn it off capabilities &= (0xFFFF ^ CommsConstants.CAPABILITIY_REQUIRES_OPTIMIZED_TX); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getClientCapabilities", capabilities); return capabilities; }
java
public void defaultChecker(CommsByteBuffer buffer, short exceptionCode) throws SIErrorException { if (exceptionCode != CommsConstants.SI_NO_EXCEPTION) { throw new SIErrorException(buffer.getException(con)); } }
java
protected void invalidateConnection(boolean notifyPeer, Throwable throwable, String debugReason) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "invalidateConnection", new Object[]{new Boolean(notifyPeer), throwable, debugReason}); if (con != null) { ConnectionInterface connection = con.getConnectionReference(); if (connection != null) { connection.invalidate(notifyPeer, throwable, debugReason); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "invalidateConnection"); }
java
SibRaListener createListener(final SIDestinationAddress destination, MessageEndpointFactory messageEndpointFactory) throws ResourceException { final String methodName = "createListener"; if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.entry(this, TRACE, methodName, new Object[] { destination, messageEndpointFactory }); } if (_closed) { throw new IllegalStateException(NLS .getString("LISTENER_CLOSED_CWSIV0952")); } final SibRaListener listener; listener = new SibRaSingleProcessListener(this, destination, messageEndpointFactory); _listeners.put(destination, listener); if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.exit(this, TRACE, methodName, listener); } return listener; }
java
SibRaDispatcher createDispatcher(final AbstractConsumerSession session, final Reliability unrecoveredReliability, final int maxFailedDeliveries, final int sequentialFailureThreshold) throws ResourceException { final String methodName = "createDispatcher"; if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.entry(this, TRACE, methodName, new Object[] { session, unrecoveredReliability, maxFailedDeliveries, sequentialFailureThreshold }); } if (_closed) { throw new IllegalStateException(NLS .getString("LISTENER_CLOSED_CWSIV0953")); } final SibRaDispatcher dispatcher; if (_endpointActivation.isEndpointMethodTransactional()) { if (_endpointConfiguration.getShareDataSourceWithCMP()) { dispatcher = new SibRaSynchronizedDispatcher(this, session, _endpointActivation, unrecoveredReliability, maxFailedDeliveries, sequentialFailureThreshold); } else { dispatcher = new SibRaTransactionalDispatcher(this, session, _endpointActivation, _busName, unrecoveredReliability, maxFailedDeliveries, sequentialFailureThreshold); } } else { if (SibRaMessageDeletionMode.BATCH.equals(_endpointConfiguration .getMessageDeletionMode())) { dispatcher = new SibRaBatchMessageDeletionDispatcher( this, session, _endpointActivation, unrecoveredReliability, maxFailedDeliveries, sequentialFailureThreshold); } else if (SibRaMessageDeletionMode.SINGLE .equals(_endpointConfiguration.getMessageDeletionMode())) { dispatcher = new SibRaSingleMessageDeletionDispatcher( this, session, _endpointActivation, unrecoveredReliability, maxFailedDeliveries, sequentialFailureThreshold); } else { dispatcher = new SibRaNonTransactionalDispatcher(this, session, _endpointActivation, unrecoveredReliability, maxFailedDeliveries, sequentialFailureThreshold); } } _dispatcherCount.incrementAndGet(); if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) { SibTr.debug(this, TRACE, "Creating a dispatcher, there are now " + _dispatcherCount.get() + " open dispatchers"); } if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.exit(this, TRACE, methodName, dispatcher); } return dispatcher; }
java
void closeDispatcher(final SibRaDispatcher dispatcher) { final String methodName = "closeDispatcher"; if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.entry(this, TRACE, methodName); } dispatcher.close(); _dispatcherCount.decrementAndGet(); if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) { SibTr.debug(this, TRACE, "Removing a dispatcher - there are " + _dispatcherCount.get() + " left"); } synchronized (_dispatcherCount) { _dispatcherCount.notifyAll(); } if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.exit(this, TRACE, methodName); } }
java
void close() { final String methodName = "close"; if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.entry(this, TRACE, methodName); } close(false); if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.exit(this, TRACE, methodName); } }
java
void close(boolean alreadyClosed) { final String methodName = "close"; if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.entry(this, TRACE, methodName, alreadyClosed); } _closed = true; /* * 238811: * Stop all of the listeners - do not close them as the dispatchers * might still be using them. Close them after the dispatchers have * stopped. */ /* * We close dispatchers as soon as they are finished with so no longer have to * close them here. */ if (!alreadyClosed) { for (final Iterator iterator = _listeners.values().iterator(); iterator .hasNext();) { final SibRaListener listener = (SibRaListener) iterator.next(); listener.stop(); } } // The connection is closing so throw away the connection name SibRaDispatcher.resetMEName(); // We want this thread to wait until all the dispatchers have finished their work // (which will happen when the dispatcherCount hits 0. We put the thread into a // wait state if there are any dispatchers still going, the thread will be notified // each time a dispatcher closes (when it has finished its work). synchronized (_dispatcherCount) { if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) { SibTr.debug(this, TRACE, "There are still " + _dispatcherCount.get() + " open dispatchers"); } if (_dispatcherCount.get() > 0) { Long mdbQuiescingTimeout = getMDBQuiescingTimeoutProperty(); waitForDispatchersToFinish(mdbQuiescingTimeout); } } /* * Close all of the listeners */ if (!alreadyClosed) { for (final Iterator iterator = _listeners.values().iterator(); iterator .hasNext();) { final SibRaListener listener = (SibRaListener) iterator.next(); listener.close(); } } _listeners.clear(); /* * Close the connection */ try { _connection.removeConnectionListener(_connectionListener); // It should be ok to call close on an already closed connection but comms // FFDCs thjis (processor seems ok with it though). No need to close the connection // again anyway so we'll check and if we are being called as part of MeTerminated or // connectionError then the connection will have been closed so dont close again. if (!alreadyClosed) { _connection.close(); } } catch (final SIException exception) { FFDCFilter.processException(exception, CLASS_NAME + "." + methodName, "1:1023:1.59", this); if (TraceComponent.isAnyTracingEnabled() && TRACE.isEventEnabled()) { SibTr.exception(this, TRACE, exception); } } catch (final SIErrorException exception) { FFDCFilter.processException(exception, CLASS_NAME + "." + methodName, "1:1031:1.59", this); if (TraceComponent.isAnyTracingEnabled() && TRACE.isEventEnabled()) { SibTr.exception(this, TRACE, exception); } } if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.exit(this, TRACE, methodName); } }
java
SICoreConnection createConnection(SICoreConnectionFactory factory, String name, String password, Map properties, String busName) throws SIException, SIErrorException, Exception { final String methodName = "createConnection"; if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.entry(this, TRACE, methodName, new Object[] { factory, name, "password not traced", properties, busName }); } SICoreConnection result; if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) { SibTr.debug(this, TRACE, "Creating connection with Userid and password"); } result = factory.createConnection(name, password, properties); if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.exit(this, TRACE, "createConnection", result); } return result; }
java
private String getUnavailableServices() { StringBuilder missingServices = new StringBuilder(); if (tokenService.getReference() == null) { missingServices.append("tokenService, "); } if (tokenManager.getReference() == null) { missingServices.append("tokenManager, "); } if (authenticationService.getReference() == null) { missingServices.append("authenticationService, "); } if (authorizationService.getReference() == null) { missingServices.append("authorizationService, "); } if (userRegistry.getReference() == null) { missingServices.append("userRegistry, "); } if (userRegistryService.getReference() == null) { missingServices.append("userRegistryService, "); } if (missingServices.length() == 0) { return null; } else { // Return everything but the last ", " return missingServices.substring(0, missingServices.length() - 2); } }
java
private void updateSecurityReadyState() { if (!activated) { return; } String unavailableServices = getUnavailableServices(); if (unavailableServices == null) { Tr.info(tc, "SECURITY_SERVICE_READY"); securityReady = true; Dictionary<String, Object> props = new Hashtable<String, Object>(); props.put("service.vendor", "IBM"); reg = cc.getBundleContext().registerService(SecurityReadyService.class, this, props); } else { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "The following required security services are not available: " + unavailableServices); } securityReady = false; if (reg != null) { reg.unregister(); reg = null; } } }
java
private void parseDirectoryFiles(WsResource directory, ServerConfiguration configuration) throws ConfigParserException, ConfigValidationException { if (directory != null) { File[] defaultFiles = getChildXMLFiles(directory); if (defaultFiles == null) return; Arrays.sort(defaultFiles, new AlphaComparator()); for (int i = 0; i < defaultFiles.length; i++) { File file = defaultFiles[i]; if (!file.isFile()) continue; WsResource defaultFile = directory.resolveRelative(file.getName()); if (defaultFile == null) { // This should never happen, but it's conceivable that someone could remove a file // after listFiles and before getChild if (tc.isDebugEnabled()) { Tr.debug(tc, file.getName() + " was not found in directory " + directory.getName() + ". Ignoring. "); } continue; } Tr.audit(tc, "audit.dropin.being.processed", defaultFile.asFile()); try { parser.parseServerConfiguration(defaultFile, configuration); } catch (ConfigParserException ex) { parser.handleParseError(ex, null); if (ErrorHandler.INSTANCE.fail()) { // if onError=FAIL, bubble the exception up the stack throw ex; } else { // Mark the last update for the configuration so that we don't try to load it again configuration.updateLastModified(configRoot.getLastModified()); } } } } }
java
public ServletContext findContext(String path) { WebGroup g = (WebGroup) requestMapper.map(path); if (g != null) return g.getContext(); else return null; }
java
private void addWlpInformation(Asset asset) { WlpInformation wlpInfo = asset.getWlpInformation(); if (wlpInfo == null) { wlpInfo = new WlpInformation(); asset.setWlpInformation(wlpInfo); } if (wlpInfo.getAppliesToFilterInfo() == null) { wlpInfo.setAppliesToFilterInfo(new ArrayList<AppliesToFilterInfo>()); } }
java
public Discriminator getDiscriminator() { if (tc.isEntryEnabled()) SibTr.entry(this, tc, "getDiscriminator"); if (tc.isEntryEnabled()) SibTr.exit(this, tc, "getDiscriminator", discriminator); return discriminator; }
java
private Object getResult() throws InterruptedException, ExecutionException { if (ivCancelled) { // F743-11774 if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "getResult: throwing CancellationException"); } throw new CancellationException(); // F743-11774 } // Method ended with an exception if (ivException != null) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "getResult: " + ivException); } throw new ExecutionException(ivException); } // F743-609CodRev // If the result object is itself a Future object, we need to call "get" on it // so that we unwrap the results and place them in this Future object. This // is done to support asynchronous method calls that return results wrapped // in Future objects, and also to support nested asynchronous method calls. // Also, note that "null" is an acceptable result. // F743-16193 // Remove instanceof check for Future object. Return type validation check // moved to EJBMDOrchestrator.java Object resultToReturn = null; if (ivFuture != null) { resultToReturn = ivFuture.get(); // d650178 } return (resultToReturn); }
java
private Object getResult(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { if (ivCancelled) { // F743-11774 if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "getResult: throwing CancellationException"); } throw new CancellationException(); // F743-11774 } // Method ended with an exception if (ivException != null) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "getResult: " + ivException); } throw new ExecutionException(ivException); } // F743-609CodRev // If the result object is itself a Future object, we need to call "get" on it // so that we unwrap the results and place them in this Future object. This // is done to support asynchronous method calls that return results wrapped // in Future objects, and also to support nested asynchronous method calls. // Also, note that "null" is an acceptable result. // F743-16193 // Remove instanceof check for Future object. Return type validation check // moved to EJBMDOrchestrator.java Object resultToReturn = null; if (ivFuture != null) { // AsyncResult EJB3.2 API just throws IllegalStateExceptions for everything but .get(). // Even in EJB3.1 API get(timeout, unit) just immediately returned. In a long nested // chain of futures, only the last one will be AsyncResult so we won't need to pass // down the remaining timeout anyway. if (ivFuture instanceof AsyncResult) { resultToReturn = ivFuture.get(); } else { resultToReturn = ivFuture.get(timeout, unit); // d650178 } } return (resultToReturn); }
java
@Override public boolean isCancelled() { //F743-609CodRev - read volatile variable only once boolean cancelled = ivCancelled; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "isCancelled: " + cancelled + " Future object: " + this); } return (cancelled); }
java
void setResult(Future<?> theFuture) { // d650178 if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "setResult: " + Util.identity(theFuture) + " Future object: " + this); } // set result, we are done ivFuture = theFuture; done(); // F743-11774 }
java
void setException(Throwable theException) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "setException - Future object: " + this, theException); } // set exception, we are done ivException = theException; done(); // F743-11774 }
java
public Object saveState(FacesContext context) { if (!initialStateMarked()) { Object values[] = new Object[2]; values[0] = _maximum; values[1] = _minimum; return values; } return null; }
java
public void logout(Subject subject) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, CLASS_NAME + "logout"); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, CLASS_NAME + "logout"); } }
java
public void setMessagingAuthenticationService( MessagingAuthenticationService messagingAuthenticationService) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, CLASS_NAME + "setMessagingAuthenticationService", messagingAuthenticationService); } this.messagingAuthenticationService = messagingAuthenticationService; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exit(tc, CLASS_NAME + "setMessagingAuthenticationService"); } }
java
public void deactivate(ComponentContext cc) throws IOException { ConfigProviderResolver.setInstance(null); shutdown(); scheduledExecutorServiceRef.deactivate(cc); }
java
public void shutdown() { synchronized (configCache) { Set<ClassLoader> allClassLoaders = new HashSet<>(); allClassLoaders.addAll(configCache.keySet()); //create a copy of the keys so that we avoid a ConcurrentModificationException for (ClassLoader classLoader : allClassLoaders) { close(classLoader); } //caches should be empty now but clear them anyway configCache.clear(); appClassLoaderMap.clear(); } }
java
private void close(ClassLoader classLoader) { synchronized (configCache) { ConfigWrapper config = configCache.remove(classLoader); if (config != null) { Set<String> applicationNames = config.getApplications(); for (String app : applicationNames) { appClassLoaderMap.remove(app); } config.close(); } } }
java
private void closeConfig(Config config) { if (config instanceof WebSphereConfig) { try { ((WebSphereConfig) config).close(); } catch (IOException e) { throw new ConfigException(Tr.formatMessage(tc, "could.not.close.CWMCG0004E", e)); } } }
java
@Override public SICoreConnection getSICoreConnection() throws IllegalStateException { if (connectionClosed) { throw new IllegalStateException(NLS.getFormattedMessage( ("ILLEGAL_STATE_CWSJR1086"), new Object[] { "getSICoreConnection" }, null)); } return _coreConnection; }
java
@Override synchronized public void close() throws SIConnectionLostException, SIIncorrectCallException, SIResourceException, SIErrorException, SIConnectionDroppedException, SIConnectionUnavailableException { if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.entry(this, TRACE, "close"); } if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled()) { SibTr.debug(TRACE, "We have " + _sessions.size() + " left open - closing them"); } // Close all the sessions created from this connection. for (final Iterator iterator = _sessions.iterator(); iterator.hasNext();) { final Object object = iterator.next(); if (object instanceof JmsJcaSessionImpl) { final JmsJcaSessionImpl session = (JmsJcaSessionImpl) object; session.close(false); } iterator.remove(); } if (_coreConnection != null) { _coreConnection.close(); } connectionClosed = true; if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.exit(this, TRACE, "close"); } }
java
private static boolean isRunningInWAS() { if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.entry(TRACE, "isRunningInWAS"); } if (inWAS == null) { inWAS = Boolean.TRUE; } if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.exit(TRACE, "isRunningInWAS", inWAS); } return inWAS.booleanValue(); }
java
private static final Object getCurrentUOWCoord() { if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.entry(TRACE, "getCurrentUOWCoord"); } Object currentUOW = null; if (isRunningInWAS()) { currentUOW = EmbeddableTransactionManagerFactory.getUOWCurrent().getUOWCoord(); } if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) { SibTr.exit(TRACE, "getCurrentUOWCoord", currentUOW); } return currentUOW; }
java
private PostCreateAction listenForLibraryChanges(final String libid) { return new PostCreateAction() { @Override public void invoke(AppClassLoader acl) { listenForLibraryChanges(libid, acl); } }; }
java
private void listenForLibraryChanges(String libid, AppClassLoader acl) { // ensure this loader is removed from the canonical store when the library is updated new WeakLibraryListener(libid, acl.getKey().getId(), acl, bundleContext) { @Override protected void update() { Object cl = get(); if (cl instanceof AppClassLoader && aclStore != null) aclStore.remove((AppClassLoader) cl); deregister(); } }; }
java
private String getTopic(BundleEvent bundleEvent) { StringBuilder topic = new StringBuilder(BUNDLE_EVENT_TOPIC_PREFIX); switch (bundleEvent.getType()) { case BundleEvent.INSTALLED: topic.append("INSTALLED"); break; case BundleEvent.STARTED: topic.append("STARTED"); break; case BundleEvent.STOPPED: topic.append("STOPPED"); break; case BundleEvent.UPDATED: topic.append("UPDATED"); break; case BundleEvent.UNINSTALLED: topic.append("UNINSTALLED"); break; case BundleEvent.RESOLVED: topic.append("RESOLVED"); break; case BundleEvent.UNRESOLVED: topic.append("UNRESOLVED"); break; default: return null; } return topic.toString(); }
java
public PmiDataInfo[] submoduleMembers(String submoduleName, int level) { if (submoduleName == null) return listLevelData(level); ArrayList returnData = new ArrayList(); // special case for category boolean inCategory = false; if (submoduleName.startsWith("ejb.")) inCategory = true; Iterator allData = perfData.values().iterator(); while (allData.hasNext()) { PmiDataInfo info = (PmiDataInfo) allData.next(); if (inCategory) { // submoduleName is actually the category name for entity/session/mdb if (info.getCategory().equals("all") || isInCategory(submoduleName, info.getCategory())) returnData.add(info); } else if (info.getSubmoduleName() != null && info.getSubmoduleName().equals(submoduleName) && info.getLevel() <= level) { returnData.add(info); } } PmiDataInfo[] ret = new PmiDataInfo[returnData.size()]; for (int i = 0; i < ret.length; i++) ret[i] = (PmiDataInfo) returnData.get(i); return ret; }
java
public PmiDataInfo[] listLevelData(int level) { ArrayList levelData = new ArrayList(); Iterator allData = perfData.values().iterator(); while (allData.hasNext()) { PmiDataInfo dataInfo = (PmiDataInfo) allData.next(); if (dataInfo.getLevel() <= level) { levelData.add(dataInfo); } } // get the array PmiDataInfo[] ret = new PmiDataInfo[levelData.size()]; for (int i = 0; i < ret.length; i++) ret[i] = (PmiDataInfo) levelData.get(i); return ret; }
java
public PmiDataInfo[] listMyLevelData(int level) { ArrayList levelData = new ArrayList(); Iterator allData = perfData.values().iterator(); while (allData.hasNext()) { PmiDataInfo dataInfo = (PmiDataInfo) allData.next(); if (dataInfo.getLevel() == level) { levelData.add(dataInfo); } } return (PmiDataInfo[]) levelData.toArray(); }
java
public int[] listStatisticsWithDependents() { if (dependList == null) { ArrayList list = new ArrayList(); Iterator allData = perfData.values().iterator(); while (allData.hasNext()) { PmiDataInfo dataInfo = (PmiDataInfo) allData.next(); if (dataInfo.getDependency() != null) { list.add(new Integer(dataInfo.getId())); } } dependList = new int[list.size()]; for (int i = 0; i < list.size(); i++) { dependList[i] = ((Integer) list.get(i)).intValue(); } } return dependList; }
java
private void scheduleEvictionTask(long timeoutInMilliSeconds) { EvictionTask evictionTask = new EvictionTask(); // Before creating new Timers, which create new Threads, we // must ensure that we are not using any application classloader // as the current thread's context classloader. Otherwise, it // is possible that the new Timer thread would hold on to the // app classloader indefinitely, thereby leaking it and all // classes that it loaded, long after the app has been stopped. SwapTCCLAction swapTCCL = new SwapTCCLAction(); AccessController.doPrivileged(swapTCCL); try { timer = new Timer(true); long period = timeoutInMilliSeconds / 3; long delay = period; timer.schedule(evictionTask, delay, period); } finally { AccessController.doPrivileged(swapTCCL); } }
java
public synchronized Object update(String key, Object value) { // evict until size < maxSize while (isEvictionRequired() && entryLimit > 0 && entryLimit < Integer.MAX_VALUE) { evictStaleEntries(); } CacheEntry oldEntry = null; CacheEntry curEntry = new CacheEntry(value); if (primaryTable.containsKey(key)) { oldEntry = (CacheEntry) primaryTable.put(key, curEntry); } else if (secondaryTable.containsKey(key)) { oldEntry = (CacheEntry) secondaryTable.put(key, curEntry); } else if (tertiaryTable.containsKey(key)) { oldEntry = (CacheEntry) tertiaryTable.put(key, curEntry); } else { oldEntry = (CacheEntry) primaryTable.put(key, curEntry); } return oldEntry != null ? oldEntry.value : null; }
java
public synchronized void clearAllEntries() { tertiaryTable.putAll(primaryTable); tertiaryTable.putAll(secondaryTable); primaryTable.clear(); secondaryTable.clear(); evictStaleEntries(); }
java
public static WebSphereBeanDeploymentArchive createBDA(WebSphereCDIDeployment deployment, ExtensionArchive extensionArchive, CDIRuntime cdiRuntime) throws CDIException { Set<String> additionalClasses = extensionArchive.getExtraClasses(); Set<String> additionalAnnotations = extensionArchive.getExtraBeanDefiningAnnotations(); boolean extensionCanSeeApplicationBDAs = extensionArchive.applicationBDAsVisible(); boolean extClassesOnlyBDA = extensionArchive.isExtClassesOnly(); String archiveID = deployment.getDeploymentID() + "#" + extensionArchive.getName() + ".additionalClasses"; //this isn't really part of any EE module so we just use the archiveID which should be unique EEModuleDescriptor eeModuleDescriptor = new WebSphereEEModuleDescriptor(archiveID, extensionArchive.getType()); WebSphereBeanDeploymentArchive bda = createBDA(deployment, archiveID, extensionArchive, cdiRuntime, additionalClasses, additionalAnnotations, extensionCanSeeApplicationBDAs, extClassesOnlyBDA, eeModuleDescriptor); return bda; }
java
public void setWrapperCacheSize(int cacheSize) { wrapperCache.setCachePreferredMaxSize(cacheSize); int updatedCacheSize = getBeanIdCacheSize(cacheSize); beanIdCache.setSize(updatedCacheSize); }
java
private int getBeanIdCacheSize(int cacheSize) { int beanIdCacheSize = cacheSize; if (beanIdCacheSize < (Integer.MAX_VALUE / 2)) beanIdCacheSize = beanIdCacheSize * 2; else beanIdCacheSize = Integer.MAX_VALUE; return beanIdCacheSize; }
java
public boolean unregister(BeanId beanId, boolean dropRef) // f111627 throws CSIException { boolean removed = false; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "unregister", new Object[] { beanId, new Boolean(dropRef) }); // d181569 ByteArray wrapperKey = beanId.getByteArray(); // d181569 try { EJSWrapperCommon wrapperCommon = (EJSWrapperCommon) // f111627 wrapperCache.removeAndDiscard(wrapperKey, dropRef); if (wrapperCommon != null) { // f111627 removed = true; } } catch (IllegalOperationException ex) { // Object is pinned and cannot be removed from the cache // Swallow the exception for now, and let the Eviction thread // take care of the object later FFDCFilter.processException(ex, CLASS_NAME + ".unregister", "351", this); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { // d144064 Tr.event(tc, "unregister ignoring IllegalOperationException for object " + beanId); // d181569 Tr.event(tc, "Exception: " + ex); } } catch (DiscardException ex) { FFDCFilter.processException(ex, CLASS_NAME + ".unregister", "358", this); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) // d144064 Tr.event(tc, "Unable to discard element"); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "unregister"); return removed; }
java
public void unregisterHome(J2EEName homeName, EJSHome homeObj) throws CSIException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "unregisterHome"); J2EEName cacheHomeName; int numEnumerated = 0, numRemoved = 0; // d103404.2 Enumeration<?> enumerate = wrapperCache.enumerateElements(); while (enumerate.hasMoreElements()) { // need to get the beanid from either the remote or local wrapper, // whichever is available, the beanid must be the same for both wrappers EJSWrapperCommon wCommon = (EJSWrapperCommon) // f111627 ((CacheElement) enumerate.nextElement()).getObject(); // f111627 BeanId cacheMemberBeanId = wCommon.getBeanId(); // d181569 cacheHomeName = cacheMemberBeanId.getJ2EEName(); numEnumerated++; // If the cache has homeObj as it's home or is itself the home, // remove it. If the wrapper has been removed since it was found // (above), then the call to unregister() will just return false. // Note that the enumeration can handle elements being removed // from the cache while enumerating. d103404.2 if (cacheHomeName.equals(homeName) || cacheMemberBeanId.equals(homeObj.getId())) { unregister(cacheMemberBeanId, true); // d181217 d181569 numRemoved++; } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { // d103404.1 d103404.2 Tr.debug(tc, "Unregistered " + numRemoved + " wrappers (total = " + numEnumerated + ")"); } // Now remove any cached BeanIds for this home. d152323 beanIdCache.removeAll(homeObj); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "unregisterHome"); }
java
@Override public void discardObject(EJBCache wrapperCache, Object key, Object ele) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "discardObject", new Object[] { key, ele }); EJSWrapperCommon wrapperCommon = (EJSWrapperCommon) ele; wrapperCommon.disconnect(); // @MD20022C, F58064 if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "discardObject"); }
java
@Override public Object faultOnKey(EJBCache cache, Object key) throws FaultException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "faultOnKey", key); ByteArray wrapperKey = (ByteArray) key; EJSWrapperCommon result = null; // f111627 // Check if the beanId is already set on this key in which case // we can avoid the deserialize BeanId beanId = wrapperKey.getBeanId(); try { if (beanId == null) { beanId = BeanId.getBeanId(wrapperKey, container); // d140003.12 } result = container.createWrapper(beanId); } catch (InvalidBeanIdException ex) { FFDCFilter.processException(ex, CLASS_NAME + ".faultOnKey", "533", this); // If the nested exception is an EJBNotFoundException, then report // that the app is not started/installed, rather than just the // generic 'Malformed object key'. d356676.1 Throwable cause = ex.getCause(); if (cause instanceof EJBNotFoundException) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) Tr.event(tc, "Application Not Started", ex); throw new FaultException((EJBNotFoundException) cause, "Application not started or not installed"); } if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) Tr.event(tc, "Malformed object key", ex); throw new FaultException(ex, "Malformed object key"); } catch (Exception ex) { FFDCFilter.processException(ex, CLASS_NAME + ".faultOnKey", "548", this); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) Tr.event(tc, "Malformed object key", ex); throw new FaultException(ex, "Malformed object key"); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "faultOnKey"); return result; }
java
public boolean isValid() { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "Checking validity of token " + this.getClass().getName()); if (token != null) { // return if this token is still valid long currentTime = System.currentTimeMillis(); long expiration = getExpiration(); long timeleft = expiration - currentTime; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "Time left for token: " + timeleft); if (timeleft > 0) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "token is valid."); return true; } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "token is invalid."); return false; } } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "token is null, returning invalid."); return false; } }
java
public String getPrincipal() { String[] accessIDArray = getAttributes("u"); if (accessIDArray != null && accessIDArray.length > 0) return accessIDArray[0]; else return null; }
java
public String getUniqueID() { // return null so that this token does not change the uniqueness, // all static attributes from the default tokens. String[] cacheKeyArray = getAttributes(AttributeNameConstants.WSCREDENTIAL_CACHE_KEY); if (cacheKeyArray != null && cacheKeyArray[0] != null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "Found cache key in Authz token: " + cacheKeyArray[0]); return cacheKeyArray[0]; } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "No unique cache key found in token."); return null; }
java
public String[] getAttributes(String key) { if (token != null) return token.getAttributes(key); else return null; }
java
@Override public long getMaximumTimeInStore() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getMaximumTimeInStore"); long maxTime = getMessageItem().getMaximumTimeInStore(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getMaximumTimeInStore", new Long(maxTime)); return maxTime; }
java
private void resetEvents() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "resetEvents"); // Reset all callbacks PRE_COMMIT_ADD = null; PRE_COMMIT_REMOVE = null; POST_COMMIT_ADD_1 = null; POST_COMMIT_ADD_2 = null; POST_COMMIT_REMOVE_1 = null; POST_COMMIT_REMOVE_2 = null; POST_COMMIT_REMOVE_3 = null; POST_COMMIT_REMOVE_4 = null; POST_ROLLBACK_ADD_1 = null; POST_ROLLBACK_ADD_2 = null; POST_ROLLBACK_REMOVE_1 = null; POST_ROLLBACK_REMOVE_2 = null; POST_ROLLBACK_REMOVE_3 = null; POST_ROLLBACK_REMOVE_4 = null; UNLOCKED_1 = null; UNLOCKED_2 = null; UNLOCKED_3 = null; PRE_UNLOCKED_1 = null; PRE_UNLOCKED_2 = null; REFERENCES_DROPPED_TO_ZERO = null; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "resetEvents"); }
java
@Override public SIBUuid12 getProducerConnectionUuid() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.entry(tc, "getProducerConnectionUuid"); SibTr.exit(tc, "getProducerConnectionUuid"); } return getMessageItem().getProducerConnectionUuid(); }
java
private MessageItem getMessageItem() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getMessageItem"); MessageItem msg = null; try { msg = (MessageItem) getReferredItem(); } catch (MessageStoreException e) { // FFDC FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.store.items.MessageItemReference.getMessageItem", "1:857:1.147", this); SibTr.exception(tc, e); // TODO : For now we throw a runtime here but we need to look at the stack to see // what this means. if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getMessageItem", e); throw new SIErrorException(e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getMessageItem", msg); return msg; }
java
public static void setTextInfoTranslationEnabled(boolean textInfoTranslationEnabled, Locale locale) { com.ibm.ws.pmi.stat.StatsImpl.setEnableNLS(textInfoTranslationEnabled, locale); }
java
private final static void ELCheckType(final Object obj, final Class<?> type) throws ELException { if (String.class.equals(type)) { ELSupport.coerceToString(obj); } if (ELArithmetic.isNumberType(type)) { ELSupport.coerceToNumber(obj, type); } if (Character.class.equals(type) || Character.TYPE == type) { ELSupport.coerceToCharacter(obj); } if (Boolean.class.equals(type) || Boolean.TYPE == type) { ELSupport.coerceToBoolean(obj); } if (type.isEnum()) { ELSupport.coerceToEnum(obj, type); } }
java
public static String getProductVersion(RepositoryResource installResource) { String resourceVersion = null; try { Collection<ProductDefinition> pdList = new ArrayList<ProductDefinition>(); for (ProductInfo pi : ProductInfo.getAllProductInfo().values()) { pdList.add(new ProductInfoProductDefinition(pi)); } resourceVersion = installResource.getAppliesToVersions(pdList); } catch (Exception e) { logger.log(Level.FINEST, e.getMessage(), e); } if (resourceVersion == null) resourceVersion = InstallConstants.NOVERSION; return resourceVersion; }
java
public static boolean isPublicAsset(ResourceType resourceType, RepositoryResource installResource) { if (resourceType.equals(ResourceType.FEATURE) || resourceType.equals(ResourceType.ADDON)) { EsaResource esar = ((EsaResource) installResource); if (esar.getVisibility().equals(Visibility.PUBLIC) || esar.getVisibility().equals(Visibility.INSTALL)) { return true; } } else if (resourceType.equals(ResourceType.PRODUCTSAMPLE) || resourceType.equals(ResourceType.OPENSOURCE)) { return true; } return false; }
java
public static Map<String, Collection<String>> writeResourcesToDiskRepo(Map<String, Collection<String>> downloaded, File toDir, Map<String, List<List<RepositoryResource>>> installResources, String productVersion, EventManager eventManager, boolean defaultRepo) throws InstallException { int progress = 10; int interval1 = installResources.size() == 0 ? 90 : 90 / installResources.size(); for (List<List<RepositoryResource>> targetList : installResources.values()) { for (List<RepositoryResource> mrList : targetList) { int interval2 = mrList.size() == 0 ? interval1 : interval1 / mrList.size(); for (RepositoryResource installResource : mrList) { try { writeResourcesToDiskRepo(downloaded, toDir, installResource, eventManager, progress += interval2); } catch (InstallException e) { throw e; } catch (Exception e) { throw ExceptionUtils.createFailedToDownload(installResource, e, toDir); } } } } return downloaded; }
java
@Reference(cardinality = ReferenceCardinality.MULTIPLE) protected void setJaasLoginModuleConfig(JAASLoginModuleConfig lmc, Map<String, Object> props) { String pid = (String) props.get(KEY_SERVICE_PID); loginModuleMap.put(pid, lmc); }
java
public void init(HttpInboundServiceContext context) { this.message = context.getRequest(); if (this.useEE7Streams) { this.body = new HttpInputStreamEE7(context); } else { this.body = new HttpInputStreamImpl(context); } }
java
public static Metadata<Extension> loadExtension(String extensionClass, ClassLoader classloader) { Class<? extends Extension> serviceClass = loadClass(Extension.class, extensionClass, classloader); if (serviceClass == null) { return null; } Extension serviceInstance = prepareInstance(serviceClass); if (serviceInstance == null) { return null; } return new MetadataImpl<Extension>(serviceInstance, extensionClass); }
java
public static <S> Class<? extends S> loadClass(Class<S> expectedType, String serviceClassName, ClassLoader classloader) { Class<?> clazz = null; Class<? extends S> serviceClass = null; try { clazz = classloader.loadClass(serviceClassName); serviceClass = clazz.asSubclass(expectedType); } catch (ResourceLoadingException e) { //noop if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "loadClass()", e); } } catch (ClassCastException e) { //noop if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "loadClass()", e); } } catch (ClassNotFoundException e) { //noop if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "loadClass()", e); } } return serviceClass; }
java
public static <S> S prepareInstance(Class<? extends S> serviceClass) { try { final Constructor<? extends S> constructor = serviceClass.getDeclaredConstructor(); AccessController.doPrivileged(new PrivilegedAction<Void>() { @Override public Void run() { constructor.setAccessible(true); return null; } }); return constructor.newInstance(); } catch (LinkageError e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "prepareInstance(): Could not instantiate service class " + serviceClass.getName(), e); } return null; } catch (InvocationTargetException e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "prepareInstance(): The exception happened on loading " + serviceClass.getName(), e); } return null; } catch (IllegalArgumentException e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "prepareInstance(): The exception happened on loading " + serviceClass.getName(), e); } return null; } catch (InstantiationException e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "prepareInstance(): The exception happened on loading " + serviceClass.getName(), e); } return null; } catch (IllegalAccessException e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "prepareInstance(): The exception happened on loading " + serviceClass.getName(), e); } return null; } catch (SecurityException e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "prepareInstance(): The exception happened on loading " + serviceClass.getName(), e); } return null; } catch (NoSuchMethodException e) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "prepareInstance(): The exception happened on loading " + serviceClass.getName(), e); } return null; } }
java
private static boolean isVisible(ClassLoader loaderA, ClassLoader loaderB) { if (loaderB == loaderA || loaderB.getParent() == loaderA) { return true; } return false; }
java
public static ClassLoader getAndSetLoader(ClassLoader newCL) { ThreadContextAccessor tca = ThreadContextAccessor.getThreadContextAccessor(); //This could be a ClassLoader or the special type UNCHANGED. Object maybeOldCL = tca.pushContextClassLoaderForUnprivileged(newCL); if (maybeOldCL instanceof ClassLoader) { return (ClassLoader) maybeOldCL; } else { return newCL; } }
java
public static boolean isWeldProxy(Object obj) { Class<?> clazz = obj.getClass(); boolean result = isWeldProxy(clazz); return result; }
java
@Override public <T> void aroundInject(final InjectionContext<T> injectionContext) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Annotations: " + injectionContext.getAnnotatedType()); } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Perform EE injection."); } injectJavaEEResources(injectionContext); // perform Weld injection AccessController.doPrivileged(new PrivilegedAction<Void>() { @Override public Void run() { injectionContext.proceed(); return null; } }); }
java
@Override public void readSet(int requestNumber, SIMessageHandle[] msgHandles) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "readSet", new Object[] { requestNumber, msgHandles }); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Request to read " + msgHandles.length + " message(s)"); final ConversationState convState = (ConversationState) getConversation().getAttachment(); try { SIBusMessage[] messages = bifSession.readSet(msgHandles); // Add the number of items first CommsServerByteBuffer buff = poolManager.allocate(); buff.putInt(messages.length); for (int x = 0; x < messages.length; x++) { buff.putMessage((JsMessage) messages[x], convState.getCommsConnection(), getConversation()); } try { getConversation().send(buff, JFapChannelConstants.SEG_READ_SET_R, requestNumber, JFapChannelConstants.PRIORITY_MEDIUM, true, ThrottlingPolicy.BLOCK_THREAD, null); } catch (SIException e) { FFDCFilter.processException(e, CLASS_NAME + ".readSet", CommsConstants.CATBIFCONSUMER_READSET_01, this); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, e.getMessage(), e); SibTr.error(tc, "COMMUNICATION_ERROR_SICO2033", e); } } catch (Exception e) { //No FFDC code needed //Only FFDC if we haven't received a meTerminated event OR if this Exception isn't a SIException. if (!(e instanceof SIException) || !convState.hasMETerminated()) { FFDCFilter.processException(e, CLASS_NAME + ".readSet", CommsConstants.CATBIFCONSUMER_READSET_02, this); } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, e.getMessage(), e); StaticCATHelper.sendExceptionToClient(e, CommsConstants.CATBIFCONSUMER_READSET_02, getConversation(), requestNumber); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "readSet"); }
java
@Override public void readAndDeleteSet(int requestNumber, SIMessageHandle[] msgHandles, int tran) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "readAndDeleteSet", new Object[] { requestNumber, msgHandles, tran }); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Request to read / delete " + msgHandles.length + " message(s)"); final ConversationState convState = (ConversationState) getConversation().getAttachment(); try { SITransaction siTran = null; if (tran != CommsConstants.NO_TRANSACTION) { siTran = ((ServerLinkLevelState) getConversation().getLinkLevelAttachment()).getTransactionTable().get(tran); } SIBusMessage[] messages; if (siTran != IdToTransactionTable.INVALID_TRANSACTION) { messages = bifSession.readAndDeleteSet(msgHandles, siTran); } else { messages = new SIBusMessage[0]; } // Add the number of items first CommsServerByteBuffer buff = poolManager.allocate(); buff.putInt(messages.length); for (int x = 0; x < messages.length; x++) { buff.putMessage((JsMessage) messages[x], convState.getCommsConnection(), getConversation()); } try { getConversation().send(buff, JFapChannelConstants.SEG_READ_AND_DELETE_SET_R, requestNumber, JFapChannelConstants.PRIORITY_MEDIUM, true, ThrottlingPolicy.BLOCK_THREAD, null); } catch (SIException e) { FFDCFilter.processException(e, CLASS_NAME + ".readAndDeleteSet", CommsConstants.CATBIFCONSUMER_READANDDELTESET_01, this); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, e.getMessage(), e); SibTr.error(tc, "COMMUNICATION_ERROR_SICO2033", e); } } catch (Exception e) { //No FFDC code needed //Only FFDC if we haven't received a meTerminated event OR if this Exception isn't a SIException. if (!(e instanceof SIException) || !convState.hasMETerminated()) { FFDCFilter.processException(e, CLASS_NAME + ".readAndDeleteSet", CommsConstants.CATBIFCONSUMER_READANDDELTESET_02, this); } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, e.getMessage(), e); StaticCATHelper.sendExceptionToClient(e, CommsConstants.CATBIFCONSUMER_READANDDELTESET_02, getConversation(), requestNumber); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "readAndDeleteSet"); }
java
public String getCodeSource(ProtectionDomain pd) { CodeSource cs = pd.getCodeSource(); String csStr = null; if (cs == null) { csStr = "null code source"; } else { URL url = cs.getLocation(); if (url == null) { csStr = "null code URL"; } else { csStr = url.toString(); } } return csStr; }
java
public String permissionToString(java.security.CodeSource cs, ClassLoader classloaderClass, PermissionCollection col) { StringBuffer buf = new StringBuffer("ClassLoader: "); if (classloaderClass == null) { buf.append("Primordial Classloader"); } else { buf.append(classloaderClass.getClass().getName()); } buf.append(lineSep); buf.append(" Permissions granted to CodeSource ").append(cs).append(lineSep); if (col != null) { Enumeration<Permission> e = col.elements(); buf.append(" {").append(lineSep); while (e.hasMoreElements()) { Permission p = e.nextElement(); buf.append(" ").append(p.toString()).append(";").append(lineSep); } buf.append(" }"); } else { buf.append(" {").append(lineSep).append(" }"); } return buf.toString(); }
java
boolean isOffendingClass(Class<?>[] classes, int j, ProtectionDomain pd2, Permission inPerm) { // Return true if ... return (!classes[j].getName().startsWith("java")) && // as long as not // starting with // java (classes[j].getName().indexOf("com.ibm.ws.kernel.launch.internal.NoRethrowSecurityManager") == -1) && // not // our // SecurityManager (classes[j].getName().indexOf("ClassLoader") == -1) && // not a // class // loader // not the end of stack and next is not a class loader ((j == classes.length - 1) ? true : (classes[j + 1].getName().indexOf("ClassLoader") == -1)) && // lacks the required permissions !pd2.implies(inPerm); }
java
protected void cleanup() { final String methodName = "cleanup"; if (TRACE.isEntryEnabled()) { SibTr.entry(this, TRACE, methodName); } super.cleanup(); if (_successfulMessages.size() > 0) { try { deleteMessages(getMessageHandles(_successfulMessages), null); } catch (final ResourceException exception) { FFDCFilter.processException(exception, CLASS_NAME + "." + methodName, FFDC_PROBE_1, this); if (TRACE.isEventEnabled()) { SibTr.exception(this, TRACE, exception); } } finally { _successfulMessages.clear(); } } if (TRACE.isEntryEnabled()) { SibTr.exit(this, TRACE, methodName); } }
java
public String getContextName() { ExternalContext ctx = _MyFacesExternalContextHelper.firstInstance.get(); if (ctx == null) { throw new UnsupportedOperationException(); } return ctx.getContextName(); }
java
@Override public boolean addTransformer(final ClassFileTransformer cft) { transformers.add(cft); // Also recursively register with parent(s), until a non-AppClassLoader or GlobalSharedLibrary loader is encountered. if (parent instanceof AppClassLoader) { if (Util.isGlobalSharedLibraryLoader(((AppClassLoader) parent))) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "addTransformer - skipping parent loader because it is a GlobalSharedLibrary"); } } else { return ((AppClassLoader) parent).addTransformer(cft); } } return true; }
java
@Override public Bundle getBundle() { return parent instanceof GatewayClassLoader ? ((GatewayClassLoader) parent).getBundle() : parent instanceof LibertyLoader ? ((LibertyLoader) parent).getBundle() : null; }
java
@FFDCIgnore(value = { IllegalArgumentException.class }) private void definePackage(ByteResourceInformation byteResourceInformation, String packageName) { // If the package is in a JAR then we can load the JAR manifest to see what package definitions it's got Manifest manifest = byteResourceInformation.getManifest(); try { // The URLClassLoader.definePackage() will NPE with a null manifest so use the other definePackage if we don't have a manifest if (manifest == null) { definePackage(packageName, null, null, null, null, null, null, null); } else { definePackage(packageName, manifest, byteResourceInformation.getResourceUrl()); } } catch (IllegalArgumentException e) { // Ignore, this happens if the package is already defined but it is hard to guard against this in a thread safe way. See: // http://bugs.sun.com/view_bug.do?bug_id=4841786 } }
java
@FFDCIgnore(ClassNotFoundException.class) private Class<?> findClassCommonLibraryClassLoaders(String name) throws ClassNotFoundException { for (LibertyLoader cl : delegateLoaders) { try { return cl.findClass(name); } catch (ClassNotFoundException e) { // Ignore. Will throw at the end if class is not found. } } // If we reached here, then the class was not loaded. throw new ClassNotFoundException(name); }
java
private URL findResourceCommonLibraryClassLoaders(String name) { for (LibertyLoader cl : delegateLoaders) { URL url = cl.findResource(name); if (url != null) { return url; } } // If we reached here, then the resource was not found. return null; }
java
private CompositeEnumeration<URL> findResourcesCommonLibraryClassLoaders(String name, CompositeEnumeration<URL> enumerations) throws IOException { for (LibertyLoader cl : delegateLoaders) { enumerations.add(cl.findResources(name)); } return enumerations; }
java
private void copyLibraryElementsToClasspath(Library library) { Collection<File> files = library.getFiles(); addToClassPath(library.getContainers()); if (files != null && !!!files.isEmpty()) { for (File file : files) { nativeLibraryFiles.add(file); } } for (Fileset fileset : library.getFilesets()) { for (File file : fileset.getFileset()) { nativeLibraryFiles.add(file); } } }
java
private static boolean checkLib(final File f, String basename) { boolean fExists = System.getSecurityManager() == null ? f.exists() : AccessController.doPrivileged(new PrivilegedAction<Boolean>() { @Override public Boolean run() { return f.exists(); } }); return fExists && (f.getName().equals(basename) || (isWindows(basename) && f.getName().equalsIgnoreCase(basename))); }
java
public static void removeCompositeComponentForResolver(FacesContext facesContext) { List<UIComponent> list = (List<UIComponent>) facesContext.getAttributes().get(CURRENT_COMPOSITE_COMPONENT_KEY); if (list != null) { list.remove(list.size()-1); } }
java
public void processHttpChainWork(boolean enableEndpoint, boolean isPause) { if (enableEndpoint) { // enable the endpoint if it is currently disabled // it's ok if the endpoint is stopped, the config update will occur @ next start endpointState.compareAndSet(DISABLED, ENABLED); if (httpPort >= 0) { httpChain.enable(); } if (httpsPort >= 0 && sslFactoryProvider.getService() != null) { httpSecureChain.enable(); } if (!isPause) { // Use an update action so they pick up the new settings performAction(updateAction); } else { updateAction.run(); } } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(this, tc, "endpoint disabled: " + (String) endpointConfig.get("id")); } // The endpoint has been disabled-- stop it now endpointState.set(DISABLED); if (!isPause) { performAction(stopAction); } else { stopAction.run(); } } }
java