code
stringlengths
73
34.1k
label
stringclasses
1 value
private int initStepTransactionTimeout() { logger.entering(sourceClass, "initStepTransactionTimeout"); Properties p = runtimeStepExecution.getProperties(); int timeout = DEFAULT_TRAN_TIMEOUT_SECONDS; // default as per spec. if (p != null && !p.isEmpty()) { String propertyTim...
java
@Trivial private static String replaceWhitespace(String value) { final int length = value.length(); for (int i = 0; i < length; ++i) { char c = value.charAt(i); if (c < 0x20 && (c == 0x9 || c == 0xA || c == 0xD)) { return replace0(value, i, length); ...
java
private void setMessagingEngineUuid(SIBUuid8 uuid) { if (tc.isEntryEnabled()) SibTr.entry(tc, "setMessagingEngineUuid", new Object[] { uuid }); messagingEngineUuid = uuid; if (tc.isEntryEnabled()) SibTr.exit(tc, "setMessagingEngineUuid"); }
java
public static Map<String, List<Map<String, Object>>> nest(Map<String, Object> map, String... keys) { Map<String, List<Map<String, Object>>> result = new HashMap<String, List<Map<String, Object>>>(keys.length); String keyMatch = ""; for (String key : keys) { result.put(key, new ArrayL...
java
private static String getUserHome() { String home; if (platformType == SelfExtractUtils.PlatformType_CYGWIN) { home = System.getenv("HOME"); } else { home = System.getProperty("user.home"); } return home; }
java
private static String createIfNeeded(String dir) { File f = new File(dir); if (f.exists()) { return dir; } else { boolean success = f.mkdirs(); if (success) return dir; else return null; } }
java
private static String jarFileName() { // do this first so we can access extractor, ok to invoke more than once createExtractor(); // get <name> from path/<name>.jar String fullyQualifiedFileName = extractor.container.getName(); int lastSeparator = fullyQualifiedFileName.lastIndex...
java
private static void disable2PC(String extractDirectory, String serverName) throws IOException { String fileName = extractDirectory + File.separator + "wlp" + File.separator + "usr" + File.separator + "servers" + File.separator + serverName + File.separator + "jvm.options"; Buff...
java
private static int runServer(String extractDirectory, String serverName, String[] args) throws IOException, InterruptedException { int rc = 0; Runtime rt = Runtime.getRuntime(); String action = "run"; if (System.getenv("WLP_JAR_DEBUG") != null) action = "debug"; //...
java
private void isInitialized(boolean condition, String propName) { if (condition == true) { IllegalStateException e = new IllegalStateException("J2CGlobalConfigProperties: internal error. Set once property already set."); Tr.error(tc, "SET_ONCE_PROP_ALREADY_SET_J2CA0159", (Object) null); ...
java
public synchronized final void applyRequestGroupConfigChanges() { // Note: on the following call the "false,true" forces the change notification // to be sent. The listener will then pick up all property values in the // group. if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabl...
java
public Object get(int key) throws SIErrorException // D214655 { if (tc.isEntryEnabled()) SibTr.entry(tc, "get"); if (tc.isDebugEnabled()) SibTr.debug(tc, "key: "+key); // f174137 captiveComparitorKey.setValue(key); if (t...
java
public Object remove(int key) throws SIErrorException // D214655 { if (tc.isEntryEnabled()) SibTr.entry(tc, "remove", ""+key); captiveComparitorKey.setValue(key); // Start D214655 Object retObject = map.remove(captiveComparitorKey); if (retObject == n...
java
public Iterator iterator() { if (tc.isEntryEnabled()) SibTr.entry(tc, "iterator"); if (tc.isEntryEnabled()) SibTr.exit(tc, "iterator"); return map.values().iterator(); }
java
public boolean containsKey(int id) { if (tc.isEntryEnabled()) SibTr.entry(tc, "get", ""+id); captiveComparitorKey.setValue(id); final boolean result = map.containsKey(captiveComparitorKey); if (tc.isEntryEnabled()) SibTr.exit(tc, "get", ""+result); return result; }
java
public static Object checkCast(Object value, Object object, String valueClassName) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { ClassLoader valueLoader = value == null ? null : AccessController.doPrivileged(new GetClassLoaderPrivileged(...
java
GBSNode getNode(Object newKey) { GBSNode p; if (_nodePool == null) p = new GBSNode(this, newKey); else { p = _nodePool; _nodePool = p.rightChild(); p.reset(newKey); } return p; }
java
public void prePopulate(int x) { for (int i = 0; i < x; i++) { GBSNode p = new GBSNode(this); releaseNode(p); } }
java
public int maximumFringeImbalance() { int maxBal; GBSNode q = root(); if (q.leftChild() == null) { maxBal = kFactor() - 1; if (maxBal < 3) maxBal = 3; } else { if ((kFactor() % 3) == 0) maxBal...
java
private int calcTZeroDepth(int proposedK) { int d = -1; if ( (proposedK >= 0) && (proposedK < _t0_d.length) ) d = _t0_d[proposedK]; if (d < 0) { String x = "K Factor (" + proposedK + ") is invalid.\n" + "Valid K factors are: " + kFactor...
java
static boolean checkForPossibleIndexChange( int v1, int v2, Throwable exc, String msg) { ...
java
public Iterator iterator() { GBSIterator x = new GBSIterator(this); Iterator q = (Iterator) x; return q; }
java
public Object searchEqual( Object searchKey) { SearchComparator comp = searchComparator(SearchComparator.EQ); Object p = find(comp, searchKey); return p; }
java
public Object searchGreater( Object searchKey) { SearchComparator comp = searchComparator(SearchComparator.GT); Object p = find(comp, searchKey); return p; }
java
public Object searchGreaterOrEqual( Object searchKey) { SearchComparator comp = searchComparator(SearchComparator.GE); Object p = find(comp, searchKey); return p; }
java
private SearchNode getSearchNode() { Object x = _searchNode.get(); SearchNode g = null; if (x != null) { g = (SearchNode) x; g.reset(); } else { g = new SearchNode(); x = (Object) g; _searchNode.set(x...
java
private boolean optimisticFind( SearchComparator comp, Object searchKey, SearchNode point) { point.reset(); int v1 = _vno; if (root() != null) { if ((v...
java
private void pessimisticFind( SearchComparator comp, Object searchKey, SearchNode point) { point.reset(); synchronized(this) { internalFind(comp, searchKey, point);...
java
synchronized Object iteratorFind( DeleteStack stack, SearchComparator comp, Object searchKey, SearchNode point) { point.reset(); GB...
java
private void leftSearch( SearchComparator comp, GBSNode p, GBSNode r, Object searchKey, SearchNode point) { if (r == null) ...
java
private void rightSearch( SearchComparator comp, GBSNode p, GBSNode l, Object searchKey, SearchNode point) { int xcc = comp.compa...
java
private InsertStack getInsertStack() { Object x = _insertStack.get(); InsertStack g = null; if (x != null) { g = (InsertStack) x; g.reset(); } else { g = new InsertStack(this); x = (Object) g; _insert...
java
public boolean insert( Object new1) { boolean result; InsertStack stack = getInsertStack(); if (root() == null) pessimisticInsert(stack, new1); else { boolean didit = optimisticInsert(stack, new1); if (di...
java
private boolean optimisticInsert( InsertStack stack, Object new1) { InsertNodes point = stack.insertNodes(); int v1 = _vno; if (root() == null) return pessimisticNeeded; if ((v1&1) ...
java
private synchronized boolean pessimisticInsert( InsertStack stack, Object new1) { _vno++; if ((_vno&1) == 1) { if (root() == null) { ad...
java
private void findInsert( InsertNodes point, InsertStack stack, Object new1) { java.util.Comparator comp = insertComparator(); NodeInsertPoint ip = stack.nodeInsertPoint(); GBSNode p;...
java
private void leftAdd( GBSNode p, GBSNode r, Object new1, NodeInsertPoint ip, InsertNodes point) { if (r == null) /* There is no upper...
java
private void leftAddNoPredecessor( GBSNode p, Object new1, NodeInsertPoint ip, InsertNodes point) { p.findInsertPointInLeft(new1, i...
java
private void leftAddWithPredecessor( GBSNode p, GBSNode r, Object new1, NodeInsertPoint ip, ...
java
private void rightAdd( GBSNode p, GBSNode l, Object new1, NodeInsertPoint ip, InsertNodes point) { if (l == null) /* There is no...
java
private void rightAddNoSuccessor( GBSNode p, Object new1, NodeInsertPoint ip, InsertNodes point) { if (p.lessThanHalfFull()) /* No...
java
private void rightAddWithSuccessor( GBSNode p, GBSNode l, Object new1, NodeInsertPoint ip, Insert...
java
private void finishInsert( InsertNodes point, InsertStack stack, Object new1) { Object insertKey = new1; if (point.positionNode() != null) { GBSNode p = point.positionNod...
java
private void insertFringeMigrate( InsertStack stack, GBSNode p, Object mkey) { GBSNode endp = p; int endIndex = stack.index(); /* Maximum number of right chi...
java
private void insertCheckFringeBalance( InsertStack stack, GBSNode endp, int endIndex, int maxBal) { ...
java
private DeleteStack getDeleteStack() { Object x = _deleteStack.get(); DeleteStack g = null; if (x != null) { g = (DeleteStack) x; g.reset(); } else { g = new DeleteStack(this); x = (Object) g; _delete...
java
private boolean optimisticDelete( DeleteStack stack, Object deleteKey) { DeleteNode point = stack.deleteNode(); int v1 = _vno; if ((v1&1) != 0) return pessimisticNeeded; synchronize...
java
void iteratorSpecialDelete( Iterator iter, GBSNode node, int index) { _vno++; if ((_vno&1) == 1) { node.deleteByLeftShift(index); node.adjustMedian(); ...
java
private void finishDelete( DeleteNode point, DeleteStack stack, Object deleteKey) { adjustTarget(point); point.deleteNode().deleteByLeftShift(point.deleteIndex()); deleteFringeMigr...
java
private void findDelete( DeleteNode point, DeleteStack stack, Object deleteKey) { java.util.Comparator comp = deleteComparator(); GBSNode p; /* P is used to march down the tre...
java
private void midDelete( DeleteStack stack, GBSNode p, DeleteNode point) { /* Assume no lower predecessor/successor */ point.setDelete(p, p.middleIndex()); GBSNode q = p.lowerPredecessor(stack...
java
private void leftDelete( GBSNode p, GBSNode r, Object deleteKey, DeleteNode point) { if (r == null) /* There is no upper predecessor */ ...
java
private void leftDeleteNoPredecessor( GBSNode p, Object deleteKey, DeleteNode point) { int idx = p.findDeleteInLeft(deleteKey); if (idx >= 0) ...
java
private void leftDeleteWithPredecessor( GBSNode p, GBSNode r, Object deleteKey, DeleteNode point) { ja...
java
private void rightDelete( GBSNode p, GBSNode l, Object deleteKey, DeleteNode point) { if (l == null) /* There is no upper successor ...
java
private void rightDeleteNoSuccessor( GBSNode p, Object deleteKey, DeleteNode point) { int idx = p.findDeleteInRight(deleteKey); if (idx >= 0) p...
java
private void rightDeleteWithSuccessor( GBSNode p, GBSNode l, Object deleteKey, DeleteNode point) { java.ut...
java
private void deleteFringeMigrate( DeleteStack stack, GBSNode p) { GBSNode endp = p; /* Last node processed */ int endIndex = stack.index(); /* Index to last parent */ ...
java
private void deleteCheckFringeBalance( DeleteStack stack, GBSNode endp, int endIndex, int maxBal) { int f...
java
public static ThreadContextDescriptor deserialize(byte[] bytes, Map<String, String> execProps) throws ClassNotFoundException, IOException { return new ThreadContextDescriptorImpl(execProps, bytes); }
java
public static File[] listFiles(final File target, final List<Pattern> patterns, final boolean include) { if (patterns == null || patterns.isEmpty()) return target.listFiles(); return target.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, S...
java
public static void copyFile(File dest, File source) throws IOException { InputStream input = null; try { input = new FileInputStream(source); createFile(dest, input); } finally { Utils.tryToClose(input); } }
java
public static void createFile(final File dest, final InputStream sourceInput) throws IOException { if (sourceInput == null || dest == null) return; FileOutputStream fos = null; try { if (!dest.getParentFile().exists()) { if (!dest.getParentFile().mkdirs()...
java
public static void copyDir(File from, File to) throws FileNotFoundException, IOException { File[] files = from.listFiles(); if (files != null) { for (File ff : files) { File tf = new File(to, ff.getName()); if (ff.isDirectory()) { if (tf.m...
java
public static boolean isUnderDirectory(File child, File parent) { if (child == null || parent == null) return false; URI childUri = child.toURI(); URI relativeUri = parent.toURI().relativize(childUri); return relativeUri.equals(childUri) ? false : true; }
java
public static String normalizeEntryPath(String entryPath) { if (entryPath == null || entryPath.isEmpty()) return ""; entryPath = entryPath.replace("\\", "/"); if (entryPath.startsWith("/")) { if (entryPath.length() == 1) { entryPath = ""; } e...
java
public static String normalizeDirPath(String dirPath) { if (dirPath == null || dirPath.isEmpty()) return ""; dirPath = dirPath.replace("\\", "/"); if (!dirPath.endsWith("/")) { dirPath = dirPath + "/"; } return dirPath; }
java
private static final boolean contains(Collection<String> list, String value) { for (String item : list) if (item.contains(value)) return true; return false; }
java
static String getConnectionPoolDataSourceClassName(String vendorPropertiesPID) { String[] classNames = classNamesByPID.get(vendorPropertiesPID); return classNames == null ? null : classNames[1]; }
java
static String getDataSourceClassName(Collection<String> fileNames) { for (Map.Entry<String, String[]> entry : classNamesByKey.entrySet()) if (contains(fileNames, entry.getKey())) { String[] classNames = entry.getValue(); return classNames == null ? null : classNames[...
java
static String getDataSourceClassName(String vendorPropertiesPID) { String[] classNames = classNamesByPID.get(vendorPropertiesPID); return classNames == null ? null : classNames[0]; }
java
static String getXADataSourceClassName(String vendorPropertiesPID) { String[] classNames = classNamesByPID.get(vendorPropertiesPID); return classNames == null ? null : classNames[2]; }
java
private static String tryToLoad(Class<?> type, ClassLoader loader, String... classNames) { final boolean trace = TraceComponent.isAnyTracingEnabled(); for (String className : classNames) try { Class<?> c = loader.loadClass(className); boolean isInstance = typ...
java
protected final String[] getAttributes(String key) { ArrayList<String> array = this._attributes.get(key); if (array != null && array.size() > 0) { String[] type = new String[array.size()]; return array.toArray(type); } return null; }
java
public Object handleOperation(String operation, Object[] params) throws IOException { if (OPERATION_DOWNLOAD.equals(operation)) { if (params.length == 2) { downloadFile((String) params[0], (String) params[1]); } else { //partial download re...
java
@Override public long read(long numBytes, int timeout) throws IOException { long readCount = 0; H2StreamProcessor p = muxLink.getStreamProcessor(streamID); try { p.getReadLatch().await(timeout, TimeUnit.MILLISECONDS); readCount = p.readCount(numBytes, this.getBuffer...
java
@FFDCIgnore(PrivilegedActionException.class) private String getConfigNameForRef(final String ref) { String name = null; if (ref != null) { final ConfigurationAdmin configAdmin = configAdminRef.getService(); Configuration config; try { config = Acce...
java
public static synchronized void addConfig(String id, String uri, Map<String, String> params) { uriMap.put(id, uri); configInfo.put(uri, params); resolvedConfigInfo.clear(); if (uri.endsWith("*")) { wildcardsPresentInConfigInfo = true; } }
java
public String generateSessionId() { byte random[] = new byte[16]; // Render the result as a String of hexadecimal digits StringBuilder buffer = new StringBuilder(); int resultLenBytes = 0; while (resultLenBytes < sessionIdLength) { getRandomBytes(rando...
java
public boolean containsKey(Object key) { FastHashtableEntry tab[] = table; int hash = key.hashCode(); int index = (hash & 0x7FFFFFFF) % tab.length; for (FastHashtableEntry e = tab[index] ; e != null ; e = e.next) { if ((e.hash == hash) && e.key.equals(key)) { return true; } } ...
java
private boolean ableToFilter() { if (filter == null) return false; for (int i = table.length; i-- > 0 ;) { FastHashtableEntry newContents = null, next = null; for (FastHashtableEntry e = table[i] ; e != null ; e = next) { next = e.next; if (filter.shouldRetain(e.key, e.value)) ...
java
private void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException { // Read in the length, threshold, and loadfactor s.defaultReadObject(); // Read the original length of the array and number of elements int origlength = s.readInt(); int elements = s.readInt(...
java
public boolean getBooleanProperty(String propertyName) { boolean booleanValue = false; // Pull the key from the property map Object objectValue = this.properties.get(propertyName); if (objectValue != null) { if (objectValue instanceof Boolean) { booleanValue ...
java
public String getStringProperty(String propertyName) { Object value = this.properties.get(propertyName); if (null != value && value instanceof String) { return (String) value; } return null; }
java
private boolean getBooleanProperty(String key, String defaultValue, StringBuilder errors) { boolean booleanValue = false; String stringValue = null; boolean valueCorrect = false; // Pull the key from the property map Object objectValue = this.properties.get(key); if (obj...
java
private int getIntProperty(String key, boolean defaultProvided, int defaultValue, StringBuilder errors) { String value = getStringProperty(key); if (null != value) { try { int realValue = Integer.parseInt(value); if (TraceComponent.isAnyTracingEnabled() && tc....
java
public synchronized void lockExclusive() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "lockExclusive", this); boolean interrupted = false; // If another thread is attempting to lock exclusive, // wait for it to finish first. while...
java
public int getLocalBusinessInterfaceIndex(String interfaceName) { if (ivBusinessLocalInterfaceClasses != null) { for (int i = 0; i < ivBusinessLocalInterfaceClasses.length; i++) { String bInterfaceName = ivBusinessLocalInterfaceClasses[i].getName(); if (bInterfaceName...
java
public int getRequiredLocalBusinessInterfaceIndex(String interfaceName) throws IllegalStateException { int interfaceIndex = getLocalBusinessInterfaceIndex(interfaceName); if (interfaceIndex == -1) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc...
java
public int getRemoteBusinessInterfaceIndex(String interfaceName) { if (ivBusinessRemoteInterfaceClasses != null) { for (int i = 0; i < ivBusinessRemoteInterfaceClasses.length; i++) { String bInterface = ivBusinessRemoteInterfaceClasses[i].getName(); if (bInterface.equ...
java
public int getRequiredRemoteBusinessInterfaceIndex(String interfaceName) throws IllegalStateException { int interfaceIndex = getRemoteBusinessInterfaceIndex(interfaceName); if (interfaceIndex == -1) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(...
java
public String[][] getMethodLevelCustomFinderMethodSignatures(String cfprocessstring) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "getMethodLevelCustomFinderMethodSignatures:" + cfprocessstring); StringTokenizer st = new StringTokenizer(cfprocessstring, ":...
java
public JsMessage transcribeToJmf() throws MessageCopyFailedException , IncorrectMessageTypeException , UnsupportedEncodingException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "transcribe...
java
public int getApproximateLength() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getApproximateLength"); if (approxLength == -1) approxLength = guessApproxLength(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getApproxim...
java
private final JsMessageImpl createNew() throws MessageCopyFailedException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "createNew"); JsMessageImpl newMsg = null; Class msgClass = this.getClass(); try { /* Create the new JsMessage*/ newMsg = (JsMe...
java
private final JsMessageImpl createNewGeneralized(JsMsgObject newJmo) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "createNewGeneralized"); JsMessageImpl newMsg = null; /* Now create the new JsMessage */ newMsg = new JsMessageImpl(newJmo); if (TraceCompo...
java
@SuppressWarnings("rawtypes") public static Hashtable parsePostData(ServletInputStream in, String encoding, boolean multireadPropertyEnabled) /* 157338 add throws */ throws IOException { int inputLen; byte[] postedBytes = null; String postedBody; if (com.ibm.ejs.ras.TraceComponen...
java
public final Item findOldestItem() throws MessageStoreException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "findOldestItem"); ItemCollection ic = ((ItemCollection) _getMembership()); if (null == ic) { if (TraceCom...
java
protected void abort() { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Aborting connection"); } this.aborted = true; }
java
protected void setTimeoutTime(int time) { int timeout = time; if (timeout == TCPRequestContext.NO_TIMEOUT) { this.timeoutTime = TCPRequestContext.NO_TIMEOUT; this.timeoutInterval = 0; } else { if (timeout == TCPRequestContext.USE_CHANNEL_TIMEOUT) { ...
java