code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public void createPrimaryKey(HsqlName indexName, int[] columns, boolean columnsNotNull) { if (primaryKeyCols != null) { throw Error.runtimeError(ErrorCode.U_S0500, "Table"); } if (columns == null) { columns = ValuePool.emptyIntArray; } else { for (int i = 0; i < columns.length; i++) { getColumn(columns[i]).setPrimaryKey(true); } } primaryKeyCols = columns; setColumnStructures(); primaryKeyTypes = new Type[primaryKeyCols.length]; ArrayUtil.projectRow(colTypes, primaryKeyCols, primaryKeyTypes); primaryKeyColsSequence = new int[primaryKeyCols.length]; ArrayUtil.fillSequence(primaryKeyColsSequence); HsqlName name = indexName; if (name == null) { name = database.nameManager.newAutoName("IDX", getSchemaName(), getName(), SchemaObject.INDEX); } createPrimaryIndex(primaryKeyCols, primaryKeyTypes, name); setBestRowIdentifiers(); } }
public class class_name { public void createPrimaryKey(HsqlName indexName, int[] columns, boolean columnsNotNull) { if (primaryKeyCols != null) { throw Error.runtimeError(ErrorCode.U_S0500, "Table"); } if (columns == null) { columns = ValuePool.emptyIntArray; // depends on control dependency: [if], data = [none] } else { for (int i = 0; i < columns.length; i++) { getColumn(columns[i]).setPrimaryKey(true); // depends on control dependency: [for], data = [i] } } primaryKeyCols = columns; setColumnStructures(); primaryKeyTypes = new Type[primaryKeyCols.length]; ArrayUtil.projectRow(colTypes, primaryKeyCols, primaryKeyTypes); primaryKeyColsSequence = new int[primaryKeyCols.length]; ArrayUtil.fillSequence(primaryKeyColsSequence); HsqlName name = indexName; if (name == null) { name = database.nameManager.newAutoName("IDX", getSchemaName(), getName(), SchemaObject.INDEX); // depends on control dependency: [if], data = [none] } createPrimaryIndex(primaryKeyCols, primaryKeyTypes, name); setBestRowIdentifiers(); } }
public class class_name { @Override public final void setPickUpPlace(final PickUpPlace pPickUpPlace) { this.pickUpPlace = pPickUpPlace; if (this.itsId == null) { this.itsId = new GoodsPlaceId(); } this.itsId.setPickUpPlace(this.pickUpPlace); } }
public class class_name { @Override public final void setPickUpPlace(final PickUpPlace pPickUpPlace) { this.pickUpPlace = pPickUpPlace; if (this.itsId == null) { this.itsId = new GoodsPlaceId(); // depends on control dependency: [if], data = [none] } this.itsId.setPickUpPlace(this.pickUpPlace); } }
public class class_name { public final void primitiveType() throws RecognitionException { try { // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:549:5: ( boolean_key | char_key | byte_key | short_key | int_key | long_key | float_key | double_key ) int alt57=8; int LA57_0 = input.LA(1); if ( (LA57_0==ID) && ((((helper.validateIdentifierKey(DroolsSoftKeywords.SHORT)))||((helper.validateIdentifierKey(DroolsSoftKeywords.LONG)))||((helper.validateIdentifierKey(DroolsSoftKeywords.CHAR)))||((helper.validateIdentifierKey(DroolsSoftKeywords.INT)))||((helper.validateIdentifierKey(DroolsSoftKeywords.FLOAT)))||((helper.validateIdentifierKey(DroolsSoftKeywords.BOOLEAN)))||((helper.validateIdentifierKey(DroolsSoftKeywords.DOUBLE)))||((helper.validateIdentifierKey(DroolsSoftKeywords.BYTE)))))) { int LA57_1 = input.LA(2); if ( (((helper.validateIdentifierKey(DroolsSoftKeywords.BOOLEAN)))) ) { alt57=1; } else if ( (((helper.validateIdentifierKey(DroolsSoftKeywords.CHAR)))) ) { alt57=2; } else if ( (((helper.validateIdentifierKey(DroolsSoftKeywords.BYTE)))) ) { alt57=3; } else if ( (((helper.validateIdentifierKey(DroolsSoftKeywords.SHORT)))) ) { alt57=4; } else if ( (((helper.validateIdentifierKey(DroolsSoftKeywords.INT)))) ) { alt57=5; } else if ( (((helper.validateIdentifierKey(DroolsSoftKeywords.LONG)))) ) { alt57=6; } else if ( (((helper.validateIdentifierKey(DroolsSoftKeywords.FLOAT)))) ) { alt57=7; } else if ( (((helper.validateIdentifierKey(DroolsSoftKeywords.DOUBLE)))) ) { alt57=8; } else { if (state.backtracking>0) {state.failed=true; return;} int nvaeMark = input.mark(); try { input.consume(); NoViableAltException nvae = new NoViableAltException("", 57, 1, input); throw nvae; } finally { input.rewind(nvaeMark); } } } switch (alt57) { case 1 : // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:549:9: boolean_key { pushFollow(FOLLOW_boolean_key_in_primitiveType2814); boolean_key(); state._fsp--; if (state.failed) return; } break; case 2 : // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:550:7: char_key { pushFollow(FOLLOW_char_key_in_primitiveType2822); char_key(); state._fsp--; if (state.failed) return; } break; case 3 : // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:551:7: byte_key { pushFollow(FOLLOW_byte_key_in_primitiveType2830); byte_key(); state._fsp--; if (state.failed) return; } break; case 4 : // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:552:7: short_key { pushFollow(FOLLOW_short_key_in_primitiveType2838); short_key(); state._fsp--; if (state.failed) return; } break; case 5 : // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:553:7: int_key { pushFollow(FOLLOW_int_key_in_primitiveType2846); int_key(); state._fsp--; if (state.failed) return; } break; case 6 : // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:554:7: long_key { pushFollow(FOLLOW_long_key_in_primitiveType2854); long_key(); state._fsp--; if (state.failed) return; } break; case 7 : // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:555:7: float_key { pushFollow(FOLLOW_float_key_in_primitiveType2862); float_key(); state._fsp--; if (state.failed) return; } break; case 8 : // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:556:7: double_key { pushFollow(FOLLOW_double_key_in_primitiveType2870); double_key(); state._fsp--; if (state.failed) return; } break; } } catch (RecognitionException re) { throw re; } finally { // do for sure before leaving } } }
public class class_name { public final void primitiveType() throws RecognitionException { try { // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:549:5: ( boolean_key | char_key | byte_key | short_key | int_key | long_key | float_key | double_key ) int alt57=8; int LA57_0 = input.LA(1); if ( (LA57_0==ID) && ((((helper.validateIdentifierKey(DroolsSoftKeywords.SHORT)))||((helper.validateIdentifierKey(DroolsSoftKeywords.LONG)))||((helper.validateIdentifierKey(DroolsSoftKeywords.CHAR)))||((helper.validateIdentifierKey(DroolsSoftKeywords.INT)))||((helper.validateIdentifierKey(DroolsSoftKeywords.FLOAT)))||((helper.validateIdentifierKey(DroolsSoftKeywords.BOOLEAN)))||((helper.validateIdentifierKey(DroolsSoftKeywords.DOUBLE)))||((helper.validateIdentifierKey(DroolsSoftKeywords.BYTE)))))) { int LA57_1 = input.LA(2); if ( (((helper.validateIdentifierKey(DroolsSoftKeywords.BOOLEAN)))) ) { alt57=1; // depends on control dependency: [if], data = [none] } else if ( (((helper.validateIdentifierKey(DroolsSoftKeywords.CHAR)))) ) { alt57=2; // depends on control dependency: [if], data = [none] } else if ( (((helper.validateIdentifierKey(DroolsSoftKeywords.BYTE)))) ) { alt57=3; // depends on control dependency: [if], data = [none] } else if ( (((helper.validateIdentifierKey(DroolsSoftKeywords.SHORT)))) ) { alt57=4; // depends on control dependency: [if], data = [none] } else if ( (((helper.validateIdentifierKey(DroolsSoftKeywords.INT)))) ) { alt57=5; // depends on control dependency: [if], data = [none] } else if ( (((helper.validateIdentifierKey(DroolsSoftKeywords.LONG)))) ) { alt57=6; // depends on control dependency: [if], data = [none] } else if ( (((helper.validateIdentifierKey(DroolsSoftKeywords.FLOAT)))) ) { alt57=7; // depends on control dependency: [if], data = [none] } else if ( (((helper.validateIdentifierKey(DroolsSoftKeywords.DOUBLE)))) ) { alt57=8; // depends on control dependency: [if], data = [none] } else { if (state.backtracking>0) {state.failed=true; return;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] int nvaeMark = input.mark(); try { input.consume(); // depends on control dependency: [try], data = [none] NoViableAltException nvae = new NoViableAltException("", 57, 1, input); throw nvae; } finally { input.rewind(nvaeMark); } } } switch (alt57) { case 1 : // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:549:9: boolean_key { pushFollow(FOLLOW_boolean_key_in_primitiveType2814); boolean_key(); state._fsp--; if (state.failed) return; } break; case 2 : // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:550:7: char_key { pushFollow(FOLLOW_char_key_in_primitiveType2822); char_key(); state._fsp--; if (state.failed) return; } break; case 3 : // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:551:7: byte_key { pushFollow(FOLLOW_byte_key_in_primitiveType2830); byte_key(); state._fsp--; if (state.failed) return; } break; case 4 : // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:552:7: short_key { pushFollow(FOLLOW_short_key_in_primitiveType2838); short_key(); state._fsp--; if (state.failed) return; } break; case 5 : // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:553:7: int_key { pushFollow(FOLLOW_int_key_in_primitiveType2846); int_key(); state._fsp--; if (state.failed) return; } break; case 6 : // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:554:7: long_key { pushFollow(FOLLOW_long_key_in_primitiveType2854); long_key(); state._fsp--; if (state.failed) return; } break; case 7 : // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:555:7: float_key { pushFollow(FOLLOW_float_key_in_primitiveType2862); float_key(); state._fsp--; if (state.failed) return; } break; case 8 : // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:556:7: double_key { pushFollow(FOLLOW_double_key_in_primitiveType2870); double_key(); state._fsp--; if (state.failed) return; } break; } } catch (RecognitionException re) { throw re; } finally { // do for sure before leaving } } }
public class class_name { public void addVertex(JobVertex vertex) { final JobVertexID id = vertex.getID(); JobVertex previous = taskVertices.put(id, vertex); // if we had a prior association, restore and throw an exception if (previous != null) { taskVertices.put(id, previous); throw new IllegalArgumentException("The JobGraph already contains a vertex with that id."); } } }
public class class_name { public void addVertex(JobVertex vertex) { final JobVertexID id = vertex.getID(); JobVertex previous = taskVertices.put(id, vertex); // if we had a prior association, restore and throw an exception if (previous != null) { taskVertices.put(id, previous); // depends on control dependency: [if], data = [none] throw new IllegalArgumentException("The JobGraph already contains a vertex with that id."); } } }
public class class_name { public Set<WordEntry> distanceMax(String word) { float[] wordVector = getWordVector(word); if (wordVector == null) { return null; } Set<Entry<String, float[]>> entrySet = vocabulary.entrySet(); float[] tempVector = null; List<WordEntry> wordEntrys = new ArrayList<WordEntry>(topNSize); for (Entry<String, float[]> entry : entrySet) { String name = entry.getKey(); if (name.equals(word)) { continue; } float minDist = 10, maxDist = -10; tempVector = entry.getValue(); for (int i = 0; i < wordVector.length; i++) { maxDist = Math.max(wordVector[i] * tempVector[i], maxDist); minDist = Math.min(wordVector[i] * tempVector[i], minDist); } insertTopN(name, maxDist + minDist, wordEntrys); } return new TreeSet<WordEntry>(wordEntrys); } }
public class class_name { public Set<WordEntry> distanceMax(String word) { float[] wordVector = getWordVector(word); if (wordVector == null) { return null; // depends on control dependency: [if], data = [none] } Set<Entry<String, float[]>> entrySet = vocabulary.entrySet(); float[] tempVector = null; List<WordEntry> wordEntrys = new ArrayList<WordEntry>(topNSize); for (Entry<String, float[]> entry : entrySet) { String name = entry.getKey(); if (name.equals(word)) { continue; } float minDist = 10, maxDist = -10; tempVector = entry.getValue(); // depends on control dependency: [for], data = [entry] for (int i = 0; i < wordVector.length; i++) { maxDist = Math.max(wordVector[i] * tempVector[i], maxDist); // depends on control dependency: [for], data = [i] minDist = Math.min(wordVector[i] * tempVector[i], minDist); // depends on control dependency: [for], data = [i] } insertTopN(name, maxDist + minDist, wordEntrys); // depends on control dependency: [for], data = [none] } return new TreeSet<WordEntry>(wordEntrys); } }
public class class_name { public Table copy() { Table copy = new Table(name); for (Column<?> column : columnList) { copy.addColumns(column.emptyCopy(rowCount())); } int[] rows = new int[rowCount()]; for (int i = 0; i < rowCount(); i++) { rows[i] = i; } Rows.copyRowsToTable(rows, this, copy); return copy; } }
public class class_name { public Table copy() { Table copy = new Table(name); for (Column<?> column : columnList) { copy.addColumns(column.emptyCopy(rowCount())); // depends on control dependency: [for], data = [column] } int[] rows = new int[rowCount()]; for (int i = 0; i < rowCount(); i++) { rows[i] = i; // depends on control dependency: [for], data = [i] } Rows.copyRowsToTable(rows, this, copy); return copy; } }
public class class_name { private Map<URI, Map<String, Element>> getMapMetadata(final Collection<FileInfo> fis) { final MapMetaReader metaReader = new MapMetaReader(); metaReader.setLogger(logger); metaReader.setJob(job); for (final FileInfo f : fis) { final File mapFile = new File(job.tempDir, f.file.getPath()); //FIXME: this reader gets the parent path of input file metaReader.read(mapFile); } return metaReader.getMapping(); } }
public class class_name { private Map<URI, Map<String, Element>> getMapMetadata(final Collection<FileInfo> fis) { final MapMetaReader metaReader = new MapMetaReader(); metaReader.setLogger(logger); metaReader.setJob(job); for (final FileInfo f : fis) { final File mapFile = new File(job.tempDir, f.file.getPath()); //FIXME: this reader gets the parent path of input file metaReader.read(mapFile); // depends on control dependency: [for], data = [none] } return metaReader.getMapping(); } }
public class class_name { public static void beginDelayedTransition(final @NonNull ViewGroup sceneRoot, @Nullable Transition transition) { if (!sPendingTransitions.contains(sceneRoot) && ViewUtils.isLaidOut(sceneRoot, true)) { if (Transition.DBG) { Log.d(LOG_TAG, "beginDelayedTransition: root, transition = " + sceneRoot + ", " + transition); } sPendingTransitions.add(sceneRoot); if (transition == null) { transition = sDefaultTransition; } final Transition transitionClone = transition.clone(); sceneChangeSetup(sceneRoot, transitionClone); Scene.setCurrentScene(sceneRoot, null); sceneChangeRunTransition(sceneRoot, transitionClone); } } }
public class class_name { public static void beginDelayedTransition(final @NonNull ViewGroup sceneRoot, @Nullable Transition transition) { if (!sPendingTransitions.contains(sceneRoot) && ViewUtils.isLaidOut(sceneRoot, true)) { if (Transition.DBG) { Log.d(LOG_TAG, "beginDelayedTransition: root, transition = " + sceneRoot + ", " + transition); // depends on control dependency: [if], data = [none] } sPendingTransitions.add(sceneRoot); // depends on control dependency: [if], data = [none] if (transition == null) { transition = sDefaultTransition; // depends on control dependency: [if], data = [none] } final Transition transitionClone = transition.clone(); sceneChangeSetup(sceneRoot, transitionClone); // depends on control dependency: [if], data = [none] Scene.setCurrentScene(sceneRoot, null); // depends on control dependency: [if], data = [none] sceneChangeRunTransition(sceneRoot, transitionClone); // depends on control dependency: [if], data = [none] } } }
public class class_name { public String printResponseHeaders() { StringBuilder sb = new StringBuilder(); HttpURLConnection http = http(); if (http != null) { Map<String, List<String>> header = http.getHeaderFields(); for (String key : header.keySet()) { for (String val : header.get(key)) { sb.append(key).append(": ").append(val).append("\n"); } } } return sb.toString(); } }
public class class_name { public String printResponseHeaders() { StringBuilder sb = new StringBuilder(); HttpURLConnection http = http(); if (http != null) { Map<String, List<String>> header = http.getHeaderFields(); for (String key : header.keySet()) { for (String val : header.get(key)) { sb.append(key).append(": ").append(val).append("\n"); // depends on control dependency: [for], data = [val] } } } return sb.toString(); } }
public class class_name { private String createDirectoryPath(String path) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "createDirectoryPath", "Path="+path); StringBuilder directoryPath = new StringBuilder(""); if ((path != null) && (path.length() > 0)) { // Defect 287722 // Are we on unix? If so then we need // to make sure we replace the first // slash if present as it will be // removed by the tokenizer. if (path.charAt(0) == '/') { directoryPath.append("/"); } // Are we UNC format? If so then we need // to make sure we replace the first // two backslashes as they will be // removed by the tokenizer. if (path.charAt(0) == '\\' && path.charAt(1) == '\\') { directoryPath.append("\\\\"); } final StringTokenizer tokenizer = new StringTokenizer(path, "\\/"); while (tokenizer.hasMoreTokens()) { final String pathChunk = tokenizer.nextToken(); directoryPath.append(pathChunk); // Check to see if the directory exists. File test = new File(directoryPath.toString()); if (!test.exists()) { // Create the directory. test.mkdir(); } if (tokenizer.hasMoreTokens()) { directoryPath.append(File.separator); } } } String retval = directoryPath.toString(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "createDirectoryPath", retval); return retval; } }
public class class_name { private String createDirectoryPath(String path) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "createDirectoryPath", "Path="+path); StringBuilder directoryPath = new StringBuilder(""); if ((path != null) && (path.length() > 0)) { // Defect 287722 // Are we on unix? If so then we need // to make sure we replace the first // slash if present as it will be // removed by the tokenizer. if (path.charAt(0) == '/') { directoryPath.append("/"); // depends on control dependency: [if], data = [none] } // Are we UNC format? If so then we need // to make sure we replace the first // two backslashes as they will be // removed by the tokenizer. if (path.charAt(0) == '\\' && path.charAt(1) == '\\') { directoryPath.append("\\\\"); // depends on control dependency: [if], data = [none] } final StringTokenizer tokenizer = new StringTokenizer(path, "\\/"); while (tokenizer.hasMoreTokens()) { final String pathChunk = tokenizer.nextToken(); directoryPath.append(pathChunk); // depends on control dependency: [while], data = [none] // Check to see if the directory exists. File test = new File(directoryPath.toString()); if (!test.exists()) { // Create the directory. test.mkdir(); // depends on control dependency: [if], data = [none] } if (tokenizer.hasMoreTokens()) { directoryPath.append(File.separator); // depends on control dependency: [if], data = [none] } } } String retval = directoryPath.toString(); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "createDirectoryPath", retval); return retval; } }
public class class_name { public static boolean isXML11ValidNCName(String ncName) { int length = ncName.length(); if (length == 0) return false; int i = 1; char ch = ncName.charAt(0); if( !isXML11NCNameStart(ch) ) { if ( length > 1 && isXML11NameHighSurrogate(ch) ) { char ch2 = ncName.charAt(1); if ( !XMLChar.isLowSurrogate(ch2) || !isXML11NCNameStart(XMLChar.supplemental(ch, ch2)) ) { return false; } i = 2; } else { return false; } } while (i < length) { ch = ncName.charAt(i); if ( !isXML11NCName(ch) ) { if ( ++i < length && isXML11NameHighSurrogate(ch) ) { char ch2 = ncName.charAt(i); if ( !XMLChar.isLowSurrogate(ch2) || !isXML11NCName(XMLChar.supplemental(ch, ch2)) ) { return false; } } else { return false; } } ++i; } return true; } }
public class class_name { public static boolean isXML11ValidNCName(String ncName) { int length = ncName.length(); if (length == 0) return false; int i = 1; char ch = ncName.charAt(0); if( !isXML11NCNameStart(ch) ) { if ( length > 1 && isXML11NameHighSurrogate(ch) ) { char ch2 = ncName.charAt(1); if ( !XMLChar.isLowSurrogate(ch2) || !isXML11NCNameStart(XMLChar.supplemental(ch, ch2)) ) { return false; // depends on control dependency: [if], data = [none] } i = 2; // depends on control dependency: [if], data = [none] } else { return false; // depends on control dependency: [if], data = [none] } } while (i < length) { ch = ncName.charAt(i); // depends on control dependency: [while], data = [(i] if ( !isXML11NCName(ch) ) { if ( ++i < length && isXML11NameHighSurrogate(ch) ) { char ch2 = ncName.charAt(i); if ( !XMLChar.isLowSurrogate(ch2) || !isXML11NCName(XMLChar.supplemental(ch, ch2)) ) { return false; // depends on control dependency: [if], data = [none] } } else { return false; // depends on control dependency: [if], data = [none] } } ++i; // depends on control dependency: [while], data = [none] } return true; } }
public class class_name { @Override protected String calculateContentHash(SignableRequest<?> request) { // To be consistent with other service clients using sig-v4, // we just set the header as "required", and AWS4Signer.sign() will be // notified to pick up the header value returned by this method. request.addHeader(X_AMZ_CONTENT_SHA256, "required"); if (isPayloadSigningEnabled(request)) { if (useChunkEncoding(request)) { final String contentLength = request.getHeaders().get(Headers.CONTENT_LENGTH); final long originalContentLength; if (contentLength != null) { originalContentLength = Long.parseLong(contentLength); } else { /** * "Content-Length" header could be missing if the caller is * uploading a stream without setting Content-Length in * ObjectMetadata. Before using sigv4, we rely on HttpClient to * add this header by using BufferedHttpEntity when creating the * HttpRequest object. But now, we need this information * immediately for the signing process, so we have to cache the * stream here. */ try { originalContentLength = getContentLength(request); } catch (IOException e) { throw new SdkClientException( "Cannot get the content-length of the request content.", e); } } request.addHeader("x-amz-decoded-content-length", Long.toString(originalContentLength)); // Make sure "Content-Length" header is not empty so that HttpClient // won't cache the stream again to recover Content-Length request.addHeader(Headers.CONTENT_LENGTH, Long.toString( AwsChunkedEncodingInputStream .calculateStreamContentLength(originalContentLength))); return CONTENT_SHA_256; } else { return super.calculateContentHash(request); } } return UNSIGNED_PAYLOAD; } }
public class class_name { @Override protected String calculateContentHash(SignableRequest<?> request) { // To be consistent with other service clients using sig-v4, // we just set the header as "required", and AWS4Signer.sign() will be // notified to pick up the header value returned by this method. request.addHeader(X_AMZ_CONTENT_SHA256, "required"); if (isPayloadSigningEnabled(request)) { if (useChunkEncoding(request)) { final String contentLength = request.getHeaders().get(Headers.CONTENT_LENGTH); final long originalContentLength; if (contentLength != null) { originalContentLength = Long.parseLong(contentLength); // depends on control dependency: [if], data = [(contentLength] } else { /** * "Content-Length" header could be missing if the caller is * uploading a stream without setting Content-Length in * ObjectMetadata. Before using sigv4, we rely on HttpClient to * add this header by using BufferedHttpEntity when creating the * HttpRequest object. But now, we need this information * immediately for the signing process, so we have to cache the * stream here. */ try { originalContentLength = getContentLength(request); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new SdkClientException( "Cannot get the content-length of the request content.", e); } // depends on control dependency: [catch], data = [none] } request.addHeader("x-amz-decoded-content-length", Long.toString(originalContentLength)); // depends on control dependency: [if], data = [none] // Make sure "Content-Length" header is not empty so that HttpClient // won't cache the stream again to recover Content-Length request.addHeader(Headers.CONTENT_LENGTH, Long.toString( AwsChunkedEncodingInputStream .calculateStreamContentLength(originalContentLength))); // depends on control dependency: [if], data = [none] return CONTENT_SHA_256; // depends on control dependency: [if], data = [none] } else { return super.calculateContentHash(request); // depends on control dependency: [if], data = [none] } } return UNSIGNED_PAYLOAD; } }
public class class_name { @Override public void delete(ZooPC obj) { if (obj.getClass() == GenericObject.class) { throw new IllegalArgumentException(); // deleteGeneric((GenericObject) obj); // return; } if (!isStarted) { this.sie = node.getSchemaIE(cls); isStarted = true; } //updated index //This is buffered to reduce look-ups to find field indices. buffer[bufferCnt++] = obj; if (bufferCnt == BUFFER_SIZE) { flushBuffer(); } } }
public class class_name { @Override public void delete(ZooPC obj) { if (obj.getClass() == GenericObject.class) { throw new IllegalArgumentException(); // deleteGeneric((GenericObject) obj); // return; } if (!isStarted) { this.sie = node.getSchemaIE(cls); // depends on control dependency: [if], data = [none] isStarted = true; // depends on control dependency: [if], data = [none] } //updated index //This is buffered to reduce look-ups to find field indices. buffer[bufferCnt++] = obj; if (bufferCnt == BUFFER_SIZE) { flushBuffer(); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static boolean isDouble(String s) { try { Double.parseDouble(s); if (s.contains(".")) { return true; } return false; } catch (NumberFormatException e) { return false; } } }
public class class_name { public static boolean isDouble(String s) { try { Double.parseDouble(s); // depends on control dependency: [try], data = [none] if (s.contains(".")) { return true; // depends on control dependency: [if], data = [none] } return false; // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public Token[] parseTokens() { char delim = ' '; final StringBuilder part = new StringBuilder(); boolean inToken = false; int startX = 0; final List<Token> tokens = new ArrayList<>(); char thisChar = ' '; char prevChar; for (int scanX = 0; scanX < commandLine.length(); scanX++) { prevChar = thisChar; thisChar = commandLine.charAt(scanX); char nextChar = ' '; /* * Look ahead one char if possible */ if (scanX < commandLine.length() - 2) nextChar = commandLine.charAt(scanX + 1); if (inToken) { if (delim != ' ' && thisChar == delim) { tokens.add(new Token(commandPrefix, part.toString(), startX, scanX + 1, true)); part.delete(0, part.length()); inToken = false; } else /* * As long as we are not in a quoted literal then we want * to split the token if any of these conditions are * true. */ if (delim == ' ' && (Character.isWhitespace(thisChar) || thisChar == '(' || thisChar == ')' || thisChar == '[' || thisChar == ']' || thisChar == ';' || thisChar == ',' || thisChar == '"' || thisChar == '\'' /* * = is whitespace unless it is followed by an * open paren, then it is an equation directive */ || (thisChar == '=' && nextChar != '(') /* * Make sure to allow double dashes at the * beginning of a token, the second one is * technically not an embedded dash. */ || (!allowEmbeddedCommandPrefix && thisChar == commandPrefix && prevChar != commandPrefix) /* * Even if we are allowing embedded * tokens we don't want to allow double * dashes within a token, only at the * beginning. A double dash will * indicate that a new token should be * started instead. */ || (allowEmbeddedCommandPrefix && thisChar == commandPrefix && nextChar == commandPrefix) /* * An embedded dash will cause a new * token if the current token started * with a single dash */ || (thisChar == commandPrefix && part.length() > 1 && part.charAt(0) == commandPrefix && part.charAt(1) != commandPrefix))) { boolean forceLiteral = false; /* * Single char commands can not be a number. This allows * negative numbers to be entered without escaping them or * surrounding them with delimiters. */ if (part.length() > 1) if (part.charAt(0) == commandPrefix && Character.isDigit(part.charAt(1))) forceLiteral = true; tokens.add(new Token(commandPrefix, part.toString(), startX, scanX, forceLiteral)); part.delete(0, part.length()); /* * rescan char */ --scanX; inToken = false; } else { if (thisChar == '\\') thisChar = commandLine.charAt(++scanX); part.append(thisChar); } } else { /* * Completely throw away whitespace characters unless quoted. * They served their purpose in that they caused a token to be * stopped. */ if (Character.isWhitespace(thisChar) || thisChar == ':' || thisChar == ';' || thisChar == ',' || (thisChar == '=' && nextChar != '(')) continue; if (thisChar == '(' || thisChar == ')' || thisChar == '[' || thisChar == ']') { tokens.add(new Token(commandPrefix, "" + thisChar, scanX, scanX + 1, false)); continue; } if (thisChar == '"' || thisChar == '\'') delim = thisChar; else { delim = ' '; part.append(thisChar); } inToken = true; startX = scanX; } } if (inToken) tokens.add(new Token(commandPrefix, part.toString(), startX, commandLine.length(), delim != ' ')); return tokens.toArray(new Token[tokens.size()]); } }
public class class_name { @Override public Token[] parseTokens() { char delim = ' '; final StringBuilder part = new StringBuilder(); boolean inToken = false; int startX = 0; final List<Token> tokens = new ArrayList<>(); char thisChar = ' '; char prevChar; for (int scanX = 0; scanX < commandLine.length(); scanX++) { prevChar = thisChar; // depends on control dependency: [for], data = [none] thisChar = commandLine.charAt(scanX); // depends on control dependency: [for], data = [scanX] char nextChar = ' '; /* * Look ahead one char if possible */ if (scanX < commandLine.length() - 2) nextChar = commandLine.charAt(scanX + 1); if (inToken) { if (delim != ' ' && thisChar == delim) { tokens.add(new Token(commandPrefix, part.toString(), startX, scanX + 1, true)); // depends on control dependency: [if], data = [none] part.delete(0, part.length()); // depends on control dependency: [if], data = [none] inToken = false; // depends on control dependency: [if], data = [none] } else /* * As long as we are not in a quoted literal then we want * to split the token if any of these conditions are * true. */ if (delim == ' ' && (Character.isWhitespace(thisChar) || thisChar == '(' || thisChar == ')' || thisChar == '[' || thisChar == ']' || thisChar == ';' || thisChar == ',' || thisChar == '"' || thisChar == '\'' /* * = is whitespace unless it is followed by an * open paren, then it is an equation directive */ || (thisChar == '=' && nextChar != '(') /* * Make sure to allow double dashes at the * beginning of a token, the second one is * technically not an embedded dash. */ || (!allowEmbeddedCommandPrefix && thisChar == commandPrefix && prevChar != commandPrefix) /* * Even if we are allowing embedded * tokens we don't want to allow double * dashes within a token, only at the * beginning. A double dash will * indicate that a new token should be * started instead. */ || (allowEmbeddedCommandPrefix && thisChar == commandPrefix && nextChar == commandPrefix) /* * An embedded dash will cause a new * token if the current token started * with a single dash */ || (thisChar == commandPrefix && part.length() > 1 && part.charAt(0) == commandPrefix && part.charAt(1) != commandPrefix))) { boolean forceLiteral = false; /* * Single char commands can not be a number. This allows * negative numbers to be entered without escaping them or * surrounding them with delimiters. */ if (part.length() > 1) if (part.charAt(0) == commandPrefix && Character.isDigit(part.charAt(1))) forceLiteral = true; tokens.add(new Token(commandPrefix, part.toString(), startX, scanX, forceLiteral)); // depends on control dependency: [if], data = [none] part.delete(0, part.length()); // depends on control dependency: [if], data = [none] /* * rescan char */ --scanX; // depends on control dependency: [if], data = [none] inToken = false; // depends on control dependency: [if], data = [none] } else { if (thisChar == '\\') thisChar = commandLine.charAt(++scanX); part.append(thisChar); // depends on control dependency: [if], data = [none] } } else { /* * Completely throw away whitespace characters unless quoted. * They served their purpose in that they caused a token to be * stopped. */ if (Character.isWhitespace(thisChar) || thisChar == ':' || thisChar == ';' || thisChar == ',' || (thisChar == '=' && nextChar != '(')) continue; if (thisChar == '(' || thisChar == ')' || thisChar == '[' || thisChar == ']') { tokens.add(new Token(commandPrefix, "" + thisChar, scanX, scanX + 1, false)); // depends on control dependency: [if], data = [none] continue; } if (thisChar == '"' || thisChar == '\'') delim = thisChar; else { delim = ' '; // depends on control dependency: [if], data = [none] part.append(thisChar); // depends on control dependency: [if], data = [(thisChar] } inToken = true; // depends on control dependency: [if], data = [none] startX = scanX; // depends on control dependency: [if], data = [none] } } if (inToken) tokens.add(new Token(commandPrefix, part.toString(), startX, commandLine.length(), delim != ' ')); return tokens.toArray(new Token[tokens.size()]); } }
public class class_name { private void remove_i(final String p, final boolean fwd) { if (name_equals(p)) { System.out.println("Group::remove_i::failed to remove " + p + " (can't remove self)"); return; } if (p.indexOf('*') == -1) { final Iterator it = elements.iterator(); while (it.hasNext()) { final GroupElement e = (GroupElement) it.next(); if (e.name_equals(p)) { elements.remove(e); break; } } } else { final Vector remove_list = new Vector(); Iterator it = elements.iterator(); while (it.hasNext()) { final GroupElement e = (GroupElement) it.next(); if (e.name_matches(p)) { remove_list.add(e); } } it = remove_list.iterator(); while (it.hasNext()) { elements.remove(it.next()); } } if (fwd == true) { final Iterator it = elements.iterator(); while (it.hasNext()) { final GroupElement e = (GroupElement) it.next(); if (e instanceof Group) { ((Group) e).remove(p, fwd); } } } } }
public class class_name { private void remove_i(final String p, final boolean fwd) { if (name_equals(p)) { System.out.println("Group::remove_i::failed to remove " + p + " (can't remove self)"); return; } if (p.indexOf('*') == -1) { // depends on control dependency: [if], data = [none] final Iterator it = elements.iterator(); while (it.hasNext()) { final GroupElement e = (GroupElement) it.next(); if (e.name_equals(p)) { elements.remove(e); // depends on control dependency: [if], data = [none] break; } } } else { // depends on control dependency: [if], data = [none] final Vector remove_list = new Vector(); Iterator it = elements.iterator(); while (it.hasNext()) { final GroupElement e = (GroupElement) it.next(); if (e.name_matches(p)) { remove_list.add(e); // depends on control dependency: [if], data = [none] } } it = remove_list.iterator(); while (it.hasNext()) { elements.remove(it.next()); // depends on control dependency: [while], data = [none] } } if (fwd == true) { final Iterator it = elements.iterator(); while (it.hasNext()) { final GroupElement e = (GroupElement) it.next(); if (e instanceof Group) { ((Group) e).remove(p, fwd); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public final static Class<?> getCompiledClass(String fullClassName, boolean useCache) throws Err.Compilation, Err.UnloadableClass { try { if (! useCache) { DynamicClassLoader dynamicClassLoader = new DynamicClassLoader(fullClassName.substring(0, fullClassName.lastIndexOf('.'))); Class<?> cl = dynamicClassLoader.loadClass(fullClassName); dynamicClassLoader = null; return cl; } else { return CACHED_CONTROLLERS.computeIfAbsent(fullClassName, WRAP_FORNAME); } } catch (Exception e) { throw new Err.UnloadableClass(e); } } }
public class class_name { public final static Class<?> getCompiledClass(String fullClassName, boolean useCache) throws Err.Compilation, Err.UnloadableClass { try { if (! useCache) { DynamicClassLoader dynamicClassLoader = new DynamicClassLoader(fullClassName.substring(0, fullClassName.lastIndexOf('.'))); Class<?> cl = dynamicClassLoader.loadClass(fullClassName); dynamicClassLoader = null; // depends on control dependency: [if], data = [none] return cl; // depends on control dependency: [if], data = [none] } else { return CACHED_CONTROLLERS.computeIfAbsent(fullClassName, WRAP_FORNAME); // depends on control dependency: [if], data = [none] } } catch (Exception e) { throw new Err.UnloadableClass(e); } } }
public class class_name { public synchronized CEMILData getFrame() { final CEMILData[] c = (CEMILData[]) value; final int first = first(); final CEMILData f = c[first]; if (size > 0 && consuming) { --size; c[first] = null; timestamps[first] = 0; if (size == 0) next = 0; } return f; } }
public class class_name { public synchronized CEMILData getFrame() { final CEMILData[] c = (CEMILData[]) value; final int first = first(); final CEMILData f = c[first]; if (size > 0 && consuming) { --size; // depends on control dependency: [if], data = [none] c[first] = null; // depends on control dependency: [if], data = [none] timestamps[first] = 0; // depends on control dependency: [if], data = [none] if (size == 0) next = 0; } return f; } }
public class class_name { public Document getSchema() { Document result; if (m_schemaDocument == null) { result = DocumentHelper.createDocument(); Element root = result.addElement(XSD_NODE_SCHEMA); root.addAttribute(XSD_ATTRIBUTE_ELEMENT_FORM_DEFAULT, XSD_ATTRIBUTE_VALUE_QUALIFIED); Element include = root.addElement(XSD_NODE_INCLUDE); include.addAttribute(XSD_ATTRIBUTE_SCHEMA_LOCATION, XSD_INCLUDE_OPENCMS); if (m_includes.size() > 0) { Iterator<CmsXmlContentDefinition> i = m_includes.iterator(); while (i.hasNext()) { CmsXmlContentDefinition definition = i.next(); root.addElement(XSD_NODE_INCLUDE).addAttribute( XSD_ATTRIBUTE_SCHEMA_LOCATION, definition.m_schemaLocation); } } String outerTypeName = createTypeName(getOuterName()); String innerTypeName = createTypeName(getInnerName()); Element content = root.addElement(XSD_NODE_ELEMENT); content.addAttribute(XSD_ATTRIBUTE_NAME, getOuterName()); content.addAttribute(XSD_ATTRIBUTE_TYPE, outerTypeName); Element list = root.addElement(XSD_NODE_COMPLEXTYPE); list.addAttribute(XSD_ATTRIBUTE_NAME, outerTypeName); Element listSequence = list.addElement(XSD_NODE_SEQUENCE); Element listElement = listSequence.addElement(XSD_NODE_ELEMENT); listElement.addAttribute(XSD_ATTRIBUTE_NAME, getInnerName()); listElement.addAttribute(XSD_ATTRIBUTE_TYPE, innerTypeName); listElement.addAttribute(XSD_ATTRIBUTE_MIN_OCCURS, XSD_ATTRIBUTE_VALUE_ZERO); listElement.addAttribute(XSD_ATTRIBUTE_MAX_OCCURS, XSD_ATTRIBUTE_VALUE_UNBOUNDED); Element main = root.addElement(XSD_NODE_COMPLEXTYPE); main.addAttribute(XSD_ATTRIBUTE_NAME, innerTypeName); Element mainSequence; if (m_sequenceType == SequenceType.SEQUENCE) { mainSequence = main.addElement(XSD_NODE_SEQUENCE); } else { mainSequence = main.addElement(XSD_NODE_CHOICE); if (getChoiceMaxOccurs() > 1) { mainSequence.addAttribute(XSD_ATTRIBUTE_MAX_OCCURS, String.valueOf(getChoiceMaxOccurs())); } else { mainSequence.addAttribute(XSD_ATTRIBUTE_MIN_OCCURS, XSD_ATTRIBUTE_VALUE_ZERO); mainSequence.addAttribute(XSD_ATTRIBUTE_MAX_OCCURS, XSD_ATTRIBUTE_VALUE_ONE); } } Iterator<I_CmsXmlSchemaType> i = m_typeSequence.iterator(); while (i.hasNext()) { I_CmsXmlSchemaType schemaType = i.next(); schemaType.appendXmlSchema(mainSequence); } Element language = main.addElement(XSD_NODE_ATTRIBUTE); language.addAttribute(XSD_ATTRIBUTE_NAME, XSD_ATTRIBUTE_VALUE_LANGUAGE); language.addAttribute(XSD_ATTRIBUTE_TYPE, CmsXmlLocaleValue.TYPE_NAME); language.addAttribute(XSD_ATTRIBUTE_USE, XSD_ATTRIBUTE_VALUE_OPTIONAL); } else { result = (Document)m_schemaDocument.clone(); } return result; } }
public class class_name { public Document getSchema() { Document result; if (m_schemaDocument == null) { result = DocumentHelper.createDocument(); // depends on control dependency: [if], data = [none] Element root = result.addElement(XSD_NODE_SCHEMA); root.addAttribute(XSD_ATTRIBUTE_ELEMENT_FORM_DEFAULT, XSD_ATTRIBUTE_VALUE_QUALIFIED); // depends on control dependency: [if], data = [none] Element include = root.addElement(XSD_NODE_INCLUDE); include.addAttribute(XSD_ATTRIBUTE_SCHEMA_LOCATION, XSD_INCLUDE_OPENCMS); // depends on control dependency: [if], data = [none] if (m_includes.size() > 0) { Iterator<CmsXmlContentDefinition> i = m_includes.iterator(); while (i.hasNext()) { CmsXmlContentDefinition definition = i.next(); root.addElement(XSD_NODE_INCLUDE).addAttribute( XSD_ATTRIBUTE_SCHEMA_LOCATION, definition.m_schemaLocation); // depends on control dependency: [while], data = [none] } } String outerTypeName = createTypeName(getOuterName()); String innerTypeName = createTypeName(getInnerName()); Element content = root.addElement(XSD_NODE_ELEMENT); content.addAttribute(XSD_ATTRIBUTE_NAME, getOuterName()); // depends on control dependency: [if], data = [none] content.addAttribute(XSD_ATTRIBUTE_TYPE, outerTypeName); // depends on control dependency: [if], data = [none] Element list = root.addElement(XSD_NODE_COMPLEXTYPE); list.addAttribute(XSD_ATTRIBUTE_NAME, outerTypeName); // depends on control dependency: [if], data = [none] Element listSequence = list.addElement(XSD_NODE_SEQUENCE); Element listElement = listSequence.addElement(XSD_NODE_ELEMENT); listElement.addAttribute(XSD_ATTRIBUTE_NAME, getInnerName()); // depends on control dependency: [if], data = [none] listElement.addAttribute(XSD_ATTRIBUTE_TYPE, innerTypeName); // depends on control dependency: [if], data = [none] listElement.addAttribute(XSD_ATTRIBUTE_MIN_OCCURS, XSD_ATTRIBUTE_VALUE_ZERO); // depends on control dependency: [if], data = [none] listElement.addAttribute(XSD_ATTRIBUTE_MAX_OCCURS, XSD_ATTRIBUTE_VALUE_UNBOUNDED); // depends on control dependency: [if], data = [none] Element main = root.addElement(XSD_NODE_COMPLEXTYPE); main.addAttribute(XSD_ATTRIBUTE_NAME, innerTypeName); // depends on control dependency: [if], data = [none] Element mainSequence; if (m_sequenceType == SequenceType.SEQUENCE) { mainSequence = main.addElement(XSD_NODE_SEQUENCE); // depends on control dependency: [if], data = [none] } else { mainSequence = main.addElement(XSD_NODE_CHOICE); // depends on control dependency: [if], data = [none] if (getChoiceMaxOccurs() > 1) { mainSequence.addAttribute(XSD_ATTRIBUTE_MAX_OCCURS, String.valueOf(getChoiceMaxOccurs())); // depends on control dependency: [if], data = [(getChoiceMaxOccurs()] } else { mainSequence.addAttribute(XSD_ATTRIBUTE_MIN_OCCURS, XSD_ATTRIBUTE_VALUE_ZERO); // depends on control dependency: [if], data = [none] mainSequence.addAttribute(XSD_ATTRIBUTE_MAX_OCCURS, XSD_ATTRIBUTE_VALUE_ONE); // depends on control dependency: [if], data = [none] } } Iterator<I_CmsXmlSchemaType> i = m_typeSequence.iterator(); while (i.hasNext()) { I_CmsXmlSchemaType schemaType = i.next(); schemaType.appendXmlSchema(mainSequence); // depends on control dependency: [while], data = [none] } Element language = main.addElement(XSD_NODE_ATTRIBUTE); language.addAttribute(XSD_ATTRIBUTE_NAME, XSD_ATTRIBUTE_VALUE_LANGUAGE); // depends on control dependency: [if], data = [none] language.addAttribute(XSD_ATTRIBUTE_TYPE, CmsXmlLocaleValue.TYPE_NAME); // depends on control dependency: [if], data = [none] language.addAttribute(XSD_ATTRIBUTE_USE, XSD_ATTRIBUTE_VALUE_OPTIONAL); // depends on control dependency: [if], data = [none] } else { result = (Document)m_schemaDocument.clone(); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { public static Object getFieldValue(String qualifiedFieldName) { Class clazz; try { clazz = classForName(ClassUtils.qualifier(qualifiedFieldName)); } catch (ClassNotFoundException cnfe) { return null; } try { return clazz.getField(ClassUtils.unqualify(qualifiedFieldName)).get(null); } catch (Exception e) { return null; } } }
public class class_name { public static Object getFieldValue(String qualifiedFieldName) { Class clazz; try { clazz = classForName(ClassUtils.qualifier(qualifiedFieldName)); // depends on control dependency: [try], data = [none] } catch (ClassNotFoundException cnfe) { return null; } // depends on control dependency: [catch], data = [none] try { return clazz.getField(ClassUtils.unqualify(qualifiedFieldName)).get(null); // depends on control dependency: [try], data = [none] } catch (Exception e) { return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void pushParameterStack() { if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)){ //306998.15 logger.logp(Level.FINE, CLASS_NAME,"pushParameterStack", "entry"); } if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){ checkRequestObjectInUse(); } SRTServletRequestThreadData reqData = SRTServletRequestThreadData.getInstance(); if (reqData.getParameters() == null) { reqData.pushParameterStack(null); } else { _paramStack.push(((Hashtable) reqData.getParameters()).clone()); } if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE) && reqData.getParameters() !=null) //306998.15 { debugParams(reqData.getParameters()); } } }
public class class_name { public void pushParameterStack() { if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)){ //306998.15 logger.logp(Level.FINE, CLASS_NAME,"pushParameterStack", "entry"); // depends on control dependency: [if], data = [none] } if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){ checkRequestObjectInUse(); // depends on control dependency: [if], data = [none] } SRTServletRequestThreadData reqData = SRTServletRequestThreadData.getInstance(); if (reqData.getParameters() == null) { reqData.pushParameterStack(null); // depends on control dependency: [if], data = [null)] } else { _paramStack.push(((Hashtable) reqData.getParameters()).clone()); // depends on control dependency: [if], data = [none] } if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE) && reqData.getParameters() !=null) //306998.15 { debugParams(reqData.getParameters()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public AttributeBuilder allowAttributes(String... attributeNames) { ImmutableList.Builder<String> b = ImmutableList.builder(); for (String attributeName : attributeNames) { b.add(HtmlLexer.canonicalName(attributeName)); } return new AttributeBuilder(b.build()); } }
public class class_name { public AttributeBuilder allowAttributes(String... attributeNames) { ImmutableList.Builder<String> b = ImmutableList.builder(); for (String attributeName : attributeNames) { b.add(HtmlLexer.canonicalName(attributeName)); // depends on control dependency: [for], data = [attributeName] } return new AttributeBuilder(b.build()); } }
public class class_name { public static final FileAttribute<?>[] getFileAttributes(String perms) { if (perms.length() != 10) { throw new IllegalArgumentException(perms+" not permission. E.g. -rwxr--r--"); } if (supports("posix")) { Set<PosixFilePermission> posixPerms = PosixFilePermissions.fromString(perms.substring(1)); FileAttribute<Set<PosixFilePermission>> attrs = PosixFilePermissions.asFileAttribute(posixPerms); return new FileAttribute<?>[]{attrs}; } else { return new FileAttribute<?>[]{}; } } }
public class class_name { public static final FileAttribute<?>[] getFileAttributes(String perms) { if (perms.length() != 10) { throw new IllegalArgumentException(perms+" not permission. E.g. -rwxr--r--"); } if (supports("posix")) { Set<PosixFilePermission> posixPerms = PosixFilePermissions.fromString(perms.substring(1)); FileAttribute<Set<PosixFilePermission>> attrs = PosixFilePermissions.asFileAttribute(posixPerms); return new FileAttribute<?>[]{attrs}; // depends on control dependency: [if], data = [none] } else { return new FileAttribute<?>[]{}; // depends on control dependency: [if], data = [none] } } }
public class class_name { public void marshall(DescribeTagOptionRequest describeTagOptionRequest, ProtocolMarshaller protocolMarshaller) { if (describeTagOptionRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeTagOptionRequest.getId(), ID_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DescribeTagOptionRequest describeTagOptionRequest, ProtocolMarshaller protocolMarshaller) { if (describeTagOptionRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeTagOptionRequest.getId(), ID_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @SuppressWarnings("unchecked") private DependencyPermutationFunction getPermutationFunction() { try { if (!argOptions.hasOption('P')) return null; if (!argOptions.hasOption('p')) return new DefaultDependencyPermutationFunction<TernaryVector>( new TernaryPermutationFunction()); Class clazz = Class.forName(argOptions.getStringOption('p')); Constructor<?> c = clazz.getConstructor(PermutationFunction.class); return (DependencyPermutationFunction<TernaryVector>) c.newInstance(new TernaryPermutationFunction()); } catch (Exception e) { throw new Error(e); } } }
public class class_name { @SuppressWarnings("unchecked") private DependencyPermutationFunction getPermutationFunction() { try { if (!argOptions.hasOption('P')) return null; if (!argOptions.hasOption('p')) return new DefaultDependencyPermutationFunction<TernaryVector>( new TernaryPermutationFunction()); Class clazz = Class.forName(argOptions.getStringOption('p')); // depends on control dependency: [try], data = [none] Constructor<?> c = clazz.getConstructor(PermutationFunction.class); return (DependencyPermutationFunction<TernaryVector>) c.newInstance(new TernaryPermutationFunction()); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new Error(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void rcvMFPRequestSchema(CommsByteBuffer request, Conversation conversation, int requestNumber, int segmentId, boolean allocatedFromBufferPool, boolean partOfExchange) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "rcvMFPRequestSchema", new Object[] { request, conversation, Integer.valueOf(requestNumber), Boolean.valueOf(allocatedFromBufferPool), Boolean.valueOf(partOfExchange) }); CompHandshake ch = null; ConversationState convState = (ConversationState) conversation.getAttachment(); CommsConnection cc = convState.getCommsConnection(); try { // Get MFP Singleton ch = (CompHandshake) CompHandshakeFactory.getInstance(); byte[] mfpRequestData = request.getRemaining(); // Get hold of product version HandshakeProperties handshakeGroup = conversation.getHandshakeProperties(); int productVersion = handshakeGroup.getMajorVersion(); // Give MFP received Schema byte[] mfpReplyData = ch.compRequest(cc, productVersion, segmentId, mfpRequestData); if (mfpReplyData == null) { // Oops something went wrong in MFP if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "MFP returned null"); SIErrorException e = new SIErrorException( nls.getFormattedMessage("MFP_SCHEMA_REQUEST_FAILED_SICO2056", null, null) // D256974 ); FFDCFilter.processException(e, CLASS_NAME + ".rcvMFPRequestSchema", CommsConstants.SERVERTRANSPORTRECEIVELISTENER_MFPREQSCH_01, this); StaticCATHelper.sendExceptionToClient(e, null, conversation, requestNumber); } else { // Otherwise send the data back for MFP CommsByteBuffer reply = poolManager.allocate(); reply.wrap(mfpReplyData); try { conversation.send(reply, JFapChannelConstants.SEG_REQUEST_SCHEMA_R, requestNumber, JFapChannelConstants.PRIORITY_HIGHEST, true, ThrottlingPolicy.BLOCK_THREAD, null); } catch (SIException e) { FFDCFilter.processException(e, CLASS_NAME + ".rcvMFPRequestSchema", CommsConstants.SERVERTRANSPORTRECEIVELISTENER_MFPREQSCH_02, this); SibTr.error(tc, "COMMUNICATION_ERROR_SICO2019", e); } } } catch (Exception e) { FFDCFilter.processException(e, CLASS_NAME + ".rcvMFPRequestSchema", CommsConstants.SERVERTRANSPORTRECEIVELISTENER_MFPREQSCH_03, this); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "MFP unable to create CompHandshake Singleton", e); } request.release(allocatedFromBufferPool); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "rcvMFPRequestSchema"); } }
public class class_name { private void rcvMFPRequestSchema(CommsByteBuffer request, Conversation conversation, int requestNumber, int segmentId, boolean allocatedFromBufferPool, boolean partOfExchange) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "rcvMFPRequestSchema", new Object[] { request, conversation, Integer.valueOf(requestNumber), Boolean.valueOf(allocatedFromBufferPool), Boolean.valueOf(partOfExchange) }); CompHandshake ch = null; ConversationState convState = (ConversationState) conversation.getAttachment(); CommsConnection cc = convState.getCommsConnection(); try { // Get MFP Singleton ch = (CompHandshake) CompHandshakeFactory.getInstance(); // depends on control dependency: [try], data = [none] byte[] mfpRequestData = request.getRemaining(); // Get hold of product version HandshakeProperties handshakeGroup = conversation.getHandshakeProperties(); int productVersion = handshakeGroup.getMajorVersion(); // Give MFP received Schema byte[] mfpReplyData = ch.compRequest(cc, productVersion, segmentId, mfpRequestData); if (mfpReplyData == null) { // Oops something went wrong in MFP if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "MFP returned null"); SIErrorException e = new SIErrorException( nls.getFormattedMessage("MFP_SCHEMA_REQUEST_FAILED_SICO2056", null, null) // D256974 ); FFDCFilter.processException(e, CLASS_NAME + ".rcvMFPRequestSchema", CommsConstants.SERVERTRANSPORTRECEIVELISTENER_MFPREQSCH_01, this); // depends on control dependency: [if], data = [none] StaticCATHelper.sendExceptionToClient(e, null, conversation, requestNumber); // depends on control dependency: [if], data = [none] } else { // Otherwise send the data back for MFP CommsByteBuffer reply = poolManager.allocate(); reply.wrap(mfpReplyData); // depends on control dependency: [if], data = [(mfpReplyData] try { conversation.send(reply, JFapChannelConstants.SEG_REQUEST_SCHEMA_R, requestNumber, JFapChannelConstants.PRIORITY_HIGHEST, true, ThrottlingPolicy.BLOCK_THREAD, null); // depends on control dependency: [try], data = [none] } catch (SIException e) { FFDCFilter.processException(e, CLASS_NAME + ".rcvMFPRequestSchema", CommsConstants.SERVERTRANSPORTRECEIVELISTENER_MFPREQSCH_02, this); SibTr.error(tc, "COMMUNICATION_ERROR_SICO2019", e); } // depends on control dependency: [catch], data = [none] } } catch (Exception e) { FFDCFilter.processException(e, CLASS_NAME + ".rcvMFPRequestSchema", CommsConstants.SERVERTRANSPORTRECEIVELISTENER_MFPREQSCH_03, this); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "MFP unable to create CompHandshake Singleton", e); } // depends on control dependency: [catch], data = [none] request.release(allocatedFromBufferPool); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "rcvMFPRequestSchema"); } }
public class class_name { public void userCompletedAction(String action, HashMap<String, String> metadata) { JSONObject actionCompletedPayload = new JSONObject(); try { JSONArray canonicalIDList = new JSONArray(); canonicalIDList.put(canonicalIdentifier_); actionCompletedPayload.put(canonicalIdentifier_, convertToJson()); if (metadata != null) { for (String key : metadata.keySet()) { actionCompletedPayload.put(key, metadata.get(key)); } } if (Branch.getInstance() != null) { Branch.getInstance().userCompletedAction(action, actionCompletedPayload); } } catch (JSONException ignore) { } } }
public class class_name { public void userCompletedAction(String action, HashMap<String, String> metadata) { JSONObject actionCompletedPayload = new JSONObject(); try { JSONArray canonicalIDList = new JSONArray(); canonicalIDList.put(canonicalIdentifier_); // depends on control dependency: [try], data = [none] actionCompletedPayload.put(canonicalIdentifier_, convertToJson()); // depends on control dependency: [try], data = [none] if (metadata != null) { for (String key : metadata.keySet()) { actionCompletedPayload.put(key, metadata.get(key)); // depends on control dependency: [for], data = [key] } } if (Branch.getInstance() != null) { Branch.getInstance().userCompletedAction(action, actionCompletedPayload); // depends on control dependency: [if], data = [none] } } catch (JSONException ignore) { } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static int[] asIntegerArray(Collection collection) { int[] result = new int[collection.size()]; int i = 0; for (Object c : collection) { result[i++] = asInteger(c); } return result; } }
public class class_name { public static int[] asIntegerArray(Collection collection) { int[] result = new int[collection.size()]; int i = 0; for (Object c : collection) { result[i++] = asInteger(c); // depends on control dependency: [for], data = [c] } return result; } }
public class class_name { public void setPartitions(java.util.Collection<String> partitions) { if (partitions == null) { this.partitions = null; return; } this.partitions = new com.amazonaws.internal.SdkInternalList<String>(partitions); } }
public class class_name { public void setPartitions(java.util.Collection<String> partitions) { if (partitions == null) { this.partitions = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.partitions = new com.amazonaws.internal.SdkInternalList<String>(partitions); } }
public class class_name { public void performLearning(T image) { // use the update track location get_subwindow(image, templateNew); // Kernel Regularized Least-Squares, calculate alphas (in Fourier domain) // k = dense_gauss_kernel(sigma, x); dense_gauss_kernel(sigma, templateNew, templateNew, k); fft.forward(k,kf); // new_alphaf = yf ./ (fft2(k) + lambda); %(Eq. 7) computeAlphas(gaussianWeightDFT, kf, lambda, newAlphaf); // subsequent frames, interpolate model // alphaf = (1 - interp_factor) * alphaf + interp_factor * new_alphaf; int N = alphaf.width*alphaf.height*2; for( int i = 0; i < N; i++ ) { alphaf.data[i] = (1-interp_factor)*alphaf.data[i] + interp_factor*newAlphaf.data[i]; } // Set the previous image to be an interpolated version // z = (1 - interp_factor) * z + interp_factor * new_z; N = templateNew.width* templateNew.height; for( int i = 0; i < N; i++ ) { template.data[i] = (1-interp_factor)* template.data[i] + interp_factor*templateNew.data[i]; } } }
public class class_name { public void performLearning(T image) { // use the update track location get_subwindow(image, templateNew); // Kernel Regularized Least-Squares, calculate alphas (in Fourier domain) // k = dense_gauss_kernel(sigma, x); dense_gauss_kernel(sigma, templateNew, templateNew, k); fft.forward(k,kf); // new_alphaf = yf ./ (fft2(k) + lambda); %(Eq. 7) computeAlphas(gaussianWeightDFT, kf, lambda, newAlphaf); // subsequent frames, interpolate model // alphaf = (1 - interp_factor) * alphaf + interp_factor * new_alphaf; int N = alphaf.width*alphaf.height*2; for( int i = 0; i < N; i++ ) { alphaf.data[i] = (1-interp_factor)*alphaf.data[i] + interp_factor*newAlphaf.data[i]; // depends on control dependency: [for], data = [i] } // Set the previous image to be an interpolated version // z = (1 - interp_factor) * z + interp_factor * new_z; N = templateNew.width* templateNew.height; for( int i = 0; i < N; i++ ) { template.data[i] = (1-interp_factor)* template.data[i] + interp_factor*templateNew.data[i]; // depends on control dependency: [for], data = [i] } } }
public class class_name { public final PersistenceServiceUnit getPersistenceServiceUnit() throws Exception { lock.readLock().lock(); try { if (destroyed) throw new IllegalStateException(); if (persistenceServiceUnit == null) { // Switch to write lock for lazy initialization lock.readLock().unlock(); lock.writeLock().lock(); try { if (destroyed) throw new IllegalStateException(); if (persistenceServiceUnit == null) persistenceServiceUnit = dbStore.createPersistenceServiceUnit(priv.getClassLoader(Task.class), Partition.class.getName(), Property.class.getName(), Task.class.getName()); } finally { // Downgrade to read lock for rest of method lock.readLock().lock(); lock.writeLock().unlock(); } } return persistenceServiceUnit; } finally { lock.readLock().unlock(); } } }
public class class_name { public final PersistenceServiceUnit getPersistenceServiceUnit() throws Exception { lock.readLock().lock(); try { if (destroyed) throw new IllegalStateException(); if (persistenceServiceUnit == null) { // Switch to write lock for lazy initialization lock.readLock().unlock(); // depends on control dependency: [if], data = [none] lock.writeLock().lock(); // depends on control dependency: [if], data = [none] try { if (destroyed) throw new IllegalStateException(); if (persistenceServiceUnit == null) persistenceServiceUnit = dbStore.createPersistenceServiceUnit(priv.getClassLoader(Task.class), Partition.class.getName(), Property.class.getName(), Task.class.getName()); } finally { // Downgrade to read lock for rest of method lock.readLock().lock(); lock.writeLock().unlock(); } } return persistenceServiceUnit; } finally { lock.readLock().unlock(); } } }
public class class_name { protected static String getSingleParam(List<String> list) { if (list != null && list.size() == 1) { return list.get(0); } return null; } }
public class class_name { protected static String getSingleParam(List<String> list) { if (list != null && list.size() == 1) { return list.get(0); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public void closeStream(IConnection conn, Number streamId) { log.info("closeStream stream id: {} connection: {}", streamId, conn.getSessionId()); if (conn instanceof IStreamCapableConnection) { IStreamCapableConnection scConn = (IStreamCapableConnection) conn; IClientStream stream = scConn.getStreamById(streamId); if (stream != null) { if (stream instanceof IClientBroadcastStream) { // this is a broadcasting stream (from Flash Player to Red5) IClientBroadcastStream bs = (IClientBroadcastStream) stream; IBroadcastScope bsScope = getBroadcastScope(conn.getScope(), bs.getPublishedName()); if (bsScope != null && conn instanceof BaseConnection) { ((BaseConnection) conn).unregisterBasicScope(bsScope); } } stream.close(); scConn.deleteStreamById(streamId); // in case of broadcasting stream, status is sent automatically by Red5 if (!(stream instanceof IClientBroadcastStream)) { StreamService.sendNetStreamStatus(conn, StatusCodes.NS_PLAY_STOP, "Stream closed by server", stream.getName(), Status.STATUS, streamId); } } else { log.info("Stream not found - streamId: {} connection: {}", streamId, conn.getSessionId()); } } else { log.warn("Connection is not instance of IStreamCapableConnection: {}", conn); } } }
public class class_name { public void closeStream(IConnection conn, Number streamId) { log.info("closeStream stream id: {} connection: {}", streamId, conn.getSessionId()); if (conn instanceof IStreamCapableConnection) { IStreamCapableConnection scConn = (IStreamCapableConnection) conn; IClientStream stream = scConn.getStreamById(streamId); if (stream != null) { if (stream instanceof IClientBroadcastStream) { // this is a broadcasting stream (from Flash Player to Red5) IClientBroadcastStream bs = (IClientBroadcastStream) stream; IBroadcastScope bsScope = getBroadcastScope(conn.getScope(), bs.getPublishedName()); if (bsScope != null && conn instanceof BaseConnection) { ((BaseConnection) conn).unregisterBasicScope(bsScope); // depends on control dependency: [if], data = [(bsScope] } } stream.close(); // depends on control dependency: [if], data = [none] scConn.deleteStreamById(streamId); // depends on control dependency: [if], data = [(stream] // in case of broadcasting stream, status is sent automatically by Red5 if (!(stream instanceof IClientBroadcastStream)) { StreamService.sendNetStreamStatus(conn, StatusCodes.NS_PLAY_STOP, "Stream closed by server", stream.getName(), Status.STATUS, streamId); // depends on control dependency: [if], data = [none] } } else { log.info("Stream not found - streamId: {} connection: {}", streamId, conn.getSessionId()); // depends on control dependency: [if], data = [none] } } else { log.warn("Connection is not instance of IStreamCapableConnection: {}", conn); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void processHttpResponseMessage(HttpMessage message) { // Get the session tokens for this site HttpSessionTokensSet siteTokensSet = extension.getHttpSessionTokensSet(getSite()); // No tokens for this site, so no processing if (siteTokensSet == null) { log.debug("No session tokens for: " + this.getSite()); return; } // Create an auxiliary map of token values and insert keys for every token Map<String, Cookie> tokenValues = new HashMap<>(); // Get new values that were set for tokens (e.g. using SET-COOKIE headers), if any List<HttpCookie> cookiesToSet = message.getResponseHeader().getHttpCookies(message.getRequestHeader().getHostName()); for (HttpCookie cookie : cookiesToSet) { String lcCookieName = cookie.getName(); if (siteTokensSet.isSessionToken(lcCookieName)) { try { // Use 0 if max-age less than -1, Cookie class does not accept negative (expired) max-age (-1 has special // meaning). long maxAge = cookie.getMaxAge() < -1 ? 0 : cookie.getMaxAge(); Cookie ck = new Cookie(cookie.getDomain(),lcCookieName,cookie.getValue(),cookie.getPath(),(int) maxAge,cookie.getSecure()); tokenValues.put(lcCookieName, ck); } catch (IllegalArgumentException e) { log.warn("Failed to create cookie [" + cookie + "] for site [" + getSite() + "]: " + e.getMessage()); } } } // Get the cookies present in the request List<HttpCookie> requestCookies = message.getRequestHeader().getHttpCookies(); // XXX When an empty HttpSession is set in the message and the response // contains session cookies, the empty HttpSession is reused which // causes the number of messages matched to be incorrect. // Get the session, based on the request header HttpSession session = message.getHttpSession(); if (session == null || !session.isValid()) { session = getMatchingHttpSession(requestCookies, siteTokensSet); if (log.isDebugEnabled()) { log.debug("Matching session for response message (from site " + getSite() + "): " + session); } } else { if (log.isDebugEnabled()) { log.debug("Matching cached session for response message (from site " + getSite() + "): " + session); } } boolean newSession = false; // If the session didn't exist, create it now if (session == null) { session = new HttpSession(generateUniqueSessionName(), extension.getHttpSessionTokensSet(getSite())); this.addHttpSession(session); // Add all the existing tokens from the request, if they don't replace one in the // response for (HttpCookie cookie : requestCookies) { String cookieName = cookie.getName(); if (siteTokensSet.isSessionToken(cookieName)) { if (!tokenValues.containsKey(cookieName)) { // We must ensure that a cookie as always a valid domain and path in order to be able to reuse it. // HttpClient will discard invalid cookies String domain = cookie.getDomain(); if (domain == null) { domain = message.getRequestHeader().getHostName(); } String path = cookie.getPath(); if (path == null) { path = "/"; // Default path } Cookie ck = new Cookie(domain, cookieName, cookie.getValue(), path, (int) cookie.getMaxAge(), cookie.getSecure()); tokenValues.put(cookieName,ck); } } } newSession = true; } // Update the session if (!tokenValues.isEmpty()) { for (Entry<String, Cookie> tv : tokenValues.entrySet()) { session.setTokenValue(tv.getKey(), tv.getValue()); } } if (newSession && log.isDebugEnabled()) { log.debug("Created a new session as no match was found: " + session); } // Update the count of messages matched session.setMessagesMatched(session.getMessagesMatched() + 1); this.model.fireHttpSessionUpdated(session); // Store the session in the HttpMessage for caching purpose message.setHttpSession(session); } }
public class class_name { public void processHttpResponseMessage(HttpMessage message) { // Get the session tokens for this site HttpSessionTokensSet siteTokensSet = extension.getHttpSessionTokensSet(getSite()); // No tokens for this site, so no processing if (siteTokensSet == null) { log.debug("No session tokens for: " + this.getSite()); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } // Create an auxiliary map of token values and insert keys for every token Map<String, Cookie> tokenValues = new HashMap<>(); // Get new values that were set for tokens (e.g. using SET-COOKIE headers), if any List<HttpCookie> cookiesToSet = message.getResponseHeader().getHttpCookies(message.getRequestHeader().getHostName()); for (HttpCookie cookie : cookiesToSet) { String lcCookieName = cookie.getName(); if (siteTokensSet.isSessionToken(lcCookieName)) { try { // Use 0 if max-age less than -1, Cookie class does not accept negative (expired) max-age (-1 has special // meaning). long maxAge = cookie.getMaxAge() < -1 ? 0 : cookie.getMaxAge(); Cookie ck = new Cookie(cookie.getDomain(),lcCookieName,cookie.getValue(),cookie.getPath(),(int) maxAge,cookie.getSecure()); tokenValues.put(lcCookieName, ck); // depends on control dependency: [try], data = [none] } catch (IllegalArgumentException e) { log.warn("Failed to create cookie [" + cookie + "] for site [" + getSite() + "]: " + e.getMessage()); } // depends on control dependency: [catch], data = [none] } } // Get the cookies present in the request List<HttpCookie> requestCookies = message.getRequestHeader().getHttpCookies(); // XXX When an empty HttpSession is set in the message and the response // contains session cookies, the empty HttpSession is reused which // causes the number of messages matched to be incorrect. // Get the session, based on the request header HttpSession session = message.getHttpSession(); if (session == null || !session.isValid()) { session = getMatchingHttpSession(requestCookies, siteTokensSet); // depends on control dependency: [if], data = [none] if (log.isDebugEnabled()) { log.debug("Matching session for response message (from site " + getSite() + "): " + session); // depends on control dependency: [if], data = [none] } } else { if (log.isDebugEnabled()) { log.debug("Matching cached session for response message (from site " + getSite() + "): " + session); // depends on control dependency: [if], data = [none] } } boolean newSession = false; // If the session didn't exist, create it now if (session == null) { session = new HttpSession(generateUniqueSessionName(), extension.getHttpSessionTokensSet(getSite())); // depends on control dependency: [if], data = [none] this.addHttpSession(session); // depends on control dependency: [if], data = [(session] // Add all the existing tokens from the request, if they don't replace one in the // response for (HttpCookie cookie : requestCookies) { String cookieName = cookie.getName(); if (siteTokensSet.isSessionToken(cookieName)) { if (!tokenValues.containsKey(cookieName)) { // We must ensure that a cookie as always a valid domain and path in order to be able to reuse it. // HttpClient will discard invalid cookies String domain = cookie.getDomain(); if (domain == null) { domain = message.getRequestHeader().getHostName(); // depends on control dependency: [if], data = [none] } String path = cookie.getPath(); if (path == null) { path = "/"; // Default path // depends on control dependency: [if], data = [none] } Cookie ck = new Cookie(domain, cookieName, cookie.getValue(), path, (int) cookie.getMaxAge(), cookie.getSecure()); tokenValues.put(cookieName,ck); // depends on control dependency: [if], data = [none] } } } newSession = true; // depends on control dependency: [if], data = [none] } // Update the session if (!tokenValues.isEmpty()) { for (Entry<String, Cookie> tv : tokenValues.entrySet()) { session.setTokenValue(tv.getKey(), tv.getValue()); // depends on control dependency: [for], data = [tv] } } if (newSession && log.isDebugEnabled()) { log.debug("Created a new session as no match was found: " + session); // depends on control dependency: [if], data = [none] } // Update the count of messages matched session.setMessagesMatched(session.getMessagesMatched() + 1); this.model.fireHttpSessionUpdated(session); // Store the session in the HttpMessage for caching purpose message.setHttpSession(session); } }
public class class_name { protected synchronized void installJAASConfigurationFromJAASConfigFile() { JAASLoginConfig jaasLoginConfig = jaasLoginConfigRef.getService(); if (jaasLoginConfig != null) { jaasConfigurationEntriesFromJaasConfig = jaasLoginConfig.getEntries(); if (jaasConfigurationEntriesFromJaasConfig != null) { if (jaasSecurityConfiguration == null) { jaasSecurityConfiguration = new JAASSecurityConfiguration(); Configuration.setConfiguration(jaasSecurityConfiguration); } jaasSecurityConfiguration.setAppConfigurationEntries(jaasConfigurationEntriesFromJaasConfig); } } } }
public class class_name { protected synchronized void installJAASConfigurationFromJAASConfigFile() { JAASLoginConfig jaasLoginConfig = jaasLoginConfigRef.getService(); if (jaasLoginConfig != null) { jaasConfigurationEntriesFromJaasConfig = jaasLoginConfig.getEntries(); // depends on control dependency: [if], data = [none] if (jaasConfigurationEntriesFromJaasConfig != null) { if (jaasSecurityConfiguration == null) { jaasSecurityConfiguration = new JAASSecurityConfiguration(); // depends on control dependency: [if], data = [none] Configuration.setConfiguration(jaasSecurityConfiguration); // depends on control dependency: [if], data = [(jaasSecurityConfiguration] } jaasSecurityConfiguration.setAppConfigurationEntries(jaasConfigurationEntriesFromJaasConfig); // depends on control dependency: [if], data = [(jaasConfigurationEntriesFromJaasConfig] } } } }
public class class_name { public boolean areAllPermissionsGranted(@NonNull Activity activity, @NonNull String[] permissions) { for (String p : permissions) { if (!isPermissionGranted(activity, p)) { return false; } } return true; } }
public class class_name { public boolean areAllPermissionsGranted(@NonNull Activity activity, @NonNull String[] permissions) { for (String p : permissions) { if (!isPermissionGranted(activity, p)) { return false; // depends on control dependency: [if], data = [none] } } return true; } }
public class class_name { public boolean isEquivalent(CodecIdentifier other) { if (this.codecName.equals(other.getCodecName())) { return true; } if (this.codecAliases != null && this.codecAliases.contains(other.getCodecName())) { return true; } if (other.getCodecAliases() != null && other.getCodecAliases().contains(this.codecName)) { return true; } return false; } }
public class class_name { public boolean isEquivalent(CodecIdentifier other) { if (this.codecName.equals(other.getCodecName())) { return true; // depends on control dependency: [if], data = [none] } if (this.codecAliases != null && this.codecAliases.contains(other.getCodecName())) { return true; // depends on control dependency: [if], data = [none] } if (other.getCodecAliases() != null && other.getCodecAliases().contains(this.codecName)) { return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { public void addClassLoader(final ClassLoader classLoader) { if (this.addedClassLoaders == null) { this.addedClassLoaders = new ArrayList<>(); } if (classLoader != null) { this.addedClassLoaders.add(classLoader); } } }
public class class_name { public void addClassLoader(final ClassLoader classLoader) { if (this.addedClassLoaders == null) { this.addedClassLoaders = new ArrayList<>(); // depends on control dependency: [if], data = [none] } if (classLoader != null) { this.addedClassLoaders.add(classLoader); // depends on control dependency: [if], data = [(classLoader] } } }
public class class_name { public static <ENTITIFROM, ENTITYTO> DaoPageResult<ENTITYTO> getResult(DaoPageResult<ENTITIFROM> daoPageFrom, DataTransfer<ENTITIFROM, ENTITYTO> dataTransfer) { List<ENTITYTO> entitytos = new ArrayList<ENTITYTO>(); // // 转换 // for (ENTITIFROM entitifrom : daoPageFrom.getResult()) { ENTITYTO entityto = dataTransfer.transfer(entitifrom); entitytos.add(entityto); } // // result // DaoPageResult<ENTITYTO> daoPageResult = new DaoPageResult<ENTITYTO>(); daoPageResult.setResult(entitytos); daoPageResult.setTotalCount(daoPageFrom.getTotalCount()); return daoPageResult; } }
public class class_name { public static <ENTITIFROM, ENTITYTO> DaoPageResult<ENTITYTO> getResult(DaoPageResult<ENTITIFROM> daoPageFrom, DataTransfer<ENTITIFROM, ENTITYTO> dataTransfer) { List<ENTITYTO> entitytos = new ArrayList<ENTITYTO>(); // // 转换 // for (ENTITIFROM entitifrom : daoPageFrom.getResult()) { ENTITYTO entityto = dataTransfer.transfer(entitifrom); entitytos.add(entityto); // depends on control dependency: [for], data = [none] } // // result // DaoPageResult<ENTITYTO> daoPageResult = new DaoPageResult<ENTITYTO>(); daoPageResult.setResult(entitytos); daoPageResult.setTotalCount(daoPageFrom.getTotalCount()); return daoPageResult; } }
public class class_name { @Bean(ERRBUF_BEAN_NAME) public StringBuilder errbuf() { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Create error buffer with size: {}.", PCAP_ERRBUF_SIZE); } return new StringBuilder(PCAP_ERRBUF_SIZE); } }
public class class_name { @Bean(ERRBUF_BEAN_NAME) public StringBuilder errbuf() { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Create error buffer with size: {}.", PCAP_ERRBUF_SIZE); // depends on control dependency: [if], data = [none] } return new StringBuilder(PCAP_ERRBUF_SIZE); } }
public class class_name { public void addPropertyChangeListener(PropertyChangeListener listener) { if ( propertyChangeSupport == null ) { propertyChangeSupport = new PropertyChangeSupport(this); } propertyChangeSupport.addPropertyChangeListener(listener); } }
public class class_name { public void addPropertyChangeListener(PropertyChangeListener listener) { if ( propertyChangeSupport == null ) { propertyChangeSupport = new PropertyChangeSupport(this); // depends on control dependency: [if], data = [none] } propertyChangeSupport.addPropertyChangeListener(listener); } }
public class class_name { public static int determineSampleSize( final RotationOptions rotationOptions, @Nullable final ResizeOptions resizeOptions, final EncodedImage encodedImage, final int maxBitmapSize) { if (!EncodedImage.isMetaDataAvailable(encodedImage)) { return DEFAULT_SAMPLE_SIZE; } float ratio = determineDownsampleRatio(rotationOptions, resizeOptions, encodedImage); int sampleSize; if (encodedImage.getImageFormat() == DefaultImageFormats.JPEG) { sampleSize = ratioToSampleSizeJPEG(ratio); } else { sampleSize = ratioToSampleSize(ratio); } // Check the case when the dimension of the downsampled image is still larger than the max // possible dimension for an image. int maxDimension = Math.max(encodedImage.getHeight(), encodedImage.getWidth()); final float computedMaxBitmapSize = resizeOptions != null ? resizeOptions.maxBitmapSize : maxBitmapSize; while (maxDimension / sampleSize > computedMaxBitmapSize) { if (encodedImage.getImageFormat() == DefaultImageFormats.JPEG) { sampleSize *= 2; } else { sampleSize++; } } return sampleSize; } }
public class class_name { public static int determineSampleSize( final RotationOptions rotationOptions, @Nullable final ResizeOptions resizeOptions, final EncodedImage encodedImage, final int maxBitmapSize) { if (!EncodedImage.isMetaDataAvailable(encodedImage)) { return DEFAULT_SAMPLE_SIZE; // depends on control dependency: [if], data = [none] } float ratio = determineDownsampleRatio(rotationOptions, resizeOptions, encodedImage); int sampleSize; if (encodedImage.getImageFormat() == DefaultImageFormats.JPEG) { sampleSize = ratioToSampleSizeJPEG(ratio); // depends on control dependency: [if], data = [none] } else { sampleSize = ratioToSampleSize(ratio); // depends on control dependency: [if], data = [none] } // Check the case when the dimension of the downsampled image is still larger than the max // possible dimension for an image. int maxDimension = Math.max(encodedImage.getHeight(), encodedImage.getWidth()); final float computedMaxBitmapSize = resizeOptions != null ? resizeOptions.maxBitmapSize : maxBitmapSize; while (maxDimension / sampleSize > computedMaxBitmapSize) { if (encodedImage.getImageFormat() == DefaultImageFormats.JPEG) { sampleSize *= 2; // depends on control dependency: [if], data = [none] } else { sampleSize++; // depends on control dependency: [if], data = [none] } } return sampleSize; } }
public class class_name { public EClass getIfcVolumetricFlowRateMeasure() { if (ifcVolumetricFlowRateMeasureEClass == null) { ifcVolumetricFlowRateMeasureEClass = (EClass) EPackage.Registry.INSTANCE .getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(760); } return ifcVolumetricFlowRateMeasureEClass; } }
public class class_name { public EClass getIfcVolumetricFlowRateMeasure() { if (ifcVolumetricFlowRateMeasureEClass == null) { ifcVolumetricFlowRateMeasureEClass = (EClass) EPackage.Registry.INSTANCE .getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(760); // depends on control dependency: [if], data = [none] } return ifcVolumetricFlowRateMeasureEClass; } }
public class class_name { private void outputSingleCJK(int index){ if(CharacterUtil.CHAR_CHINESE == this.charTypes[index]){ Lexeme singleCharLexeme = new Lexeme(this.buffOffset , index , 1 , Lexeme.TYPE_CNCHAR); this.results.add(singleCharLexeme); }else if(CharacterUtil.CHAR_OTHER_CJK == this.charTypes[index]){ Lexeme singleCharLexeme = new Lexeme(this.buffOffset , index , 1 , Lexeme.TYPE_OTHER_CJK); this.results.add(singleCharLexeme); } } }
public class class_name { private void outputSingleCJK(int index){ if(CharacterUtil.CHAR_CHINESE == this.charTypes[index]){ Lexeme singleCharLexeme = new Lexeme(this.buffOffset , index , 1 , Lexeme.TYPE_CNCHAR); this.results.add(singleCharLexeme); // depends on control dependency: [if], data = [none] }else if(CharacterUtil.CHAR_OTHER_CJK == this.charTypes[index]){ Lexeme singleCharLexeme = new Lexeme(this.buffOffset , index , 1 , Lexeme.TYPE_OTHER_CJK); this.results.add(singleCharLexeme); // depends on control dependency: [if], data = [none] } } }
public class class_name { public int checkContactSecurity(String strContactType, String strContactID) { int iErrorCode = DBConstants.NORMAL_RETURN; if (Utility.isNumeric(strContactType)) { ContactTypeModel recContactType = (ContactTypeModel)Record.makeRecordFromClassName(ContactTypeModel.THICK_CLASS, this); strContactType = recContactType.getContactTypeFromID(strContactType); recContactType.free(); } String strUserContactType = this.getProperty(TrxMessageHeader.CONTACT_TYPE); String strUserContactID = this.getProperty(TrxMessageHeader.CONTACT_ID); if ((strUserContactType == null) || (strUserContactType.length() == 0) || (strUserContactType.equalsIgnoreCase(strContactType))) iErrorCode = DBConstants.NORMAL_RETURN; // No contact or different contact, okay else if ((strUserContactID != null) && (strUserContactID.equalsIgnoreCase(strContactID))) iErrorCode = DBConstants.NORMAL_RETURN; // Matching contact, okay else iErrorCode = DBConstants.ACCESS_DENIED; // Non-matching contact, NO return iErrorCode; } }
public class class_name { public int checkContactSecurity(String strContactType, String strContactID) { int iErrorCode = DBConstants.NORMAL_RETURN; if (Utility.isNumeric(strContactType)) { ContactTypeModel recContactType = (ContactTypeModel)Record.makeRecordFromClassName(ContactTypeModel.THICK_CLASS, this); strContactType = recContactType.getContactTypeFromID(strContactType); // depends on control dependency: [if], data = [none] recContactType.free(); // depends on control dependency: [if], data = [none] } String strUserContactType = this.getProperty(TrxMessageHeader.CONTACT_TYPE); String strUserContactID = this.getProperty(TrxMessageHeader.CONTACT_ID); if ((strUserContactType == null) || (strUserContactType.length() == 0) || (strUserContactType.equalsIgnoreCase(strContactType))) iErrorCode = DBConstants.NORMAL_RETURN; // No contact or different contact, okay else if ((strUserContactID != null) && (strUserContactID.equalsIgnoreCase(strContactID))) iErrorCode = DBConstants.NORMAL_RETURN; // Matching contact, okay else iErrorCode = DBConstants.ACCESS_DENIED; // Non-matching contact, NO return iErrorCode; } }
public class class_name { @Override public List<QueueInfo> getQueueInfos() { final List<String> queueNames = getQueueNames(); return PoolUtils.doWorkInPoolNicely(this.jedisPool, new PoolWork<Jedis, List<QueueInfo>>() { /** * {@inheritDoc} */ @Override public List<QueueInfo> doWork(final Jedis jedis) throws Exception { final List<QueueInfo> queueInfos = new ArrayList<QueueInfo>(queueNames.size()); for (final String queueName : queueNames) { final QueueInfo queueInfo = new QueueInfo(); queueInfo.setName(queueName); queueInfo.setSize(size(jedis, queueName)); queueInfo.setDelayed(delayed(jedis, queueName)); if (queueInfo.isDelayed()) { queueInfo.setPending(pending(jedis, queueName)); } queueInfos.add(queueInfo); } Collections.sort(queueInfos); return queueInfos; } }); } }
public class class_name { @Override public List<QueueInfo> getQueueInfos() { final List<String> queueNames = getQueueNames(); return PoolUtils.doWorkInPoolNicely(this.jedisPool, new PoolWork<Jedis, List<QueueInfo>>() { /** * {@inheritDoc} */ @Override public List<QueueInfo> doWork(final Jedis jedis) throws Exception { final List<QueueInfo> queueInfos = new ArrayList<QueueInfo>(queueNames.size()); for (final String queueName : queueNames) { final QueueInfo queueInfo = new QueueInfo(); queueInfo.setName(queueName); queueInfo.setSize(size(jedis, queueName)); queueInfo.setDelayed(delayed(jedis, queueName)); if (queueInfo.isDelayed()) { queueInfo.setPending(pending(jedis, queueName)); // depends on control dependency: [if], data = [none] } queueInfos.add(queueInfo); } Collections.sort(queueInfos); return queueInfos; } }); } }
public class class_name { View getTargetView() { View view = screenshotTarget; if (!screenshotChildrenOnly) { while (view.getRootView() != view) { view = view.getRootView(); } } return view; } }
public class class_name { View getTargetView() { View view = screenshotTarget; if (!screenshotChildrenOnly) { while (view.getRootView() != view) { view = view.getRootView(); // depends on control dependency: [while], data = [none] } } return view; } }
public class class_name { public void configure(Properties props) { this.refreshCount.set(0); this.overrideProps.clear(); this.originalAsyncAppenderNameMap.clear(); // First try to load the log4j configuration file from the classpath String log4jConfigurationFile = System.getProperty(PROP_LOG4J_CONFIGURATION); NFHierarchy nfHierarchy = null; // Make log4j use blitz4j implementations if ((!NFHierarchy.class.equals(LogManager.getLoggerRepository().getClass()))) { nfHierarchy = new NFHierarchy(new NFRootLogger(org.apache.log4j.Level.INFO)); org.apache.log4j.LogManager.setRepositorySelector(new NFRepositorySelector(nfHierarchy), guard); } String log4jLoggerFactory = System.getProperty(PROP_LOG4J_LOGGER_FACTORY); if (log4jLoggerFactory != null) { this.initialProps.setProperty(PROP_LOG4J_LOGGER_FACTORY, log4jLoggerFactory); if (nfHierarchy != null) { try { LoggerFactory loggerFactory = (LoggerFactory) Class.forName(log4jLoggerFactory).newInstance(); nfHierarchy.setLoggerFactory(loggerFactory); } catch (Exception e) { System.err.println("Cannot set the logger factory. Hence reverting to default."); e.printStackTrace(); } } } else { this.initialProps.setProperty(PROP_LOG4J_LOGGER_FACTORY, BLITZ_LOGGER_FACTORY); } if (log4jConfigurationFile != null) { loadLog4jConfigurationFile(log4jConfigurationFile); // First configure without async so that we can capture the output // of dependent libraries clearAsyncAppenderList(); PropertyConfigurator.configure(this.initialProps); } this.blitz4jConfig = new DefaultBlitz4jConfig(props); if ((log4jConfigurationFile == null) && (blitz4jConfig.shouldLoadLog4jPropertiesFromClassPath())) { try { URL url = Loader.getResource(LOG4J_PROPERTIES); if (url != null) { try (InputStream in = url.openStream()) { this.initialProps.load(in); } } } catch (Exception t) { System.err.println("Error loading properties from " + LOG4J_PROPERTIES); } } Enumeration enumeration = props.propertyNames(); while (enumeration.hasMoreElements()) { String key = (String) enumeration.nextElement(); String propertyValue = props.getProperty(key); this.initialProps.setProperty(key, propertyValue); } this.blitz4jConfig = new DefaultBlitz4jConfig(this.initialProps); String[] asyncAppenderArray = blitz4jConfig.getAsyncAppenders(); if (asyncAppenderArray == null) { return; } for (int i = 0; i < asyncAppenderArray.length; i++) { String oneAppenderName = asyncAppenderArray[i]; if ((i == 0) || (oneAppenderName == null)) { continue; } oneAppenderName = oneAppenderName.trim(); String oneAsyncAppenderName = oneAppenderName + ASYNC_APPENDERNAME_SUFFIX; originalAsyncAppenderNameMap.put(oneAppenderName, oneAsyncAppenderName); } try { convertConfiguredAppendersToAsync(this.initialProps); } catch (Exception e) { throw new RuntimeException("Could not configure async appenders ", e); } // Yes second time init required as properties would have been during async appender conversion this.blitz4jConfig = new DefaultBlitz4jConfig(this.initialProps); clearAsyncAppenderList(); PropertyConfigurator.configure(this.initialProps); closeNonexistingAsyncAppenders(); this.logger = org.slf4j.LoggerFactory.getLogger(LoggingConfiguration.class); ConfigurationManager.getConfigInstance().addConfigurationListener( new ExpandedConfigurationListenerAdapter(this)); } }
public class class_name { public void configure(Properties props) { this.refreshCount.set(0); this.overrideProps.clear(); this.originalAsyncAppenderNameMap.clear(); // First try to load the log4j configuration file from the classpath String log4jConfigurationFile = System.getProperty(PROP_LOG4J_CONFIGURATION); NFHierarchy nfHierarchy = null; // Make log4j use blitz4j implementations if ((!NFHierarchy.class.equals(LogManager.getLoggerRepository().getClass()))) { nfHierarchy = new NFHierarchy(new NFRootLogger(org.apache.log4j.Level.INFO)); // depends on control dependency: [if], data = [none] org.apache.log4j.LogManager.setRepositorySelector(new NFRepositorySelector(nfHierarchy), guard); // depends on control dependency: [if], data = [none] } String log4jLoggerFactory = System.getProperty(PROP_LOG4J_LOGGER_FACTORY); if (log4jLoggerFactory != null) { this.initialProps.setProperty(PROP_LOG4J_LOGGER_FACTORY, log4jLoggerFactory); // depends on control dependency: [if], data = [none] if (nfHierarchy != null) { try { LoggerFactory loggerFactory = (LoggerFactory) Class.forName(log4jLoggerFactory).newInstance(); nfHierarchy.setLoggerFactory(loggerFactory); // depends on control dependency: [try], data = [none] } catch (Exception e) { System.err.println("Cannot set the logger factory. Hence reverting to default."); e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } } else { this.initialProps.setProperty(PROP_LOG4J_LOGGER_FACTORY, BLITZ_LOGGER_FACTORY); // depends on control dependency: [if], data = [none] } if (log4jConfigurationFile != null) { loadLog4jConfigurationFile(log4jConfigurationFile); // depends on control dependency: [if], data = [(log4jConfigurationFile] // First configure without async so that we can capture the output // of dependent libraries clearAsyncAppenderList(); // depends on control dependency: [if], data = [none] PropertyConfigurator.configure(this.initialProps); // depends on control dependency: [if], data = [none] } this.blitz4jConfig = new DefaultBlitz4jConfig(props); if ((log4jConfigurationFile == null) && (blitz4jConfig.shouldLoadLog4jPropertiesFromClassPath())) { try { URL url = Loader.getResource(LOG4J_PROPERTIES); if (url != null) { try (InputStream in = url.openStream()) { this.initialProps.load(in); } } } catch (Exception t) { System.err.println("Error loading properties from " + LOG4J_PROPERTIES); } // depends on control dependency: [catch], data = [none] } Enumeration enumeration = props.propertyNames(); while (enumeration.hasMoreElements()) { String key = (String) enumeration.nextElement(); String propertyValue = props.getProperty(key); this.initialProps.setProperty(key, propertyValue); // depends on control dependency: [while], data = [none] } this.blitz4jConfig = new DefaultBlitz4jConfig(this.initialProps); String[] asyncAppenderArray = blitz4jConfig.getAsyncAppenders(); if (asyncAppenderArray == null) { return; // depends on control dependency: [if], data = [none] } for (int i = 0; i < asyncAppenderArray.length; i++) { String oneAppenderName = asyncAppenderArray[i]; if ((i == 0) || (oneAppenderName == null)) { continue; } oneAppenderName = oneAppenderName.trim(); // depends on control dependency: [for], data = [none] String oneAsyncAppenderName = oneAppenderName + ASYNC_APPENDERNAME_SUFFIX; originalAsyncAppenderNameMap.put(oneAppenderName, oneAsyncAppenderName); // depends on control dependency: [for], data = [none] } try { convertConfiguredAppendersToAsync(this.initialProps); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new RuntimeException("Could not configure async appenders ", e); } // depends on control dependency: [catch], data = [none] // Yes second time init required as properties would have been during async appender conversion this.blitz4jConfig = new DefaultBlitz4jConfig(this.initialProps); clearAsyncAppenderList(); PropertyConfigurator.configure(this.initialProps); closeNonexistingAsyncAppenders(); this.logger = org.slf4j.LoggerFactory.getLogger(LoggingConfiguration.class); ConfigurationManager.getConfigInstance().addConfigurationListener( new ExpandedConfigurationListenerAdapter(this)); } }
public class class_name { @Override public PollResult poll(T target) { int index = buffer.position(); byte status = readStatus(); if (status == STATUS_EMPTY) { buffer.position(index); return PollResult.NO_NEW_MESSAGES; } if (status == STATUS_END_OF_STREAM) { return PollResult.END_OF_STREAM; } memoryBarrier.loadLoad(); if (index == 0) { // For the header, the first byte works both as the status (when zero), // and part of the magic bytes (when non-zero), so we must not consume the byte before readHeader(). buffer.position(index); readHeader(); } else { assert status == STATUS_EXISTS : "unexpected status: " + status; messageEncoding.decode(target); } return PollResult.HAD_SOME_MESSAGES; } }
public class class_name { @Override public PollResult poll(T target) { int index = buffer.position(); byte status = readStatus(); if (status == STATUS_EMPTY) { buffer.position(index); // depends on control dependency: [if], data = [none] return PollResult.NO_NEW_MESSAGES; // depends on control dependency: [if], data = [none] } if (status == STATUS_END_OF_STREAM) { return PollResult.END_OF_STREAM; // depends on control dependency: [if], data = [none] } memoryBarrier.loadLoad(); if (index == 0) { // For the header, the first byte works both as the status (when zero), // and part of the magic bytes (when non-zero), so we must not consume the byte before readHeader(). buffer.position(index); // depends on control dependency: [if], data = [(index] readHeader(); // depends on control dependency: [if], data = [none] } else { assert status == STATUS_EXISTS : "unexpected status: " + status; messageEncoding.decode(target); // depends on control dependency: [if], data = [none] } return PollResult.HAD_SOME_MESSAGES; } }
public class class_name { public static BinaryExpression newInitializationExpression(String variable, ClassNode type, Expression rhs) { VariableExpression lhs = new VariableExpression(variable); if (type != null) { lhs.setType(type); } Token operator = Token.newPlaceholder(Types.ASSIGN); return new BinaryExpression(lhs, operator, rhs); } }
public class class_name { public static BinaryExpression newInitializationExpression(String variable, ClassNode type, Expression rhs) { VariableExpression lhs = new VariableExpression(variable); if (type != null) { lhs.setType(type); // depends on control dependency: [if], data = [(type] } Token operator = Token.newPlaceholder(Types.ASSIGN); return new BinaryExpression(lhs, operator, rhs); } }
public class class_name { public List<Interceptors<Beans<T>>> getAllInterceptors() { List<Interceptors<Beans<T>>> list = new ArrayList<Interceptors<Beans<T>>>(); List<Node> nodeList = childNode.get("interceptors"); for(Node node: nodeList) { Interceptors<Beans<T>> type = new InterceptorsImpl<Beans<T>>(this, "interceptors", childNode, node); list.add(type); } return list; } }
public class class_name { public List<Interceptors<Beans<T>>> getAllInterceptors() { List<Interceptors<Beans<T>>> list = new ArrayList<Interceptors<Beans<T>>>(); List<Node> nodeList = childNode.get("interceptors"); for(Node node: nodeList) { Interceptors<Beans<T>> type = new InterceptorsImpl<Beans<T>>(this, "interceptors", childNode, node); list.add(type); // depends on control dependency: [for], data = [none] } return list; } }
public class class_name { public static void sortFile(File sortDir, File inputFile, File outputFile, Comparator<String> comparator, boolean skipHeader, long maxBytes, int mergeFactor) { // validation if(comparator == null) { comparator = Lexical.ascending(); } // steps List<File> splitFiles = split(sortDir, inputFile, maxBytes, skipHeader); List<File> sortedFiles = sort(sortDir, splitFiles, comparator); merge(sortDir, sortedFiles, outputFile, comparator, mergeFactor); } }
public class class_name { public static void sortFile(File sortDir, File inputFile, File outputFile, Comparator<String> comparator, boolean skipHeader, long maxBytes, int mergeFactor) { // validation if(comparator == null) { comparator = Lexical.ascending(); // depends on control dependency: [if], data = [none] } // steps List<File> splitFiles = split(sortDir, inputFile, maxBytes, skipHeader); List<File> sortedFiles = sort(sortDir, splitFiles, comparator); merge(sortDir, sortedFiles, outputFile, comparator, mergeFactor); } }
public class class_name { public static void sort(double[] x, int start, int end, Collection<List<?>> paired) { int a = start; int n = end-start; if (n < 7)/* Insertion sort on smallest arrays */ { for (int i = a; i < end; i++) for (int j = i; j > a && x[j - 1] > x[j]; j--) swap(x, j, j - 1, paired); return; } int pm = a + (n/2); /* Small arrays, middle element */ if (n > 7) { int pl = a; int pn = a + n - 1; if (n > 40) /* Big arrays, pseudomedian of 9 */ { int s = n / 8; pl = med3(x, pl, pl + s, pl + 2 * s); pm = med3(x, pm - s, pm, pm + s); pn = med3(x, pn - 2 * s, pn - s, pn); } pm = med3(x, pl, pm, pn); /* Mid-size, med of 3 */ } double pivotValue = x[pm]; int pa = a, pb = pa, pc = end - 1, pd = pc; while (true) { while (pb <= pc && x[pb] <= pivotValue) { if (x[pb] == pivotValue) swap(x, pa++, pb, paired); pb++; } while (pc >= pb && x[pc] >= pivotValue) { if (x[pc] == pivotValue) swap(x, pc, pd--, paired); pc--; } if (pb > pc) break; swap(x, pb++, pc--, paired); } int s; int pn = end; s = Math.min(pa - a, pb - pa); vecswap(x, a, pb - s, s, paired); s = Math.min(pd - pc, pn - pd - 1); vecswap(x, pb, pn - s, s, paired); //recurse if ((s = pb - pa) > 1) sort(x, a, a+s, paired); if ((s = pd - pc) > 1) sort(x, pn - s, pn, paired); } }
public class class_name { public static void sort(double[] x, int start, int end, Collection<List<?>> paired) { int a = start; int n = end-start; if (n < 7)/* Insertion sort on smallest arrays */ { for (int i = a; i < end; i++) for (int j = i; j > a && x[j - 1] > x[j]; j--) swap(x, j, j - 1, paired); return; } int pm = a + (n/2); /* Small arrays, middle element */ if (n > 7) { int pl = a; int pn = a + n - 1; if (n > 40) /* Big arrays, pseudomedian of 9 */ { int s = n / 8; pl = med3(x, pl, pl + s, pl + 2 * s); // depends on control dependency: [if], data = [none] pm = med3(x, pm - s, pm, pm + s); // depends on control dependency: [if], data = [none] pn = med3(x, pn - 2 * s, pn - s, pn); // depends on control dependency: [if], data = [none] } pm = med3(x, pl, pm, pn); /* Mid-size, med of 3 */ } double pivotValue = x[pm]; int pa = a, pb = pa, pc = end - 1, pd = pc; while (true) { while (pb <= pc && x[pb] <= pivotValue) { if (x[pb] == pivotValue) swap(x, pa++, pb, paired); pb++; // depends on control dependency: [while], data = [none] } while (pc >= pb && x[pc] >= pivotValue) { if (x[pc] == pivotValue) swap(x, pc, pd--, paired); pc--; // depends on control dependency: [while], data = [none] } if (pb > pc) break; swap(x, pb++, pc--, paired); } int s; int pn = end; s = Math.min(pa - a, pb - pa); vecswap(x, a, pb - s, s, paired); s = Math.min(pd - pc, pn - pd - 1); vecswap(x, pb, pn - s, s, paired); //recurse if ((s = pb - pa) > 1) sort(x, a, a+s, paired); if ((s = pd - pc) > 1) sort(x, pn - s, pn, paired); } }
public class class_name { public static void send(Throwable throwable, List tags, Map userCustomData) { RaygunMessage msg = buildMessage(throwable); if (msg == null) { RaygunLogger.e("Failed to send RaygunMessage - due to invalid message being built"); return; } msg.getDetails().setTags(RaygunUtils.mergeLists(RaygunClient.tags, tags)); msg.getDetails().setUserCustomData(RaygunUtils.mergeMaps(RaygunClient.userCustomData, userCustomData)); if (RaygunClient.onBeforeSend != null) { msg = RaygunClient.onBeforeSend.onBeforeSend(msg); if (msg == null) { return; } } enqueueWorkForCrashReportingService(RaygunClient.apiKey, new Gson().toJson(msg)); postCachedMessages(); } }
public class class_name { public static void send(Throwable throwable, List tags, Map userCustomData) { RaygunMessage msg = buildMessage(throwable); if (msg == null) { RaygunLogger.e("Failed to send RaygunMessage - due to invalid message being built"); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } msg.getDetails().setTags(RaygunUtils.mergeLists(RaygunClient.tags, tags)); msg.getDetails().setUserCustomData(RaygunUtils.mergeMaps(RaygunClient.userCustomData, userCustomData)); if (RaygunClient.onBeforeSend != null) { msg = RaygunClient.onBeforeSend.onBeforeSend(msg); // depends on control dependency: [if], data = [none] if (msg == null) { return; // depends on control dependency: [if], data = [none] } } enqueueWorkForCrashReportingService(RaygunClient.apiKey, new Gson().toJson(msg)); postCachedMessages(); } }
public class class_name { public static GrayU8 bitmapToGray( Bitmap input , GrayU8 output , byte[] storage ) { if( output == null ) { output = new GrayU8( input.getWidth() , input.getHeight() ); } else { output.reshape(input.getWidth(), input.getHeight()); } if( storage == null ) storage = declareStorage(input,null); input.copyPixelsToBuffer(ByteBuffer.wrap(storage)); ImplConvertBitmap.arrayToGray(storage, input.getConfig(), output); return output; } }
public class class_name { public static GrayU8 bitmapToGray( Bitmap input , GrayU8 output , byte[] storage ) { if( output == null ) { output = new GrayU8( input.getWidth() , input.getHeight() ); // depends on control dependency: [if], data = [none] } else { output.reshape(input.getWidth(), input.getHeight()); // depends on control dependency: [if], data = [none] } if( storage == null ) storage = declareStorage(input,null); input.copyPixelsToBuffer(ByteBuffer.wrap(storage)); ImplConvertBitmap.arrayToGray(storage, input.getConfig(), output); return output; } }
public class class_name { public UpdateUserPoolClientRequest withAllowedOAuthFlows(OAuthFlowType... allowedOAuthFlows) { java.util.ArrayList<String> allowedOAuthFlowsCopy = new java.util.ArrayList<String>(allowedOAuthFlows.length); for (OAuthFlowType value : allowedOAuthFlows) { allowedOAuthFlowsCopy.add(value.toString()); } if (getAllowedOAuthFlows() == null) { setAllowedOAuthFlows(allowedOAuthFlowsCopy); } else { getAllowedOAuthFlows().addAll(allowedOAuthFlowsCopy); } return this; } }
public class class_name { public UpdateUserPoolClientRequest withAllowedOAuthFlows(OAuthFlowType... allowedOAuthFlows) { java.util.ArrayList<String> allowedOAuthFlowsCopy = new java.util.ArrayList<String>(allowedOAuthFlows.length); for (OAuthFlowType value : allowedOAuthFlows) { allowedOAuthFlowsCopy.add(value.toString()); // depends on control dependency: [for], data = [value] } if (getAllowedOAuthFlows() == null) { setAllowedOAuthFlows(allowedOAuthFlowsCopy); // depends on control dependency: [if], data = [none] } else { getAllowedOAuthFlows().addAll(allowedOAuthFlowsCopy); // depends on control dependency: [if], data = [none] } return this; } }
public class class_name { private ListenerToken addDocumentChangeListener( Executor executor, DocumentChangeListener listener, String docID) { // NOTE: caller method is synchronized. DocumentChangeNotifier docNotifier = docChangeNotifiers.get(docID); if (docNotifier == null) { docNotifier = new DocumentChangeNotifier((Database) this, docID); docChangeNotifiers.put(docID, docNotifier); } final ChangeListenerToken token = docNotifier.addChangeListener(executor, listener); token.setKey(docID); return token; } }
public class class_name { private ListenerToken addDocumentChangeListener( Executor executor, DocumentChangeListener listener, String docID) { // NOTE: caller method is synchronized. DocumentChangeNotifier docNotifier = docChangeNotifiers.get(docID); if (docNotifier == null) { docNotifier = new DocumentChangeNotifier((Database) this, docID); // depends on control dependency: [if], data = [none] docChangeNotifiers.put(docID, docNotifier); // depends on control dependency: [if], data = [none] } final ChangeListenerToken token = docNotifier.addChangeListener(executor, listener); token.setKey(docID); return token; } }
public class class_name { private DecimalFormat getNumberFormatter( TransformerImpl transformer, int contextNode) throws TransformerException { // Patch from Steven Serocki // Maybe we really want to do the clone in getLocale() and return // a clone of the default Locale?? Locale locale = (Locale)getLocale(transformer, contextNode).clone(); // Helper to format local specific numbers to strings. DecimalFormat formatter = null; //synchronized (locale) //{ // formatter = (DecimalFormat) NumberFormat.getNumberInstance(locale); //} String digitGroupSepValue = (null != m_groupingSeparator_avt) ? m_groupingSeparator_avt.evaluate( transformer.getXPathContext(), contextNode, this) : null; // Validate grouping separator if an AVT was used; otherwise this was // validated statically in XSLTAttributeDef.java. if ((digitGroupSepValue != null) && (!m_groupingSeparator_avt.isSimple()) && (digitGroupSepValue.length() != 1)) { transformer.getMsgMgr().warn( this, XSLTErrorResources.WG_ILLEGAL_ATTRIBUTE_VALUE, new Object[]{ Constants.ATTRNAME_NAME, m_groupingSeparator_avt.getName()}); } String nDigitsPerGroupValue = (null != m_groupingSize_avt) ? m_groupingSize_avt.evaluate( transformer.getXPathContext(), contextNode, this) : null; // TODO: Handle digit-group attributes if ((null != digitGroupSepValue) && (null != nDigitsPerGroupValue) && // Ignore if separation value is empty string (digitGroupSepValue.length() > 0)) { try { formatter = (DecimalFormat) NumberFormat.getNumberInstance(locale); formatter.setGroupingSize( Integer.valueOf(nDigitsPerGroupValue).intValue()); DecimalFormatSymbols symbols = formatter.getDecimalFormatSymbols(); symbols.setGroupingSeparator(digitGroupSepValue.charAt(0)); formatter.setDecimalFormatSymbols(symbols); formatter.setGroupingUsed(true); } catch (NumberFormatException ex) { formatter.setGroupingUsed(false); } } return formatter; } }
public class class_name { private DecimalFormat getNumberFormatter( TransformerImpl transformer, int contextNode) throws TransformerException { // Patch from Steven Serocki // Maybe we really want to do the clone in getLocale() and return // a clone of the default Locale?? Locale locale = (Locale)getLocale(transformer, contextNode).clone(); // Helper to format local specific numbers to strings. DecimalFormat formatter = null; //synchronized (locale) //{ // formatter = (DecimalFormat) NumberFormat.getNumberInstance(locale); //} String digitGroupSepValue = (null != m_groupingSeparator_avt) ? m_groupingSeparator_avt.evaluate( transformer.getXPathContext(), contextNode, this) : null; // Validate grouping separator if an AVT was used; otherwise this was // validated statically in XSLTAttributeDef.java. if ((digitGroupSepValue != null) && (!m_groupingSeparator_avt.isSimple()) && (digitGroupSepValue.length() != 1)) { transformer.getMsgMgr().warn( this, XSLTErrorResources.WG_ILLEGAL_ATTRIBUTE_VALUE, new Object[]{ Constants.ATTRNAME_NAME, m_groupingSeparator_avt.getName()}); } String nDigitsPerGroupValue = (null != m_groupingSize_avt) ? m_groupingSize_avt.evaluate( transformer.getXPathContext(), contextNode, this) : null; // TODO: Handle digit-group attributes if ((null != digitGroupSepValue) && (null != nDigitsPerGroupValue) && // Ignore if separation value is empty string (digitGroupSepValue.length() > 0)) { try { formatter = (DecimalFormat) NumberFormat.getNumberInstance(locale); // depends on control dependency: [try], data = [none] formatter.setGroupingSize( Integer.valueOf(nDigitsPerGroupValue).intValue()); // depends on control dependency: [try], data = [none] DecimalFormatSymbols symbols = formatter.getDecimalFormatSymbols(); symbols.setGroupingSeparator(digitGroupSepValue.charAt(0)); // depends on control dependency: [try], data = [none] formatter.setDecimalFormatSymbols(symbols); // depends on control dependency: [try], data = [none] formatter.setGroupingUsed(true); // depends on control dependency: [try], data = [none] } catch (NumberFormatException ex) { formatter.setGroupingUsed(false); } // depends on control dependency: [catch], data = [none] } return formatter; } }
public class class_name { public BaseMessage sendMessageRequest(BaseMessage messageOut) { String strTrxID = null; try { // Create a message from the message factory. String strXmlMessageOut = messageOut.getExternalMessage().toString(); // Create an endpoint for the recipient of the message. TrxMessageHeader trxMessageHeader = (TrxMessageHeader)messageOut.getMessageHeader(); String strDest = (String)trxMessageHeader.get(TrxMessageHeader.DESTINATION_PARAM); String strMsgDest = (String)trxMessageHeader.get(TrxMessageHeader.DESTINATION_MESSAGE_PARAM); if (strMsgDest != null) strDest = strDest + strMsgDest; strTrxID = (String)trxMessageHeader.get(TrxMessageHeader.LOG_TRX_ID); URL url = new URL(strDest); Properties properties = new Properties(); properties.setProperty("xml", strXmlMessageOut); // Send the message to the provider using the connection. // Create a message from the message factory. //x msg.setProperty(SOAPMessage.WRITE_XML_DECLARATION, DBConstants.TRUE); //x msg.getMimeHeaders().setHeader("Content-Type", "text/xml"); ServletMessage servlet = new ServletMessage(url); InputStream in = servlet.sendMessage(properties); this.logMessage(strTrxID, messageOut, MessageInfoTypeModel.REQUEST, MessageTypeModel.MESSAGE_OUT, MessageStatusModel.SENT, null, null); InputStreamReader reader = new InputStreamReader(in); BufferedReader buffReader = new BufferedReader(reader); StringBuffer sbReply = new StringBuffer(); while (true) { String str = buffReader.readLine(); if ((str == null) || (str.length() == 0)) break; if (sbReply.length() > 0) sbReply.append("\n"); sbReply.append(str); } if (sbReply.length() > 0) { BaseMessage messageReply = new TreeMessage(null, null); new XmlTrxMessageIn(messageReply, sbReply.toString()); return messageReply; } else { System.err.println("No reply"); } } catch(Throwable ex) { ex.printStackTrace(); String strErrorMessage = ex.getMessage(); this.logMessage(strTrxID, messageOut, MessageInfoTypeModel.REQUEST, MessageTypeModel.MESSAGE_OUT, MessageStatusModel.ERROR, strErrorMessage, null); return BaseMessageProcessor.processErrorMessage(this, messageOut, strErrorMessage); } return null; } }
public class class_name { public BaseMessage sendMessageRequest(BaseMessage messageOut) { String strTrxID = null; try { // Create a message from the message factory. String strXmlMessageOut = messageOut.getExternalMessage().toString(); // Create an endpoint for the recipient of the message. TrxMessageHeader trxMessageHeader = (TrxMessageHeader)messageOut.getMessageHeader(); String strDest = (String)trxMessageHeader.get(TrxMessageHeader.DESTINATION_PARAM); String strMsgDest = (String)trxMessageHeader.get(TrxMessageHeader.DESTINATION_MESSAGE_PARAM); if (strMsgDest != null) strDest = strDest + strMsgDest; strTrxID = (String)trxMessageHeader.get(TrxMessageHeader.LOG_TRX_ID); // depends on control dependency: [try], data = [none] URL url = new URL(strDest); Properties properties = new Properties(); properties.setProperty("xml", strXmlMessageOut); // depends on control dependency: [try], data = [none] // Send the message to the provider using the connection. // Create a message from the message factory. //x msg.setProperty(SOAPMessage.WRITE_XML_DECLARATION, DBConstants.TRUE); //x msg.getMimeHeaders().setHeader("Content-Type", "text/xml"); ServletMessage servlet = new ServletMessage(url); InputStream in = servlet.sendMessage(properties); this.logMessage(strTrxID, messageOut, MessageInfoTypeModel.REQUEST, MessageTypeModel.MESSAGE_OUT, MessageStatusModel.SENT, null, null); // depends on control dependency: [try], data = [none] InputStreamReader reader = new InputStreamReader(in); BufferedReader buffReader = new BufferedReader(reader); StringBuffer sbReply = new StringBuffer(); while (true) { String str = buffReader.readLine(); if ((str == null) || (str.length() == 0)) break; if (sbReply.length() > 0) sbReply.append("\n"); sbReply.append(str); // depends on control dependency: [while], data = [none] } if (sbReply.length() > 0) { BaseMessage messageReply = new TreeMessage(null, null); new XmlTrxMessageIn(messageReply, sbReply.toString()); // depends on control dependency: [if], data = [none] return messageReply; // depends on control dependency: [if], data = [none] } else { System.err.println("No reply"); // depends on control dependency: [if], data = [none] } } catch(Throwable ex) { ex.printStackTrace(); String strErrorMessage = ex.getMessage(); this.logMessage(strTrxID, messageOut, MessageInfoTypeModel.REQUEST, MessageTypeModel.MESSAGE_OUT, MessageStatusModel.ERROR, strErrorMessage, null); return BaseMessageProcessor.processErrorMessage(this, messageOut, strErrorMessage); } // depends on control dependency: [catch], data = [none] return null; } }
public class class_name { @CommandArgument public void cancel(int index) { if (jobProgressStates == null) { System.err.println("Server not running"); return; } if (index <= 0 || index > jobProgressStates.size()) { System.err.println("Invalid job number"); } ProgressState state = jobProgressStates.get(index - 1); state.setCancelPending(); } }
public class class_name { @CommandArgument public void cancel(int index) { if (jobProgressStates == null) { System.err.println("Server not running"); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (index <= 0 || index > jobProgressStates.size()) { System.err.println("Invalid job number"); // depends on control dependency: [if], data = [none] } ProgressState state = jobProgressStates.get(index - 1); state.setCancelPending(); } }
public class class_name { public void requestSpeak (SpeakService speakService, String message, byte mode) { if (speakService == null) { if (_place == null) { return; } speakService = _place.speakService; } // make sure they can say what they want to say message = filter(message, null, true); if (message == null) { return; } // dispatch a speak request using the supplied speak service speakService.speak(message, mode); } }
public class class_name { public void requestSpeak (SpeakService speakService, String message, byte mode) { if (speakService == null) { if (_place == null) { return; // depends on control dependency: [if], data = [none] } speakService = _place.speakService; // depends on control dependency: [if], data = [none] } // make sure they can say what they want to say message = filter(message, null, true); if (message == null) { return; // depends on control dependency: [if], data = [none] } // dispatch a speak request using the supplied speak service speakService.speak(message, mode); } }
public class class_name { public Observable<ServiceResponse<Page<DataLakeStoreAccountInfoInner>>> listDataLakeStoreAccountsNextWithServiceResponseAsync(final String nextPageLink) { return listDataLakeStoreAccountsNextSinglePageAsync(nextPageLink) .concatMap(new Func1<ServiceResponse<Page<DataLakeStoreAccountInfoInner>>, Observable<ServiceResponse<Page<DataLakeStoreAccountInfoInner>>>>() { @Override public Observable<ServiceResponse<Page<DataLakeStoreAccountInfoInner>>> call(ServiceResponse<Page<DataLakeStoreAccountInfoInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listDataLakeStoreAccountsNextWithServiceResponseAsync(nextPageLink)); } }); } }
public class class_name { public Observable<ServiceResponse<Page<DataLakeStoreAccountInfoInner>>> listDataLakeStoreAccountsNextWithServiceResponseAsync(final String nextPageLink) { return listDataLakeStoreAccountsNextSinglePageAsync(nextPageLink) .concatMap(new Func1<ServiceResponse<Page<DataLakeStoreAccountInfoInner>>, Observable<ServiceResponse<Page<DataLakeStoreAccountInfoInner>>>>() { @Override public Observable<ServiceResponse<Page<DataLakeStoreAccountInfoInner>>> call(ServiceResponse<Page<DataLakeStoreAccountInfoInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); // depends on control dependency: [if], data = [none] } return Observable.just(page).concatWith(listDataLakeStoreAccountsNextWithServiceResponseAsync(nextPageLink)); } }); } }
public class class_name { @CheckForNull public <T> Model<T> getOrNull(Class<T> type, @CheckForNull Class<?> propertyOwner, @Nullable String property) { Model<T> m = models.get(type); if(m==null && type.getAnnotation(ExportedBean.class) != null) { m = new Model<T>(this, type, propertyOwner, property); } return m; } }
public class class_name { @CheckForNull public <T> Model<T> getOrNull(Class<T> type, @CheckForNull Class<?> propertyOwner, @Nullable String property) { Model<T> m = models.get(type); if(m==null && type.getAnnotation(ExportedBean.class) != null) { m = new Model<T>(this, type, propertyOwner, property); // depends on control dependency: [if], data = [none] } return m; } }
public class class_name { public static Geometry force3D(Geometry geom) { if (geom == null) { return null; } return GeometryCoordinateDimension.force(geom, 3); } }
public class class_name { public static Geometry force3D(Geometry geom) { if (geom == null) { return null; // depends on control dependency: [if], data = [none] } return GeometryCoordinateDimension.force(geom, 3); } }
public class class_name { protected static void addAlarm(Object key, Object alarmObject) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "addAlarm", new Object[] { key, alarmObject }); synchronized (pendingAlarms) { Set alarms = null; if (pendingAlarms.containsKey(key)) alarms = (Set) pendingAlarms.get(key); else { alarms = new HashSet(); pendingAlarms.put(key, alarms); } alarms.add(alarmObject); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "addAlarm"); } }
public class class_name { protected static void addAlarm(Object key, Object alarmObject) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "addAlarm", new Object[] { key, alarmObject }); synchronized (pendingAlarms) { Set alarms = null; if (pendingAlarms.containsKey(key)) alarms = (Set) pendingAlarms.get(key); else { alarms = new HashSet(); // depends on control dependency: [if], data = [none] pendingAlarms.put(key, alarms); // depends on control dependency: [if], data = [none] } alarms.add(alarmObject); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "addAlarm"); } }
public class class_name { public float getAsFloat(String attribute) { String value = getAttribute(attribute); if (value == null) { return 0; } try { return Float.parseFloat(value); } catch (NumberFormatException e) { throw new RuntimeException("Attribute "+attribute+" is not specified as a float:"+getAttribute(attribute)); } } }
public class class_name { public float getAsFloat(String attribute) { String value = getAttribute(attribute); if (value == null) { return 0; // depends on control dependency: [if], data = [none] } try { return Float.parseFloat(value); // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { throw new RuntimeException("Attribute "+attribute+" is not specified as a float:"+getAttribute(attribute)); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static Long getLong(String name, Long def, Level logLevel) { String v = getString(name); if (v != null) { try { return Long.decode(v); } catch (NumberFormatException e) { // Ignore, fallback to default if (LOGGER.isLoggable(logLevel)) { LOGGER.log(logLevel, "Property. Value is not long: {0} => {1}", new Object[] {name, v}); } } } return def; } }
public class class_name { public static Long getLong(String name, Long def, Level logLevel) { String v = getString(name); if (v != null) { try { return Long.decode(v); // depends on control dependency: [try], data = [none] } catch (NumberFormatException e) { // Ignore, fallback to default if (LOGGER.isLoggable(logLevel)) { LOGGER.log(logLevel, "Property. Value is not long: {0} => {1}", new Object[] {name, v}); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } return def; } }
public class class_name { String unescapeString(String st) { StringBuilder sb = new StringBuilder(st.length()); for (int i = 0; i < st.length(); i++) { char ch = st.charAt(i); if (ch == '\\') { char nextChar = (i == st.length() - 1) ? '\\' : st.charAt(i + 1); switch (nextChar) { case '\\': ch = '\\'; break; case 'b': ch = '\b'; break; case 'f': ch = '\f'; break; case 'n': ch = '\n'; break; case 'r': ch = '\r'; break; case 't': ch = '\t'; break; /*case '\"': ch = '\"'; break; case '\'': ch = '\''; break;*/ // Hex Unicode: u???? case 'u': if (i >= st.length() - 5) { ch = 'u'; break; } int code = Integer.parseInt( "" + st.charAt(i + 2) + st.charAt(i + 3) + st.charAt(i + 4) + st.charAt(i + 5), 16); sb.append(Character.toChars(code)); i += 5; continue; } i++; } sb.append(ch); } return sb.toString(); } }
public class class_name { String unescapeString(String st) { StringBuilder sb = new StringBuilder(st.length()); for (int i = 0; i < st.length(); i++) { char ch = st.charAt(i); if (ch == '\\') { char nextChar = (i == st.length() - 1) ? '\\' : st.charAt(i + 1); switch (nextChar) { case '\\': ch = '\\'; break; case 'b': ch = '\b'; break; case 'f': ch = '\f'; break; case 'n': ch = '\n'; break; case 'r': ch = '\r'; break; case 't': ch = '\t'; break; /*case '\"': ch = '\"'; break; case '\'': ch = '\''; break;*/ // Hex Unicode: u???? case 'u': if (i >= st.length() - 5) { ch = 'u'; // depends on control dependency: [if], data = [none] break; } int code = Integer.parseInt( "" + st.charAt(i + 2) + st.charAt(i + 3) + st.charAt(i + 4) + st.charAt(i + 5), 16); sb.append(Character.toChars(code)); i += 5; continue; } i++; // depends on control dependency: [if], data = [none] } sb.append(ch); // depends on control dependency: [for], data = [none] } return sb.toString(); } }
public class class_name { public List<File> scan(Resource resource) { Scanner scanner = buildContext.newScanner(new File(resource.getDirectory()), true); setupScanner(scanner, resource); scanner.scan(); List<File> files = new ArrayList<File>(); for (String file : scanner.getIncludedFiles()) { files.add(new File(resource.getDirectory(), file)); } return files; } }
public class class_name { public List<File> scan(Resource resource) { Scanner scanner = buildContext.newScanner(new File(resource.getDirectory()), true); setupScanner(scanner, resource); scanner.scan(); List<File> files = new ArrayList<File>(); for (String file : scanner.getIncludedFiles()) { files.add(new File(resource.getDirectory(), file)); // depends on control dependency: [for], data = [file] } return files; } }
public class class_name { public void marshall(GetResourceShareAssociationsRequest getResourceShareAssociationsRequest, ProtocolMarshaller protocolMarshaller) { if (getResourceShareAssociationsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getResourceShareAssociationsRequest.getAssociationType(), ASSOCIATIONTYPE_BINDING); protocolMarshaller.marshall(getResourceShareAssociationsRequest.getResourceShareArns(), RESOURCESHAREARNS_BINDING); protocolMarshaller.marshall(getResourceShareAssociationsRequest.getResourceArn(), RESOURCEARN_BINDING); protocolMarshaller.marshall(getResourceShareAssociationsRequest.getPrincipal(), PRINCIPAL_BINDING); protocolMarshaller.marshall(getResourceShareAssociationsRequest.getAssociationStatus(), ASSOCIATIONSTATUS_BINDING); protocolMarshaller.marshall(getResourceShareAssociationsRequest.getNextToken(), NEXTTOKEN_BINDING); protocolMarshaller.marshall(getResourceShareAssociationsRequest.getMaxResults(), MAXRESULTS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(GetResourceShareAssociationsRequest getResourceShareAssociationsRequest, ProtocolMarshaller protocolMarshaller) { if (getResourceShareAssociationsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getResourceShareAssociationsRequest.getAssociationType(), ASSOCIATIONTYPE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getResourceShareAssociationsRequest.getResourceShareArns(), RESOURCESHAREARNS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getResourceShareAssociationsRequest.getResourceArn(), RESOURCEARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getResourceShareAssociationsRequest.getPrincipal(), PRINCIPAL_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getResourceShareAssociationsRequest.getAssociationStatus(), ASSOCIATIONSTATUS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getResourceShareAssociationsRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getResourceShareAssociationsRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static List<String> splitToLines(String csvText) { List<String> newLines = new ArrayList<>(); for (Iterator<String> lineItr = Arrays.asList(csvText.split("\r\n|\n")).iterator(); lineItr .hasNext();) { String line = lineItr.next(); LOG.trace("line : {}", line); StringBuilder newLine = new StringBuilder(line); // 行内にダブルクオーテーションが奇数個の場合はセル内改行ありとみなし、 // 次にダブルクオーテーションが奇数個の行までを連結して1行とする。 if (StringUtils.countMatches(line, '"') % 2 != 0) { do { line = lineItr.next(); newLine.append("\n"); newLine.append(line); } while (StringUtils.countMatches(line, '"') % 2 == 0 && lineItr.hasNext()); } String newLineStr = newLine.toString(); LOG.trace("new line : {}", newLineStr); newLines.add(newLine.toString()); } LOG.trace("actual line number : {}", newLines.size()); return newLines; } }
public class class_name { public static List<String> splitToLines(String csvText) { List<String> newLines = new ArrayList<>(); for (Iterator<String> lineItr = Arrays.asList(csvText.split("\r\n|\n")).iterator(); lineItr .hasNext();) { String line = lineItr.next(); LOG.trace("line : {}", line); // depends on control dependency: [for], data = [none] StringBuilder newLine = new StringBuilder(line); // 行内にダブルクオーテーションが奇数個の場合はセル内改行ありとみなし、 // 次にダブルクオーテーションが奇数個の行までを連結して1行とする。 if (StringUtils.countMatches(line, '"') % 2 != 0) { do { line = lineItr.next(); newLine.append("\n"); newLine.append(line); } while (StringUtils.countMatches(line, '"') % 2 == 0 && lineItr.hasNext()); } String newLineStr = newLine.toString(); LOG.trace("new line : {}", newLineStr); // depends on control dependency: [for], data = [none] newLines.add(newLine.toString()); // depends on control dependency: [for], data = [none] } LOG.trace("actual line number : {}", newLines.size()); return newLines; } }
public class class_name { public EList<GLINERG> getRg() { if (rg == null) { rg = new EObjectContainmentEList.Resolving<GLINERG>(GLINERG.class, this, AfplibPackage.GLINE__RG); } return rg; } }
public class class_name { public EList<GLINERG> getRg() { if (rg == null) { rg = new EObjectContainmentEList.Resolving<GLINERG>(GLINERG.class, this, AfplibPackage.GLINE__RG); // depends on control dependency: [if], data = [none] } return rg; } }
public class class_name { private static final double getHllBitMapEstimate( final int lgConfigK, final int curMin, final int numAtCurMin) { final int configK = 1 << lgConfigK; final int numUnhitBuckets = (curMin == 0) ? numAtCurMin : 0; //This will eventually go away. if (numUnhitBuckets == 0) { return configK * Math.log(configK / 0.5); } final int numHitBuckets = configK - numUnhitBuckets; return HarmonicNumbers.getBitMapEstimate(configK, numHitBuckets); } }
public class class_name { private static final double getHllBitMapEstimate( final int lgConfigK, final int curMin, final int numAtCurMin) { final int configK = 1 << lgConfigK; final int numUnhitBuckets = (curMin == 0) ? numAtCurMin : 0; //This will eventually go away. if (numUnhitBuckets == 0) { return configK * Math.log(configK / 0.5); // depends on control dependency: [if], data = [none] } final int numHitBuckets = configK - numUnhitBuckets; return HarmonicNumbers.getBitMapEstimate(configK, numHitBuckets); } }
public class class_name { public void marshall(GetPersonTrackingRequest getPersonTrackingRequest, ProtocolMarshaller protocolMarshaller) { if (getPersonTrackingRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getPersonTrackingRequest.getJobId(), JOBID_BINDING); protocolMarshaller.marshall(getPersonTrackingRequest.getMaxResults(), MAXRESULTS_BINDING); protocolMarshaller.marshall(getPersonTrackingRequest.getNextToken(), NEXTTOKEN_BINDING); protocolMarshaller.marshall(getPersonTrackingRequest.getSortBy(), SORTBY_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(GetPersonTrackingRequest getPersonTrackingRequest, ProtocolMarshaller protocolMarshaller) { if (getPersonTrackingRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getPersonTrackingRequest.getJobId(), JOBID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getPersonTrackingRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getPersonTrackingRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getPersonTrackingRequest.getSortBy(), SORTBY_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private String generateModelId() { String mt = this.modelType.toString(); StringBuilder mid = new StringBuilder(mt); Integer lastId = null; if (generatedModelIds.containsKey(mt)) { lastId = generatedModelIds.get(mt); } else { lastId = new Integer(-1); } lastId++; mid.append(lastId); generatedModelIds.put(mt, lastId); return mid.toString(); } }
public class class_name { private String generateModelId() { String mt = this.modelType.toString(); StringBuilder mid = new StringBuilder(mt); Integer lastId = null; if (generatedModelIds.containsKey(mt)) { lastId = generatedModelIds.get(mt); // depends on control dependency: [if], data = [none] } else { lastId = new Integer(-1); // depends on control dependency: [if], data = [none] } lastId++; mid.append(lastId); generatedModelIds.put(mt, lastId); return mid.toString(); } }
public class class_name { public static List<Collection<Integer>> sortHostIdByHGDistance(int hostId, Map<Integer, String> hostGroups) { String localHostGroup = hostGroups.get(hostId); Preconditions.checkArgument(localHostGroup != null); HAGroup localHaGroup = new HAGroup(localHostGroup); // Memorize the distance, map the distance to host ids. Multimap<Integer, Integer> distanceMap = MultimapBuilder.treeKeys(Comparator.<Integer>naturalOrder().reversed()) .arrayListValues().build(); for (Map.Entry<Integer, String> entry : hostGroups.entrySet()) { if (hostId == entry.getKey()) { continue; } distanceMap.put(localHaGroup.getRelationshipTo(entry.getValue()).m_distance, entry.getKey()); } return new ArrayList<>(distanceMap.asMap().values()); } }
public class class_name { public static List<Collection<Integer>> sortHostIdByHGDistance(int hostId, Map<Integer, String> hostGroups) { String localHostGroup = hostGroups.get(hostId); Preconditions.checkArgument(localHostGroup != null); HAGroup localHaGroup = new HAGroup(localHostGroup); // Memorize the distance, map the distance to host ids. Multimap<Integer, Integer> distanceMap = MultimapBuilder.treeKeys(Comparator.<Integer>naturalOrder().reversed()) .arrayListValues().build(); for (Map.Entry<Integer, String> entry : hostGroups.entrySet()) { if (hostId == entry.getKey()) { continue; } distanceMap.put(localHaGroup.getRelationshipTo(entry.getValue()).m_distance, entry.getKey()); // depends on control dependency: [for], data = [entry] } return new ArrayList<>(distanceMap.asMap().values()); } }
public class class_name { public void addMailHost( String hostname, String port, String order, String protocol, String security, String username, String password) { Integer thePort; try { thePort = Integer.valueOf(port); } catch (Throwable t) { thePort = Integer.valueOf(25); } m_orderDefault += 10; Integer theOrder; try { theOrder = Integer.valueOf(order); if (theOrder.intValue() > m_orderDefault) { m_orderDefault = theOrder.intValue(); } } catch (Throwable t) { // valueOf: use jdk int cache if possible and not new operator: theOrder = Integer.valueOf(m_orderDefault); } CmsMailHost host = new CmsMailHost(hostname, thePort, theOrder, protocol, security, username, password); m_mailHosts.add(host); if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info(Messages.get().getBundle().key(Messages.LOG_ADD_HOST_1, host)); } Collections.sort(m_mailHosts); } }
public class class_name { public void addMailHost( String hostname, String port, String order, String protocol, String security, String username, String password) { Integer thePort; try { thePort = Integer.valueOf(port); // depends on control dependency: [try], data = [none] } catch (Throwable t) { thePort = Integer.valueOf(25); } // depends on control dependency: [catch], data = [none] m_orderDefault += 10; Integer theOrder; try { theOrder = Integer.valueOf(order); // depends on control dependency: [try], data = [none] if (theOrder.intValue() > m_orderDefault) { m_orderDefault = theOrder.intValue(); // depends on control dependency: [if], data = [none] } } catch (Throwable t) { // valueOf: use jdk int cache if possible and not new operator: theOrder = Integer.valueOf(m_orderDefault); } // depends on control dependency: [catch], data = [none] CmsMailHost host = new CmsMailHost(hostname, thePort, theOrder, protocol, security, username, password); m_mailHosts.add(host); if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info(Messages.get().getBundle().key(Messages.LOG_ADD_HOST_1, host)); // depends on control dependency: [if], data = [none] } Collections.sort(m_mailHosts); } }
public class class_name { @Override public TableBuilder getTableBuilder(final TableName tableName, final ExecutorService pool) { return new TableBuilder() { @Override public TableBuilder setWriteRpcTimeout(int arg0) { return this; } @Override public TableBuilder setRpcTimeout(int arg0) { return this; } @Override public TableBuilder setReadRpcTimeout(int arg0) { return this; } @Override public TableBuilder setOperationTimeout(int arg0) { return this; } @Override public Table build() { try { return getTable(tableName, pool); } catch (IOException e) { throw new RuntimeException("Could not create the table", e); } } }; } }
public class class_name { @Override public TableBuilder getTableBuilder(final TableName tableName, final ExecutorService pool) { return new TableBuilder() { @Override public TableBuilder setWriteRpcTimeout(int arg0) { return this; } @Override public TableBuilder setRpcTimeout(int arg0) { return this; } @Override public TableBuilder setReadRpcTimeout(int arg0) { return this; } @Override public TableBuilder setOperationTimeout(int arg0) { return this; } @Override public Table build() { try { return getTable(tableName, pool); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new RuntimeException("Could not create the table", e); } // depends on control dependency: [catch], data = [none] } }; } }
public class class_name { public void clearMessagesAtSource(IndoubtAction indoubtAction) throws SIMPControllableNotFoundException, SIMPRuntimeOperationFailedException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "clearMessagesAtSource"); //This method used to be exposed by the MBeans, //but this is no longer the case. Instead, the exposed methods will be delete/moveAll //which will implicitly use this path assertValidControllable(); synchronized(_streamSet) { boolean foundUncommittedMsgs = false; boolean reallocateAllMsgs = false; // Start by reallocating all messages which have not yet been sent // If inDoubtAction == INDOUBT_REALLOCATE then reallocate all messages // including those which have already been sent if( indoubtAction == IndoubtAction.INDOUBT_REALLOCATE) { reallocateAllMsgs = true; // This will be PtoP Only try { _sourceStreamManager.reallocate(reallocateAllMsgs); } catch (SIException e) { FFDCFilter.processException( e, "com.ibm.ws.sib.processor.runtime.SourceStreamSetControl.clearMessagesAtSource", "1:424:1.39", this); SIMPRuntimeOperationFailedException finalE = new SIMPRuntimeOperationFailedException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0003", new Object[] {"SourceStreamSetControl.clearMessagesAtSource", "1:432:1.39", e}, null), e); SibTr.exception(tc, finalE); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "clearMessagesAtSource", finalE); throw finalE; } } // Next delete all indoubt messages from the Message store // Unless we have been told to leave them there // Since any reallocated messages have been replace by Silence // in the streams we can assume we want to work on all messages which // remain in the stream if( indoubtAction != IndoubtAction.INDOUBT_LEAVE) { boolean discard = false; if( indoubtAction == IndoubtAction.INDOUBT_DELETE) discard = true; // This is an iterator over all messages in all the source streams // in this streamSet. There may be Uncommitted messages in this list // but getSIMPMessage will return null for these as they don't have a // valid ItemStream id so we won't try to delete them Iterator itr = this.getTransmitMessagesIterator(SIMPConstants.SIMPCONTROL_RETURN_ALL_MESSAGES); TransmitMessage xmitMsg = null; String state=null; while(itr.hasNext()) { xmitMsg = (TransmitMessage)itr.next(); state = xmitMsg.getState(); if (state.equals( State.COMMITTING.toString() ) ) { // Ignore committing messages. Theres nothing we can do with them. foundUncommittedMsgs = true; } else { try { // Try to delete it SIMPMessage msg = xmitMsg.getSIMPMessage(); if( msg != null) { _sourceStreamManager.removeMessage(msg); QueuedMessage queuedMessage = (QueuedMessage)msg.getControlAdapter(); // A null message implies it's already gone from the MsgStore if(queuedMessage != null) queuedMessage.moveMessage(discard); } } catch (SIException e) { FFDCFilter.processException( e, "com.ibm.ws.sib.processor.runtime.SourceStreamSetControl.clearMessagesAtSource", "1:496:1.39", this); SIMPRuntimeOperationFailedException finalE = new SIMPRuntimeOperationFailedException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0003", new Object[] {"SourceStreamSetControl.clearMessagesAtSource", "1:504:1.39", e}, null), e); SibTr.exception(tc, finalE); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "clearMessagesAtSource", finalE); throw finalE; } } } } // d477883 - COMMENT THE FOLLOWING CODE // We no longer flush the streams as part of a deleteAll/reallocateAll // This stream may still be used afterwards and therefore we dont want to // null out any resources. // // Now send a Flushed message and remove streamSet from sourcestreamManager // if( foundUncommittedMsgs == false) // { // // try // { // _sourceStreamManager.forceFlush(); // } // catch (SIException e) // { // FFDCFilter.processException( // e, // "com.ibm.ws.sib.processor.runtime.SourceStreamSetControl.clearMessagesAtSource", // "1:535:1.39", // this); // // SIMPRuntimeOperationFailedException finalE = // new SIMPRuntimeOperationFailedException( // nls.getFormattedMessage( // "INTERNAL_MESSAGING_ERROR_CWSIP0003", // new Object[] {"SourceStreamSetControl.clearMessagesAtSource", // "1:543:1.39", // e}, // null), e); // // SibTr.exception(tc, finalE); // // if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "clearMessagesAtSource", finalE); // throw finalE; // } // } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "clearMessagesAtSource"); } }
public class class_name { public void clearMessagesAtSource(IndoubtAction indoubtAction) throws SIMPControllableNotFoundException, SIMPRuntimeOperationFailedException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "clearMessagesAtSource"); //This method used to be exposed by the MBeans, //but this is no longer the case. Instead, the exposed methods will be delete/moveAll //which will implicitly use this path assertValidControllable(); synchronized(_streamSet) { boolean foundUncommittedMsgs = false; boolean reallocateAllMsgs = false; // Start by reallocating all messages which have not yet been sent // If inDoubtAction == INDOUBT_REALLOCATE then reallocate all messages // including those which have already been sent if( indoubtAction == IndoubtAction.INDOUBT_REALLOCATE) { reallocateAllMsgs = true; // depends on control dependency: [if], data = [none] // This will be PtoP Only try { _sourceStreamManager.reallocate(reallocateAllMsgs); // depends on control dependency: [try], data = [none] } catch (SIException e) { FFDCFilter.processException( e, "com.ibm.ws.sib.processor.runtime.SourceStreamSetControl.clearMessagesAtSource", "1:424:1.39", this); SIMPRuntimeOperationFailedException finalE = new SIMPRuntimeOperationFailedException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0003", new Object[] {"SourceStreamSetControl.clearMessagesAtSource", "1:432:1.39", e}, null), e); SibTr.exception(tc, finalE); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "clearMessagesAtSource", finalE); throw finalE; } // depends on control dependency: [catch], data = [none] } // Next delete all indoubt messages from the Message store // Unless we have been told to leave them there // Since any reallocated messages have been replace by Silence // in the streams we can assume we want to work on all messages which // remain in the stream if( indoubtAction != IndoubtAction.INDOUBT_LEAVE) { boolean discard = false; if( indoubtAction == IndoubtAction.INDOUBT_DELETE) discard = true; // This is an iterator over all messages in all the source streams // in this streamSet. There may be Uncommitted messages in this list // but getSIMPMessage will return null for these as they don't have a // valid ItemStream id so we won't try to delete them Iterator itr = this.getTransmitMessagesIterator(SIMPConstants.SIMPCONTROL_RETURN_ALL_MESSAGES); TransmitMessage xmitMsg = null; String state=null; while(itr.hasNext()) { xmitMsg = (TransmitMessage)itr.next(); // depends on control dependency: [while], data = [none] state = xmitMsg.getState(); // depends on control dependency: [while], data = [none] if (state.equals( State.COMMITTING.toString() ) ) { // Ignore committing messages. Theres nothing we can do with them. foundUncommittedMsgs = true; // depends on control dependency: [if], data = [none] } else { try { // Try to delete it SIMPMessage msg = xmitMsg.getSIMPMessage(); if( msg != null) { _sourceStreamManager.removeMessage(msg); // depends on control dependency: [if], data = [none] QueuedMessage queuedMessage = (QueuedMessage)msg.getControlAdapter(); // A null message implies it's already gone from the MsgStore if(queuedMessage != null) queuedMessage.moveMessage(discard); } } catch (SIException e) { FFDCFilter.processException( e, "com.ibm.ws.sib.processor.runtime.SourceStreamSetControl.clearMessagesAtSource", "1:496:1.39", this); SIMPRuntimeOperationFailedException finalE = new SIMPRuntimeOperationFailedException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0003", new Object[] {"SourceStreamSetControl.clearMessagesAtSource", "1:504:1.39", e}, null), e); SibTr.exception(tc, finalE); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "clearMessagesAtSource", finalE); throw finalE; } // depends on control dependency: [catch], data = [none] } } } // d477883 - COMMENT THE FOLLOWING CODE // We no longer flush the streams as part of a deleteAll/reallocateAll // This stream may still be used afterwards and therefore we dont want to // null out any resources. // // Now send a Flushed message and remove streamSet from sourcestreamManager // if( foundUncommittedMsgs == false) // { // // try // { // _sourceStreamManager.forceFlush(); // } // catch (SIException e) // { // FFDCFilter.processException( // e, // "com.ibm.ws.sib.processor.runtime.SourceStreamSetControl.clearMessagesAtSource", // "1:535:1.39", // this); // // SIMPRuntimeOperationFailedException finalE = // new SIMPRuntimeOperationFailedException( // nls.getFormattedMessage( // "INTERNAL_MESSAGING_ERROR_CWSIP0003", // new Object[] {"SourceStreamSetControl.clearMessagesAtSource", // "1:543:1.39", // e}, // null), e); // // SibTr.exception(tc, finalE); // // if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "clearMessagesAtSource", finalE); // throw finalE; // } // } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "clearMessagesAtSource"); } }
public class class_name { @Override public CursorPosition getCursor() { if (settings.isAnsiConsole() && Config.isOSPOSIXCompatible()) { try { StringBuilder col = new StringBuilder(4); StringBuilder row = new StringBuilder(4); out().print(ANSI.CURSOR_ROW); out().flush(); boolean gotSep = false; // read the position int[] input = read(); for (int i = 2; i < input.length - 1; i++) { if (input[i] == 59) // we got a ';' which is the separator gotSep = true; else { if (gotSep) col.append((char) input[i]); else row.append((char) input[i]); } } return new CursorPosition(Integer.parseInt(row.toString()), Integer.parseInt(col.toString())); } catch (Exception e) { if (settings.isLogging()) logger.log(Level.SEVERE, "Failed to find current row with ansi code: ", e); return new CursorPosition(-1, -1); } } return new CursorPosition(-1, -1); } }
public class class_name { @Override public CursorPosition getCursor() { if (settings.isAnsiConsole() && Config.isOSPOSIXCompatible()) { try { StringBuilder col = new StringBuilder(4); StringBuilder row = new StringBuilder(4); out().print(ANSI.CURSOR_ROW); // depends on control dependency: [try], data = [none] out().flush(); // depends on control dependency: [try], data = [none] boolean gotSep = false; // read the position int[] input = read(); for (int i = 2; i < input.length - 1; i++) { if (input[i] == 59) // we got a ';' which is the separator gotSep = true; else { if (gotSep) col.append((char) input[i]); else row.append((char) input[i]); } } return new CursorPosition(Integer.parseInt(row.toString()), Integer.parseInt(col.toString())); // depends on control dependency: [try], data = [none] } catch (Exception e) { if (settings.isLogging()) logger.log(Level.SEVERE, "Failed to find current row with ansi code: ", e); return new CursorPosition(-1, -1); } // depends on control dependency: [catch], data = [none] } return new CursorPosition(-1, -1); } }
public class class_name { protected ProblemTreeViewer getViewer() { try { return (ProblemTreeViewer) this.reflect.get(this, "fViewer"); //$NON-NLS-1$ } catch (SecurityException | NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) { throw new Error(e); } } }
public class class_name { protected ProblemTreeViewer getViewer() { try { return (ProblemTreeViewer) this.reflect.get(this, "fViewer"); //$NON-NLS-1$ // depends on control dependency: [try], data = [none] } catch (SecurityException | NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) { throw new Error(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public void close() throws IOException { try { if (this.logicallyClosed.compareAndSet(false, true) && available) { // 中断连接监视线程 if (this.threadWatch != null) { this.threadWatch.interrupt(); this.threadWatch = null; } ThriftConnectionHandle<T> handle = null; try { handle = this.recreateConnectionHandle(); this.thriftConnectionPool.connectionStrategy.cleanupConnection(this, handle); this.thriftConnectionPool.releaseConnection(handle); } catch (ThriftConnectionPoolException e) { possiblyBroken = true; // 检查连接是否关闭了 if (!isClosed()) { this.thriftConnectionPool.connectionStrategy.cleanupConnection(this, handle); this.thriftConnectionPool.releaseConnection(this); } throw new IOException(e); } } else { this.thriftConnectionPool.postDestroyConnection(this); } } catch (Exception e) { possiblyBroken = true; throw new IOException(e); } if (thriftConnection != null) { thriftConnection.close(); } } }
public class class_name { @Override public void close() throws IOException { try { if (this.logicallyClosed.compareAndSet(false, true) && available) { // 中断连接监视线程 if (this.threadWatch != null) { this.threadWatch.interrupt(); // depends on control dependency: [if], data = [none] this.threadWatch = null; // depends on control dependency: [if], data = [none] } ThriftConnectionHandle<T> handle = null; try { handle = this.recreateConnectionHandle(); // depends on control dependency: [try], data = [none] this.thriftConnectionPool.connectionStrategy.cleanupConnection(this, handle); // depends on control dependency: [try], data = [none] this.thriftConnectionPool.releaseConnection(handle); // depends on control dependency: [try], data = [none] } catch (ThriftConnectionPoolException e) { possiblyBroken = true; // 检查连接是否关闭了 if (!isClosed()) { this.thriftConnectionPool.connectionStrategy.cleanupConnection(this, handle); // depends on control dependency: [if], data = [none] this.thriftConnectionPool.releaseConnection(this); // depends on control dependency: [if], data = [none] } throw new IOException(e); } // depends on control dependency: [catch], data = [none] } else { this.thriftConnectionPool.postDestroyConnection(this); } } catch (Exception e) { possiblyBroken = true; throw new IOException(e); } if (thriftConnection != null) { thriftConnection.close(); } } }
public class class_name { String getAttributeName(Method getter) { String attributeName; readLockAttrName.lock(); try { attributeName = attributeNameCache.get(getter); } finally { readLockAttrName.unlock(); } if ( attributeName != null ) return attributeName; DynamoDBHashKey hashKeyAnnotation = ReflectionUtils.getAnnotationFromGetterOrField(getter, DynamoDBHashKey.class); if ( hashKeyAnnotation != null ) { attributeName = hashKeyAnnotation.attributeName(); if ( attributeName != null && attributeName.length() > 0 ) return cacheAttributeName(getter, attributeName); } DynamoDBIndexHashKey indexHashKey = ReflectionUtils.getAnnotationFromGetterOrField(getter, DynamoDBIndexHashKey.class); if ( indexHashKey != null ) { attributeName = indexHashKey.attributeName(); if ( attributeName != null && attributeName.length() > 0 ) return cacheAttributeName(getter, attributeName); } DynamoDBRangeKey rangeKey = ReflectionUtils.getAnnotationFromGetterOrField(getter, DynamoDBRangeKey.class); if ( rangeKey != null ) { attributeName = rangeKey.attributeName(); if ( attributeName != null && attributeName.length() > 0 ) return cacheAttributeName(getter, attributeName); } DynamoDBIndexRangeKey indexRangeKey = ReflectionUtils.getAnnotationFromGetterOrField(getter, DynamoDBIndexRangeKey.class); if ( indexRangeKey != null ) { attributeName = indexRangeKey.attributeName(); if ( attributeName != null && attributeName.length() > 0 ) return cacheAttributeName(getter, attributeName); } DynamoDBAttribute attribute = ReflectionUtils.getAnnotationFromGetterOrField(getter, DynamoDBAttribute.class); if ( attribute != null ) { attributeName = attribute.attributeName(); if ( attributeName != null && attributeName.length() > 0 ) return cacheAttributeName(getter, attributeName); } DynamoDBVersionAttribute version = ReflectionUtils.getAnnotationFromGetterOrField(getter, DynamoDBVersionAttribute.class); if ( version != null ) { attributeName = version.attributeName(); if ( attributeName != null && attributeName.length() > 0 ) return cacheAttributeName(getter, attributeName); } // Default to the camel-cased field name of the getter method, inferred // according to the Java naming convention. attributeName = ReflectionUtils.getFieldNameByGetter(getter, true); return cacheAttributeName(getter, attributeName); } }
public class class_name { String getAttributeName(Method getter) { String attributeName; readLockAttrName.lock(); try { attributeName = attributeNameCache.get(getter); // depends on control dependency: [try], data = [none] } finally { readLockAttrName.unlock(); } if ( attributeName != null ) return attributeName; DynamoDBHashKey hashKeyAnnotation = ReflectionUtils.getAnnotationFromGetterOrField(getter, DynamoDBHashKey.class); if ( hashKeyAnnotation != null ) { attributeName = hashKeyAnnotation.attributeName(); // depends on control dependency: [if], data = [none] if ( attributeName != null && attributeName.length() > 0 ) return cacheAttributeName(getter, attributeName); } DynamoDBIndexHashKey indexHashKey = ReflectionUtils.getAnnotationFromGetterOrField(getter, DynamoDBIndexHashKey.class); if ( indexHashKey != null ) { attributeName = indexHashKey.attributeName(); // depends on control dependency: [if], data = [none] if ( attributeName != null && attributeName.length() > 0 ) return cacheAttributeName(getter, attributeName); } DynamoDBRangeKey rangeKey = ReflectionUtils.getAnnotationFromGetterOrField(getter, DynamoDBRangeKey.class); if ( rangeKey != null ) { attributeName = rangeKey.attributeName(); // depends on control dependency: [if], data = [none] if ( attributeName != null && attributeName.length() > 0 ) return cacheAttributeName(getter, attributeName); } DynamoDBIndexRangeKey indexRangeKey = ReflectionUtils.getAnnotationFromGetterOrField(getter, DynamoDBIndexRangeKey.class); if ( indexRangeKey != null ) { attributeName = indexRangeKey.attributeName(); // depends on control dependency: [if], data = [none] if ( attributeName != null && attributeName.length() > 0 ) return cacheAttributeName(getter, attributeName); } DynamoDBAttribute attribute = ReflectionUtils.getAnnotationFromGetterOrField(getter, DynamoDBAttribute.class); if ( attribute != null ) { attributeName = attribute.attributeName(); // depends on control dependency: [if], data = [none] if ( attributeName != null && attributeName.length() > 0 ) return cacheAttributeName(getter, attributeName); } DynamoDBVersionAttribute version = ReflectionUtils.getAnnotationFromGetterOrField(getter, DynamoDBVersionAttribute.class); if ( version != null ) { attributeName = version.attributeName(); // depends on control dependency: [if], data = [none] if ( attributeName != null && attributeName.length() > 0 ) return cacheAttributeName(getter, attributeName); } // Default to the camel-cased field name of the getter method, inferred // according to the Java naming convention. attributeName = ReflectionUtils.getFieldNameByGetter(getter, true); return cacheAttributeName(getter, attributeName); } }
public class class_name { public static void getHeterozygousGenotype(int index, int numAlternativeAlleles, Integer alleles[]) { // index++; // double value = (-3 + Math.sqrt(1 + 8 * index)) / 2; // slower than the iterating version, right? // alleles[1] = new Double(Math.ceil(value)).intValue(); // alleles[0] = alleles[1] - ((alleles[1] + 1) * (alleles[1] +2) / 2 - index); int cursor = 0; for (int i = 0; i < numAlternativeAlleles; i++) { for (int j = i+1; j < numAlternativeAlleles +1; j++) { if (i != j) { if (cursor == index) { alleles[0] = i; alleles[1] = j; return; } cursor++; } } } } }
public class class_name { public static void getHeterozygousGenotype(int index, int numAlternativeAlleles, Integer alleles[]) { // index++; // double value = (-3 + Math.sqrt(1 + 8 * index)) / 2; // slower than the iterating version, right? // alleles[1] = new Double(Math.ceil(value)).intValue(); // alleles[0] = alleles[1] - ((alleles[1] + 1) * (alleles[1] +2) / 2 - index); int cursor = 0; for (int i = 0; i < numAlternativeAlleles; i++) { for (int j = i+1; j < numAlternativeAlleles +1; j++) { if (i != j) { if (cursor == index) { alleles[0] = i; // depends on control dependency: [if], data = [none] alleles[1] = j; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } cursor++; // depends on control dependency: [if], data = [none] } } } } }
public class class_name { private void repair(S replica) throws PersistException { replica = (S) replica.copy(); S master = mMasterStorage.prepare(); // Must copy more than just primary key properties to master since // replica object might only have alternate keys. replica.copyAllProperties(master); try { if (replica.tryLoad()) { if (master.tryLoad()) { if (replica.equalProperties(master)) { // Both are equal -- no repair needed. return; } } } else { if (!master.tryLoad()) { // Both are missing -- no repair needed. return; } } } catch (IllegalStateException e) { // Can be caused by not fully defining the primary key on the // replica, but an alternate key is. The insert will fail anyhow, // so don't try to repair. return; } catch (FetchException e) { throw e.toPersistException(); } final S finalReplica = replica; final S finalMaster = master; RepairExecutor.execute(new Runnable() { public void run() { try { Transaction txn = mRepository.enterTransaction(); try { txn.setForUpdate(true); if (finalReplica.tryLoad()) { if (finalMaster.tryLoad()) { resyncEntries(null, finalReplica, finalMaster, false); } else { resyncEntries(null, finalReplica, null, false); } } else if (finalMaster.tryLoad()) { resyncEntries(null, null, finalMaster, false); } txn.commit(); } finally { txn.exit(); } } catch (FetchException fe) { Log log = LogFactory.getLog(ReplicatedRepository.class); log.warn("Unable to check if repair is required for " + finalReplica.toStringKeyOnly(), fe); } catch (PersistException pe) { Log log = LogFactory.getLog(ReplicatedRepository.class); log.error("Unable to repair entry " + finalReplica.toStringKeyOnly(), pe); } } }); } }
public class class_name { private void repair(S replica) throws PersistException { replica = (S) replica.copy(); S master = mMasterStorage.prepare(); // Must copy more than just primary key properties to master since // replica object might only have alternate keys. replica.copyAllProperties(master); try { if (replica.tryLoad()) { if (master.tryLoad()) { if (replica.equalProperties(master)) { // Both are equal -- no repair needed. return; // depends on control dependency: [if], data = [none] } } } else { if (!master.tryLoad()) { // Both are missing -- no repair needed. return; // depends on control dependency: [if], data = [none] } } } catch (IllegalStateException e) { // Can be caused by not fully defining the primary key on the // replica, but an alternate key is. The insert will fail anyhow, // so don't try to repair. return; } catch (FetchException e) { throw e.toPersistException(); } final S finalReplica = replica; final S finalMaster = master; RepairExecutor.execute(new Runnable() { public void run() { try { Transaction txn = mRepository.enterTransaction(); try { txn.setForUpdate(true); // depends on control dependency: [try], data = [none] if (finalReplica.tryLoad()) { if (finalMaster.tryLoad()) { resyncEntries(null, finalReplica, finalMaster, false); // depends on control dependency: [if], data = [none] } else { resyncEntries(null, finalReplica, null, false); // depends on control dependency: [if], data = [none] } } else if (finalMaster.tryLoad()) { resyncEntries(null, null, finalMaster, false); // depends on control dependency: [if], data = [none] } txn.commit(); // depends on control dependency: [try], data = [none] } finally { txn.exit(); } } catch (FetchException fe) { Log log = LogFactory.getLog(ReplicatedRepository.class); log.warn("Unable to check if repair is required for " + finalReplica.toStringKeyOnly(), fe); } catch (PersistException pe) { // depends on control dependency: [catch], data = [none] Log log = LogFactory.getLog(ReplicatedRepository.class); log.error("Unable to repair entry " + finalReplica.toStringKeyOnly(), pe); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { public static int findClosestPointOnTriangle(float v0X, float v0Y, float v1X, float v1Y, float v2X, float v2Y, float pX, float pY, Vector2f result) { float abX = v1X - v0X, abY = v1Y - v0Y; float acX = v2X - v0X, acY = v2Y - v0Y; float apX = pX - v0X, apY = pY - v0Y; float d1 = abX * apX + abY * apY; float d2 = acX * apX + acY * apY; if (d1 <= 0.0f && d2 <= 0.0f) { result.x = v0X; result.y = v0Y; return POINT_ON_TRIANGLE_VERTEX_0; } float bpX = pX - v1X, bpY = pY - v1Y; float d3 = abX * bpX + abY * bpY; float d4 = acX * bpX + acY * bpY; if (d3 >= 0.0f && d4 <= d3) { result.x = v1X; result.y = v1Y; return POINT_ON_TRIANGLE_VERTEX_1; } float vc = d1 * d4 - d3 * d2; if (vc <= 0.0f && d1 >= 0.0f && d3 <= 0.0f) { float v = d1 / (d1 - d3); result.x = v0X + v * abX; result.y = v0Y + v * abY; return POINT_ON_TRIANGLE_EDGE_01; } float cpX = pX - v2X, cpY = pY - v2Y; float d5 = abX * cpX + abY * cpY; float d6 = acX * cpX + acY * cpY; if (d6 >= 0.0f && d5 <= d6) { result.x = v2X; result.y = v2Y; return POINT_ON_TRIANGLE_VERTEX_2; } float vb = d5 * d2 - d1 * d6; if (vb <= 0.0f && d2 >= 0.0f && d6 <= 0.0f) { float w = d2 / (d2 - d6); result.x = v0X + w * acX; result.y = v0Y + w * acY; return POINT_ON_TRIANGLE_EDGE_20; } float va = d3 * d6 - d5 * d4; if (va <= 0.0f && d4 - d3 >= 0.0f && d5 - d6 >= 0.0f) { float w = (d4 - d3) / (d4 - d3 + d5 - d6); result.x = v1X + w * (v2X - v1X); result.y = v1Y + w * (v2Y - v1Y); return POINT_ON_TRIANGLE_EDGE_12; } float denom = 1.0f / (va + vb + vc); float v = vb * denom; float w = vc * denom; result.x = v0X + abX * v + acX * w; result.y = v0Y + abY * v + acY * w; return POINT_ON_TRIANGLE_FACE; } }
public class class_name { public static int findClosestPointOnTriangle(float v0X, float v0Y, float v1X, float v1Y, float v2X, float v2Y, float pX, float pY, Vector2f result) { float abX = v1X - v0X, abY = v1Y - v0Y; float acX = v2X - v0X, acY = v2Y - v0Y; float apX = pX - v0X, apY = pY - v0Y; float d1 = abX * apX + abY * apY; float d2 = acX * apX + acY * apY; if (d1 <= 0.0f && d2 <= 0.0f) { result.x = v0X; // depends on control dependency: [if], data = [none] result.y = v0Y; // depends on control dependency: [if], data = [none] return POINT_ON_TRIANGLE_VERTEX_0; // depends on control dependency: [if], data = [none] } float bpX = pX - v1X, bpY = pY - v1Y; float d3 = abX * bpX + abY * bpY; float d4 = acX * bpX + acY * bpY; if (d3 >= 0.0f && d4 <= d3) { result.x = v1X; // depends on control dependency: [if], data = [none] result.y = v1Y; // depends on control dependency: [if], data = [none] return POINT_ON_TRIANGLE_VERTEX_1; // depends on control dependency: [if], data = [none] } float vc = d1 * d4 - d3 * d2; if (vc <= 0.0f && d1 >= 0.0f && d3 <= 0.0f) { float v = d1 / (d1 - d3); result.x = v0X + v * abX; // depends on control dependency: [if], data = [none] result.y = v0Y + v * abY; // depends on control dependency: [if], data = [none] return POINT_ON_TRIANGLE_EDGE_01; // depends on control dependency: [if], data = [none] } float cpX = pX - v2X, cpY = pY - v2Y; float d5 = abX * cpX + abY * cpY; float d6 = acX * cpX + acY * cpY; if (d6 >= 0.0f && d5 <= d6) { result.x = v2X; // depends on control dependency: [if], data = [none] result.y = v2Y; // depends on control dependency: [if], data = [none] return POINT_ON_TRIANGLE_VERTEX_2; // depends on control dependency: [if], data = [none] } float vb = d5 * d2 - d1 * d6; if (vb <= 0.0f && d2 >= 0.0f && d6 <= 0.0f) { float w = d2 / (d2 - d6); result.x = v0X + w * acX; // depends on control dependency: [if], data = [none] result.y = v0Y + w * acY; // depends on control dependency: [if], data = [none] return POINT_ON_TRIANGLE_EDGE_20; // depends on control dependency: [if], data = [none] } float va = d3 * d6 - d5 * d4; if (va <= 0.0f && d4 - d3 >= 0.0f && d5 - d6 >= 0.0f) { float w = (d4 - d3) / (d4 - d3 + d5 - d6); result.x = v1X + w * (v2X - v1X); // depends on control dependency: [if], data = [none] result.y = v1Y + w * (v2Y - v1Y); // depends on control dependency: [if], data = [none] return POINT_ON_TRIANGLE_EDGE_12; // depends on control dependency: [if], data = [none] } float denom = 1.0f / (va + vb + vc); float v = vb * denom; float w = vc * denom; result.x = v0X + abX * v + acX * w; result.y = v0Y + abY * v + acY * w; return POINT_ON_TRIANGLE_FACE; } }
public class class_name { @SuppressWarnings({ "rawtypes" }) private String generateBundleInterface(JClassType bundleClass, TreeLogger logger, GeneratorContext context) { Class bundleJavaClass; String bundleName = bundleClass.getQualifiedSourceName(); try { bundleJavaClass = Class.forName(bundleName); } catch (ClassNotFoundException e) { throw new TypeNotFoundException(bundleName); } @SuppressWarnings("unchecked") String bundleClassName = NlsBundleHelper.getInstance().getQualifiedLocation(bundleJavaClass); String simpleName = bundleClassName; String packageName = ""; int lastDot = bundleClassName.lastIndexOf('.'); if (lastDot > 0) { packageName = bundleClassName.substring(0, lastDot); simpleName = bundleClassName.substring(lastDot + 1); } if (bundleClassName.equals(bundleName)) { logger.log(TreeLogger.ERROR, getClass().getSimpleName() + ": Illegal NlsBundle '" + bundleName + "' - has to end with suffix 'Root'. Localization will not work!"); simpleName = simpleName + "_Interface"; } logger.log(TreeLogger.INFO, getClass().getSimpleName() + ": Generating " + simpleName); ClassSourceFileComposerFactory sourceComposerFactory = new ClassSourceFileComposerFactory(packageName, simpleName); sourceComposerFactory.makeInterface(); // import statements sourceComposerFactory.addImport(Constants.class.getName()); sourceComposerFactory.addImport(Generate.class.getCanonicalName()); sourceComposerFactory.addImplementedInterface(Constants.class.getSimpleName()); // @Generate annotation StringBuilder annotationBuffer = new StringBuilder(); annotationBuffer.append("@"); annotationBuffer.append(Generate.class.getSimpleName()); annotationBuffer.append("(format = \""); annotationBuffer.append(PropertiesFormat.class.getName()); annotationBuffer.append("\")"); sourceComposerFactory.addAnnotationDeclaration(annotationBuffer.toString()); PrintWriter writer = context.tryCreate(logger, packageName, simpleName); if (writer != null) { SourceWriter sourceWriter = sourceComposerFactory.createSourceWriter(context, writer); // generate methods for fields of bundle for (JMethod method : bundleClass.getOverridableMethods()) { JType returnType = method.getReturnType(); if (!isLookupMethod(method)) { if (!NlsMessage.class.getName().equals(returnType.getQualifiedSourceName())) { throw new IllegalCaseException(returnType.getQualifiedSourceName()); } NlsBundleMessage messageAnnotation = method.getAnnotation(NlsBundleMessage.class); if (messageAnnotation != null) { String message = messageAnnotation.value(); // generate message annotation sourceWriter.print("@DefaultStringValue(\""); sourceWriter.print(escape(message)); sourceWriter.println("\")"); } NlsBundleKey keyAnnotation = method.getAnnotation(NlsBundleKey.class); if (keyAnnotation != null) { // generate key annotation sourceWriter.print("@Key(\""); sourceWriter.print(escape(keyAnnotation.value())); sourceWriter.println("\")"); } // generate method sourceWriter.print("String "); sourceWriter.print(method.getName()); sourceWriter.println("();"); sourceWriter.println(); } } sourceWriter.commit(logger); } return sourceComposerFactory.getCreatedClassName(); } }
public class class_name { @SuppressWarnings({ "rawtypes" }) private String generateBundleInterface(JClassType bundleClass, TreeLogger logger, GeneratorContext context) { Class bundleJavaClass; String bundleName = bundleClass.getQualifiedSourceName(); try { bundleJavaClass = Class.forName(bundleName); // depends on control dependency: [try], data = [none] } catch (ClassNotFoundException e) { throw new TypeNotFoundException(bundleName); } // depends on control dependency: [catch], data = [none] @SuppressWarnings("unchecked") String bundleClassName = NlsBundleHelper.getInstance().getQualifiedLocation(bundleJavaClass); String simpleName = bundleClassName; String packageName = ""; int lastDot = bundleClassName.lastIndexOf('.'); if (lastDot > 0) { packageName = bundleClassName.substring(0, lastDot); // depends on control dependency: [if], data = [none] simpleName = bundleClassName.substring(lastDot + 1); // depends on control dependency: [if], data = [(lastDot] } if (bundleClassName.equals(bundleName)) { logger.log(TreeLogger.ERROR, getClass().getSimpleName() + ": Illegal NlsBundle '" + bundleName + "' - has to end with suffix 'Root'. Localization will not work!"); // depends on control dependency: [if], data = [none] simpleName = simpleName + "_Interface"; // depends on control dependency: [if], data = [none] } logger.log(TreeLogger.INFO, getClass().getSimpleName() + ": Generating " + simpleName); ClassSourceFileComposerFactory sourceComposerFactory = new ClassSourceFileComposerFactory(packageName, simpleName); sourceComposerFactory.makeInterface(); // import statements sourceComposerFactory.addImport(Constants.class.getName()); sourceComposerFactory.addImport(Generate.class.getCanonicalName()); sourceComposerFactory.addImplementedInterface(Constants.class.getSimpleName()); // @Generate annotation StringBuilder annotationBuffer = new StringBuilder(); annotationBuffer.append("@"); annotationBuffer.append(Generate.class.getSimpleName()); annotationBuffer.append("(format = \""); annotationBuffer.append(PropertiesFormat.class.getName()); annotationBuffer.append("\")"); sourceComposerFactory.addAnnotationDeclaration(annotationBuffer.toString()); PrintWriter writer = context.tryCreate(logger, packageName, simpleName); if (writer != null) { SourceWriter sourceWriter = sourceComposerFactory.createSourceWriter(context, writer); // generate methods for fields of bundle for (JMethod method : bundleClass.getOverridableMethods()) { JType returnType = method.getReturnType(); if (!isLookupMethod(method)) { if (!NlsMessage.class.getName().equals(returnType.getQualifiedSourceName())) { throw new IllegalCaseException(returnType.getQualifiedSourceName()); } NlsBundleMessage messageAnnotation = method.getAnnotation(NlsBundleMessage.class); if (messageAnnotation != null) { String message = messageAnnotation.value(); // generate message annotation sourceWriter.print("@DefaultStringValue(\""); sourceWriter.print(escape(message)); sourceWriter.println("\")"); // depends on control dependency: [if], data = [none] } NlsBundleKey keyAnnotation = method.getAnnotation(NlsBundleKey.class); if (keyAnnotation != null) { // generate key annotation sourceWriter.print("@Key(\""); sourceWriter.print(escape(keyAnnotation.value())); sourceWriter.println("\")"); // depends on control dependency: [if], data = [none] } // generate method sourceWriter.print("String "); // depends on control dependency: [if], data = [none] sourceWriter.print(method.getName()); // depends on control dependency: [if], data = [none] sourceWriter.println("();"); // depends on control dependency: [if], data = [none] sourceWriter.println(); // depends on control dependency: [if], data = [none] } } sourceWriter.commit(logger); // depends on control dependency: [if], data = [none] } return sourceComposerFactory.getCreatedClassName(); } }
public class class_name { public static ClassLoader getArtifactClassloader(MavenProject project, boolean includeArtifact, boolean includeTestOutputDirectory, Class clazz, Log log, boolean verbose) throws MalformedURLException { if (verbose) { log.info("Loading artifacts into URLClassLoader"); } Set<URI> uris = new HashSet<>(); // Find project dependencies, including the transitive ones. Set dependencies = project.getArtifacts(); if ((dependencies != null) && !dependencies.isEmpty()) { for (Iterator it = dependencies.iterator(); it.hasNext();) { addArtifact(uris, (Artifact) it.next(), log, verbose); } } else { log.info("there are no resolved artifacts for the Maven project."); } // Include the artifact for the actual maven project if requested if (includeArtifact) { // If the actual artifact can be resolved, then use that, otherwise use the build // directory as that should contain the files for this project that we will need to // run against. It is possible that the build directly could be empty, but we cannot // directly include the source and resources as the resources may require filtering // to replace any placeholders in the resource files. Artifact a = project.getArtifact(); if (a.getFile() != null) { addArtifact(uris, a, log, verbose); } else { addFile(uris, new File(project.getBuild().getOutputDirectory()), log, verbose); } } if (includeTestOutputDirectory) { addFile(uris, new File(project.getBuild().getTestOutputDirectory()), log, verbose); } if (verbose) { log.info(LOG_SEPARATOR); } List<URI> uriList = new ArrayList<>(uris); URL[] urlArray = new URL[uris.size()]; for (int i=0; i<uris.size(); i++ ) { urlArray[i] = uriList.get(i).toURL(); } return new URLClassLoader(urlArray, clazz.getClassLoader()); } }
public class class_name { public static ClassLoader getArtifactClassloader(MavenProject project, boolean includeArtifact, boolean includeTestOutputDirectory, Class clazz, Log log, boolean verbose) throws MalformedURLException { if (verbose) { log.info("Loading artifacts into URLClassLoader"); } Set<URI> uris = new HashSet<>(); // Find project dependencies, including the transitive ones. Set dependencies = project.getArtifacts(); if ((dependencies != null) && !dependencies.isEmpty()) { for (Iterator it = dependencies.iterator(); it.hasNext();) { addArtifact(uris, (Artifact) it.next(), log, verbose); // depends on control dependency: [for], data = [it] } } else { log.info("there are no resolved artifacts for the Maven project."); } // Include the artifact for the actual maven project if requested if (includeArtifact) { // If the actual artifact can be resolved, then use that, otherwise use the build // directory as that should contain the files for this project that we will need to // run against. It is possible that the build directly could be empty, but we cannot // directly include the source and resources as the resources may require filtering // to replace any placeholders in the resource files. Artifact a = project.getArtifact(); if (a.getFile() != null) { addArtifact(uris, a, log, verbose); // depends on control dependency: [if], data = [none] } else { addFile(uris, new File(project.getBuild().getOutputDirectory()), log, verbose); // depends on control dependency: [if], data = [none] } } if (includeTestOutputDirectory) { addFile(uris, new File(project.getBuild().getTestOutputDirectory()), log, verbose); } if (verbose) { log.info(LOG_SEPARATOR); } List<URI> uriList = new ArrayList<>(uris); URL[] urlArray = new URL[uris.size()]; for (int i=0; i<uris.size(); i++ ) { urlArray[i] = uriList.get(i).toURL(); } return new URLClassLoader(urlArray, clazz.getClassLoader()); } }
public class class_name { public Map<String, CellStyle> getCellStyleMapping() { if (this.cellStyleMapping == null) { this.cellStyleMapping = new HashMap<String, CellStyle>(16); } return cellStyleMapping; } }
public class class_name { public Map<String, CellStyle> getCellStyleMapping() { if (this.cellStyleMapping == null) { this.cellStyleMapping = new HashMap<String, CellStyle>(16); // depends on control dependency: [if], data = [none] } return cellStyleMapping; } }
public class class_name { public void setAlert(final boolean ALERT) { if (null == alert) { _alert = ALERT; fireTileEvent(ALERT_EVENT); } else { alert.set(ALERT); } } }
public class class_name { public void setAlert(final boolean ALERT) { if (null == alert) { _alert = ALERT; // depends on control dependency: [if], data = [none] fireTileEvent(ALERT_EVENT); // depends on control dependency: [if], data = [none] } else { alert.set(ALERT); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public boolean close() { this.open = false; for (int i = 0; i < listeningStreams.get(); i++) { try{ this.queue.offer((T) POISON_PILL); }catch(Exception e){ } } return true; } }
public class class_name { @Override public boolean close() { this.open = false; for (int i = 0; i < listeningStreams.get(); i++) { try{ this.queue.offer((T) POISON_PILL); // depends on control dependency: [try], data = [none] }catch(Exception e){ } // depends on control dependency: [catch], data = [none] } return true; } }
public class class_name { public static String relativize(File baseDir, File file) { try { baseDir = baseDir.getCanonicalFile(); file = file.getCanonicalFile(); return baseDir.toURI().relativize(file.toURI()).getPath(); } catch (IOException e) { throw new DockerClientException(e.getMessage(), e); } } }
public class class_name { public static String relativize(File baseDir, File file) { try { baseDir = baseDir.getCanonicalFile(); // depends on control dependency: [try], data = [none] file = file.getCanonicalFile(); // depends on control dependency: [try], data = [none] return baseDir.toURI().relativize(file.toURI()).getPath(); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new DockerClientException(e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public Map<String, List<Item>> getTableItems() { Map<String, List<Map<String, AttributeValue>>> res = result.getResponses(); Map<String, List<Item>> map = new LinkedHashMap<String, List<Item>>(res.size()); for (Map.Entry<String, List<Map<String, AttributeValue>>> e : res.entrySet()) { String tableName = e.getKey(); List<Map<String, AttributeValue>> items = e.getValue(); map.put(tableName, InternalUtils.toItemList(items)); } return map; } }
public class class_name { public Map<String, List<Item>> getTableItems() { Map<String, List<Map<String, AttributeValue>>> res = result.getResponses(); Map<String, List<Item>> map = new LinkedHashMap<String, List<Item>>(res.size()); for (Map.Entry<String, List<Map<String, AttributeValue>>> e : res.entrySet()) { String tableName = e.getKey(); List<Map<String, AttributeValue>> items = e.getValue(); map.put(tableName, InternalUtils.toItemList(items)); // depends on control dependency: [for], data = [e] } return map; } }
public class class_name { public static void deleteDirectoryContents(Path path, RecursiveDeleteOption... options) throws IOException { Collection<IOException> exceptions = null; // created lazily if needed try (DirectoryStream<Path> stream = Files.newDirectoryStream(path)) { if (stream instanceof SecureDirectoryStream) { SecureDirectoryStream<Path> sds = (SecureDirectoryStream<Path>) stream; exceptions = deleteDirectoryContentsSecure(sds); } else { checkAllowsInsecure(path, options); exceptions = deleteDirectoryContentsInsecure(stream); } } catch (IOException e) { if (exceptions == null) { throw e; } else { exceptions.add(e); } } if (exceptions != null) { throwDeleteFailed(path, exceptions); } } }
public class class_name { public static void deleteDirectoryContents(Path path, RecursiveDeleteOption... options) throws IOException { Collection<IOException> exceptions = null; // created lazily if needed try (DirectoryStream<Path> stream = Files.newDirectoryStream(path)) { if (stream instanceof SecureDirectoryStream) { SecureDirectoryStream<Path> sds = (SecureDirectoryStream<Path>) stream; exceptions = deleteDirectoryContentsSecure(sds); // depends on control dependency: [if], data = [none] } else { checkAllowsInsecure(path, options); // depends on control dependency: [if], data = [none] exceptions = deleteDirectoryContentsInsecure(stream); // depends on control dependency: [if], data = [none] } } catch (IOException e) { if (exceptions == null) { throw e; } else { exceptions.add(e); // depends on control dependency: [if], data = [none] } } if (exceptions != null) { throwDeleteFailed(path, exceptions); } } }
public class class_name { public void updateBitmapShader() { if (image == null) return; shader = new BitmapShader(image, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); if(canvasSize != image.getWidth() || canvasSize != image.getHeight()) { Matrix matrix = new Matrix(); float scale = (float) canvasSize / (float) image.getWidth(); matrix.setScale(scale, scale); shader.setLocalMatrix(matrix); } } }
public class class_name { public void updateBitmapShader() { if (image == null) return; shader = new BitmapShader(image, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); if(canvasSize != image.getWidth() || canvasSize != image.getHeight()) { Matrix matrix = new Matrix(); float scale = (float) canvasSize / (float) image.getWidth(); matrix.setScale(scale, scale); // depends on control dependency: [if], data = [none] shader.setLocalMatrix(matrix); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public void updateHeaders(RequestContext context, Multimap<String, String> headers) { if (!proxyPassReverse) { return; } for (Map.Entry<String, String> h : new LinkedHashSet<>(headers.entries())) { if (REVERSE_PROXY_HEADERS.contains(h.getKey())) { URI location = URI.create(h.getValue()).normalize(); if (location.isAbsolute() && isBackendLocation(location)) { String initial = context.request().uri(); URI uri = URI.create(initial); try { URI newURI = new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), location.getPath(), location.getQuery(), location.getFragment()); headers.remove(h.getKey(), h.getValue()); headers.put(h.getKey(), newURI.toString()); } catch (URISyntaxException e) { logger.error("Cannot manipulate the header {} (value={}) to enforce reverse routing", h .getKey(), h.getValue(), e); } } } } } }
public class class_name { @Override public void updateHeaders(RequestContext context, Multimap<String, String> headers) { if (!proxyPassReverse) { return; // depends on control dependency: [if], data = [none] } for (Map.Entry<String, String> h : new LinkedHashSet<>(headers.entries())) { if (REVERSE_PROXY_HEADERS.contains(h.getKey())) { URI location = URI.create(h.getValue()).normalize(); if (location.isAbsolute() && isBackendLocation(location)) { String initial = context.request().uri(); URI uri = URI.create(initial); try { URI newURI = new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), location.getPath(), location.getQuery(), location.getFragment()); headers.remove(h.getKey(), h.getValue()); // depends on control dependency: [try], data = [none] headers.put(h.getKey(), newURI.toString()); // depends on control dependency: [try], data = [none] } catch (URISyntaxException e) { logger.error("Cannot manipulate the header {} (value={}) to enforce reverse routing", h .getKey(), h.getValue(), e); } // depends on control dependency: [catch], data = [none] } } } } }
public class class_name { public JSONEmitter addObject(String name, String value) { checkComma(); write("{\""); write(encodeString(name)); write("\":\""); if (value != null) { write(encodeString(value)); } write("\"}"); return this; } }
public class class_name { public JSONEmitter addObject(String name, String value) { checkComma(); write("{\""); write(encodeString(name)); write("\":\""); if (value != null) { write(encodeString(value)); // depends on control dependency: [if], data = [(value] } write("\"}"); return this; } }
public class class_name { public static double quantile(double[] data, int begin, int end, double quant) { final int length = end - begin; assert (length > 0) : "Quantile on empty set?"; // Integer division is "floor" since we are non-negative. final double dleft = begin + (length - 1) * quant; final int ileft = (int) Math.floor(dleft); final double err = dleft - ileft; quickSelect(data, begin, end, ileft); if(err <= Double.MIN_NORMAL) { return data[ileft]; } else { quickSelect(data, ileft + 1, end, ileft + 1); // Mix: double mix = data[ileft] + (data[ileft + 1] - data[ileft]) * err; return mix; } } }
public class class_name { public static double quantile(double[] data, int begin, int end, double quant) { final int length = end - begin; assert (length > 0) : "Quantile on empty set?"; // Integer division is "floor" since we are non-negative. final double dleft = begin + (length - 1) * quant; final int ileft = (int) Math.floor(dleft); final double err = dleft - ileft; quickSelect(data, begin, end, ileft); if(err <= Double.MIN_NORMAL) { return data[ileft]; // depends on control dependency: [if], data = [none] } else { quickSelect(data, ileft + 1, end, ileft + 1); // depends on control dependency: [if], data = [none] // Mix: double mix = data[ileft] + (data[ileft + 1] - data[ileft]) * err; return mix; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static RgbaColor fromHsl(float H, float S, float L) { // convert to [0-1] H /= 360f; S /= 100f; L /= 100f; float R, G, B; if (S == 0) { // grey R = G = B = L; } else { float m2 = L <= 0.5 ? L * (S + 1f) : L + S - L * S; float m1 = 2f * L - m2; R = hue2rgb(m1, m2, H + 1 / 3f); G = hue2rgb(m1, m2, H); B = hue2rgb(m1, m2, H - 1 / 3f); } // convert [0-1] to [0-255] int r = Math.round(R * 255f); int g = Math.round(G * 255f); int b = Math.round(B * 255f); return new RgbaColor(r, g, b, 1); } }
public class class_name { public static RgbaColor fromHsl(float H, float S, float L) { // convert to [0-1] H /= 360f; S /= 100f; L /= 100f; float R, G, B; if (S == 0) { // grey R = G = B = L; // depends on control dependency: [if], data = [none] } else { float m2 = L <= 0.5 ? L * (S + 1f) : L + S - L * S; float m1 = 2f * L - m2; R = hue2rgb(m1, m2, H + 1 / 3f); // depends on control dependency: [if], data = [none] G = hue2rgb(m1, m2, H); // depends on control dependency: [if], data = [none] B = hue2rgb(m1, m2, H - 1 / 3f); // depends on control dependency: [if], data = [none] } // convert [0-1] to [0-255] int r = Math.round(R * 255f); int g = Math.round(G * 255f); int b = Math.round(B * 255f); return new RgbaColor(r, g, b, 1); } }
public class class_name { public void marshall(CreateAuthorizerRequest createAuthorizerRequest, ProtocolMarshaller protocolMarshaller) { if (createAuthorizerRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createAuthorizerRequest.getAuthorizerName(), AUTHORIZERNAME_BINDING); protocolMarshaller.marshall(createAuthorizerRequest.getAuthorizerFunctionArn(), AUTHORIZERFUNCTIONARN_BINDING); protocolMarshaller.marshall(createAuthorizerRequest.getTokenKeyName(), TOKENKEYNAME_BINDING); protocolMarshaller.marshall(createAuthorizerRequest.getTokenSigningPublicKeys(), TOKENSIGNINGPUBLICKEYS_BINDING); protocolMarshaller.marshall(createAuthorizerRequest.getStatus(), STATUS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(CreateAuthorizerRequest createAuthorizerRequest, ProtocolMarshaller protocolMarshaller) { if (createAuthorizerRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(createAuthorizerRequest.getAuthorizerName(), AUTHORIZERNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createAuthorizerRequest.getAuthorizerFunctionArn(), AUTHORIZERFUNCTIONARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createAuthorizerRequest.getTokenKeyName(), TOKENKEYNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createAuthorizerRequest.getTokenSigningPublicKeys(), TOKENSIGNINGPUBLICKEYS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(createAuthorizerRequest.getStatus(), STATUS_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }