code
stringlengths 73
34.1k
| label
stringclasses 1
value |
---|---|
private boolean checkIfUpgradeHeaders(Map<String, String> headers) {
// looking for two headers.
// connection header with a value of "upgrade"
// upgrade header with a value of "h2c"
boolean connection_upgrade = false;
boolean upgrade_h2c = false;
String headerValue = null;
Set<Entry<String, String>> headerEntrys = headers.entrySet();
for (Entry<String, String> header : headerEntrys) {
String name = header.getKey();
//check if it's an HTTP2 non-secure upgrade connection.
if (name.equalsIgnoreCase(CONSTANT_connection)) {
headerValue = header.getValue();
if (tc.isDebugEnabled()) {
Tr.debug(tc, "connection header found with value: " + headerValue);
}
if (headerValue != null && headerValue.equalsIgnoreCase(CONSTANT_connection_value)) {
if (connection_upgrade == true) {
// should not have two of these, log debug and return false
// TODO: determine if we should throw an exception here, or if this error will be dealt with in subsequent processing
if (tc.isDebugEnabled()) {
Tr.debug(tc, "malformed: second connection header found");
}
return false;
}
connection_upgrade = true;
}
}
if (name.equalsIgnoreCase(CONSTANT_upgrade)) {
headerValue = header.getValue();
if (tc.isDebugEnabled()) {
Tr.debug(tc, "upgrade header found with value: " + headerValue);
}
if (headerValue != null && headerValue.equalsIgnoreCase(CONSTANT_h2c)) {
if (upgrade_h2c == true) {
// should not have two of these, log debug and return false
// TODO: determine if we should throw an exception here, or if this error will be dealt with in subsequent processing
if (tc.isDebugEnabled()) {
Tr.debug(tc, "malformed: second upgrade header found");
}
return false;
}
upgrade_h2c = true;
}
}
}
if (connection_upgrade && upgrade_h2c) {
return true;
}
return false;
} | java |
@Override
protected LicenseProvider createLicenseProvider(String licenseAgreementPrefix, String licenseInformationPrefix,
String subsystemLicenseType) {
String featureLicenseAgreementPrefix = this.featureName + "/" + licenseAgreementPrefix;
String featureLicenseInformationPrefix = licenseInformationPrefix == null ? null : this.featureName + "/" + licenseInformationPrefix;
if (featureLicenseInformationPrefix == null) {
LicenseProvider lp = ZipLicenseProvider.createInstance(zip, featureLicenseAgreementPrefix);
if (lp != null)
return lp;
} else {
wlp.lib.extract.ReturnCode licenseReturnCode = ZipLicenseProvider.buildInstance(zip, featureLicenseAgreementPrefix,
featureLicenseInformationPrefix);
if (licenseReturnCode == wlp.lib.extract.ReturnCode.OK) {
// Everything is set up ok so carry on
return ZipLicenseProvider.getInstance();
}
}
// An error indicates that the IBM licenses could not be found so we can use the subsystem header
if (subsystemLicenseType != null && subsystemLicenseType.length() > 0) {
return new ThirdPartyLicenseProvider(featureDefinition.getFeatureName(), subsystemLicenseType);
}
return null;
} | java |
public LocalTransaction createLocalTransaction(boolean useSingleResourceOnly)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "createLocalTransaction");
LocalTransaction tran = null;
//Venu Removing the createLocalTransactionWithSubordinates() as it has to happen only
// in case of PEV resources
tran = transactionFactory.createLocalTransaction();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createLocalTransaction", tran);
return tran;
} | java |
public ExternalAutoCommitTransaction createAutoCommitTransaction()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "createAutoCommitTransaction");
ExternalAutoCommitTransaction transaction =
transactionFactory.createAutoCommitTransaction();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createAutoCommitTransaction", transaction);
return transaction;
} | java |
public SIXAResource createXAResource(boolean useSingleResource)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "createXAResource", new Boolean(useSingleResource));
SIXAResource resource = null;
//get the message store resource
resource = transactionFactory.createXAResource();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "createXAResource", resource);
return resource;
} | java |
public Object createObjectCache(String reference) {
final String methodName = "createCacheInstance()";
if (tc.isEntryEnabled())
Tr.entry(tc, methodName + " cacheName=" + reference);
CacheConfig config = ServerCache.getCacheService().getCacheInstanceConfig(reference);
if (config == null) {
// DYNA1004E=DYNA1004E: WebSphere Dynamic Cache instance named {0} can not be initialized because it is not
// configured.
// DYNA1004E.explanation=This message indicates the named WebSphere Dynamic Cache instance can not be
// initialized. The named instance is not avaliable.
// DYNA1004E.useraction=Use the WebSphere Administrative Console to configure a cache instance resource
// named {0}.
Tr.error(tc, "DYNA1004E", new Object[] { reference });
}
/*
* Sync on the WCCMConfig because multiple cache readers might have entered the createCacheInstance at the same
* time. With this sync one reader has to wait till the other has finished creating the cache instance
*/
DistributedObjectCache dCache = null;
synchronized (config) { // ADDED FOR 378973
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Entered synchronized (config) for " + config.getCacheName());
}
dCache = config.getDistributedObjectCache();
if (dCache == null) {
dCache = createDistributedObjectCache(config);
config.setDistributedObjectCache(dCache);
}
}
if (tc.isDebugEnabled()) {
Tr.debug(tc, methodName + " cacheName in=" + reference + " out=" + reference);
}
if (tc.isEntryEnabled())
Tr.exit(tc, methodName + " distributedObjectCache=" + dCache);
return dCache;
} | java |
private DistributedObjectCache createDistributedObjectCache(CacheConfig config) {
final String methodName = "createDistributedObjectCache()";
if (tc.isEntryEnabled())
Tr.entry(tc, methodName + " cacheName=" + (config != null ? config.getCacheName() : "null"));
DCache dCache = ServerCache.createCache(config.getCacheName(), config);
config.setCache(dCache);
DistributedObjectCache distributedObjectCache = null;
if (config.isEnableNioSupport()) {
distributedObjectCache = new DistributedNioMapImpl(dCache);
} else {
distributedObjectCache = new DistributedMapImpl(dCache);
}
if (tc.isEntryEnabled())
Tr.exit(tc, methodName + " distributedObjectCache=" + distributedObjectCache);
return distributedObjectCache;
} | java |
public EventSource createEventSource(boolean createAsyncEventSource, String cacheName) {
EventSource eventSource = new DCEventSource(cacheName, createAsyncEventSource);
if (tc.isDebugEnabled())
Tr.debug(tc, "Using caller thread context for callback - cacheName= " + cacheName);
return eventSource;
} | java |
public static Map<JNDIEnvironmentRefType, Map<String, String>> createAllBindingsMap() {
Map<JNDIEnvironmentRefType, Map<String, String>> allBindings = new EnumMap<JNDIEnvironmentRefType, Map<String, String>>(JNDIEnvironmentRefType.class);
for (JNDIEnvironmentRefType refType : JNDIEnvironmentRefType.VALUES) {
if (refType.getBindingElementName() != null) {
allBindings.put(refType, new HashMap<String, String>());
}
}
return allBindings;
} | java |
public static void setAllBndAndExt(ComponentNameSpaceConfiguration compNSConfig,
Map<JNDIEnvironmentRefType, Map<String, String>> allBindings,
Map<String, String> envEntryValues,
ResourceRefConfigList resRefList) {
for (JNDIEnvironmentRefType refType : JNDIEnvironmentRefType.VALUES) {
if (refType.getBindingElementName() != null) {
compNSConfig.setJNDIEnvironmentRefBindings(refType.getType(), allBindings.get(refType));
}
}
compNSConfig.setEnvEntryValues(envEntryValues);
compNSConfig.setResourceRefConfigList(resRefList);
} | java |
public static void chainRequestDispatchers(RequestDispatcher[] dispatchers, HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException{
for(int i=0; i<dispatchers.length-1; i++) {
ChainedResponse chainedResp = new ChainedResponse(request, response);
dispatchers[i].forward(request, chainedResp);
request = chainedResp.getChainedRequest();
}
dispatchers[dispatchers.length-1].forward(request, response);
} | java |
@Reference(name = KEY_GENERATOR, service = DDLGenerationParticipant.class, policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MULTIPLE)
protected void setGenerator(ServiceReference<DDLGenerationParticipant> ref) {
generators.addReference(ref);
} | java |
@Override
synchronized public Map<String, Serializable> generateDDL() {
Map<String, Serializable> returnMap = new HashMap<String, Serializable>();
WsResource ddlOutputDirectory = locationService.get().resolveResource(OUTPUT_DIR);
if (ddlOutputDirectory.exists() == false) {
ddlOutputDirectory.create();
}
// Try to put the canonical path to the DDL output directory in the results.
// If we can't, then put the symbolic name.
try {
returnMap.put(OUTPUT_DIRECTORY, ddlOutputDirectory.asFile().getCanonicalPath());
} catch (IOException ioe) {
returnMap.put(OUTPUT_DIRECTORY, OUTPUT_DIR);
}
boolean success = true;
int fileCount = 0;
Map<String, DDLGenerationParticipant> participants = new HashMap<String, DDLGenerationParticipant>();
Iterator<ServiceAndServiceReferencePair<DDLGenerationParticipant>> i = generators.getServicesWithReferences();
while (i.hasNext()) {
// We'll request the DDL be written to a file whose name is chosen by the component providing the service.
ServiceAndServiceReferencePair<DDLGenerationParticipant> generatorPair = i.next();
DDLGenerationParticipant generator = generatorPair.getService();
String rawId = generator.getDDLFileName();
// Remove any restricted characters from the file name, and make sure
// that the resulting string is not empty. If it's empty, supply a
// default name.
String id = (rawId != null) ? PathUtils.replaceRestrictedCharactersInFileName(rawId) : null;
if ((id == null) || (id.length() == 0)) {
throw new IllegalArgumentException("Service " + generator.toString() + " DDL file name: " + rawId);
}
participants.put(id, generator);
}
for (Map.Entry<String, DDLGenerationParticipant> entry : participants.entrySet()) {
String id = entry.getKey();
DDLGenerationParticipant participant = entry.getValue();
// The path to the file is in the server's output directory.
WsResource ddlOutputResource = locationService.get().resolveResource(OUTPUT_DIR + id + ".ddl");
if (ddlOutputResource.exists() == false) {
ddlOutputResource.create();
}
// Use the text file output stream factory to create the file so that
// it is readable on distributed and z/OS platforms. Overwrite the
// file if it already exists. We have to specify the encoding explicitly
// on the OutputStreamWriter or Findbugs gets upset. We always specify
// UTF-8 because the output DDL might have UNICODE characters. We use
// a TextFileOutputStreamFactory in an attempt to make the file readable
// on z/OS. The file will be tagged as 'ISO8859-1' on z/OS, allowing at
// least some of the characters to be printable. The z/OS chtag command
// does not appear to honor 'UTF-8' as an encoding, even though iconv
// supports it. The data on the disk will be correct in any case, the
// customer may need to FTP it to a distributed machine, or use iconv,
// to be able to view the data.
try {
TextFileOutputStreamFactory f = TrConfigurator.getFileOutputStreamFactory();
OutputStream os = f.createOutputStream(ddlOutputResource.asFile(), false);
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(os, "UTF-8"));
participant.generate(bw);
// The JPA code may close the stream for us. Just make sure it's
// closed so that we flush any data out.
bw.close();
fileCount++;
} catch (Throwable t) {
// We'll get an FFDC here... indicate that we had trouble.
success = false;
}
}
returnMap.put(SUCCESS, Boolean.valueOf(success));
returnMap.put(FILE_COUNT, Integer.valueOf(fileCount));
return returnMap;
} | java |
@Override
public MetaRuleset createMetaRuleset(Class type)
{
MetaRuleset ruleset = new MetaRulesetImpl(_delegate.getTag(), type);
ruleset.ignore("binding");
ruleset.ignore("event");
return ruleset;
} | java |
public void applyAttachedObject(FacesContext context, UIComponent parent)
{
// Retrieve the current FaceletContext from FacesContext object
FaceletContext faceletContext = (FaceletContext) context.getAttributes().get(
FaceletContext.FACELET_CONTEXT_KEY);
ValueExpression ve = null;
Behavior behavior = null;
if (_delegate.getBinding() != null)
{
ve = _delegate.getBinding().getValueExpression(faceletContext, Behavior.class);
behavior = (Behavior) ve.getValue(faceletContext);
}
if (behavior == null)
{
behavior = this.createBehavior(faceletContext);
if (ve != null)
{
ve.setValue(faceletContext, behavior);
}
}
if (behavior == null)
{
throw new TagException(_delegate.getTag(), "No Validator was created");
}
_delegate.setAttributes(faceletContext, behavior);
if (behavior instanceof ClientBehavior)
{
// cast to a ClientBehaviorHolder
ClientBehaviorHolder cvh = (ClientBehaviorHolder) parent;
// TODO: check if the behavior could be applied to the current parent
// For run tests it is not necessary, so we let this one pending.
// It is necessary to obtain a event name for add it, so we have to
// look first to the defined event name, otherwise take the default from
// the holder
String eventName = getEventName();
if (eventName == null)
{
eventName = cvh.getDefaultEventName();
}
if (eventName == null)
{
throw new TagAttributeException(_delegate.getEvent(),
"eventName could not be defined for client behavior "+ behavior.toString());
}
else if (!cvh.getEventNames().contains(eventName))
{
throw new TagAttributeException(_delegate.getEvent(),
"eventName "+eventName+" not found on component instance");
}
else
{
cvh.addClientBehavior(eventName, (ClientBehavior) behavior);
}
AjaxHandler.registerJsfAjaxDefaultResource(faceletContext, parent);
}
} | java |
@FFDCIgnore(InvocationTargetException.class)
Object getDB(String databaseName) throws Exception {
final boolean trace = TraceComponent.isAnyTracingEnabled();
lock.readLock().lock();
try {
if (mongoClient == null) {
// Switch to write lock for lazy initialization
lock.readLock().unlock();
lock.writeLock().lock();
try {
if (mongoClient == null)
init();
} finally {
// Downgrade to read lock for rest of method
lock.readLock().lock();
lock.writeLock().unlock();
}
}
Object db = MongoClient_getDB.invoke(mongoClient, databaseName);
// authentication
String user = (String) props.get(USER);
if (user != null) {
if ((Boolean) DB_isAuthenticated.invoke(db)) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "already authenticated");
} else {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "authenticate as: " + user);
SerializableProtectedString password = (SerializableProtectedString) props.get(PASSWORD);
String pwdStr = password == null ? null : String.valueOf(password.getChars());
pwdStr = PasswordUtil.getCryptoAlgorithm(pwdStr) == null ? pwdStr : PasswordUtil.decode(pwdStr);
char[] pwdChars = pwdStr == null ? null : pwdStr.toCharArray();
try {
if (!(Boolean) DB_authenticate.invoke(db, user, pwdChars))
if ((Boolean) DB_isAuthenticated.invoke(db)) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "another thread must have authenticated first");
} else
throw new IllegalArgumentException(Tr.formatMessage(tc, "CWKKD0012.authentication.error", MONGO, id, databaseName));
} catch (InvocationTargetException x) {
// If already authenticated, Mongo raises:
// IllegalStateException: can't authenticate twice on the same database
// Maybe another thread did the authentication right after we checked, so check again.
Throwable cause = x.getCause();
if (cause instanceof IllegalStateException && (Boolean) DB_isAuthenticated.invoke(db)) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "another thread must have authenticated first", cause);
} else
throw cause;
}
}
} else if (useCertAuth) {
// If we specified a certificate we will already have used the client constructor that
// specified the credential so if we have got to here we are already authenticated and
// JIT should remove this so it will not be an overhead.
}
return db;
} catch (Throwable x) {
// rethrowing the exception allows it to be captured in FFDC and traced automatically
x = x instanceof InvocationTargetException ? x.getCause() : x;
if (x instanceof Exception)
throw (Exception) x;
else if (x instanceof Error)
throw (Error) x;
else
throw new RuntimeException(x);
} finally {
lock.readLock().unlock();
}
} | java |
private String getCerticateSubject(AtomicServiceReference<Object> serviceRef, Properties sslProperties) {
String certificateDN = null;
try {
certificateDN = sslHelper.getClientKeyCertSubject(serviceRef, sslProperties);
} catch (KeyStoreException ke) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.error(tc, "CWKKD0020.ssl.get.certificate.user", MONGO, id, ke);
}
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0020.ssl.get.certificate.user", MONGO, id, ke));
} catch (CertificateException ce) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.error(tc, "CWKKD0020.ssl.get.certificate.user", MONGO, id, ce);
}
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0020.ssl.get.certificate.user", MONGO, id, ce));
}
// handle null .... cannot find the client key
if (certificateDN == null) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.error(tc, "CWKKD0026.ssl.certificate.exception", MONGO, id);
}
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0026.ssl.certificate.exception", MONGO, id));
}
return certificateDN;
} | java |
@FFDCIgnore(Throwable.class)
@Trivial
private void set(Class<?> MongoClientOptions_Builder, Object optionsBuilder, String propName,
Object value) throws IntrospectionException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
try {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, propName + '=' + value);
Class<?> type = MONGO_CLIENT_OPTIONS_TYPES.get(propName);
// setter methods are just propName, no setPropName.
Method method = MongoClientOptions_Builder.getMethod(propName, type);
// even though we told the config service that some of these props are Integers, they get converted to longs. Need
// to convert them back to int so that our .invoke(..) method doesn't blow up.
if (type.equals(int.class) && value instanceof Long) {
value = ((Long) value).intValue();
}
method.invoke(optionsBuilder, value);
return;
} catch (Throwable x) {
if (x instanceof InvocationTargetException)
x = x.getCause();
IllegalArgumentException failure = ignoreWarnOrFail(x, IllegalArgumentException.class, "CWKKD0010.prop.error", propName, MONGO, id, x);
if (failure != null) {
FFDCFilter.processException(failure, getClass().getName(), "394", this, new Object[] { value == null ? null : value.getClass(), value });
throw failure;
}
}
} | java |
@FFDCIgnore(Throwable.class)
@Trivial
private void setReadPreference(Class<?> MongoClientOptions_Builder, Object optionsBuilder,
String creatorMethod) throws ClassNotFoundException, IllegalArgumentException, SecurityException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {
try {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, READ_PREFERENCE + '=' + creatorMethod);
Class<?> ReadPreference = MongoClientOptions_Builder.getClassLoader().loadClass("com.mongodb.ReadPreference");
// Calls static ReadPreference.nearest() (or whatever conf is set to) to get a ReadPreference object
Object readPreference = ReadPreference.getMethod(creatorMethod).invoke(ReadPreference);
// Set static ReadPreference on Builder.
MongoClientOptions_Builder.getMethod("readPreference", ReadPreference).invoke(optionsBuilder, readPreference);
} catch (Throwable x) {
if (x instanceof InvocationTargetException)
x = x.getCause();
IllegalArgumentException failure = ignoreWarnOrFail(x, IllegalArgumentException.class, "CWKKD0010.prop.error", READ_PREFERENCE, MONGO, id, x);
if (failure != null) {
FFDCFilter.processException(failure, getClass().getName(), "422", this);
throw failure;
}
}
} | java |
@FFDCIgnore(Throwable.class)
@Trivial
private void setWriteConcern(Class<?> MongoClientOptions_Builder, Object optionsBuilder,
String fieldName) throws ClassNotFoundException, IllegalArgumentException, SecurityException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {
try {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, WRITE_CONCERN + '=' + fieldName);
Class<?> WriteConcern = MongoClientOptions_Builder.getClassLoader().loadClass("com.mongodb.WriteConcern");
// Set value to the static class value
Object writeConcern = WriteConcern.getField(fieldName).get(null);
MongoClientOptions_Builder.getMethod("writeConcern", WriteConcern).invoke(optionsBuilder, writeConcern);
} catch (Throwable x) {
if (x instanceof InvocationTargetException)
x = x.getCause();
IllegalArgumentException failure = ignoreWarnOrFail(x, IllegalArgumentException.class, "CWKKD0010.prop.error", WRITE_CONCERN, MONGO, id, x);
if (failure != null) {
FFDCFilter.processException(failure, getClass().getName(), "422", this);
throw failure;
}
}
} | java |
protected void setSsl(ServiceReference<Object> reference) {
sslConfigurationRef.setReference(reference);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "sslRef set to " + reference.getProperty(CONFIG_DISPLAY_ID));
}
} | java |
protected void unsetSsl(ServiceReference<Object> reference) {
sslConfigurationRef.unsetReference(reference);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "sslRef unset");
}
} | java |
private void assertValidSSLConfig() {
final boolean trace = TraceComponent.isAnyTracingEnabled();
boolean sslEnabled = (((Boolean) props.get(SSL_ENABLED)) == null) ? false : (Boolean) props.get(SSL_ENABLED);
boolean sslRefExists = ((props.get(SSL_REF)) == null) ? false : true;
if (sslRefExists && !sslEnabled) {
if (trace && tc.isDebugEnabled()) {
// sslRef property set in the server.xml but sslEnabled not set to true.
Tr.error(tc, "CWKKD0024.ssl.sslref.no.ssl", MONGO, id);
}
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0024.ssl.sslref.no.ssl", MONGO, id));
}
if (sslEnabled) {
// we should have the ssl-1.0 feature selected
if (sslHelper == null) {
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0015.ssl.feature.missing", MONGO, id));
}
if (useCertAuth) {
if (!sslEnabled) {
// SSL not enabled, so shouldn't be using certificate authentication
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0019.ssl.certificate.no.ssl", MONGO, id));
}
if (props.get(USER) != null || props.get(PASSWORD) != null) {
// shouldn't be using userid and pasword with certificate authentication
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0018.ssl.user.pswd.certificate", MONGO, id));
}
}
}
} | java |
@Sensitive
public String getReferrerURLFromCookies(HttpServletRequest req, String cookieName) {
Cookie[] cookies = req.getCookies();
String referrerURL = CookieHelper.getCookieValue(cookies, cookieName);
if (referrerURL != null) {
StringBuffer URL = req.getRequestURL();
referrerURL = decodeURL(referrerURL);
referrerURL = restoreHostNameToURL(referrerURL, URL.toString());
}
return referrerURL;
} | java |
public void clearReferrerURLCookie(HttpServletRequest req, HttpServletResponse res, String cookieName) {
String url = CookieHelper.getCookieValue(req.getCookies(), cookieName);
if (url != null && url.length() > 0) {
invalidateReferrerURLCookie(req, res, cookieName);
}
} | java |
public void setReferrerURLCookie(HttpServletRequest req, AuthenticationResult authResult, String url) {
//PM81345: If the URL contains favicon, then we will not update the value of the ReffererURL. The only way
//we will do it, is if the value of the cookie is null. This will solve the Error 500.
if (url.contains("/favicon.ico") && CookieHelper.getCookieValue(req.getCookies(), REFERRER_URL_COOKIENAME) != null) {
if (tc.isDebugEnabled())
Tr.debug(tc, "Will not update the WASReqURL cookie");
} else {
if (!webAppSecConfig.getPreserveFullyQualifiedReferrerUrl()) {
url = removeHostNameFromURL(url);
}
url = encodeURL(url);
authResult.setCookie(createReferrerUrlCookie(req, url));
if (tc.isDebugEnabled()) {
Tr.debug(tc, "set " + REFERRER_URL_COOKIENAME + " cookie into AuthenticationResult.");
Tr.debug(tc, "setReferrerURLCookie", "Referrer URL cookie set " + url);
}
}
} | java |
@FFDCIgnore(Exception.class)
private boolean checkDataSource(DataSource nonTranDataSource)
{
boolean fullyFormedDS = false;
try
{
nonTranDataSource = (DataSource) _dataSourceFactory.createResource(null);
if (tc.isDebugEnabled())
Tr.debug(tc, "Non Tran dataSource is " + nonTranDataSource);
Connection conn = nonTranDataSource.getConnection();
if (tc.isDebugEnabled())
Tr.debug(tc, "Established connection " + conn);
DatabaseMetaData mdata = conn.getMetaData();
String dbName = mdata.getDatabaseProductName();
if (tc.isDebugEnabled())
Tr.debug(tc, "Database name " + dbName);
String dbVersion = mdata.getDatabaseProductVersion();
if (tc.isDebugEnabled())
Tr.debug(tc, "Database version " + dbVersion);
fullyFormedDS = true;
} catch (Exception e)
{
// We will catch an exception if the DataSource is not yet fully formed
if (tc.isDebugEnabled())
Tr.debug(tc, "Caught exception: " + e);
}
return fullyFormedDS;
} | java |
public void bytes(Object source,
Class sourceClass,
byte[] data) {
internalBytes(source,
sourceClass,
data,
0,
0);
} | java |
public final void entry(Class sourceClass,
String methodName) {
internalEntry(null,
sourceClass,
methodName,
null);
} | java |
public final void exit(Class sourceClass,
String methodName) {
internalExit(null,
sourceClass,
methodName,
null);
} | java |
private final void internalExit(Object source,
Class sourceClass,
String methodName,
Object object) {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(methodName);
stringBuffer.append(" [");
if (source != null) {
stringBuffer.append(source);
} else {
stringBuffer.append("Static");
}
stringBuffer.append("]");
if (object != null) {
SibTr.exit(traceComponent,
stringBuffer.toString(),
object);
} else {
SibTr.exit(traceComponent,
stringBuffer.toString());
}
if (usePrintWriterForTrace) {
java.io.PrintWriter printWriter = traceFactory.getPrintWriter();
if (printWriter != null) {
printWriter.print(new java.util.Date() + " < ");
printWriter.print(sourceClass.getName());
printWriter.print(".");
printWriter.println(stringBuffer.toString());
if (object != null) {
if (object instanceof Object[]) {
Object[] objects = (Object[]) object;
for (int i = 0; i < objects.length; i++) {
printWriter.println("\t\t" + objects[i]);
}
} else {
printWriter.println("\t\t" + object);
}
}
printWriter.flush();
}
}
} | java |
public final void event(Class sourceClass,
String methodName,
Throwable throwable) {
internalEvent(null,
sourceClass,
methodName,
throwable);
} | java |
public final void event(Object source,
Class sourceClass,
String methodName,
Throwable throwable) {
internalEvent(source,
sourceClass,
methodName,
throwable);
} | java |
private final void internalEvent(Object source,
Class sourceClass,
String methodName,
Throwable throwable) {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(methodName);
stringBuffer.append(" [");
if (source != null) {
stringBuffer.append(source);
} else {
stringBuffer.append("Static");
}
stringBuffer.append("]");
if (throwable != null) {
SibTr.event(traceComponent,
stringBuffer.toString(),
new Object[] { "Exception caught: ",
throwable });
} else {
SibTr.event(traceComponent,
stringBuffer.toString());
}
if (usePrintWriterForTrace) {
java.io.PrintWriter printWriter = traceFactory.getPrintWriter();
if (printWriter != null) {
printWriter.print(new java.util.Date() + " E ");
printWriter.print(sourceClass.getName());
printWriter.print(".");
printWriter.println(stringBuffer.toString());
if (throwable != null) {
throwable.printStackTrace(printWriter);
}
printWriter.flush();
}
}
} | java |
public final void info(Class sourceClass,
String methodName,
String messageIdentifier,
Object object) {
internalInfo(null,
sourceClass,
methodName,
messageIdentifier,
object);
} | java |
public final void warning(Class sourceClass,
String methodName,
String messageIdentifier,
Object object) {
internalWarning(null,
sourceClass,
methodName,
messageIdentifier,
object);
} | java |
public void overrideCacheConfig(Properties properties) {
if (properties != null) {
FieldInitializer.initFromSystemProperties(this, properties);
}
processOffloadDirectory();
if (!this.enableServletSupport) {
this.disableTemplatesSupport = true;
}
} | java |
public void determineCacheProvider() {
this.defaultProvider = true;
if (cacheProviderName.equals("")) {
cacheProviderName = CacheConfig.CACHE_PROVIDER_DYNACACHE;
}
if (!cacheProviderName.equals(CACHE_PROVIDER_DYNACACHE)) {
defaultProvider = false;
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Alternate CacheProvider " + cacheProviderName + " set for " + cacheName);
}
}
} | java |
public void resetProvider(String cacheName) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Reverting to the default Dynacache cache provider");
}
this.cacheProviderName = CACHE_PROVIDER_DYNACACHE;
this.enableCacheReplication = false;
this.defaultProvider = true;
this.cacheName = cacheName;
} | java |
void restoreDynacacheProviderDefaults() { // restore commonConfig to Dynacache defaults
if (restoreDynacacheDefaults) {
if (cacheProviderName != CacheConfig.CACHE_PROVIDER_DYNACACHE) {
cacheProviderName = CacheConfig.CACHE_PROVIDER_DYNACACHE;
enableCacheReplication = false;
if (tc.isDebugEnabled()) {
Tr.debug(tc, "OVERRIDING Object Grid default for " + cacheName);
}
}
}
} | java |
public String pluginId() {
if (tc.isEntryEnabled())
Tr.entry(tc, "pluginId", this);
if (tc.isEntryEnabled())
Tr.exit(tc, "pluginId", _pluginId);
return _pluginId;
} | java |
public Properties properties() {
if (tc.isEntryEnabled())
Tr.entry(tc, "propertis", this);
if (tc.isEntryEnabled())
Tr.exit(tc, "properties", _props);
return _props;
} | java |
public ResourceFactory resourceFactory() {
if (tc.isEntryEnabled())
Tr.entry(tc, "resourceFactory", this);
if (tc.isEntryEnabled())
Tr.exit(tc, "resourceFactory", _resourceFactory);
return _resourceFactory;
} | java |
protected void loadCipherToBit() {
boolean keySizeFromCipherMap =
Boolean.valueOf(WebContainer.getWebContainerProperties().getProperty("com.ibm.ws.webcontainer.keysizefromciphermap", "true")).booleanValue();
//721610
if (keySizeFromCipherMap) {
this.getKeySizefromCipherMap("toLoad"); // this will load the Map with values
} else {
Properties cipherToBitProps = new Properties();
// load the ssl cipher suite bit sizes property file
try {
String fileName = System.getProperty("server.root") + File.separator + "properties" + File.separator + "sslbitsizes.properties";
cipherToBitProps.load(new FileInputStream(fileName));
} catch (Exception ex) {
logger.logp(Level.SEVERE, CLASS_NAME, "loadCipherToBit", "failed.to.load.sslbitsizes.properties ", ex); /* 283348.1 */
com.ibm.wsspi.webcontainer.util.FFDCWrapper.processException(ex, CLASS_NAME + ".loadCipherToBit", "825", this);
}
// put the properties into a hash map for unsynch. reference
_cipherToBit.putAll(cipherToBitProps);
}
} | java |
public VirtualHost getVirtualHost(String targetHost) throws WebAppHostNotFoundException {
Iterator i = requestMapper.targetMappings();
while (i.hasNext()) {
RequestProcessor rp = (RequestProcessor) i.next();
if (rp instanceof VirtualHost) {
VirtualHost vHost = (VirtualHost) rp;
if (targetHost.equalsIgnoreCase(vHost.getName()))
return vHost;
}
}
return null;
} | java |
private PathInfoHelper removeExtraPathInfo(String pathInfo) {
if (pathInfo == null)
return null;
int semicolon = pathInfo.indexOf(';');
if (semicolon != -1) {
String tmpPathInfo = pathInfo.substring(0, semicolon);
String extraPathInfo = pathInfo.substring(semicolon);
return new PathInfoHelper(tmpPathInfo, extraPathInfo);
}
return new PathInfoHelper(pathInfo, null);
} | java |
public static void sendAppUnavailableException(HttpServletRequest req, HttpServletResponse res) throws IOException {
if ((req instanceof SRTServletRequest) && (res instanceof SRTServletResponse)) {
IRequest ireq = ((SRTServletRequest) req).getIRequest();
IResponse ires = ((SRTServletResponse) res).getIResponse();
sendUnavailableException(ireq, ires);
}
} | java |
protected static void sendUnavailableException(IRequest req, IResponse res) throws IOException {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) //306998.15
logger.logp(Level.FINE, CLASS_NAME, "sendUnavailableException", "Inside sendUnavailableException");
res.addHeader("Content-Type", "text/html");
res.setStatusCode(503);
//Translated to SRVE0095I: Servlet has become temporarily unavailable for service: {0}
String formattedMessage = nls.getFormattedMessage("Servlet.has.become.temporarily.unavailable.for.service:.{0}", new Object[] { truncateURI(req.getRequestURI()) },
"Servlet has become temporarily unavailable for service");
String output = "<H1>"
+ formattedMessage
+ "</H1><BR>";
byte[] outBytes = output.getBytes();
res.getOutputStream().write(outBytes, 0, outBytes.length);
logger.logp(Level.SEVERE, CLASS_NAME, "sendUnavailableException", formattedMessage );
} | java |
@Test
public void MPJwtNoMpJwtConfig_notInWebXML_notInApp() throws Exception {
genericLoginConfigVariationTest(
MpJwtFatConstants.LOGINCONFIG_NOT_IN_WEB_XML_SERVLET_NOT_IN_APP_ROOT_CONTEXT,
MpJwtFatConstants.LOGINCONFIG_NOT_IN_WEB_XML_SERVLET_NOT_IN_APP,
MpJwtFatConstants.MPJWT_APP_CLASS_NO_LOGIN_CONFIG,
ExpectedResult.BAD);
} | java |
@Test
public void MPJwtNoMpJwtConfig_notInWebXML_basicInApp() throws Exception {
genericLoginConfigVariationTest(
MpJwtFatConstants.LOGINCONFIG_NOT_IN_WEB_XML_SERVLET_BASIC_IN_APP_ROOT_CONTEXT,
MpJwtFatConstants.LOGINCONFIG_NOT_IN_WEB_XML_SERVLET_BASIC_IN_APP,
MpJwtFatConstants.MPJWT_APP_CLASS_LOGIN_CONFIG_BASIC,
ExpectedResult.BAD);
} | java |
@Test
public void MPJwtNoMpJwtConfig_formLoginInWebXML_notInApp() throws Exception {
genericLoginConfigFormLoginVariationTest(
MpJwtFatConstants.LOGINCONFIG_FORM_LOGIN_IN_WEB_XML_SERVLET_NOT_IN_APP_ROOT_CONTEXT,
MpJwtFatConstants.LOGINCONFIG_FORM_LOGIN_IN_WEB_XML_SERVLET_NOT_IN_APP,
MpJwtFatConstants.MPJWT_APP_CLASS_LOGIN_CONFIG_FORMLOGININWEBXML_NOTINAPP,
UseJWTToken.NO);
} | java |
@Test
public void MPJwtNoMpJwtConfig_formLoginInWebXML_basicInApp() throws Exception {
genericLoginConfigFormLoginVariationTest(
MpJwtFatConstants.LOGINCONFIG_FORM_LOGIN_IN_WEB_XML_SERVLET_BASIC_IN_APP_ROOT_CONTEXT,
MpJwtFatConstants.LOGINCONFIG_FORM_LOGIN_IN_WEB_XML_SERVLET_BASIC_IN_APP,
MpJwtFatConstants.MPJWT_APP_CLASS_LOGIN_CONFIG_FORMLOGININWEBXML_BASICINAPP,
UseJWTToken.NO);
} | java |
@Test
public void MPJwtNoMpJwtConfig_formLoginInWebXML_mpJwtInApp() throws Exception {
genericLoginConfigFormLoginVariationTest(
MpJwtFatConstants.LOGINCONFIG_FORM_LOGIN_IN_WEB_XML_SERVLET_MP_JWT_IN_APP_ROOT_CONTEXT,
MpJwtFatConstants.LOGINCONFIG_FORM_LOGIN_IN_WEB_XML_SERVLET_MP_JWT_IN_APP,
MpJwtFatConstants.MPJWT_APP_CLASS_LOGIN_CONFIG_FORMLOGININWEBXML_MPJWTINAPP,
UseJWTToken.NO);
} | java |
@Test
public void MPJwtNoMpJwtConfig_mpJwtInWebXML_notInApp() throws Exception {
genericLoginConfigVariationTest(
MpJwtFatConstants.LOGINCONFIG_MP_JWT_IN_WEB_XML_SERVLET_NOT_IN_APP_ROOT_CONTEXT,
MpJwtFatConstants.LOGINCONFIG_MP_JWT_IN_WEB_XML_SERVLET_NOT_IN_APP,
MpJwtFatConstants.MPJWT_APP_CLASS_LOGIN_CONFIG_MPJWTINWEBXML_NOTINAPP,
ExpectedResult.BAD);
} | java |
@Test
public void MPJwtNoMpJwtConfig_mpJwtInWebXML_basicInApp() throws Exception {
genericLoginConfigVariationTest(
MpJwtFatConstants.LOGINCONFIG_MP_JWT_IN_WEB_XML_SERVLET_BASIC_IN_APP_ROOT_CONTEXT,
MpJwtFatConstants.LOGINCONFIG_MP_JWT_IN_WEB_XML_SERVLET_BASIC_IN_APP,
MpJwtFatConstants.MPJWT_APP_CLASS_LOGIN_CONFIG_MPJWTINWEBXML_BASICINAPP,
ExpectedResult.BAD);
} | java |
@Mode(TestMode.LITE)
@Test
public void MPJwtNoMpJwtConfig_mpJwtInWebXML_mpJwtInApp() throws Exception {
genericLoginConfigVariationTest(
MpJwtFatConstants.LOGINCONFIG_MP_JWT_IN_WEB_XML_SERVLET_MP_JWT_IN_APP_ROOT_CONTEXT,
MpJwtFatConstants.LOGINCONFIG_MP_JWT_IN_WEB_XML_SERVLET_MP_JWT_IN_APP,
MpJwtFatConstants.MPJWT_APP_CLASS_LOGIN_CONFIG_MPJWTINWEBXML_MPJWTINAPP,
ExpectedResult.BAD);
} | java |
@Override
public void setTopicName(String tName) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "setTopicName", tName);
setDestDiscrim(tName);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "setTopicName");
} | java |
@Override
public String getTopicSpace() throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "getTopicSpace");
String result = getDestName();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "getTopicSpace", result);
return result;
} | java |
@Override
public void setTopicSpace(String tSpace) throws JMSException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "setTopicSpace", tSpace);
setDestName(tSpace);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "setTopicSpace");
} | java |
public static void initialise(AcceptListenerFactory _acceptListenerFactory) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "initalise");
acceptListenerFactory = _acceptListenerFactory;
// Create the maintainer of the configuration.
Framework framework = Framework.getInstance();
if (framework == null) {
state = State.INITIALISATION_FAILED;
} else {
state = State.INITIALISED;
// Extract the chain reference.
connectionTracker = new OutboundConnectionTracker(framework);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "initalise");
} | java |
public static void initialiseAcceptListenerFactory(AcceptListenerFactory _acceptListenerFactory) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "initialiseAcceptListenerFactory", _acceptListenerFactory);
acceptListenerFactory = _acceptListenerFactory;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "initialiseAcceptListenerFactory");
} | java |
@Override
public List getActiveOutboundMEtoMEConversations() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "getActiveOutboundMEtoMEConversations");
List convs = null;
if (connectionTracker != null) {
convs = connectionTracker.getAllOutboundConversations();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "getActiveOutboundMEtoMEConversations", convs);
return convs;
} | java |
@Override
public void open() throws InfoStoreException {
String methodName = "open";
try {
getClassSource().open();
} catch (ClassSource_Exception e) {
// defect 84235:we are generating multiple Warning/Error messages for each error due to each level reporting them.
// Disable the following warning and defer message generation to a higher level.
// CWWKC0026W
//Tr.warning(tc, "ANNO_INFOSTORE_OPEN1_EXCEPTION", getHashText(), getClassSource().getHashText());
String eMsg = "[ " + getHashText() + " ] Failed to open class source ";
throw InfoStoreException.wrap(tc, CLASS_NAME, methodName, eMsg, e);
}
} | java |
public void scanClass(String className) throws InfoStoreException {
Object[] logParms;
if (tc.isDebugEnabled()) {
logParms = new Object[] { getHashText(), className };
Tr.debug(tc, MessageFormat.format("[ {0} ] Class [ {1} ] ENTER", logParms));
} else {
logParms = null;
}
ClassInfoImpl classInfo = getNonDelayedClassInfo(className);
if (classInfo != null) {
if (logParms != null) {
Tr.debug(tc, MessageFormat.format("[ {0} ] Class [ {1} ] RETURN Already loaded", logParms));
}
return;
}
scanNewClass(className); // throws AnnotationScannerException
if (logParms != null) {
Tr.debug(tc, MessageFormat.format("[ {0} ] Class [ {1} ] RETURN New load", logParms));
}
} | java |
@Override
public PackageInfoImpl getPackageInfo(String name) {
return getClassInfoCache().getPackageInfo(name, ClassInfoCache.DO_NOT_FORCE_PACKAGE);
} | java |
private void updateBindings(Map<String, Object> props) {
// Process the user element
processProps(props, CFG_KEY_USER, users);
// Process the user-access-id element
processProps(props, CFG_KEY_USER_ACCESSID, users);
// Process the group element
processProps(props, CFG_KEY_GROUP, groups);
// Process the group-access-id element
processProps(props, CFG_KEY_GROUP_ACCESSID, groups);
} | java |
public void cancel(Exception reason) {
// IMPROVEMENT: need to rework how syncs on the future.complete() work. We really should be
// syncing here, so we don't do the channel.cancel if the request is processing
// future.complete() on another thread at the same time. Should just do a quick
// sync, check the future.complete flag, then process only if !complete. That will
// also mean we can remove a bunch of redundant checks for complete, but we need to check all
// the paths carefully.
if (this.channel == null) {
return;
}
synchronized (this.completedSemaphore) {
if (!this.completed) {
try {
// this ends up calling future.completed()
this.channel.cancel(this, reason);
} catch (Exception e) {
// Simply swallow the exception
} // end try
} else {
if (this.channel.readFuture != null) {
this.channel.readFuture.setCancelInProgress(0);
}
if (this.channel.writeFuture != null) {
this.channel.writeFuture.setCancelInProgress(0);
}
}
}
} | java |
protected void fireCompletionActions() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "fireCompletionActions");
}
if (this.firstListener != null) {
ICompletionListener listenerToInvoke = this.firstListener;
// reset listener so it can't be inadvertently be called on the next request
this.firstListener = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "invoking callback for channel id: " + this.channel.channelIdentifier);
}
invokeCallback(listenerToInvoke, this, this.firstListenerState);
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "no listener found for event, future: " + this);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "fireCompletionActions");
}
} | java |
protected void throwException() throws InterruptedException, IOException {
if (this.exception instanceof IOException) {
throw (IOException) this.exception;
}
if (this.exception instanceof InterruptedException) {
throw (InterruptedException) this.exception;
}
if (this.exception instanceof RuntimeException) {
throw (RuntimeException) this.exception;
}
throw new RuntimeException(this.exception);
} | java |
private void internalBytes(Object source, Class sourceClass, byte[] data, int start, int count)
{
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append(sourceClass.getName());
stringBuffer.append(" [");
if (source != null)
{
stringBuffer.append(source);
}
else
{
stringBuffer.append("Static");
}
stringBuffer.append("]");
stringBuffer.append(ls);
if (data != null)
{
if (count > 0)
{
stringBuffer.append(formatBytes(data, start, count, true));
}
else
{
stringBuffer.append(formatBytes(data, start, data.length, true));
}
}
else
{
stringBuffer.append("data is null");
}
Tr.debug(traceComponent, stringBuffer.toString());
if (usePrintWriterForTrace)
{
if (printWriter != null)
{
printWriter.print(new java.util.Date()+" B ");
printWriter.println(stringBuffer.toString());
printWriter.flush();
}
}
} | java |
public AppConfigurationEntry createAppConfigurationEntry(JAASLoginModuleConfig loginModule, String loginContextEntryName) {
String loginModuleClassName = loginModule.getClassName();
LoginModuleControlFlag controlFlag = loginModule.getControlFlag();
Map<String, Object> options = new HashMap<String, Object>();
options.putAll(loginModule.getOptions());
if (JaasLoginConfigConstants.APPLICATION_WSLOGIN.equals(loginContextEntryName)) {
options.put(WAS_IGNORE_CLIENT_CONTAINER_DD, true);
}
else {
options.put(WAS_IGNORE_CLIENT_CONTAINER_DD, false);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "loginModuleClassName: " + loginModuleClassName + " options: " + options.toString() + " controlFlag: " + controlFlag.toString());
}
AppConfigurationEntry loginModuleEntry = new AppConfigurationEntry(loginModuleClassName, controlFlag, options);
return loginModuleEntry;
} | java |
@Override
public List<AnnotationInfoImpl> getAnnotations() {
if (annotations != null) {
return annotations;
}
// Several cases where superclasses contribute no annotations. In
// each of these cases case, simply re-use the declared annotations
// collection.
//
// (One case: All of the inheritable superclass annotations is
// overridden by the immediate class, is not detected.)
ClassInfoImpl useSuperClass = getSuperclass(); // Null for 'java.lang.Object'; null for interfaces.
if (useSuperClass == null) {
annotations = declaredAnnotations;
return annotations;
}
// Retrieve *all* annotations of the superclass. The effect
// is to recurse across annotations of all superclasses.
List<AnnotationInfoImpl> superAnnos = useSuperClass.getAnnotations();
if (superAnnos.isEmpty()) {
annotations = declaredAnnotations;
return annotations;
}
Map<String, AnnotationInfoImpl> allAnnotations =
new HashMap<String, AnnotationInfoImpl>(superAnnos.size() + declaredAnnotations.size(), 1.0f);
boolean sawInherited = false;
for (AnnotationInfoImpl superAnno : superAnnos) {
if (sawInherited = superAnno.isInherited()) {
allAnnotations.put(superAnno.getAnnotationClassName(), superAnno);
}
}
if (!sawInherited) {
annotations = declaredAnnotations;
return annotations;
}
// Make sure to add the declared annotations *after* adding the super class
// annotations. The immediate declared annotations have precedence.
// We could test the number of overwritten annotations against the
// number of inherited annotations. That case seems infrequent, and
// is not implemented.
for (AnnotationInfoImpl declaredAnno : declaredAnnotations) {
AnnotationInfoImpl overwrittenAnno = allAnnotations.put(declaredAnno.getAnnotationClassName(), declaredAnno);
if (overwrittenAnno != null) {
// NO-OP: But maybe we want to log this
}
}
annotations = new ArrayList<AnnotationInfoImpl>(allAnnotations.values());
return annotations;
} | java |
private void checkNotClosed() throws SISessionUnavailableException
{
if (tc.isEntryEnabled())
SibTr.entry(tc, "checkNotClosed");
// Check that the consumer session isn't closed
_consumerSession.checkNotClosed();
// Now check that this consumer hasn't closed.
synchronized (this)
{
if(_closed)
{
SISessionUnavailableException e =
new SISessionUnavailableException(
nls.getFormattedMessage(
"CONSUMER_CLOSED_ERROR_CWSIP0177",
new Object[] { _localConsumerPoint.getConsumerManager().getDestination().getName(),
_localConsumerPoint.getConsumerManager().getMessageProcessor().getMessagingEngineName()},
null));
if (tc.isEntryEnabled())
SibTr.exit(tc, "checkNotClosed", "consumer closed");
throw e;
}
}
if (tc.isEntryEnabled())
SibTr.exit(tc, "checkNotClosed");
} | java |
@Override
public Map<Object, Object> getSwappableData() {
if (mSwappableData == null) {
mSwappableData = new ConcurrentHashMap<Object, Object>();
if (isNew()) {
//if this is a new session, then we have the updated app data
populatedAppData = true;
}
}
return mSwappableData;
} | java |
@Override
public boolean getSwappableListeners(short requestedListener) {
short thisListenerFlag = getListenerFlag();
boolean rc = false;
// check session's listenrCnt to see if it has any of the type we want
// input listener is either BINDING or ACTIVATION, so if the session has both, its a match
if (thisListenerFlag == requestedListener || thisListenerFlag == HTTP_SESSION_BINDING_AND_ACTIVATION_LISTENER) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "loading data because we have listener match for " + requestedListener);
rc = true;
if (!populatedAppData) {
try {
getSessions().getIStore().setThreadContext();
getMultiRowAppData();
} finally {
getSessions().getIStore().unsetThreadContext();
}
}
}
return rc;
} | java |
public boolean enlistResource(XAResource xaRes) throws RollbackException, SystemException, IllegalStateException {
if (tc.isEntryEnabled())
Tr.entry(tc, "enlistResource", xaRes);
// Determine if we are attempting to enlist a second resource within a transaction
// that can't support 2PC anyway.
if (_disableTwoPhase && (_resourceObjects.size() > 0)) {
final String msg = "Unable to enlist a second resource within the transaction. Two phase support is disabled " +
"as the recovery log was not available at transaction start";
final IllegalStateException ise = new IllegalStateException(msg);
if (tc.isEntryEnabled())
Tr.exit(tc, "enlistResource (SPI)", ise);
throw ise;
}
// Create the resource wrapper and see if it already exists in the table
OnePhaseResourceImpl jtaRes = new OnePhaseResourceImpl((OnePhaseXAResource) xaRes, _txServiceXid);
boolean register = true;
// See if any other resource has been enlisted
// Allow 1PC and 2PC to be enlisted, it will be rejected at prepare time if LPS is not enabled
// Reject multiple 1PC enlistments
if (_onePhaseResourceEnlisted != null) {
if (_onePhaseResourceEnlisted.equals(jtaRes)) {
register = false;
jtaRes = _onePhaseResourceEnlisted;
} else {
Tr.error(tc, "WTRN0062_ILLEGAL_ENLIST_FOR_MULTIPLE_1PC_RESOURCES");
final String msg = "Illegal attempt to enlist multiple 1PC XAResources";
final IllegalStateException ise = new IllegalStateException(msg);
// FFDC in TransactionImpl
if (tc.isEntryEnabled())
Tr.exit(tc, "enlistResource (SPI)", ise);
throw ise;
}
}
//
// start association of Resource object and register if first time with JTA
// and record that a 1PC resource has now been registered with the transaction.
//
try {
this.startRes(jtaRes);
if (register) {
jtaRes.setResourceStatus(StatefulResource.REGISTERED);
// This is 1PC then we need to insert at element 0
// of the list so we can ensure it is processed last
// at completion time.
_resourceObjects.add(0, jtaRes);
// Check and update LPS enablement state for the application - LIDB1673.22
checkLPSEnablement();
if (tc.isEventEnabled())
Tr.event(tc, "(SPI) RESOURCE registered with Transaction. TX: " + _transaction.getLocalTID() + ", Resource: " + jtaRes);
_onePhaseResourceEnlisted = jtaRes;
}
} catch (RollbackException rbe) {
FFDCFilter.processException(rbe, "com.ibm.tx.jta.impl.RegisteredResources.enlistResource", "480", this);
if (tc.isEntryEnabled())
Tr.exit(tc, "enlistResource", rbe);
throw rbe;
} catch (SystemException se) {
FFDCFilter.processException(se, "com.ibm.tx.jta.impl.RegisteredResources.enlistResource", "487", this);
if (tc.isEntryEnabled())
Tr.exit(tc, "enlistResource", se);
throw se;
}
if (tc.isEntryEnabled())
Tr.exit(tc, "enlistResource", Boolean.TRUE);
return true;
} | java |
protected boolean delistResource(XAResource xaRes, int flag) throws SystemException {
if (tc.isEntryEnabled())
Tr.entry(tc, "delistResource", new Object[] { xaRes, Util.printFlag(flag) });
// get resource manager instance
JTAResourceBase jtaRes = (JTAResourceBase) getResourceTable().get(xaRes);
if (jtaRes == null && _onePhaseResourceEnlisted != null) {
if (_onePhaseResourceEnlisted.XAResource().equals(xaRes))
jtaRes = _onePhaseResourceEnlisted;
}
if (jtaRes == null) {
Tr.error(tc, "WTRN0065_XARESOURCE_NOT_KNOWN", xaRes);
if (tc.isEntryEnabled())
Tr.exit(tc, "delistResource", Boolean.FALSE);
return false;
}
// try to end transaction association using specified flag.
try {
jtaRes.end(flag);
} catch (XAException xae) {
_errorCode = xae.errorCode; // Save locally for FFDC
FFDCFilter.processException(xae, "com.ibm.tx.jta.impl.RegisteredResources.delistResource", "711", this);
if (tc.isDebugEnabled())
Tr.debug(tc, "XAException: error code " + XAReturnCodeHelper.convertXACode(_errorCode), xae);
Throwable toThrow = null;
if (_errorCode >= XAException.XA_RBBASE &&
_errorCode <= XAException.XA_RBEND) {
if (tc.isEventEnabled())
Tr.event(tc, "Transaction branch has been marked rollback-only by the RM");
} else if (_errorCode == XAException.XAER_RMFAIL) {
if (tc.isEventEnabled())
Tr.event(tc, "RM has failed");
// Resource has rolled back
jtaRes.setResourceStatus(StatefulResource.ROLLEDBACK);
jtaRes.destroy();
} else // XAER_RMERR, XAER_INVAL, XAER_PROTO, XAER_NOTA
{
Tr.error(tc, "WTRN0079_END_FAILED", new Object[] { XAReturnCodeHelper.convertXACode(_errorCode), xae });
toThrow = new SystemException("XAResource end association error:" + XAReturnCodeHelper.convertXACode(_errorCode)).initCause(xae);
}
// Mark transaction as rollback only.
try {
_transaction.setRollbackOnly();
if (tc.isEventEnabled())
Tr.event(tc, "Transaction marked as rollback only.");
} catch (IllegalStateException e) {
FFDCFilter.processException(e, "com.ibm.tx.jta.impl.RegisteredResources.delistResource", "742", this);
toThrow = new SystemException(e.getLocalizedMessage()).initCause(e);
}
if (toThrow != null) {
if (tc.isEntryEnabled())
Tr.exit(tc, "delistResource", toThrow);
throw (SystemException) toThrow;
}
}
if (tc.isEntryEnabled())
Tr.exit(tc, "delistResource", Boolean.TRUE);
return true;
} | java |
protected Xid generateNewBranch() {
if (tc.isEntryEnabled())
Tr.entry(tc, "generateNewBranch");
// Create a new Xid branch
final XidImpl result = new XidImpl(_txServiceXid, ++_branchCount);
if (tc.isEntryEnabled())
Tr.exit(tc, "generateNewBranch", result);
return result;
} | java |
protected void startRes(JTAResource resource) throws RollbackException, SystemException {
if (tc.isEntryEnabled())
Tr.entry(tc, "startRes", new Object[] { this, resource });
try {
resource.start();
} catch (XAException xae) {
_errorCode = xae.errorCode; // Save locally for FFDC
FFDCFilter.processException(xae, "com.ibm.tx.jta.impl.RegisteredResources.startRes", "1053", this);
if (tc.isDebugEnabled())
Tr.debug(tc, "XAException: error code " + XAReturnCodeHelper.convertXACode(_errorCode), xae);
final Throwable toThrow;
//
// the XAResource object is doing work outside global
// transaction. This means that XAResource is doing local
// transaction. Local transaction has to be completed before
// start global transaction or XA transaction.
//
if (_errorCode == XAException.XAER_OUTSIDE) {
toThrow = new RollbackException("XAResource working outside transaction").initCause(xae);
if (tc.isEventEnabled())
Tr.event(tc, "XAResource is doing work outside of the transaction.", toThrow);
throw (RollbackException) toThrow;
} else if (_errorCode >= XAException.XA_RBBASE &&
_errorCode <= XAException.XA_RBEND) {
if (tc.isEventEnabled())
Tr.event(tc, "Transaction branch has been marked rollback-only by the RM");
//
// Transaction branch has been rolled back, so we
// mark transaction as rollback only.
//
try {
_transaction.setRollbackOnly();
} catch (IllegalStateException e) {
FFDCFilter.processException(e, "com.ibm.tx.jta.impl.RegisteredResources.startRes", "1085", this);
if (tc.isEventEnabled())
Tr.event(tc, "Exception caught marking Transaction rollback only", e);
throw (SystemException) new SystemException(e.getLocalizedMessage()).initCause(e);
}
toThrow = new RollbackException("Transaction has been marked as rollback only.").initCause(xae);
if (tc.isEventEnabled())
Tr.event(tc, "Marked transaction as rollback only.", toThrow);
throw (RollbackException) toThrow;
}
//
// Any other error is a protocol violation or the RM is broken, and we throw
// SystemException.
//
else // XAER_RMERR, XAER_RMFAIL, XAER_INVAL, XAER_PROTO, XAER_DUPID
{
Tr.error(tc, "WTRN0078_START_FAILED", new Object[] { XAReturnCodeHelper.convertXACode(_errorCode), xae });
throw (SystemException) new SystemException("XAResource start association error:" + XAReturnCodeHelper.convertXACode(_errorCode)).initCause(xae);
}
} finally {
if (tc.isEntryEnabled())
Tr.exit(tc, "startRes");
}
} | java |
public int numRegistered() {
final int result = _resourceObjects.size();
if (tc.isDebugEnabled())
Tr.debug(tc, "numRegistered", result);
return result;
} | java |
public boolean distributeEnd(int flags) {
if (tc.isEntryEnabled())
Tr.entry(tc, "distributeEnd", Util.printFlag(flags));
boolean result = true;
for (int i = _resourceObjects.size(); --i >= 0;) {
final JTAResource resource = _resourceObjects.get(i);
if (!sendEnd(resource, flags)) {
result = false;
}
}
if (_sameRMResource != null) {
if (!sendEnd(_sameRMResource, flags)) {
result = false;
}
}
if (tc.isEntryEnabled())
Tr.exit(tc, "distributeEnd", result);
return result;
} | java |
private void updateHeuristicState(boolean commit) throws SystemException {
if (tc.isEntryEnabled())
Tr.entry(tc, "updateHeuristicState", commit);
if (_transaction.isSubordinate()) {
// Get the current transaction state. Need to do this in case we are
// in recovery and have already logged a heuristic
final TransactionState ts = _transaction.getTransactionState();
final int state = ts.getState();
if (commit) {
if (state != TransactionState.STATE_HEURISTIC_ON_COMMIT)
ts.setState(TransactionState.STATE_HEURISTIC_ON_COMMIT);
} else {
// if state is ACTIVE, then this is called via
// rollbackResources, so do not change state
if (state != TransactionState.STATE_HEURISTIC_ON_ROLLBACK
&& state != TransactionState.STATE_ACTIVE)
ts.setState(TransactionState.STATE_HEURISTIC_ON_ROLLBACK);
}
}
if (tc.isEntryEnabled())
Tr.exit(tc, "updateHeuristicState");
} | java |
public boolean distributeForget() throws SystemException {
if (tc.isEntryEnabled())
Tr.entry(tc, "distributeForget", this);
boolean retryRequired = false; // indicates whether retry necessary
final int resourceCount = _resourceObjects.size();
// Browse through the participants, processing them as appropriate
for (int i = 0; i < resourceCount; i++) {
final JTAResource currResource = _resourceObjects.get(i);
switch (currResource.getResourceStatus()) {
case StatefulResource.HEURISTIC_COMMIT:
case StatefulResource.HEURISTIC_ROLLBACK:
case StatefulResource.HEURISTIC_MIXED:
case StatefulResource.HEURISTIC_HAZARD:
if (forgetResource(currResource)) {
retryRequired = true;
_retryRequired = true;
}
break;
default: // do nothing
break;
} // end switch
} // end for
if (_systemException != null) {
final Throwable toThrow = new SystemException().initCause(_systemException);
if (tc.isEntryEnabled())
Tr.exit(tc, "distributeForget", toThrow);
throw (SystemException) toThrow;
}
if (tc.isEntryEnabled())
Tr.exit(tc, "distributeForget", retryRequired);
return retryRequired;
} | java |
protected boolean forgetResource(JTAResource resource) {
if (tc.isEntryEnabled())
Tr.entry(tc, "forgetResource", resource);
boolean result = false; // indicates whether retry necessary
boolean auditing = false;
try {
boolean informResource = true;
auditing = _transaction.auditSendForget(resource);
if (xaFlowCallbackEnabled) {
informResource = XAFlowCallbackControl.beforeXAFlow(XAFlowCallback.FORGET,
XAFlowCallback.FORGET_NORMAL);
}
if (informResource) {
resource.forget();
}
// Set the state of the Resource to completed after a successful forget.
resource.setResourceStatus(StatefulResource.COMPLETED);
if (auditing)
_transaction.auditForgetResponse(XAResource.XA_OK, resource);
if (xaFlowCallbackEnabled) {
XAFlowCallbackControl.afterXAFlow(XAFlowCallback.FORGET,
XAFlowCallback.AFTER_SUCCESS);
}
} catch (XAException xae) {
_errorCode = xae.errorCode; // Save locally for FFDC
FFDCFilter.processException(xae, "com.ibm.tx.jta.impl.RegisteredResources.forgetResource", "2859", this);
if (tc.isDebugEnabled())
Tr.debug(tc, "XAException: error code " + XAReturnCodeHelper.convertXACode(_errorCode), xae);
if (auditing)
_transaction.auditForgetResponse(_errorCode, resource);
if (xaFlowCallbackEnabled) {
XAFlowCallbackControl.afterXAFlow(XAFlowCallback.FORGET,
XAFlowCallback.AFTER_FAIL);
}
if (_errorCode == XAException.XAER_RMERR) {
// An internal error has occured within
// the resource manager and it was unable
// to forget the transaction.
//
// Retry the forget flow.
result = true;
addToFailedResources(resource);
} else if (_errorCode == XAException.XAER_RMFAIL) {
// The resource manager is unavailable.
// Set the resource's state to failed so that
// we will attempt to reconnect to the resource
// manager upon retrying.
resource.setState(JTAResource.FAILED);
// Retry the forget flow.
result = true;
addToFailedResources(resource);
} else if (_errorCode == XAException.XAER_NOTA) {
// The resource manager had no knowledge
// of this transaction. Perform some cleanup
// and return normally.
resource.setResourceStatus(StatefulResource.COMPLETED);
resource.destroy();
} else // XAER_INVAL, XAER_PROTO
{
if (!auditing)
Tr.error(tc, "WTRN0054_XA_FORGET_ERROR", new Object[] { XAReturnCodeHelper.convertXACode(_errorCode), xae });
resource.setResourceStatus(StatefulResource.COMPLETED);
// An internal logic error has occured.
_systemException = xae;
}
} catch (Throwable t) {
// treat like RMERR
FFDCFilter.processException(t, "com.ibm.tx.jta.impl.RegisteredResources.forgetResource", "2935", this);
if (tc.isDebugEnabled())
Tr.debug(tc, "RuntimeException", t);
if (xaFlowCallbackEnabled) {
XAFlowCallbackControl.afterXAFlow(XAFlowCallback.FORGET,
XAFlowCallback.AFTER_FAIL);
}
// An internal error has occured within
// the resource manager and it was unable
// to forget the transaction.
//
// Retry the forget flow.
result = true;
addToFailedResources(resource);
}
if (tc.isEntryEnabled())
Tr.exit(tc, "forgetResource", result);
return result;
} | java |
public void distributeCommit()
throws SystemException, HeuristicHazardException, HeuristicMixedException, HeuristicRollbackException {
if (tc.isEntryEnabled())
Tr.entry(tc, "distributeCommit");
final TransactionState ts = _transaction.getTransactionState();
ts.setCommittingStateUnlogged();
// Shuffle resources around according to commit priority order
_retryRequired = sortResources();
if (!_retryRequired) {
_outcome = true;
_retryRequired = distributeOutcome();
} else {
updateHeuristicOutcome(StatefulResource.HEURISTIC_HAZARD);
}
if (_systemException != null) {
final Throwable toThrow = new SystemException().initCause(_systemException);
if (tc.isEntryEnabled())
Tr.exit(tc, "distributeCommit", toThrow);
throw (SystemException) toThrow;
}
// check for heuristics ... as we will move forget processing to TransactionImpl later
if (HeuristicOutcome.isHeuristic(_heuristicOutcome)) {
switch (_heuristicOutcome) {
case StatefulResource.HEURISTIC_COMMIT:
break;
case StatefulResource.HEURISTIC_ROLLBACK:
if (tc.isEntryEnabled())
Tr.exit(tc, "distributeCommit", "HeuristicRollbackException");
throw new HeuristicRollbackException();
case StatefulResource.HEURISTIC_HAZARD:
if (tc.isEntryEnabled())
Tr.exit(tc, "distributeCommit", "HeuristicHazardException");
throw new HeuristicHazardException();
default:
if (tc.isEntryEnabled())
Tr.exit(tc, "distributeCommit", "HeuristicMixedException");
throw new HeuristicMixedException();
}
}
if (tc.isEntryEnabled())
Tr.exit(tc, "distributeCommit");
} | java |
public void destroyResources() {
if (tc.isEntryEnabled())
Tr.entry(tc, "destroyResources");
// Browse through the participants, processing them as appropriate
final ArrayList<JTAResource> resources = getResourceObjects();
for (JTAResource resource : resources) {
destroyResource(resource);
}
if (_sameRMResource != null) {
destroyResource(_sameRMResource);
}
if (tc.isEntryEnabled())
Tr.exit(tc, "destroyResources");
} | java |
@Override
public int compare(JTAResource o1, JTAResource o2) {
if (tc.isEntryEnabled())
Tr.entry(tc, "compare", new Object[] { o1, o2, this });
int result = 0;
int p1 = o1.getPriority();
int p2 = o2.getPriority();
if (p1 < p2)
result = 1;
else if (p1 > p2)
result = -1;
if (tc.isEntryEnabled())
Tr.exit(tc, "compare", result);
return result;
} | java |
protected boolean sortResources() {
if (tc.isEntryEnabled())
Tr.entry(tc, "sortResources", _resourceObjects.toArray());
if (!_sorted) {
final int resourceCount = _resourceObjects.size();
if (_gotPriorityResourcesEnlisted) {
if (resourceCount > 1)
Collections.sort(_resourceObjects, this);
}
_sorted = true;
}
if (tc.isEntryEnabled())
Tr.exit(tc, "sortResources", _resourceObjects.toArray());
return false;
} | java |
protected void sortPreparePriorityResources() {
if (tc.isEntryEnabled())
Tr.entry(tc, "sortPreparePriorityResources", _resourceObjects.toArray());
Collections.sort(_resourceObjects, prepareComparator);
if (tc.isEntryEnabled())
Tr.exit(tc, "sortPreparePriorityResources", _resourceObjects.toArray());
return;
} | java |
public boolean isLastAgentEnlisted() {
final boolean lastAgentEnlisted = (_onePhaseResourceEnlisted != null);
if (tc.isDebugEnabled())
Tr.debug(tc, "isLastAgentEnlisted", lastAgentEnlisted);
return lastAgentEnlisted;
} | java |
public Map<String,String> getDurableSelectorNamespaceMap() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getDurableSelectorNamespaceMap");
Map<String,String> map = null;
if (jmo.getChoiceField(ControlAccess.BODY_CREATEDURABLE_NAMESPACEMAP) == ControlAccess.IS_BODY_CREATEDURABLE_NAMESPACEMAP_MAP) {
List<String> names = (List<String>)jmo.getField(ControlAccess.BODY_CREATEDURABLE_NAMESPACEMAP_MAP_NAME);
List<Object> values = (List<Object>)jmo.getField(ControlAccess.BODY_CREATEDURABLE_NAMESPACEMAP_MAP_VALUE);
map = (Map<String,String>)(Map<String,?>)new JsMsgMap(names, values);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getDurableSelectorNamespaceMap", map);
return map;
} | java |
public void setDurableSelectorNamespaceMap(Map<String,String> namespaceMap) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setDurableSelectorNamespaceMap", namespaceMap);
if (namespaceMap == null) {
jmo.setChoiceField(ControlAccess.BODY_CREATEDURABLE_NAMESPACEMAP, ControlAccess.IS_BODY_CREATEDURABLE_NAMESPACEMAP_UNSET);
}
else {
List<String> names = new ArrayList<String>();
List<String> values = new ArrayList<String>();
Set<Map.Entry<String,String>> es = namespaceMap.entrySet();
for (Map.Entry<String,String> entry : es) {
names.add(entry.getKey());
values.add(entry.getValue());
}
jmo.setField(ControlAccess.BODY_CREATEDURABLE_NAMESPACEMAP_MAP_NAME, names);
jmo.setField(ControlAccess.BODY_CREATEDURABLE_NAMESPACEMAP_MAP_VALUE, values);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setDurableSelectorNamespaceMap");
} | java |
public void close() throws IOException
{
if (tc.isEntryEnabled()) Tr.entry(tc, "close", new Object[]{this, _file});
// By locking on the class rather than the object, and removing
// the inner lock on the class, this seems to resolve the problems
// reported in d347231 that file handles were not being released properly
// synchronized(this)
synchronized(RLSAccessFile.class)
{
_useCount--;
if (tc.isDebugEnabled()) Tr.debug(tc, "remaining file use count", new Integer(_useCount));
// Check for 0 usage and close the actual file.
// One needs to be aware that close() can be called both directly by the user on
// file.close(), and also indirectly by the JVM. The JVM will call close() on a
// filechannel.close() and also recursively call filechanel.close() and hence close()
// on a file.close(). For this reason, filechannel.close() has been removed from
// LogFileHandle calls - but it is still in CoordinationLock just in case the behaviour
// of the JVM changes wrt lock releases. This behaviour can make interesting trace
// reading because one can get the use count dropping to -1 either because of two
// serial calls (filechannel.close() + file.close()) or two recursive calls (ie
// file.close() calling filechannel.close() calling file.close()).
// Trace an innocious exception to help debug any recursion problems.
if (tc.isDebugEnabled() && (_useCount <= 0))
{
Tr.debug(tc, "call stack", new Exception("Dummy traceback"));
}
if (_useCount == 0)
{
super.close();
// Outer lock is now on class, so no need to lock here (d347231)
// synchronized(RLSAccessFile.class)
// {
_accessFiles.remove(_file);
// }
}
}
if (tc.isEntryEnabled()) Tr.exit(tc, "close");
} | java |
public int getInteger(String key) throws MissingResourceException {
String result = getString(key);
try {
return Integer.parseInt(result);
} catch (NumberFormatException nfe) {
if (tc.isEventEnabled()) {
Tr.event(tc, "Unable to parse " + result + " as Integer.");
}
// DGH20040823: Begin fix for defect 218797 - Source provided by Tom Musta
// String msg = messages.getString("NLS.integerParseError",
// "Unable to parse as integer.");
String msg = getMessages().getString("NLS.integerParseError",
"Unable to parse as integer.");
// DGH20040823: End fix for defect 218797 - Source provided by Tom Musta
throw new MissingResourceException(msg, bundleName, key);
}
} | java |
public void stop()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "stop");
// Lock exclusively for start operations
mpioLockManager.lockExclusive();
started = false;
mpioLockManager.unlockExclusive();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "stop");
} | java |
public void receiveMessage(MEConnection conn, AbstractMessage aMessage)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "receiveMessage", new Object[] {conn,
aMessage,
"verboseMsg IN : " + aMessage.toVerboseString()});
// Minimal comms trace of the message we've received
if (TraceComponent.isAnyTracingEnabled()) {
MECommsTrc.traceMessage(tc,
_messageProcessor,
aMessage.getGuaranteedSourceMessagingEngineUUID(),
MECommsTrc.OP_RECV,
conn,
aMessage);
}
// Take a read lock to ensure that we can't be stopped while processing a
// message
mpioLockManager.lock();
try
{
if (started)
{
//pass the message on to the RMR
_remoteMessageReciever.receiveMessage(aMessage);
}
else if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
SibTr.debug(tc, "Ignoring message as in stopped state");
}
}
catch(Throwable e)
{
// Anything going wrong in Processor (or below, e.g. MsgStore) shouldn't
// bring the ME-ME connection down. To get an exception through to here
// we must have gone wrong somewhere, i.e. an APAR-kind of event. But even
// so, that's no reason to knobble all ME-to-ME communication, so we swallow
// any exception here, after spitting out an FFDC.
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.io.MPIO.receiveMessage",
"1:228:1.32",
new Object[] {this, aMessage, conn, _messageProcessor.getMessagingEngineName()});
if (e instanceof Exception)
SibTr.exception(tc, (Exception)e);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "Exception occurred when processing a message " + e);
// We're not allowed to swallow this exception - let it work its way back to
// Comms
if(e instanceof ThreadDeath)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "receiveMessage", e);
throw (ThreadDeath)e;
}
}
finally
{
mpioLockManager.unlock();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "receiveMessage");
} | java |
public MPConnection getOrCreateNewMPConnection(SIBUuid8 remoteUuid,
MEConnection conn)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "getOrCreateNewMPConnection", new Object[] {remoteUuid, conn });
MPConnection mpConn;
synchronized(_mpConnectionsByMEConnection)
{
//look up the connection in the cache
mpConn = _mpConnectionsByMEConnection.get(conn);
//if it is not in the cache
if(mpConn == null)
{
//make sure we know the cellule
if(remoteUuid == null)
{
remoteUuid = new SIBUuid8(conn.getMessagingEngine().getUuid());
}
//create a new MPConnection for this MEConnection
mpConn = new MPConnection(this,conn,remoteUuid);
//put it in the cache
_mpConnectionsByMEConnection.put(conn, mpConn);
_mpConnectionsByMEUuid.put(remoteUuid, mpConn);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "getOrCreateNewMPConnection", mpConn);
//return the MPConnection
return mpConn;
} | java |
public MPConnection removeConnection(MEConnection conn)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "removeConnection", new Object[] { conn });
MPConnection mpConn;
synchronized(_mpConnectionsByMEConnection)
{
//remove the MPConnection from the 'by MEConnection' cache
mpConn = _mpConnectionsByMEConnection.remove(conn);
if(mpConn != null)
{
//remove it from the 'by cellule' cache also
_mpConnectionsByMEUuid.remove(mpConn.getRemoteMEUuid());
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "removeConnection", mpConn);
return mpConn;
} | java |
public void error(MEConnection conn, Throwable ex)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "error", new Object[] { this, conn, ex});
// This one goes straight to the CEL
_commsErrorListener.error(conn, ex);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "error");
} | java |
public void changeConnection(MEConnection downConn, MEConnection upConn)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "changeConnection", new Object[] { this, downConn, upConn} );
if(downConn != null)
{
//remove the connection which has gone down
removeConnection(downConn);
}
// The new connection will be created when needed
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "changeConnection");
} | java |