code
stringlengths
73
34.1k
label
stringclasses
1 value
private HttpURLConnection createHeadConnection(String path) throws IOException { HttpURLConnection connection = createHttpURLConnectionToMassive(path); connection.setRequestMethod("HEAD"); return connection; }
java
private void deleteAsset(String id) throws IOException, RequestFailureException { HttpURLConnection connection = createHttpURLConnectionToMassive("/assets/" + id); connection.setRequestMethod("DELETE"); testResponseCode(connection, true); }
java
private void writeMultiPart(final String assetId, final AttachmentSummary attSummary, HttpURLConnection connection) throws IOException, BadVersionException, RequestFailureException { final File fileToWrite = attSummary.getFile(); String boundary = "---------------------------287032381131322"; byte[] startBytes = getStartBytes(attSummary, boundary); byte[] endBytes = getEndBytes(attSummary, boundary); long fileSize; fileSize = AccessController.doPrivileged(new PrivilegedAction<Long>() { @Override public Long run() { return attSummary.getFile().length(); } }); long contentLength = startBytes.length + endBytes.length + fileSize; connection.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary); connection.setRequestProperty("Content-Length", "" + contentLength); connection.setRequestMethod("POST"); connection.setDoOutput(true); OutputStream httpStream = connection.getOutputStream(); // Write the header httpStream.write(startBytes); httpStream.flush(); FileInputStream inputStream = null; try { try { inputStream = AccessController.doPrivileged(new PrivilegedExceptionAction<FileInputStream>() { @Override public FileInputStream run() throws IOException { return new FileInputStream(fileToWrite); } }); } catch (PrivilegedActionException e) { throw (IOException) e.getCause(); } byte[] buffer = new byte[1024]; int read; int total = 0; while ((read = inputStream.read(buffer)) != -1) { httpStream.write(buffer, 0, read); total += read; } if (total != fileSize) { throw new IOException("File size was " + fileSize + " but we only uploaded " + total + " bytes"); } httpStream.flush(); } finally { if (inputStream != null) { inputStream.close(); } } httpStream.write(endBytes); httpStream.flush(); httpStream.close(); }
java
@Override public InputStream getAttachment(final Asset asset, final Attachment attachment) throws IOException, BadVersionException, RequestFailureException { // accept license for type CONTENT HttpURLConnection connection; if (attachment.getType() == AttachmentType.CONTENT) { connection = createHttpURLConnection(attachment.getUrl() + "?license=agree"); } else { connection = createHttpURLConnection(attachment.getUrl()); } // If the attachment was a link and we have a basic auth userid + password specified // we are attempting to access the files staged from a protected site so authorise for it if (attachment.getLinkType() == AttachmentLinkType.DIRECT) { if ((loginInfo.getAttachmentBasicAuthUserId() != null) && (loginInfo.getAttachmentBasicAuthPassword() != null)) { String userpass = loginInfo.getAttachmentBasicAuthUserId() + ":" + loginInfo.getAttachmentBasicAuthPassword(); String basicAuth = "Basic " + encode(userpass.getBytes(Charset.forName("UTF-8"))); connection.setRequestProperty("Authorization", basicAuth); } } connection.setRequestMethod("GET"); testResponseCode(connection); return connection.getInputStream(); }
java
public Attachment getAttachmentMetaData(String assetId, String attachmentId) throws IOException, BadVersionException, RequestFailureException { // At the moment can only get all attachments Asset ass = getAsset(assetId); List<Attachment> allAttachments = ass.getAttachments(); for (Attachment attachment : allAttachments) { if (attachmentId.equals(attachment.get_id())) { return attachment; } } // Didn't find it so just return null return null; }
java
@Override public void deleteAttachment(final String assetId, final String attachmentId) throws IOException, RequestFailureException { HttpURLConnection connection = createHttpURLConnectionToMassive("/assets/" + assetId + "/attachments/" + attachmentId); connection.setRequestMethod("DELETE"); testResponseCode(connection, true); }
java
@Override public void deleteAssetAndAttachments(final String assetId) throws IOException, RequestFailureException { Asset ass = getUnverifiedAsset(assetId); List<Attachment> attachments = ass.getAttachments(); if (attachments != null) { for (Attachment attachment : attachments) { deleteAttachment(assetId, attachment.get_id()); } } // Now delete the asset deleteAsset(assetId); }
java
@Override public Asset getAsset(final String assetId) throws IOException, BadVersionException, RequestFailureException { HttpURLConnection connection = createHttpURLConnectionToMassive("/assets/" + assetId); connection.setRequestMethod("GET"); testResponseCode(connection); return JSONAssetConverter.readValue(connection.getInputStream()); }
java
@Override public void updateState(final String assetId, final StateAction action) throws IOException, RequestFailureException { StateUpdateAction newState = new StateUpdateAction(action); HttpURLConnection connection = createHttpURLConnectionToMassive("/assets/" + assetId + "/state"); connection.setRequestMethod("PUT"); connection.setRequestProperty("Content-Type", "application/json"); connection.setDoOutput(true); JSONAssetConverter.writeValue(connection.getOutputStream(), newState); // Make sure it was ok testResponseCode(connection, true); }
java
private URL createURL(final String urlString) throws MalformedURLException { URL url; try { url = AccessController.doPrivileged(new PrivilegedExceptionAction<URL>() { @Override public URL run() throws MalformedURLException { return new URL(urlString); } }); } catch (PrivilegedActionException e) { throw (MalformedURLException) e.getCause(); } return url; }
java
@Override public Attachment updateAttachment(String assetId, AttachmentSummary summary) throws IOException, BadVersionException, RequestFailureException { // First find the attachment to update Asset ass = getAsset(assetId); List<Attachment> attachments = ass.getAttachments(); if (attachments != null) { for (Attachment attachment : attachments) { if (attachment.getName().equals(summary.getName())) { this.deleteAttachment(assetId, attachment.get_id()); break; } } } return this.addAttachment(assetId, summary); }
java
private void clearInputStream(HttpURLConnection conn) { InputStream is = null; byte[] buffer = new byte[1024]; try { is = conn.getInputStream(); while (is.read(buffer) != -1) { continue; } } catch (IOException e) { // Don't care. } finally { if (is != null) { try { is.close(); } catch (IOException e) { // Don't care. } } } }
java
public static String getCharset(final String contentType) { // Default to UTF-8 String charset = "UTF-8"; try { // Content type is in the form: // Content-Type: text/html; charset=utf-8 // Where they can be lots of params separated by ; characters if (contentType != null && !contentType.isEmpty()) { if (contentType.contains(";")) { String[] params = contentType.substring(contentType.indexOf(";")).split(";"); for (String param : params) { param = param.trim(); if (param.indexOf("=") > 0) { String paramName = param.substring(0, param.indexOf("=")).trim(); if ("charset".equals(paramName) && param.length() > (param.indexOf("=") + 1)) { String paramValue = param.substring(param.indexOf("=") + 1).trim(); if (paramValue != null && !paramValue.isEmpty() && Charset.isSupported(paramValue)) { charset = paramValue; break; } } } } } } } catch (Throwable t) { // Ignore, we really don't want this util killing anything! } return charset; }
java
private String parseErrorObject(String errorObject) { if (errorObject == null) { return null; } try { // Just use JsonObject parse directly instead of DataModelSerializer as we only want one attribute InputStream inputStream = new ByteArrayInputStream(errorObject.getBytes(Charset.forName("UTF-8"))); JsonReader jsonReader = Json.createReader(inputStream); JsonObject parsedObject = jsonReader.readObject(); jsonReader.close(); Object errorMessage = parsedObject.get("message"); if (errorMessage != null && errorMessage instanceof JsonString && !((JsonString) errorMessage).getString().isEmpty()) { return ((JsonString) errorMessage).getString(); } else { return errorObject; } } catch (JsonException e) { return errorObject; } }
java
public static void writeValue(OutputStream stream, Object pojo) throws IOException { DataModelSerializer.serializeAsStream(pojo, stream); }
java
public static List<Asset> readValues(InputStream inputStream) throws IOException { return DataModelSerializer.deserializeList(inputStream, Asset.class); }
java
public static Asset readValue(InputStream inputStream) throws IOException, BadVersionException { return DataModelSerializer.deserializeObject(inputStream, Asset.class); }
java
public static <T> T readValue(InputStream inputStream, Class<T> type) throws IOException, BadVersionException { return DataModelSerializer.deserializeObject(inputStream, type); }
java
public static <T> List<T> readValues(InputStream inputStream, Class<T> type) throws IOException { return DataModelSerializer.deserializeList(inputStream, type); }
java
public static String getHomeBeanClassName(EnterpriseBean enterpriseBean, boolean isPost11DD) // d114199 { String packageName = null; String homeInterfaceName = getHomeInterfaceName(enterpriseBean); // LIDB2281.24.2 made several changes to code below, to accommodate case // where neither a remote home nor a local home is present (EJB 2.1 allows // this). if (homeInterfaceName == null) { // f111627.1 homeInterfaceName = getLocalHomeInterfaceName(enterpriseBean); // f111627.1 } if (homeInterfaceName != null) { packageName = packageName(homeInterfaceName); StringBuffer result = new StringBuffer(); if (packageName != null) { result.append(packageName); result.append('.'); } result.append(homeBeanPrefix); result.append(getUniquePrefix(enterpriseBean)); String homeName = encodeBeanInterfacesName(enterpriseBean, isPost11DD, false, true, true); // d114199 d147734 result.append(homeName); return result.toString(); } else { return null; } }
java
public static String getConcreteBeanClassName(EnterpriseBean enterpriseBean) { String beanClassName = enterpriseBean.getEjbClassName(); String packageName = packageName(beanClassName); String beanName = encodeBeanInterfacesName(enterpriseBean, true, false, false, false); // d147734 StringBuffer result = new StringBuffer(); if (packageName != null) { result.append(packageName); result.append('.'); } result.append(concreteBeanPrefix); result.append(beanName); return result.toString(); }
java
public static final String updateFilenameHashCode(EnterpriseBean enterpriseBean, String oldName) { String newName = null; int len = oldName.length(); int last_ = (len > 9 && (oldName.charAt(len - 9) == '_')) ? len - 9 : -1; // input file name must have a trailing "_" follows by 8 hex digits // and check to make sure the last 8 characters are all hex digits if (last_ != -1 && allHexDigits(oldName, ++last_, len)) { String hashStr = getHashStr(enterpriseBean); newName = oldName.substring(0, last_) + BuzzHash.computeHashStringMid32Bit(hashStr, true); } return newName; }
java
public String getWebServiceEndpointProxyClassName() { StringBuilder result = new StringBuilder(); // Use the package of the EJB implementation. String packageName = packageName(ivBeanClass); if (packageName != null) { result.append(packageName); result.append('.'); } result.append(endpointPrefix); // WSEJBProxy result.append(ivBeanType); // SL/SF/BMP/CMP, etc. result.append(ivBeanName); // First 32 characters result.append('_'); result.append(ivHashSuffix); // 8 digit hashcode return result.toString(); }
java
public void processMessage(JsMessage jsMsg) throws SIResourceException { if (tc.isEntryEnabled()) SibTr.entry(tc, "processMessage", new Object[] { jsMsg }); int priority = jsMsg.getPriority().intValue(); Reliability reliability = jsMsg.getReliability(); SIBUuid12 streamID = jsMsg.getGuaranteedStreamUUID(); StreamSet streamSet = getStreamSet(streamID, true); InternalInputStream internalInputStream = null; synchronized(streamSet) { internalInputStream = (InternalInputStream) streamSet.getStream(priority, reliability); // This may be the first message which has required this stream if(internalInputStream == null && (reliability.compareTo(Reliability.BEST_EFFORT_NONPERSISTENT) > 0)) { internalInputStream = createStream(streamSet, priority, reliability); } } if (tc.isEntryEnabled()) SibTr.exit(tc, "processMessage"); }
java
private void activeRequestIntropectors(PrintWriter writer) { writer.println("\n------------------------------------------------------------------------------"); writer.println(" Active Requests"); writer.println("------------------------------------------------------------------------------\n"); List<RequestContext> activeRequests = RequestProbeService.getActiveRequests(); if(activeRequests == null || activeRequests.size() == 0) { // If no active request available.. writer.println("----- No active requests ----- "); } else { int maxDurationLength = 0; List<String> activeRequestDetails = new ArrayList<String>(); for(RequestContext requestContext: activeRequests) { double totalRequestDuration = (System.nanoTime() - requestContext.getRootEvent().getStartTime()) / 1000000.0; String totalRequestDurationStr = String.format("%.3f", totalRequestDuration); totalRequestDurationStr = totalRequestDurationStr + "ms"; if(requestContext.getRequestId().toString().length() > maxDurationLength) { maxDurationLength = requestContext.getRequestId().toString().length(); } String threadId = DataFormatHelper.padHexString((int) requestContext.getThreadId(), 8); activeRequestDetails.add(requestContext.getRequestId().toString()+ "," +threadId+ "," +totalRequestDurationStr); } writer.println(String.format("%-" + (maxDurationLength + EXTRA_SPACE_REQUIRED) + "s" + "%-10s%s","Request", "Thread", "Duration")); for(String request : activeRequestDetails) { String requestId = request.split(",")[0]; String threadId = request.split(",")[1]; String totalDuration = request.split(",")[2]; writer.println(String.format("%-"+ (maxDurationLength + EXTRA_SPACE_REQUIRED) + "s" + "%-10s%s", requestId, threadId, totalDuration)); } writer.println("------------------------------------------------------------------------------\n"); for(RequestContext requestContext: activeRequests) { // Print the RequestContext for all the active requests. writer.println("Request " + requestContext.getRequestId().toString()); writer.println(RequestContext.dumpTree(requestContext.getRootEvent(), true)); writer.println(); } } }
java
private void transformDescriptorIntrospectors(PrintWriter writer) { Map<String, RequestProbeTransformDescriptor> registeredTransformDescriptors = RequestProbeBCIManagerImpl.getRequestProbeTransformDescriptors(); List<String> transformDescriptorRefs = new ArrayList<String>() {{add("Transform Descriptor"); add("");}}; List<String> tdDetails = new ArrayList<String>() {{add("ClassName.MethodName(Description)"); add("");}}; List<Integer> indentationLength = new ArrayList<Integer>(); int maxSpaceRequired = 0; for(Entry<String, RequestProbeTransformDescriptor> transformDescriptor : registeredTransformDescriptors.entrySet()) { transformDescriptorRefs.add(transformDescriptor.getValue().toString()); if(transformDescriptor.getValue().getMethodDesc().equals("all")) tdDetails.add(transformDescriptor.getValue().getClassName() + "." + transformDescriptor.getValue().getMethodName() + "("+ transformDescriptor.getValue().getMethodDesc() + ")" ); else tdDetails.add(transformDescriptor.getValue().getClassName() + "." + transformDescriptor.getValue().getMethodName() + transformDescriptor.getValue().getMethodDesc() ); } for(String transformDescriptorRef : transformDescriptorRefs) { if(transformDescriptorRef.length() > maxSpaceRequired) { maxSpaceRequired = transformDescriptorRef.length(); } } indentationLength.add(maxSpaceRequired+ EXTRA_SPACE_REQUIRED); writer.println(); writer.println("------------------------------------------------------------------------------"); writer.println(" Registered Transform Descriptors "); writer.println("------------------------------------------------------------------------------"); for(int i = 0 ; i < transformDescriptorRefs.size(); i ++) { writer.println(String.format("%-" + indentationLength.get(0) + "s%s",transformDescriptorRefs.get(i) ,tdDetails.get(i))); } if(registeredTransformDescriptors.size() == 0) { writer.println("----- No transform descriptors are registered ----- "); } }
java
public void instrumentWithProbes(Collection<Class<?>> classes) { for (Class<?> clazz : classes) { try { instrumentation.retransformClasses(clazz); } catch (Throwable t) { } } }
java
public final JsMessageHandle createJsMessageHandle(SIBUuid8 uuid ,long value ) throws NullPointerException { if (uuid == null) { throw new NullPointerException("uuid"); } return new JsMessageHandleImpl(uuid, Long.valueOf(value)); }
java
@Override public Principal getCallerPrincipal() { EJBSecurityCollaborator<?> securityCollaborator = container.ivSecurityCollaborator; if (securityCollaborator == null) { return NullSecurityCollaborator.UNAUTHENTICATED; } return getCallerPrincipal(securityCollaborator, EJSContainer.getMethodContext()); }
java
HandleList getHandleList(boolean create) // d662032 { if (connectionHandleList == null && create) { connectionHandleList = new HandleList(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "getHandleList: created " + connectionHandleList); } return connectionHandleList; }
java
HandleListInterface reAssociateHandleList() // d662032 throws CSIException { HandleListInterface hl; if (connectionHandleList == null) { hl = HandleListProxy.INSTANCE; } else { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "reAssociateHandleList: " + connectionHandleList); hl = connectionHandleList; try { hl.reAssociate(); } catch (Exception ex) { throw new CSIException("", ex); } } return hl; }
java
void parkHandleList() // d662032 { if (connectionHandleList != null) { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isDebugEnabled()) Tr.debug(tc, "parkHandleList: " + connectionHandleList); try { connectionHandleList.parkHandle(); } catch (Exception ex) { if (isTraceOn && tc.isDebugEnabled()) Tr.debug(tc, "parkHandleList: exception", ex); } } }
java
protected final void destroyHandleList() // d662032 { if (connectionHandleList != null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "destroyHandleList: destroying " + connectionHandleList); connectionHandleList.componentDestroyed(); connectionHandleList = null; } }
java
protected BeanOCallDispatchToken callDispatchEventListeners (int dispatchEventCode, BeanOCallDispatchToken token) { DispatchEventListenerManager dispatchEventListenerManager = container.ivDispatchEventListenerManager; // d646413.2 DispatchEventListenerCookie[] dispatchEventListenerCookies = null; EJBMethodMetaData methodMetaData = null; BeanOCallDispatchToken retToken = null; boolean doBeforeDispatch = false; boolean doAfterDispatch = false; // first check if listeners are active, if not skip everything else ... if (dispatchEventListenerManager != null && dispatchEventListenerManager.dispatchEventListenersAreActive()) // @539186C, d646413.2 { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "callDispatchEventListeners: " + dispatchEventCode + ", " + this); // if one of the "before" callbacks // // Build temporary EJBMethodInfo object to represent this callback method. // If no dispatch cookies assigned to this bean, create new cookie array. // If no dispatch context on thread, this is not method dispatch, but rather // is end of tran processing. // if (dispatchEventCode == DispatchEventListener.BEFORE_EJBACTIVATE || dispatchEventCode == DispatchEventListener.BEFORE_EJBLOAD || dispatchEventCode == DispatchEventListener.BEFORE_EJBSTORE || dispatchEventCode == DispatchEventListener.BEFORE_EJBPASSIVATE) { methodMetaData = buildTempEJBMethodMetaData(dispatchEventCode, home.getBeanMetaData()); retToken = new BeanOCallDispatchToken(); // return value to communicate between "before" and "after" call retToken.setMethodMetaData(methodMetaData); // save away methodMetaData object for "after" call // d646413.2 - Check if a dispatch context was already created // for this bean by EJSContainer.preInvoke. EJSDeployedSupport s = EJSContainer.getMethodContext(); if (s != null && s.beanO == this) // d646413.2 { if (isTraceOn && tc.isDebugEnabled()) Tr.debug(tc, "using dispatch context from method context"); // use cookie array already assigned to bean for "after" callback dispatchEventListenerCookies = s.ivDispatchEventListenerCookies; // @MD11200.6A } if (dispatchEventListenerCookies == null) { // create new cookie array - @MD11200.6A dispatchEventListenerCookies = dispatchEventListenerManager.getNewDispatchEventListenerCookieArray(); // @MD11200.6A doBeforeDispatch = true; // must drive beforeDispatch to collect cookies from event listeners - // @MD11200.6A retToken.setDoAfterDispatch(true); /* * since doing beforeDispatch on "before" callback, must issue afterDispatch * during "after" callback */ } // save cookie array in token for "after" call retToken.setDispatchEventListenerCookies(dispatchEventListenerCookies); // @MD11200.6A } // else if one of the "after" callbacks // // get methodInfo and dispatch cookies from input token // plus check "afterDispatch" flag to see if beforeDispatch was issued // when "before" callback was done and if we now have to do afterDispatch // call to finish up else if (dispatchEventCode == DispatchEventListener.AFTER_EJBACTIVATE || dispatchEventCode == DispatchEventListener.AFTER_EJBLOAD || dispatchEventCode == DispatchEventListener.AFTER_EJBSTORE || dispatchEventCode == DispatchEventListener.AFTER_EJBPASSIVATE) { methodMetaData = token.getMethodMetaData(); // @MD11200.6A doAfterDispatch = token.getDoAfterDispatch(); // @MD11200.6A d621610 dispatchEventListenerCookies = token.getDispatchEventListenerCookies(); // @MD11200.6A } if (doBeforeDispatch) { // @MD11200.6A dispatchEventListenerManager.callDispatchEventListeners(DispatchEventListener.BEGIN_DISPATCH, dispatchEventListenerCookies, methodMetaData); // @MD11200.6A } // @MD11200.6A dispatchEventListenerManager.callDispatchEventListeners(dispatchEventCode, dispatchEventListenerCookies, methodMetaData); // @MD11200.6A if (doAfterDispatch) { // @MD11200.6A dispatchEventListenerManager.callDispatchEventListeners(DispatchEventListener.END_DISPATCH, dispatchEventListenerCookies, methodMetaData); // @MD11200.6A } // @MD11200.6A if (isTraceOn && tc.isEntryEnabled()) { // @MD11200.6A Tr.exit(tc, "callDispatchEventListeners", retToken); // @MD11200.6A } // @MD11200.6A } // if listeners are active return retToken; }
java
@Override public Timer createCalendarTimer(ScheduleExpression schedule, TimerConfig timerConfig) { Serializable info = timerConfig == null ? null : timerConfig.getInfo(); boolean persistent = timerConfig == null || timerConfig.isPersistent(); boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, "createCalendarTimer: " + persistent, this); // Bean must implement TimedObject interface or have a timeout method to create a timer. if (!home.beanMetaData.isTimedObject) { IllegalStateException ise = new IllegalStateException( "Timer Service: Bean does not implement TimedObject: " + beanId); if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "createCalendarTimer: " + ise); throw ise; } if (home.beanMetaData.isEntityBean()) // d595255 { IllegalStateException ise = new IllegalStateException( "Timer Service: Entity beans cannot use calendar-based timers: " + beanId); if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "createCalendarTimer: " + ise); throw ise; } // Determine if this bean is in a state that allows timer service // method access - throws IllegalStateException if not allowed. checkTimerServiceAccess(); // Make sure the arguments are valid.... if (schedule == null) { IllegalArgumentException ise = new IllegalArgumentException( "TimerService: schedule not a valid value: null"); if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "createCalendarTimer: " + ise); throw ise; } Timer timer = container.getEJBRuntime().createTimer(this, null, -1, schedule, info, persistent); // F743-13022 if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, "createCalendarTimer: " + timer); return timer; }
java
public SIMessageHandle restoreFromString(String data) throws IllegalArgumentException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "restoreFromString"); if ((data == null) || data.equals("")) { String badValueType; if (data==null) {badValueType = "NULL";} else {badValueType = "Empty string";} String exString = nls.getFormattedMessage("NULL_HANDLE_PASSED_FOR_RESTORE_CWSIF0032" ,new Object[] {badValueType} ,"restoreFromString called with invalid parameter of "+badValueType+"."); IllegalArgumentException e = new IllegalArgumentException(exString); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "restoreFromString called with invalid parameter of "+badValueType+".", e); throw e; } byte [] bytes = HexString.hexToBin(data,0); // try to restore, if there is an IllegalArgumentException let it propagate up SIMessageHandle handle = restoreFromBytes(bytes); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "restoreFromString"); return handle; }
java
protected Converter createConverter(FaceletContext ctx) throws FacesException, ELException, FaceletException { return ctx.getFacesContext().getApplication().createConverter(this.getConverterId(ctx)); }
java
public static JmsBodyType getBodyType(String format) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getBodyType"); JmsBodyType result = null; if (format.equals(SIApiConstants.JMS_FORMAT_BYTES)) result = BYTES; else if (format.equals(SIApiConstants.JMS_FORMAT_TEXT)) result = TEXT; else if (format.equals(SIApiConstants.JMS_FORMAT_OBJECT)) result = OBJECT; else if (format.equals(SIApiConstants.JMS_FORMAT_STREAM)) result = STREAM; else if (format.equals(SIApiConstants.JMS_FORMAT_MAP)) result = MAP; else if (format.equals(SIApiConstants.JMS_FORMAT)) result = NULL; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getBodyType"); return result; }
java
public final static JmsBodyType getJmsBodyType(Byte aValue) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc,"Value = " + aValue); return set[aValue.intValue()]; }
java
final void delistRRSXAResource(XAResource xaResource) throws Exception { RRSXAResourceFactory xaFactory = (RRSXAResourceFactory) pm.connectorSvc.rrsXAResFactorySvcRef.getService(); // Make sure that the bundle is active. if (xaFactory == null) { throw new IllegalStateException("Native service for RRS transactional support is not active or available. Resource delistment is rejected."); } UOWCurrent currentUOW = (UOWCurrent) pm.connectorSvc.transactionManager; UOWCoordinator uowCoord = currentUOW.getUOWCoord(); // If delisting for cleanup, notify the factory that the resource has been // delisted for cleanup with the transaction manager. if (!uowCoord.isGlobal()) { LocalTransactionCoordinator ltCoord = (LocalTransactionCoordinator) uowCoord; if (!ltCoord.isContainerResolved()) { ltCoord.delistFromCleanup((OnePhaseXAResource) xaResource); xaFactory.delist(uowCoord, xaResource); } } }
java
final XAResource enlistRRSXAResource(int recoveryId, int branchCoupling) throws Exception { RRSXAResourceFactory xaFactory = (RRSXAResourceFactory) pm.connectorSvc.rrsXAResFactorySvcRef.getService(); // Make sure that the bundle is active. if (xaFactory == null) { throw new IllegalStateException("Native service for RRS transactional support is not active or available. Resource enlistment is rejected."); } XAResource xaResource = null; UOWCurrent currentUOW = (UOWCurrent) pm.connectorSvc.transactionManager; UOWCoordinator uowCoord = currentUOW.getUOWCoord(); // Enlist XA resource. if (uowCoord.isGlobal()) { // Enlist a 2 phase XA resource in the global transaction. xaResource = xaFactory.getTwoPhaseXAResource(uowCoord.getXid()); pm.connectorSvc.transactionManager.enlist(uowCoord, xaResource, recoveryId, branchCoupling); } else { // Enlist a one phase XA resource in the local transaction. If enlisting for // cleanup, notify the factory that the resource has been enlisted for cleanup // with the transaction manager. xaResource = xaFactory.getOnePhaseXAResource(uowCoord); LocalTransactionCoordinator ltCoord = (LocalTransactionCoordinator) uowCoord; if (ltCoord.isContainerResolved()) { ltCoord.enlist((OnePhaseXAResource) xaResource); } else { ltCoord.enlistForCleanup((OnePhaseXAResource) xaResource); } // Enlist with the native transaction manager (factory). xaFactory.enlist(uowCoord, xaResource); } return xaResource; }
java
public ConnectionManager getConnectionManager() { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(this, tc, "Connection manager is " + cm + " for managed connection " + this); if (cm == null && pm != null) { Tr.debug(this, tc, "Connection pool is " + this.pm.toString()); } } if (cm != null) { return cm; } else { IllegalStateException e = new IllegalStateException("ConnectionManager is null"); Tr.error(tc, "ILLEGAL_STATE_EXCEPTION_J2CA0079", "getConnectionManager", e); throw e; } }
java
protected void transactionComplete() { if (state != STATE_TRAN_WRAPPER_INUSE) { IllegalStateException e = new IllegalStateException("transactionComplete: illegal state exception. State = " + getStateString() + " MCW = " + mcWrapperObject_hexString); Object[] parms = new Object[] { "transactionComplete", e }; Tr.error(tc, "ILLEGAL_STATE_EXCEPTION_J2CA0079", parms); throw e; } state = STATE_ACTIVE_INUSE; }
java
protected boolean involvedInTransaction() { final boolean isTracingEnabled = TraceComponent.isAnyTracingEnabled(); if (state == STATE_TRAN_WRAPPER_INUSE) { if (isTracingEnabled && tc.isDebugEnabled()) { Tr.debug(this, tc, "involvedInTransaction: true"); } return true; } else { if (isTracingEnabled && tc.isDebugEnabled()) { Tr.debug(this, tc, "involvedInTransaction: false"); } return false; } }
java
@Override public boolean hasFatalErrorNotificationOccurred(int fatalErrorNotificationTime) { final boolean isTracingEnabled = TraceComponent.isAnyTracingEnabled(); /* * I have changed this from using a long based on a currentTimeMillis * to an int value. * * By using an int we will perform better and synchronization is * not required. */ if (fatalErrorValue > fatalErrorNotificationTime) { return false; } else { if (isTracingEnabled && tc.isDebugEnabled()) { Tr.debug(this, tc, "hasFatalErrorNotificationOccurred is true"); } return true; } }
java
@Override public void setDestroyConnectionOnReturn() { final boolean isTracingEnabled = TraceComponent.isAnyTracingEnabled(); if (isTracingEnabled && tc.isEntryEnabled()) { Tr.entry(this, tc, "setDestroyConnectionOnReturn"); } --fatalErrorValue; if (isTracingEnabled && tc.isEntryEnabled()) { Tr.exit(this, tc, "setDestroyConnectionOnReturn", fatalErrorValue); } }
java
public void resetCoordinator() { final boolean isTracingEnabled = TraceComponent.isAnyTracingEnabled(); if (isTracingEnabled && tc.isDebugEnabled()) { Tr.debug(this, tc, "Resetting uow coordinator to null"); } uowCoord = null; }
java
public void markTransactionError() { final boolean isTracingEnabled = TraceComponent.isAnyTracingEnabled(); if (isTracingEnabled && tc.isDebugEnabled()) { Tr.debug(this, tc, "TransactionError occurred on MCWrapper:" + toString()); } _transactionErrorOccurred = true; }
java
public void clearHandleList() { final boolean isTracingEnabled = TraceComponent.isAnyTracingEnabled(); if (isTracingEnabled && tc.isDebugEnabled()) { Tr.debug(this, tc, "Clear the McWrapper handlelist for the following MCWrapper: " + this); } // since we know we are only in this method on a destroy or clean up // of a MCWrapper ,we can double check that all the handles that this MCWrapper // owns are removed from the handlelist on thread local storage before clearing the // handlelist in the MCWrapper class. I tried to be really careful to avoid NPEs // // Liberty doesn't have real HandleList so don't need to remove anything // mcwHandleList.clear(); }
java
public boolean abortMC() { boolean trace = TraceComponent.isAnyTracingEnabled(); if (!(mc instanceof WSManagedConnection)) { if (trace && tc.isDebugEnabled()) Tr.debug(tc, "abortMC", "Skipping MC abort because MC is not an instance of WSManagedConnection"); return false; } if (trace && tc.isEntryEnabled()) Tr.entry(tc, "abortMC"); WSManagedConnection wsmc = (WSManagedConnection) mc; try { do_not_reuse_mcw = true; wsmc.abort(pm.connectorSvc.execSvcRef.getServiceWithException()); aborted = true; releaseToPoolManager(); // Get the connection out of the pool } catch (SQLFeatureNotSupportedException e) { if (trace && tc.isDebugEnabled()) Tr.debug(tc, "JDBC feature or driver does not support aborting connections."); } catch (Exception e) { com.ibm.ws.ffdc.FFDCFilter.processException(e, "com.ibm.ejs.j2c.MCWrapper.abortMC", "3765", this); if (trace && tc.isDebugEnabled()) Tr.debug(this, tc, "Caught exception aborting connection or releasing aborted connection to the pool manager."); } if (trace && tc.isEntryEnabled()) Tr.exit(tc, "abortMC", aborted); return aborted; }
java
private Bucket getOrCreateBucketForKey(Object key) { int index = getBucketIndexForKey(key); // Double-checked locking. Safe since buckets do not initialize any state // until they are synchronized by the caller. d739870 Bucket bucket = buckets[index]; if (bucket == null) { synchronized (bucketLock) { bucket = buckets[index]; if (bucket == null) { // If this is to be a cache of EJB Wrappers, then create Wrapper // specific buckets, that hold EJSWrapperCommon objects, // otherwise create generic BucketImpl. d195605 bucket = wrappers ? new WrapperBucket(this) : new BucketImpl(); buckets[index] = bucket; } } } return bucket; }
java
private String getProp(Map<Object, Object> props, String key) { String value = (String) props.get(key); if (null == value) { value = (String) props.get(key.toLowerCase()); } return (null != value) ? value.trim() : null; }
java
private void parsePersistence(Map<Object, Object> props) { parseKeepAliveEnabled(props); if (isKeepAliveEnabled()) { parseMaxPersist(props); } }
java
private void parseMaxPersist(Map<Object, Object> props) { // -1 means unlimited // 0..1 means 1 // X means X Object value = props.get(HttpConfigConstants.PROPNAME_MAX_PERSIST); if (null != value) { try { this.maxPersistRequest = minLimit(convertInteger(value), HttpConfigConstants.MIN_PERSIST_REQ); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Max persistent requests is " + getMaximumPersistentRequests()); } } catch (NumberFormatException nfe) { FFDCFilter.processException(nfe, getClass().getName() + ".parseMaxPersist", "1"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Invalid max persistent requests; " + value); } } } }
java
private void parseOutgoingVersion(Map<Object, Object> props) { String value = getProp(props, HttpConfigConstants.PROPNAME_OUTGOING_VERSION); if ("1.0".equals(value)) { this.outgoingHttpVersion = VersionValues.V10; if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Outgoing version is " + getOutgoingVersion().getName()); } } }
java
private void parseBufferType(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_DIRECT_BUFF); if (null != value) { this.bDirectBuffers = convertBoolean(value); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: use direct buffers is " + isDirectBufferType()); } } }
java
private void parseOutgoingBufferSize(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_OUTGOING_HDR_BUFFSIZE); if (null != value) { try { this.outgoingHdrBuffSize = rangeLimit(convertInteger(value), HttpConfigConstants.MIN_BUFFER_SIZE, HttpConfigConstants.MAX_BUFFER_SIZE); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Outgoing hdr buffer size is " + getOutgoingHdrBufferSize()); } } catch (NumberFormatException nfe) { FFDCFilter.processException(nfe, getClass().getName() + ".parseOutgoingBufferSize", "1"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Invalid outgoing header buffer size; " + value); } } } }
java
private void parseIncomingHdrBufferSize(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_INCOMING_HDR_BUFFSIZE); if (null != value) { try { this.incomingHdrBuffSize = rangeLimit(convertInteger(value), HttpConfigConstants.MIN_BUFFER_SIZE, HttpConfigConstants.MAX_BUFFER_SIZE); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Incoming hdr buffer size is " + getIncomingHdrBufferSize()); } } catch (NumberFormatException nfe) { FFDCFilter.processException(nfe, getClass().getName() + ".parseIncomingHdrBufferSize", "1"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Invalid incoming hdr buffer size of " + value); } } } }
java
private void parseIncomingBodyBufferSize(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_INCOMING_BODY_BUFFSIZE); if (null != value) { try { this.incomingBodyBuffSize = rangeLimit(convertInteger(value), HttpConfigConstants.MIN_BUFFER_SIZE, HttpConfigConstants.MAX_BUFFER_SIZE); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Incoming body buffer size is " + getIncomingBodyBufferSize()); } } catch (NumberFormatException nfe) { FFDCFilter.processException(nfe, getClass().getName() + ".parseIncomingBodyBufferSize", "1"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Invalid incoming body buffer size; " + value); } } } }
java
private void parsePersistTimeout(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_PERSIST_TIMEOUT); if (null != value) { try { this.persistTimeout = TIMEOUT_MODIFIER * minLimit(convertInteger(value), HttpConfigConstants.MIN_TIMEOUT); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Persist timeout is " + getPersistTimeout()); } } catch (NumberFormatException nfe) { FFDCFilter.processException(nfe, getClass().getName() + ".parsePersistTimeout", "1"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Invalid persist timeout; " + value); } } } }
java
private void parseReadTimeout(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_READ_TIMEOUT); if (null != value) { try { this.readTimeout = TIMEOUT_MODIFIER * minLimit(convertInteger(value), HttpConfigConstants.MIN_TIMEOUT); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Read timeout is " + getReadTimeout()); } } catch (NumberFormatException nfe) { FFDCFilter.processException(nfe, getClass().getName() + ".parseReadTimeout", "1"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Invalid read timeout; " + value); } } } }
java
private void parseWriteTimeout(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_WRITE_TIMEOUT); if (null != value) { try { this.writeTimeout = TIMEOUT_MODIFIER * minLimit(convertInteger(value), HttpConfigConstants.MIN_TIMEOUT); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Write timeout is " + getWriteTimeout()); } } catch (NumberFormatException nfe) { FFDCFilter.processException(nfe, getClass().getName() + ".parseWriteTimeout", "1"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Invalid write timeout; " + value); } } } }
java
private void parseByteCacheSize(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_BYTE_CACHE_SIZE); if (null != value) { try { this.byteCacheSize = rangeLimit(convertInteger(value), HttpConfigConstants.MIN_BYTE_CACHE_SIZE, HttpConfigConstants.MAX_BYTE_CACHE_SIZE); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: byte cache size is " + getByteCacheSize()); } } catch (NumberFormatException nfe) { FFDCFilter.processException(nfe, getClass().getName() + ".parseByteCacheSize", "1"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Invalid bytecache setting of " + value); } } } }
java
private void parseDelayedExtract(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_EXTRACT_VALUE); if (null != value) { this.bExtractValue = convertBoolean(value); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: header value extraction is " + shouldExtractValue()); } } }
java
private void parseBinaryTransport(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_BINARY_TRANSPORT); if (null != value) { this.bBinaryTransport = convertBoolean(value); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: binary transport is " + isBinaryTransportEnabled()); } } }
java
private void parseLimitFieldSize(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_LIMIT_FIELDSIZE); if (null != value) { try { this.limitFieldSize = rangeLimit(convertInteger(value), HttpConfigConstants.MIN_LIMIT_FIELDSIZE, HttpConfigConstants.MAX_LIMIT_FIELDSIZE); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: field size limit is " + getLimitOfFieldSize()); } } catch (NumberFormatException nfe) { FFDCFilter.processException(nfe, getClass().getName() + ".parseLimitFieldSize", "1"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Invaild max field size setting of " + value); } } } }
java
private void parseLimitNumberHeaders(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_LIMIT_NUMHEADERS); if (null != value) { try { this.limitNumHeaders = rangeLimit(convertInteger(value), HttpConfigConstants.MIN_LIMIT_NUMHEADERS, HttpConfigConstants.MAX_LIMIT_NUMHEADERS); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Num hdrs limit is " + getLimitOnNumberOfHeaders()); } } catch (NumberFormatException nfe) { FFDCFilter.processException(nfe, getClass().getName() + ".parseLimitNumberHeaders", "1"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Invalid number of headers limit; " + value); } } } }
java
private void parseLimitNumberResponses(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_LIMIT_NUMBER_RESPONSES); if (null != value) { try { int size = convertInteger(value); if (HttpConfigConstants.UNLIMITED == size) { this.limitNumResponses = HttpConfigConstants.MAX_LIMIT_NUMRESPONSES; } else { this.limitNumResponses = rangeLimit(size, 1, HttpConfigConstants.MAX_LIMIT_NUMRESPONSES); } if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Num responses limit is " + getLimitOnNumberOfResponses()); } } catch (NumberFormatException nfe) { FFDCFilter.processException(nfe, getClass().getName() + ".parseLimitNumberResponses", "1"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Invalid max number of responses; " + value); } } } }
java
private void parseLimitMessageSize(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_MSG_SIZE_LIMIT); if (null != value) { try { this.limitMessageSize = convertLong(value); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Message size limit is " + getMessageSizeLimit()); } } catch (NumberFormatException nfe) { FFDCFilter.processException(nfe, getClass().getName() + ".parseLimitMessageSize", "1"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Invalid message size limit; " + value); } } } }
java
private void parseAccessLog(Map<Object, Object> props) { String id = (String) props.get(HttpConfigConstants.PROPNAME_ACCESSLOG_ID); if (id != null) { AtomicReference<AccessLog> aLog = HttpEndpointImpl.getAccessLogger(id); if (aLog != null) { this.accessLogger = aLog; } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Config: using logging service", accessLogger); } } }
java
private void parseRemoteIp(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_REMOTE_IP); if (null != value) { this.useForwardingHeaders = convertBoolean(value); if (this.useForwardingHeaders && (TraceComponent.isAnyTracingEnabled()) && (tc.isEventEnabled())) { Tr.event(tc, "HTTP Channel Config: remoteIp has been enabled"); } } }
java
private void parseAllowRetries(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_ALLOW_RETRIES); if (null != value) { this.bAllowRetries = convertBoolean(value); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: allow retries is " + allowsRetries()); } } }
java
private void parseHeaderValidation(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_HEADER_VALIDATION); if (null != value) { this.bHeaderValidation = convertBoolean(value); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: header validation is " + isHeaderValidationEnabled()); } } }
java
private void parseJITOnlyReads(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_JIT_ONLY_READS); if (null != value) { this.bJITOnlyReads = convertBoolean(value); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: JIT only reads is " + isJITOnlyReads()); } } }
java
private void parseStrictURLFormat(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_STRICT_URL_FORMAT); if (null != value) { this.bStrictURLFormat = convertBoolean(value); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Strict URL formatting is " + isStrictURLFormat()); } } }
java
private void parseServerHeader(Map<Object, Object> props) { // @PK15848 String value = getProp(props, HttpConfigConstants.PROPNAME_SERVER_HEADER_VALUE); if (null == value || "".equals(value)) { // due to security change, do not default value in Server header. // PM87013 Start } else { if ("DefaultServerVersion".equalsIgnoreCase(value)) { value = "WebSphere Application Server"; } this.baServerHeaderValue = GenericUtils.getEnglishBytes(value); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: server header value [" + value + "]"); } } // PM87013 (PM75371) End Object ov = props.get(HttpConfigConstants.PROPNAME_REMOVE_SERVER_HEADER); if (null != ov) { this.bRemoveServerHeader = convertBoolean(ov); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: remove server header is " + removeServerHeader()); } } }
java
private void parseDateHeaderRange(Map<Object, Object> props) { // @313642 Object value = props.get(HttpConfigConstants.PROPNAME_DATE_HEADER_RANGE); if (null != value) { try { this.lDateHeaderRange = minLimit(convertLong(value), 0L); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: date header range is " + value); } } catch (NumberFormatException nfe) { FFDCFilter.processException(nfe, getClass().getName() + ".parseDateHeaderRange", "1"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Invalid date header range; " + value); } } } }
java
private void parseCookieUpdate(Map<Object, Object> props) { //This property needed to be documented using a new name because //the original property contains a banned word for metatype: 'config' //This change will verify if either (or both) original/documented properties //are set. The instance variable they reference will be set to false if //either property is set to false. Object value = props.get(HttpConfigConstants.PROPNAME_NO_CACHE_COOKIES_CONTROL); Object value2 = props.get(HttpConfigConstants.PROPNAME_COOKIES_CONFIGURE_NOCACHE); boolean documentedProperty = true; boolean originalProperty = true; if (null != value) { documentedProperty = convertBoolean(value); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: set no-cache cookie control is " + documentedProperty); } } if (null != value2) { originalProperty = convertBoolean(value2); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: set-cookie configures no-cache is " + originalProperty); } } this.bCookiesConfigureNoCache = originalProperty && documentedProperty; }
java
private void parseHeaderChangeLimit(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_HEADER_CHANGE_LIMIT); if (null != value) { try { this.headerChangeLimit = convertInteger(value); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: header change limit is " + getHeaderChangeLimit()); } } catch (NumberFormatException nfe) { FFDCFilter.processException(nfe, getClass().getName() + ".parseHeaderChangeLimit", "1"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Invalid header change count of " + value); } } } }
java
private void parseRequestSmugglingProtection(Map<Object, Object> props) { // PK53193 - allow this to be disabled Object value = props.get(HttpConfigConstants.PROPNAME_ENABLE_SMUGGLING_PROTECTION); if (null != value) { this.bEnableSmugglingProtection = convertBoolean(value); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Config: request smuggling protection is " + this.bEnableSmugglingProtection); } } }
java
private void parseAutoDecompression(Map<Object, Object> props) { // PK41619 - allow this to be turned off Object value = props.get(HttpConfigConstants.PROPNAME_AUTODECOMPRESSION); if (null != value) { this.bAutoDecompression = convertBoolean(value); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: autodecompression is " + isAutoDecompressionEnabled()); } } }
java
private void parsev0CookieDateRFC1123compat(Map<?, ?> props) { Object value = props.get(HttpConfigConstants.PROPNAME_V0_COOKIE_RFC1123_COMPAT); if (null != value) { this.v0CookieDateRFC1123compat = convertBoolean(value); } if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: v0CookieDateRFC1123compat is " + isv0CookieDateRFC1123compat() + " this = " + this); } }
java
private void parseSkipCookiePathQuotes(Map<?, ?> props) { //738893 - Skip adding the quotes to the cookie path attribute String value = (String) props.get(HttpConfigConstants.PROPNAME_SKIP_PATH_QUOTE); if (null != value) { this.skipCookiePathQuotes = convertBoolean(value); if ((TraceComponent.isAnyTracingEnabled()) && (tc.isEventEnabled())) { Tr.event(tc, "Config: SkipCookiePathQuotes is " + shouldSkipCookiePathQuotes()); } } }
java
private void parseDoNotAllowDuplicateSetCookies(Map<?, ?> props) { //PI31734 - prevent multiple Set-Cookies with the same name String value = (String) props.get(HttpConfigConstants.PROPNAME_DO_NOT_ALLOW_DUPLICATE_SET_COOKIES); if (null != value) { this.doNotAllowDuplicateSetCookies = convertBoolean(value); if ((TraceComponent.isAnyTracingEnabled()) && (tc.isEventEnabled())) { Tr.event(tc, "Config: DoNotAllowDuplicateSetCookies is " + doNotAllowDuplicateSetCookies()); } } }
java
private void parseWaitForEndOfMessage(Map props) { //PI11176 String value = (String) props.get(HttpConfigConstants.PROPNAME_WAIT_FOR_END_OF_MESSAGE); if (null != value) { this.waitForEndOfMessage = convertBoolean(value); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: PI33453:WaitForEndOfMessage is " + shouldWaitForEndOfMessage()); } } }
java
private void parseRemoveCLHeaderInTempStatusRespRFC7230compat(Map props) { //PI35277 String value = (String) props.get(HttpConfigConstants.REMOVE_CLHEADER_IN_TEMP_STATUS_RFC7230_COMPAT); if (null != value) { this.removeCLHeaderInTempStatusRespRFC7230compat = convertBoolean(value); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Config: RemoveCLHeaderInTempStatusRespRFC7230compat " + shouldRemoveCLHeaderInTempStatusRespRFC7230compat()); } } }
java
private void parsePreventResponseSplit(Map<?, ?> props) { //PI45266 String value = (String) props.get(HttpConfigConstants.PROPNAME_PREVENT_RESPONSE_SPLIT); if (null != value) { this.preventResponseSplit = convertBoolean(value); if ((TraceComponent.isAnyTracingEnabled()) && (tc.isEventEnabled())) { Tr.event(tc, "Config: PreventResponseSplit is " + shouldPreventResponseSplit()); } } }
java
private void parseAttemptPurgeData(Map props) { //PI11176 String value = (String) props.get(HttpConfigConstants.PROPNAME_PURGE_DATA_DURING_CLOSE); if (null != value) { this.attemptPurgeData = convertBoolean(value); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: PI11176:PurgeDataDuringClose is " + shouldAttemptPurgeData()); } } }
java
private void parseThrowIOEForInboundConnections(Map<?, ?> props) { //PI57542 Object value = props.get(HttpConfigConstants.PROPNAME_THROW_IOE_FOR_INBOUND_CONNECTIONS); if (null != value) { this.throwIOEForInboundConnections = convertBoolean(value); if ((TraceComponent.isAnyTracingEnabled()) && (tc.isEventEnabled())) { Tr.event(tc, "Config: ThrowIOEForInboundConnections is " + throwIOEForInboundConnections()); } } }
java
private void parsePurgeRemainingResponseBody(Map<?, ?> props) { String purgeRemainingResponseProperty = AccessController.doPrivileged(new java.security.PrivilegedAction<String>() { @Override public String run() { return (System.getProperty(HttpConfigConstants.PROPNAME_PURGE_REMAINING_RESPONSE)); } }); if (purgeRemainingResponseProperty != null) { this.purgeRemainingResponseBody = convertBoolean(purgeRemainingResponseProperty); if ((TraceComponent.isAnyTracingEnabled()) && (tc.isEventEnabled())) { Tr.event(tc, "Config: PurgeRemainingResponseBody is " + shouldPurgeRemainingResponseBody()); } } }
java
private void parseProtocolVersion(Map<?, ?> props) { Object protocolVersionProperty = props.get(HttpConfigConstants.PROPNAME_PROTOCOL_VERSION); if (null != protocolVersionProperty) { String protocolVersion = ((String) protocolVersionProperty).toLowerCase(); if (HttpConfigConstants.PROTOCOL_VERSION_11.equals(protocolVersion)) { this.useH2ProtocolAttribute = Boolean.FALSE; } else if (HttpConfigConstants.PROTOCOL_VERSION_2.equals(protocolVersion)) { this.useH2ProtocolAttribute = Boolean.TRUE; } if ((TraceComponent.isAnyTracingEnabled()) && (tc.isEventEnabled()) && this.useH2ProtocolAttribute != null) { Tr.event(tc, "HTTP Channel Config: versionProtocol has been set to " + protocolVersion); } } }
java
private boolean convertBoolean(Object o) { if (o instanceof Boolean) return (Boolean) o; return "true".equalsIgnoreCase(o.toString().trim()); }
java
private int rangeLimit(int size, int min, int max) { if (size < min) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Config: " + size + " too small"); } return min; } else if (size > max) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Config: " + size + " too large"); } return max; } return size; }
java
private int minLimit(int input, int min) { if (input < min) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Config: " + input + " too small."); } return min; } return input; }
java
public boolean throwIOEForInboundConnections() { //If the httpOption throwIOEForInboundConnections is defined, return that value if (this.throwIOEForInboundConnections != null) return this.throwIOEForInboundConnections; //PI57542 //Otherwise, verify if a declarative service has been set to dictate the behavior //for this property. If not, return false. Boolean IOEForInboundConnectionsBehavior = HttpDispatcher.useIOEForInboundConnectionsBehavior(); return ((IOEForInboundConnectionsBehavior != null) ? IOEForInboundConnectionsBehavior : Boolean.FALSE); }
java
public void activate(ComponentContext cc) { executorServiceRef.activate(cc); contextServiceRef.activate(cc); ReactiveStreamsFactoryResolver.setInstance(new ReactiveStreamsFactoryImpl()); ReactiveStreamsEngineResolver.setInstance(this); singleton = this; }
java
public void deactivate(ComponentContext cc) { singleton = null; ReactiveStreamsEngineResolver.setInstance(null); ReactiveStreamsFactoryResolver.setInstance(null); executorServiceRef.deactivate(cc); contextServiceRef.deactivate(cc); }
java
public synchronized List getList() { if (tc.isEntryEnabled()) SibTr.entry(tc, "getList"); // Remove a List from the pool List list = (List) listPool.remove(); // If the list is null then there was none available in the pool // So create a new one if (list == null) { if (tc.isDebugEnabled()) SibTr.debug(tc, "No list available from pool - creating a new one"); // We could change the list implementation here if we wanted list = new ArrayList(5); } if (tc.isEntryEnabled()) SibTr.exit(tc, "getList"); return list; }
java
public synchronized void returnList(List list) { if (tc.isEntryEnabled()) SibTr.entry(tc, "returnList"); list.clear(); listPool.add(list); if (tc.isEntryEnabled()) SibTr.exit(tc, "returnList"); }
java
void setParent(JMFMessageData parent) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.entry(this, tc, "setParent", new Object[] { parent }); synchronized (getMessageLockArtefact()) { // If the parent is a JSMessageData then this is straight forward if (parent instanceof JSMessageData) { parentMessage = (JSMessageData) parent; master = ((JSMessageData) parent).master; containingMessage = ((JSMessageData) parent).compatibilityWrapperOrSelf; } // ... if not, it must be a JSCompatibleMessageImpl, and its encoding must // be a JSMessageData, because if it was a JMFEncapsulation it couldn't be our parent else { JSMessageData msg = (JSMessageData) ((JSCompatibleMessageImpl) parent).getEncodingMessage(); parentMessage = msg; master = msg.master; containingMessage = parent; } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) JmfTr.exit(this, tc, "setParent"); }
java