code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
---|---|
public class class_name {
public static String joinURL(Map<URLParts, String> urlParts) {
try {
URI uri = new URI(urlParts.get(URLParts.PROTOCOL), urlParts.get(URLParts.AUTHORITY), urlParts.get(URLParts.PATH), urlParts.get(URLParts.QUERY), urlParts.get(URLParts.REF));
return uri.toString();
}
catch (URISyntaxException ex) {
throw new RuntimeException(ex);
}
} } | public class class_name {
public static String joinURL(Map<URLParts, String> urlParts) {
try {
URI uri = new URI(urlParts.get(URLParts.PROTOCOL), urlParts.get(URLParts.AUTHORITY), urlParts.get(URLParts.PATH), urlParts.get(URLParts.QUERY), urlParts.get(URLParts.REF));
return uri.toString(); // depends on control dependency: [try], data = [none]
}
catch (URISyntaxException ex) {
throw new RuntimeException(ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private boolean isVolumeIdExists(final List<String> volumeIds, final String volumeId) {
if (volumeIds != null && volumeIds.size() > 0) {
for (String volId : volumeIds) {
if (volId.equals(volumeId)) {
return true;
}
}
}
return false;
} } | public class class_name {
private boolean isVolumeIdExists(final List<String> volumeIds, final String volumeId) {
if (volumeIds != null && volumeIds.size() > 0) {
for (String volId : volumeIds) {
if (volId.equals(volumeId)) {
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false;
} } |
public class class_name {
synchronized void collectPages(Collection<Long> offsets, Collection<PageWrapper> target) {
offsets.forEach(offset -> {
PageWrapper p = this.pageByOffset.getOrDefault(offset, null);
if (p != null) {
target.add(p);
}
});
} } | public class class_name {
synchronized void collectPages(Collection<Long> offsets, Collection<PageWrapper> target) {
offsets.forEach(offset -> {
PageWrapper p = this.pageByOffset.getOrDefault(offset, null);
if (p != null) {
target.add(p); // depends on control dependency: [if], data = [(p]
}
});
} } |
public class class_name {
public static SourceLineAnnotation fromVisitedInstructionRange(BytecodeScanningDetector visitor, int startPC, int endPC) {
LineNumberTable lineNumberTable = getLineNumberTable(visitor);
String className = visitor.getDottedClassName();
String sourceFile = visitor.getSourceFile();
if (lineNumberTable == null) {
return createUnknown(className, sourceFile, startPC, endPC);
}
int startLine = lineNumberTable.getSourceLine(startPC);
int endLine = lineNumberTable.getSourceLine(endPC);
return new SourceLineAnnotation(className, sourceFile, startLine, endLine, startPC, endPC);
} } | public class class_name {
public static SourceLineAnnotation fromVisitedInstructionRange(BytecodeScanningDetector visitor, int startPC, int endPC) {
LineNumberTable lineNumberTable = getLineNumberTable(visitor);
String className = visitor.getDottedClassName();
String sourceFile = visitor.getSourceFile();
if (lineNumberTable == null) {
return createUnknown(className, sourceFile, startPC, endPC); // depends on control dependency: [if], data = [none]
}
int startLine = lineNumberTable.getSourceLine(startPC);
int endLine = lineNumberTable.getSourceLine(endPC);
return new SourceLineAnnotation(className, sourceFile, startLine, endLine, startPC, endPC);
} } |
public class class_name {
void processPing(final HttpServerExchange exchange, final RequestData requestData) throws IOException {
final String jvmRoute = requestData.getFirst(JVMROUTE);
final String scheme = requestData.getFirst(SCHEME);
final String host = requestData.getFirst(HOST);
final String port = requestData.getFirst(PORT);
final String OK = "Type=PING-RSP&State=OK&id=" + creationTime;
final String NOTOK = "Type=PING-RSP&State=NOTOK&id=" + creationTime;
if (jvmRoute != null) {
// ping the corresponding node.
final Node nodeConfig = container.getNode(jvmRoute);
if (nodeConfig == null) {
sendResponse(exchange, NOTOK);
return;
}
final NodePingUtil.PingCallback callback = new NodePingUtil.PingCallback() {
@Override
public void completed() {
try {
sendResponse(exchange, OK);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void failed() {
try {
nodeConfig.markInError();
sendResponse(exchange, NOTOK);
} catch (Exception e) {
e.printStackTrace();
}
}
};
nodeConfig.ping(exchange, callback);
} else {
if (scheme == null && host == null && port == null) {
sendResponse(exchange, OK);
return;
} else {
if (host == null || port == null) {
processError(TYPESYNTAX, SMISFLD, exchange);
return;
}
// Check whether we can reach the host
checkHostUp(scheme, host, Integer.parseInt(port), exchange, new NodePingUtil.PingCallback() {
@Override
public void completed() {
sendResponse(exchange, OK);
}
@Override
public void failed() {
sendResponse(exchange, NOTOK);
}
});
return;
}
}
} } | public class class_name {
void processPing(final HttpServerExchange exchange, final RequestData requestData) throws IOException {
final String jvmRoute = requestData.getFirst(JVMROUTE);
final String scheme = requestData.getFirst(SCHEME);
final String host = requestData.getFirst(HOST);
final String port = requestData.getFirst(PORT);
final String OK = "Type=PING-RSP&State=OK&id=" + creationTime;
final String NOTOK = "Type=PING-RSP&State=NOTOK&id=" + creationTime;
if (jvmRoute != null) {
// ping the corresponding node.
final Node nodeConfig = container.getNode(jvmRoute);
if (nodeConfig == null) {
sendResponse(exchange, NOTOK);
return;
}
final NodePingUtil.PingCallback callback = new NodePingUtil.PingCallback() {
@Override
public void completed() {
try {
sendResponse(exchange, OK); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
@Override
public void failed() {
try {
nodeConfig.markInError(); // depends on control dependency: [try], data = [none]
sendResponse(exchange, NOTOK); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
};
nodeConfig.ping(exchange, callback);
} else {
if (scheme == null && host == null && port == null) {
sendResponse(exchange, OK);
return;
} else {
if (host == null || port == null) {
processError(TYPESYNTAX, SMISFLD, exchange);
return;
}
// Check whether we can reach the host
checkHostUp(scheme, host, Integer.parseInt(port), exchange, new NodePingUtil.PingCallback() {
@Override
public void completed() {
sendResponse(exchange, OK);
}
@Override
public void failed() {
sendResponse(exchange, NOTOK);
}
});
return;
}
}
} } |
public class class_name {
public void updateSelection(Color color) {
setFocusedSquare(null);
for (ColorSquare c : colorPickerGrid.getSquares()) {
if (c.rectangle.getFill().equals(color)) {
setFocusedSquare(c);
return;
}
}
// check custom colors
for (Node n : customColorGrid.getChildren()) {
ColorSquare c = (ColorSquare) n;
if (c.rectangle.getFill().equals(color)) {
setFocusedSquare(c);
return;
}
}
} } | public class class_name {
public void updateSelection(Color color) {
setFocusedSquare(null);
for (ColorSquare c : colorPickerGrid.getSquares()) {
if (c.rectangle.getFill().equals(color)) {
setFocusedSquare(c); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
}
// check custom colors
for (Node n : customColorGrid.getChildren()) {
ColorSquare c = (ColorSquare) n;
if (c.rectangle.getFill().equals(color)) {
setFocusedSquare(c); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static void setViewPortListeners(JTable table) {
table.addPropertyChangeListener("ancestor", createAncestorPropertyChangeListener(table));
// Install a listener to cause the whole table to repaint when a column
// is resized. We do this because the extended grid lines may need to be
// repainted. This could be cleaned up, but for now, it works fine.
for (int i = 0; i < table.getColumnModel().getColumnCount(); i++) {
table.getColumnModel().getColumn(i).addPropertyChangeListener(createAncestorPropertyChangeListener(table));
table.getColumnModel().addColumnModelListener(createTableColumnModelListener(table));
}
} } | public class class_name {
public static void setViewPortListeners(JTable table) {
table.addPropertyChangeListener("ancestor", createAncestorPropertyChangeListener(table));
// Install a listener to cause the whole table to repaint when a column
// is resized. We do this because the extended grid lines may need to be
// repainted. This could be cleaned up, but for now, it works fine.
for (int i = 0; i < table.getColumnModel().getColumnCount(); i++) {
table.getColumnModel().getColumn(i).addPropertyChangeListener(createAncestorPropertyChangeListener(table)); // depends on control dependency: [for], data = [i]
table.getColumnModel().addColumnModelListener(createTableColumnModelListener(table)); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
public static <T> List<List<T>> zip(final List<T> ... lists) {
final List<List<T>> zipped = newArrayList();
each(Arrays.asList(lists), new Consumer<List<T>>() {
@Override
public void accept(final List<T> list) {
int index = 0;
for (T elem : list) {
final List<T> nTuple = index >= zipped.size() ? U.<T>newArrayList() : zipped.get(index);
if (index >= zipped.size()) {
zipped.add(nTuple);
}
index += 1;
nTuple.add(elem);
}
}
});
return zipped;
} } | public class class_name {
@SuppressWarnings("unchecked")
public static <T> List<List<T>> zip(final List<T> ... lists) {
final List<List<T>> zipped = newArrayList();
each(Arrays.asList(lists), new Consumer<List<T>>() {
@Override
public void accept(final List<T> list) {
int index = 0;
for (T elem : list) {
final List<T> nTuple = index >= zipped.size() ? U.<T>newArrayList() : zipped.get(index);
if (index >= zipped.size()) {
zipped.add(nTuple); // depends on control dependency: [if], data = [none]
}
index += 1; // depends on control dependency: [for], data = [none]
nTuple.add(elem); // depends on control dependency: [for], data = [elem]
}
}
});
return zipped;
} } |
public class class_name {
public int compareTo(Error s) {
if (getStart() < s.getStart()) {
return -1;
} else if (getStart() == s.getStart()) {
if (getEnd() > s.getEnd()) {
return -1;
} else if (getEnd() < s.getEnd()) {
return 1;
} else {
return 0;
}
} else {
return 1;
}
} } | public class class_name {
public int compareTo(Error s) {
if (getStart() < s.getStart()) {
return -1; // depends on control dependency: [if], data = [none]
} else if (getStart() == s.getStart()) {
if (getEnd() > s.getEnd()) {
return -1; // depends on control dependency: [if], data = [none]
} else if (getEnd() < s.getEnd()) {
return 1; // depends on control dependency: [if], data = [none]
} else {
return 0; // depends on control dependency: [if], data = [none]
}
} else {
return 1; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public final boolean containsExactly(LocatedString other) {
if (!referenceCharOffsetsSequential() && other.referenceCharOffsetsSequential()) {
throw new UnsupportedOperationException("Containment for non-monotonic LocatedStrings needs"
+ " to be implemented");
}
if (!referenceBounds().asCharOffsetRange().contains(other.referenceBounds().asCharOffsetRange())
|| !referenceBounds().asEdtOffsetRange()
.contains(other.referenceBounds().asEdtOffsetRange())) {
// quick, cheap short-circuit check
return false;
}
// which of our character regions contains the start character offset of the putative substring?
final Optional<Integer> startRegionIndex =
firstRegionIndexContainingReferenceCharOffset(other.referenceBounds().startCharOffsetInclusive());
// which of our character regions contains the end character offset of the putative substring?
final Optional<Integer> endRegionIndex =
firstRegionIndexContainingReferenceCharOffset(other.referenceBounds().endCharOffsetInclusive());
// if we don't have any region containing them, it can't be a substring
if (!startRegionIndex.isPresent() || !endRegionIndex.isPresent()) {
return false;
}
final int numThisRegionsPossiblyOverlappingSubstring =
endRegionIndex.get() - startRegionIndex.get() + 1;
// we know if they are a substring this must be equal because both are in canonical form
if (numThisRegionsPossiblyOverlappingSubstring != other.characterRegions().size()) {
return false;
}
final CharOffset earliestPossibleMatchingContentOffset;
final CharOffset latestPossibleMatchingContentOffset;
if (numThisRegionsPossiblyOverlappingSubstring == 1) {
// special case for when the putative substring would be contained entirely in just one
// of our character regions
final CharacterRegion containerOnlyMatchingRegion =
characterRegions().get(startRegionIndex.get());
final CharacterRegion containeeOnlyRegion = other.characterRegions().get(0);
if (containerOnlyMatchingRegion.contains(containeeOnlyRegion)) {
earliestPossibleMatchingContentOffset =
containerOnlyMatchingRegion.absoluteStartingContentOffsetOfReferenceCharOffset(
containeeOnlyRegion.referenceStartOffsetInclusive().charOffset());
latestPossibleMatchingContentOffset =
containerOnlyMatchingRegion.absoluteEndingContentOffsetOfReferenceCharOffset(
containeeOnlyRegion.referenceEndOffsetInclusive().charOffset());
} else {
return false;
}
} else {
// if the putative substring covers more than one of our character regions, then
// its first region must be a suffix of our first region...
final CharacterRegion containerFirstMatchingRegion =
characterRegions().get(startRegionIndex.get());
final CharacterRegion containeeFirstRegion = other.characterRegions().get(0);
if (!containeeFirstRegion.isSuffixOf(containerFirstMatchingRegion)) {
return false;
}
earliestPossibleMatchingContentOffset =
containerFirstMatchingRegion.absoluteStartingContentOffsetOfReferenceCharOffset(
containeeFirstRegion.referenceStartOffsetInclusive().charOffset());
// and its last region must be a prefix of our last region
final CharacterRegion containerLastMatchingRegion =
characterRegions().get(endRegionIndex.get());
final CharacterRegion containeeLastRegion = Iterables.getLast(other.characterRegions());
if (!containeeLastRegion.isPrefixOf(containerLastMatchingRegion)) {
return false;
}
latestPossibleMatchingContentOffset =
containerLastMatchingRegion.absoluteEndingContentOffsetOfReferenceCharOffset(
containeeLastRegion.referenceEndOffsetInclusive().charOffset());
// and all intermediate regions must match exactly (because of canonical form)
for (int i = 1; i < numThisRegionsPossiblyOverlappingSubstring - 1; ++i) {
final CharacterRegion thisRegion = characterRegions().get(startRegionIndex.get() + i);
final CharacterRegion otherRegion = other.characterRegions().get(i);
if (!thisRegion.equivalentUpToShiftedContentOffsets(otherRegion)) {
return false;
}
}
}
return content().substringByCodePoints(OffsetRange.fromInclusiveEndpoints(
earliestPossibleMatchingContentOffset, latestPossibleMatchingContentOffset))
.contains(other.content());
} } | public class class_name {
public final boolean containsExactly(LocatedString other) {
if (!referenceCharOffsetsSequential() && other.referenceCharOffsetsSequential()) {
throw new UnsupportedOperationException("Containment for non-monotonic LocatedStrings needs"
+ " to be implemented");
}
if (!referenceBounds().asCharOffsetRange().contains(other.referenceBounds().asCharOffsetRange())
|| !referenceBounds().asEdtOffsetRange()
.contains(other.referenceBounds().asEdtOffsetRange())) {
// quick, cheap short-circuit check
return false; // depends on control dependency: [if], data = [none]
}
// which of our character regions contains the start character offset of the putative substring?
final Optional<Integer> startRegionIndex =
firstRegionIndexContainingReferenceCharOffset(other.referenceBounds().startCharOffsetInclusive());
// which of our character regions contains the end character offset of the putative substring?
final Optional<Integer> endRegionIndex =
firstRegionIndexContainingReferenceCharOffset(other.referenceBounds().endCharOffsetInclusive());
// if we don't have any region containing them, it can't be a substring
if (!startRegionIndex.isPresent() || !endRegionIndex.isPresent()) {
return false; // depends on control dependency: [if], data = [none]
}
final int numThisRegionsPossiblyOverlappingSubstring =
endRegionIndex.get() - startRegionIndex.get() + 1;
// we know if they are a substring this must be equal because both are in canonical form
if (numThisRegionsPossiblyOverlappingSubstring != other.characterRegions().size()) {
return false; // depends on control dependency: [if], data = [none]
}
final CharOffset earliestPossibleMatchingContentOffset;
final CharOffset latestPossibleMatchingContentOffset;
if (numThisRegionsPossiblyOverlappingSubstring == 1) {
// special case for when the putative substring would be contained entirely in just one
// of our character regions
final CharacterRegion containerOnlyMatchingRegion =
characterRegions().get(startRegionIndex.get());
final CharacterRegion containeeOnlyRegion = other.characterRegions().get(0);
if (containerOnlyMatchingRegion.contains(containeeOnlyRegion)) {
earliestPossibleMatchingContentOffset =
containerOnlyMatchingRegion.absoluteStartingContentOffsetOfReferenceCharOffset(
containeeOnlyRegion.referenceStartOffsetInclusive().charOffset()); // depends on control dependency: [if], data = [none]
latestPossibleMatchingContentOffset =
containerOnlyMatchingRegion.absoluteEndingContentOffsetOfReferenceCharOffset(
containeeOnlyRegion.referenceEndOffsetInclusive().charOffset()); // depends on control dependency: [if], data = [none]
} else {
return false; // depends on control dependency: [if], data = [none]
}
} else {
// if the putative substring covers more than one of our character regions, then
// its first region must be a suffix of our first region...
final CharacterRegion containerFirstMatchingRegion =
characterRegions().get(startRegionIndex.get());
final CharacterRegion containeeFirstRegion = other.characterRegions().get(0);
if (!containeeFirstRegion.isSuffixOf(containerFirstMatchingRegion)) {
return false; // depends on control dependency: [if], data = [none]
}
earliestPossibleMatchingContentOffset =
containerFirstMatchingRegion.absoluteStartingContentOffsetOfReferenceCharOffset(
containeeFirstRegion.referenceStartOffsetInclusive().charOffset()); // depends on control dependency: [if], data = [none]
// and its last region must be a prefix of our last region
final CharacterRegion containerLastMatchingRegion =
characterRegions().get(endRegionIndex.get());
final CharacterRegion containeeLastRegion = Iterables.getLast(other.characterRegions());
if (!containeeLastRegion.isPrefixOf(containerLastMatchingRegion)) {
return false; // depends on control dependency: [if], data = [none]
}
latestPossibleMatchingContentOffset =
containerLastMatchingRegion.absoluteEndingContentOffsetOfReferenceCharOffset(
containeeLastRegion.referenceEndOffsetInclusive().charOffset()); // depends on control dependency: [if], data = [none]
// and all intermediate regions must match exactly (because of canonical form)
for (int i = 1; i < numThisRegionsPossiblyOverlappingSubstring - 1; ++i) {
final CharacterRegion thisRegion = characterRegions().get(startRegionIndex.get() + i);
final CharacterRegion otherRegion = other.characterRegions().get(i);
if (!thisRegion.equivalentUpToShiftedContentOffsets(otherRegion)) {
return false; // depends on control dependency: [if], data = [none]
}
}
}
return content().substringByCodePoints(OffsetRange.fromInclusiveEndpoints(
earliestPossibleMatchingContentOffset, latestPossibleMatchingContentOffset))
.contains(other.content());
} } |
public class class_name {
public void addEntry(CatalogEntry entry) {
int type = entry.getEntryType();
if (type == URISUFFIX) {
String suffix = normalizeURI(entry.getEntryArg(0));
String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
entry.setEntryArg(1, fsi);
catalogManager.debug.message(4, "URISUFFIX", suffix, fsi);
} else if (type == SYSTEMSUFFIX) {
String suffix = normalizeURI(entry.getEntryArg(0));
String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
entry.setEntryArg(1, fsi);
catalogManager.debug.message(4, "SYSTEMSUFFIX", suffix, fsi);
}
super.addEntry(entry);
} } | public class class_name {
public void addEntry(CatalogEntry entry) {
int type = entry.getEntryType();
if (type == URISUFFIX) {
String suffix = normalizeURI(entry.getEntryArg(0));
String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
entry.setEntryArg(1, fsi); // depends on control dependency: [if], data = [none]
catalogManager.debug.message(4, "URISUFFIX", suffix, fsi); // depends on control dependency: [if], data = [none]
} else if (type == SYSTEMSUFFIX) {
String suffix = normalizeURI(entry.getEntryArg(0));
String fsi = makeAbsolute(normalizeURI(entry.getEntryArg(1)));
entry.setEntryArg(1, fsi); // depends on control dependency: [if], data = [none]
catalogManager.debug.message(4, "SYSTEMSUFFIX", suffix, fsi); // depends on control dependency: [if], data = [none]
}
super.addEntry(entry);
} } |
public class class_name {
public void pairsMatching(final LongObjectProcedure condition, final LongArrayList keyList, final ObjectArrayList valueList) {
keyList.clear();
valueList.clear();
for (int i = table.length ; i-- > 0 ;) {
if (state[i]==FULL && condition.apply(table[i],values[i])) {
keyList.add(table[i]);
valueList.add(values[i]);
}
}
} } | public class class_name {
public void pairsMatching(final LongObjectProcedure condition, final LongArrayList keyList, final ObjectArrayList valueList) {
keyList.clear();
valueList.clear();
for (int i = table.length ; i-- > 0 ;) {
if (state[i]==FULL && condition.apply(table[i],values[i])) {
keyList.add(table[i]);
// depends on control dependency: [if], data = [none]
valueList.add(values[i]);
// depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static NetworkConfig unmergeNetworks(NetworkConfig base, NetworkConfig unmerge) {
if (!base.getName().equals(unmerge.getName())) {
throw new IllegalArgumentException("Cannot merge networks of different names.");
}
for (ComponentConfig<?> component : unmerge.getComponents()) {
base.removeComponent(component.getName());
}
for (ConnectionConfig connection : unmerge.getConnections()) {
base.destroyConnection(connection);
}
return base;
} } | public class class_name {
public static NetworkConfig unmergeNetworks(NetworkConfig base, NetworkConfig unmerge) {
if (!base.getName().equals(unmerge.getName())) {
throw new IllegalArgumentException("Cannot merge networks of different names.");
}
for (ComponentConfig<?> component : unmerge.getComponents()) {
base.removeComponent(component.getName()); // depends on control dependency: [for], data = [component]
}
for (ConnectionConfig connection : unmerge.getConnections()) {
base.destroyConnection(connection); // depends on control dependency: [for], data = [connection]
}
return base;
} } |
public class class_name {
public void autoLoad(boolean autoReload) {
if (autoReload) {
Assert.notNull(this.propertiesFileUrl, "Properties URL is null !");
if (null != this.watchMonitor) {
// 先关闭之前的监听
this.watchMonitor.close();
}
this.watchMonitor = WatchUtil.createModify(this.propertiesFileUrl, new SimpleWatcher(){
@Override
public void onModify(WatchEvent<?> event, Path currentPath) {
load();
}
});
this.watchMonitor.start();
} else {
IoUtil.close(this.watchMonitor);
this.watchMonitor = null;
}
} } | public class class_name {
public void autoLoad(boolean autoReload) {
if (autoReload) {
Assert.notNull(this.propertiesFileUrl, "Properties URL is null !");
// depends on control dependency: [if], data = [none]
if (null != this.watchMonitor) {
// 先关闭之前的监听
this.watchMonitor.close();
// depends on control dependency: [if], data = [none]
}
this.watchMonitor = WatchUtil.createModify(this.propertiesFileUrl, new SimpleWatcher(){
@Override
public void onModify(WatchEvent<?> event, Path currentPath) {
load();
}
});
// depends on control dependency: [if], data = [none]
this.watchMonitor.start();
// depends on control dependency: [if], data = [none]
} else {
IoUtil.close(this.watchMonitor);
// depends on control dependency: [if], data = [none]
this.watchMonitor = null;
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public String getActions() {
final String actionString = this.actionString;
if (actionString != null) {
return actionString;
}
int actionBits = this.actionBits;
if (actionBits == ACTION_ALL) {
return this.actionString = "*";
}
int m = Integer.lowestOneBit(actionBits);
if (m != 0) {
StringBuilder b = new StringBuilder();
b.append(getAction(m));
actionBits &= ~m;
while (actionBits != 0) {
m = Integer.lowestOneBit(actionBits);
b.append(',').append(getAction(m));
actionBits &= ~m;
}
return this.actionString = b.toString();
} else {
return this.actionString = "";
}
} } | public class class_name {
public String getActions() {
final String actionString = this.actionString;
if (actionString != null) {
return actionString; // depends on control dependency: [if], data = [none]
}
int actionBits = this.actionBits;
if (actionBits == ACTION_ALL) {
return this.actionString = "*"; // depends on control dependency: [if], data = [none]
}
int m = Integer.lowestOneBit(actionBits);
if (m != 0) {
StringBuilder b = new StringBuilder();
b.append(getAction(m)); // depends on control dependency: [if], data = [(m]
actionBits &= ~m; // depends on control dependency: [if], data = [none]
while (actionBits != 0) {
m = Integer.lowestOneBit(actionBits); // depends on control dependency: [while], data = [(actionBits]
b.append(',').append(getAction(m)); // depends on control dependency: [while], data = [none]
actionBits &= ~m; // depends on control dependency: [while], data = [none]
}
return this.actionString = b.toString(); // depends on control dependency: [if], data = [none]
} else {
return this.actionString = ""; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static EdgeScores getEdgeMarginalsRealSemiring(O2AllGraDpHypergraph graph, Scores sc) {
Algebra s = graph.getAlgebra();
int nplus = graph.getNumTokens()+1;
Hypernode[][][][] c = graph.getChart();
EdgeScores marg = new EdgeScores(graph.getNumTokens(), 0.0);
for (int width = 1; width < nplus; width++) {
for (int i = 0; i < nplus - width; i++) {
int j = i + width;
for (int g=0; g<nplus; g++) {
if (i <= g && g <= j && !(i==0 && g==O2AllGraDpHypergraph.NIL)) { continue; }
if (j > 0) {
marg.incrScore(i-1, j-1, s.toReal(sc.marginal[c[i][j][g][O2AllGraDpHypergraph.INCOMPLETE].getId()]));
}
if (i > 0) {
marg.incrScore(j-1, i-1, s.toReal(sc.marginal[c[j][i][g][O2AllGraDpHypergraph.INCOMPLETE].getId()]));
}
}
}
}
return marg;
} } | public class class_name {
public static EdgeScores getEdgeMarginalsRealSemiring(O2AllGraDpHypergraph graph, Scores sc) {
Algebra s = graph.getAlgebra();
int nplus = graph.getNumTokens()+1;
Hypernode[][][][] c = graph.getChart();
EdgeScores marg = new EdgeScores(graph.getNumTokens(), 0.0);
for (int width = 1; width < nplus; width++) {
for (int i = 0; i < nplus - width; i++) {
int j = i + width;
for (int g=0; g<nplus; g++) {
if (i <= g && g <= j && !(i==0 && g==O2AllGraDpHypergraph.NIL)) { continue; }
if (j > 0) {
marg.incrScore(i-1, j-1, s.toReal(sc.marginal[c[i][j][g][O2AllGraDpHypergraph.INCOMPLETE].getId()])); // depends on control dependency: [if], data = [none]
}
if (i > 0) {
marg.incrScore(j-1, i-1, s.toReal(sc.marginal[c[j][i][g][O2AllGraDpHypergraph.INCOMPLETE].getId()])); // depends on control dependency: [if], data = [none]
}
}
}
}
return marg;
} } |
public class class_name {
@Implementation(minSdk = LOLLIPOP)
protected void native_queueInputBuffer(
int index, int offset, int size, long presentationTimeUs, int flags) {
// Check if this should be the last buffer cycle.
if ((flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0) {
reachedEos = true;
}
BufferInfo info = new BufferInfo();
info.set(offset, size, presentationTimeUs, flags);
makeOutputBufferAvailable(index, info);
} } | public class class_name {
@Implementation(minSdk = LOLLIPOP)
protected void native_queueInputBuffer(
int index, int offset, int size, long presentationTimeUs, int flags) {
// Check if this should be the last buffer cycle.
if ((flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0) {
reachedEos = true; // depends on control dependency: [if], data = [none]
}
BufferInfo info = new BufferInfo();
info.set(offset, size, presentationTimeUs, flags);
makeOutputBufferAvailable(index, info);
} } |
public class class_name {
public static <T> T transformThriftResult(ColumnOrSuperColumn cosc, ColumnFamilyType columnFamilyType, ThriftRow row)
{
Object output = null;
if (cosc != null)
{
switch (columnFamilyType)
{
case COLUMN:
output = cosc.column;
if (row != null)
{
row.addColumn(cosc.column);
}
break;
case SUPER_COLUMN:
output = cosc.super_column;
if (row != null)
{
row.addSuperColumn(cosc.super_column);
}
break;
case COUNTER_COLUMN:
output = cosc.counter_column;
if (row != null)
{
row.addCounterColumn(cosc.counter_column);
}
break;
case COUNTER_SUPER_COLUMN:
output = cosc.counter_super_column;
if (row != null)
{
row.addCounterSuperColumn(cosc.counter_super_column);
}
break;
}
}
return (T) output;
} } | public class class_name {
public static <T> T transformThriftResult(ColumnOrSuperColumn cosc, ColumnFamilyType columnFamilyType, ThriftRow row)
{
Object output = null;
if (cosc != null)
{
switch (columnFamilyType)
{
case COLUMN:
output = cosc.column;
if (row != null)
{
row.addColumn(cosc.column); // depends on control dependency: [if], data = [none]
}
break;
case SUPER_COLUMN:
output = cosc.super_column;
if (row != null)
{
row.addSuperColumn(cosc.super_column); // depends on control dependency: [if], data = [none]
}
break;
case COUNTER_COLUMN:
output = cosc.counter_column;
if (row != null)
{
row.addCounterColumn(cosc.counter_column); // depends on control dependency: [if], data = [none]
}
break;
case COUNTER_SUPER_COLUMN:
output = cosc.counter_super_column;
if (row != null)
{
row.addCounterSuperColumn(cosc.counter_super_column); // depends on control dependency: [if], data = [none]
}
break;
}
}
return (T) output;
} } |
public class class_name {
public static void saveSequenceFileSequences(String path, JavaRDD<List<List<Writable>>> rdd,
Integer maxOutputFiles) {
path = FilenameUtils.normalize(path, true);
if (maxOutputFiles != null) {
rdd = rdd.coalesce(maxOutputFiles);
}
JavaPairRDD<List<List<Writable>>, Long> dataIndexPairs = rdd.zipWithUniqueId(); //Note: Long values are unique + NOT contiguous; more efficient than zipWithIndex
JavaPairRDD<LongWritable, SequenceRecordWritable> keyedByIndex =
dataIndexPairs.mapToPair(new SequenceRecordSavePrepPairFunction());
keyedByIndex.saveAsNewAPIHadoopFile(path, LongWritable.class, SequenceRecordWritable.class,
SequenceFileOutputFormat.class);
} } | public class class_name {
public static void saveSequenceFileSequences(String path, JavaRDD<List<List<Writable>>> rdd,
Integer maxOutputFiles) {
path = FilenameUtils.normalize(path, true);
if (maxOutputFiles != null) {
rdd = rdd.coalesce(maxOutputFiles); // depends on control dependency: [if], data = [(maxOutputFiles]
}
JavaPairRDD<List<List<Writable>>, Long> dataIndexPairs = rdd.zipWithUniqueId(); //Note: Long values are unique + NOT contiguous; more efficient than zipWithIndex
JavaPairRDD<LongWritable, SequenceRecordWritable> keyedByIndex =
dataIndexPairs.mapToPair(new SequenceRecordSavePrepPairFunction());
keyedByIndex.saveAsNewAPIHadoopFile(path, LongWritable.class, SequenceRecordWritable.class,
SequenceFileOutputFormat.class);
} } |
public class class_name {
static <T> SettableSupplier<CompletableFuture<T>> settableSupplierOf(Supplier<CompletableFuture<T>> supplier) {
return new SettableSupplier<CompletableFuture<T>>() {
volatile boolean called;
volatile CompletableFuture<T> value;
@Override
public CompletableFuture<T> get() {
if (!called && value != null) {
called = true;
return value;
} else
return supplier.get();
}
@Override
public void set(CompletableFuture<T> value) {
called = false;
this.value = value;
}
};
} } | public class class_name {
static <T> SettableSupplier<CompletableFuture<T>> settableSupplierOf(Supplier<CompletableFuture<T>> supplier) {
return new SettableSupplier<CompletableFuture<T>>() {
volatile boolean called;
volatile CompletableFuture<T> value;
@Override
public CompletableFuture<T> get() {
if (!called && value != null) {
called = true; // depends on control dependency: [if], data = [none]
return value; // depends on control dependency: [if], data = [none]
} else
return supplier.get();
}
@Override
public void set(CompletableFuture<T> value) {
called = false;
this.value = value;
}
};
} } |
public class class_name {
@Override
public boolean isEveryoneGranted(String resourceName, Collection<String> requiredRoles) {
validateInput(resourceName, requiredRoles);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Determining if Everyone is authorized to access resource " + resourceName + ". Specified required roles are " + requiredRoles + ".");
}
if (requiredRoles.isEmpty()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Everyone is granted access to resource " + resourceName + " as there are no required roles.");
}
return true;
}
Collection<String> roles = getRolesForSpecialSubject(resourceName, AuthorizationTableService.EVERYONE);
AccessDecisionService accessDecisionService = accessDecisionServiceRef.getService();
boolean granted = accessDecisionService.isGranted(resourceName, requiredRoles, roles, null);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
if (granted) {
Tr.event(tc, "Everyone is granted access to resource " + resourceName + ".");
} else {
Tr.event(tc, "Everyone is NOT granted access to resource " + resourceName + ".");
}
}
return granted;
} } | public class class_name {
@Override
public boolean isEveryoneGranted(String resourceName, Collection<String> requiredRoles) {
validateInput(resourceName, requiredRoles);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Determining if Everyone is authorized to access resource " + resourceName + ". Specified required roles are " + requiredRoles + "."); // depends on control dependency: [if], data = [none]
}
if (requiredRoles.isEmpty()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Everyone is granted access to resource " + resourceName + " as there are no required roles."); // depends on control dependency: [if], data = [none]
}
return true; // depends on control dependency: [if], data = [none]
}
Collection<String> roles = getRolesForSpecialSubject(resourceName, AuthorizationTableService.EVERYONE);
AccessDecisionService accessDecisionService = accessDecisionServiceRef.getService();
boolean granted = accessDecisionService.isGranted(resourceName, requiredRoles, roles, null);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
if (granted) {
Tr.event(tc, "Everyone is granted access to resource " + resourceName + "."); // depends on control dependency: [if], data = [none]
} else {
Tr.event(tc, "Everyone is NOT granted access to resource " + resourceName + "."); // depends on control dependency: [if], data = [none]
}
}
return granted;
} } |
public class class_name {
@Override
public void setIssuerName(String issuerName) {
XSString name = null;
if (issuerName != null) {
name = (new XSStringBuilder()).buildObject(this.getElementQName().getNamespaceURI(), ISSUER_NAME_LOCAL_NAME,
this.getElementQName().getPrefix());
name.setValue(issuerName);
}
this.setIssuerName(name);
} } | public class class_name {
@Override
public void setIssuerName(String issuerName) {
XSString name = null;
if (issuerName != null) {
name = (new XSStringBuilder()).buildObject(this.getElementQName().getNamespaceURI(), ISSUER_NAME_LOCAL_NAME,
this.getElementQName().getPrefix()); // depends on control dependency: [if], data = [none]
name.setValue(issuerName); // depends on control dependency: [if], data = [(issuerName]
}
this.setIssuerName(name);
} } |
public class class_name {
protected /*@pure@*/ int rangeSingle(/*@non_null@*/String singleSelection) {
String single = singleSelection.trim();
if (single.toLowerCase().equals("first")) {
return 0;
}
if (single.toLowerCase().equals("last") || single.toLowerCase().equals("-1")) {
return -1;
}
int index = Integer.parseInt(single);
if (index >= 1) { //Non for negatives
index--;
}
return index;
} } | public class class_name {
protected /*@pure@*/ int rangeSingle(/*@non_null@*/String singleSelection) {
String single = singleSelection.trim();
if (single.toLowerCase().equals("first")) {
return 0; // depends on control dependency: [if], data = [none]
}
if (single.toLowerCase().equals("last") || single.toLowerCase().equals("-1")) {
return -1; // depends on control dependency: [if], data = [none]
}
int index = Integer.parseInt(single);
if (index >= 1) { //Non for negatives
index--; // depends on control dependency: [if], data = [none]
}
return index;
} } |
public class class_name {
protected SubscriptionSummary postNotification(final Subscriber subscriber, final String mimeType, final byte[] payload) {
final SubscriptionSummary result = new SubscriptionSummary();
try {
final URL target = new URL(subscriber.getCallback());
LOG.info("Posting notification to subscriber {}", subscriber.getCallback());
result.setHost(target.getHost());
final HttpURLConnection connection = (HttpURLConnection) target.openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", mimeType);
connection.setDoOutput(true);
connection.connect();
final OutputStream os = connection.getOutputStream();
os.write(payload);
os.close();
final int responseCode = connection.getResponseCode();
final String subscribers = connection.getHeaderField("X-Hub-On-Behalf-Of");
connection.disconnect();
if (responseCode != 200) {
LOG.warn("Got code {} from {}", responseCode, target);
result.setLastPublishSuccessful(false);
return result;
}
if (subscribers != null) {
try {
result.setSubscribers(Integer.parseInt(subscribers));
} catch (final NumberFormatException nfe) {
LOG.warn("Invalid subscriber value " + subscribers + " " + target, nfe);
result.setSubscribers(-1);
}
} else {
result.setSubscribers(-1);
}
} catch (final MalformedURLException ex) {
LOG.warn(null, ex);
result.setLastPublishSuccessful(false);
} catch (final IOException ex) {
LOG.error(null, ex);
result.setLastPublishSuccessful(false);
}
return result;
} } | public class class_name {
protected SubscriptionSummary postNotification(final Subscriber subscriber, final String mimeType, final byte[] payload) {
final SubscriptionSummary result = new SubscriptionSummary();
try {
final URL target = new URL(subscriber.getCallback());
LOG.info("Posting notification to subscriber {}", subscriber.getCallback()); // depends on control dependency: [try], data = [none]
result.setHost(target.getHost()); // depends on control dependency: [try], data = [none]
final HttpURLConnection connection = (HttpURLConnection) target.openConnection();
connection.setRequestMethod("POST"); // depends on control dependency: [try], data = [none]
connection.setRequestProperty("Content-Type", mimeType); // depends on control dependency: [try], data = [none]
connection.setDoOutput(true); // depends on control dependency: [try], data = [none]
connection.connect(); // depends on control dependency: [try], data = [none]
final OutputStream os = connection.getOutputStream();
os.write(payload); // depends on control dependency: [try], data = [none]
os.close(); // depends on control dependency: [try], data = [none]
final int responseCode = connection.getResponseCode();
final String subscribers = connection.getHeaderField("X-Hub-On-Behalf-Of");
connection.disconnect(); // depends on control dependency: [try], data = [none]
if (responseCode != 200) {
LOG.warn("Got code {} from {}", responseCode, target); // depends on control dependency: [if], data = [none]
result.setLastPublishSuccessful(false); // depends on control dependency: [if], data = [none]
return result; // depends on control dependency: [if], data = [none]
}
if (subscribers != null) {
try {
result.setSubscribers(Integer.parseInt(subscribers)); // depends on control dependency: [try], data = [none]
} catch (final NumberFormatException nfe) {
LOG.warn("Invalid subscriber value " + subscribers + " " + target, nfe);
result.setSubscribers(-1);
} // depends on control dependency: [catch], data = [none]
} else {
result.setSubscribers(-1); // depends on control dependency: [if], data = [none]
}
} catch (final MalformedURLException ex) {
LOG.warn(null, ex);
result.setLastPublishSuccessful(false);
} catch (final IOException ex) { // depends on control dependency: [catch], data = [none]
LOG.error(null, ex);
result.setLastPublishSuccessful(false);
} // depends on control dependency: [catch], data = [none]
return result;
} } |
public class class_name {
public void onSaveItems(ItemStateChangesLog chlog)
{
if (state == FINISHED)
{
return;
}
else if (state == WAITING)
{
suspendBuffer.add(chlog);
}
else if (state == WORKING)
{
try
{
// wait while suspended buffer is not clear
if (latcher != null && latcher.getCount() != 0)
{
latcher.await();
}
workingThreads.incrementAndGet();
save(chlog);
workingThreads.decrementAndGet();
}
catch (IOException e)
{
log.error("Incremental backup: Can't save log ", e);
notifyError("Incremental backup: Can't save log ", e);
}
catch (InterruptedException e)
{
log.error("Incremental backup: Can't save log ", e);
notifyError("Incremental backup: Can't save log ", e);
}
}
} } | public class class_name {
public void onSaveItems(ItemStateChangesLog chlog)
{
if (state == FINISHED)
{
return;
// depends on control dependency: [if], data = [none]
}
else if (state == WAITING)
{
suspendBuffer.add(chlog);
// depends on control dependency: [if], data = [none]
}
else if (state == WORKING)
{
try
{
// wait while suspended buffer is not clear
if (latcher != null && latcher.getCount() != 0)
{
latcher.await();
// depends on control dependency: [if], data = [none]
}
workingThreads.incrementAndGet();
// depends on control dependency: [try], data = [none]
save(chlog);
// depends on control dependency: [try], data = [none]
workingThreads.decrementAndGet();
// depends on control dependency: [try], data = [none]
}
catch (IOException e)
{
log.error("Incremental backup: Can't save log ", e);
notifyError("Incremental backup: Can't save log ", e);
}
// depends on control dependency: [catch], data = [none]
catch (InterruptedException e)
{
log.error("Incremental backup: Can't save log ", e);
notifyError("Incremental backup: Can't save log ", e);
}
// depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
protected void findCreds() {
if (System.getProperty(ACCESS_KEY) != null && System.getProperty(ACCESS_SECRET) != null) {
accessKey = System.getProperty(ACCESS_KEY);
secretKey = System.getProperty(ACCESS_SECRET);
}
else if (System.getenv(AWS_ACCESS_KEY) != null && System.getenv(AWS_SECRET_KEY) != null) {
accessKey = System.getenv(AWS_ACCESS_KEY);
secretKey = System.getenv(AWS_SECRET_KEY);
}
} } | public class class_name {
protected void findCreds() {
if (System.getProperty(ACCESS_KEY) != null && System.getProperty(ACCESS_SECRET) != null) {
accessKey = System.getProperty(ACCESS_KEY); // depends on control dependency: [if], data = [none]
secretKey = System.getProperty(ACCESS_SECRET); // depends on control dependency: [if], data = [none]
}
else if (System.getenv(AWS_ACCESS_KEY) != null && System.getenv(AWS_SECRET_KEY) != null) {
accessKey = System.getenv(AWS_ACCESS_KEY); // depends on control dependency: [if], data = [none]
secretKey = System.getenv(AWS_SECRET_KEY); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void readParameterAnnotations(
final MethodVisitor methodVisitor,
final Context context,
final int runtimeParameterAnnotationsOffset,
final boolean visible) {
int currentOffset = runtimeParameterAnnotationsOffset;
int numParameters = b[currentOffset++] & 0xFF;
methodVisitor.visitAnnotableParameterCount(numParameters, visible);
char[] charBuffer = context.charBuffer;
for (int i = 0; i < numParameters; ++i) {
int numAnnotations = readUnsignedShort(currentOffset);
currentOffset += 2;
while (numAnnotations-- > 0) {
// Parse the type_index field.
String annotationDescriptor = readUTF8(currentOffset, charBuffer);
currentOffset += 2;
// Parse num_element_value_pairs and element_value_pairs and visit these values.
currentOffset =
readElementValues(
methodVisitor.visitParameterAnnotation(i, annotationDescriptor, visible),
currentOffset,
/* named = */ true,
charBuffer);
}
}
} } | public class class_name {
private void readParameterAnnotations(
final MethodVisitor methodVisitor,
final Context context,
final int runtimeParameterAnnotationsOffset,
final boolean visible) {
int currentOffset = runtimeParameterAnnotationsOffset;
int numParameters = b[currentOffset++] & 0xFF;
methodVisitor.visitAnnotableParameterCount(numParameters, visible);
char[] charBuffer = context.charBuffer;
for (int i = 0; i < numParameters; ++i) {
int numAnnotations = readUnsignedShort(currentOffset);
currentOffset += 2; // depends on control dependency: [for], data = [none]
while (numAnnotations-- > 0) {
// Parse the type_index field.
String annotationDescriptor = readUTF8(currentOffset, charBuffer);
currentOffset += 2; // depends on control dependency: [while], data = [none]
// Parse num_element_value_pairs and element_value_pairs and visit these values.
currentOffset =
readElementValues(
methodVisitor.visitParameterAnnotation(i, annotationDescriptor, visible),
currentOffset,
/* named = */ true,
charBuffer); // depends on control dependency: [while], data = [none]
}
}
} } |
public class class_name {
protected Collection<JournalSegment<E>> loadSegments() {
// Ensure log directories are created.
directory.mkdirs();
TreeMap<Long, JournalSegment<E>> segments = new TreeMap<>();
// Iterate through all files in the log directory.
for (File file : directory.listFiles(File::isFile)) {
// If the file looks like a segment file, attempt to load the segment.
if (JournalSegmentFile.isSegmentFile(name, file)) {
JournalSegmentFile segmentFile = new JournalSegmentFile(file);
ByteBuffer buffer = ByteBuffer.allocate(JournalSegmentDescriptor.BYTES);
try (FileChannel channel = openChannel(file)) {
channel.read(buffer);
buffer.flip();
} catch (IOException e) {
throw new StorageException(e);
}
JournalSegmentDescriptor descriptor = new JournalSegmentDescriptor(buffer);
// Load the segment.
JournalSegment<E> segment = loadSegment(descriptor.id());
// Add the segment to the segments list.
log.debug("Found segment: {} ({})", segment.descriptor().id(), segmentFile.file().getName());
segments.put(segment.index(), segment);
}
}
// Verify that all the segments in the log align with one another.
JournalSegment<E> previousSegment = null;
boolean corrupted = false;
Iterator<Map.Entry<Long, JournalSegment<E>>> iterator = segments.entrySet().iterator();
while (iterator.hasNext()) {
JournalSegment<E> segment = iterator.next().getValue();
if (previousSegment != null && previousSegment.lastIndex() != segment.index() - 1) {
log.warn("Journal is inconsistent. {} is not aligned with prior segment {}", segment.file().file(), previousSegment.file().file());
corrupted = true;
}
if (corrupted) {
segment.close();
segment.delete();
iterator.remove();
}
previousSegment = segment;
}
return segments.values();
} } | public class class_name {
protected Collection<JournalSegment<E>> loadSegments() {
// Ensure log directories are created.
directory.mkdirs();
TreeMap<Long, JournalSegment<E>> segments = new TreeMap<>();
// Iterate through all files in the log directory.
for (File file : directory.listFiles(File::isFile)) {
// If the file looks like a segment file, attempt to load the segment.
if (JournalSegmentFile.isSegmentFile(name, file)) {
JournalSegmentFile segmentFile = new JournalSegmentFile(file);
ByteBuffer buffer = ByteBuffer.allocate(JournalSegmentDescriptor.BYTES);
try (FileChannel channel = openChannel(file)) {
channel.read(buffer);
buffer.flip(); // depends on control dependency: [if], data = [none]
} catch (IOException e) { // depends on control dependency: [for], data = [none]
throw new StorageException(e);
}
JournalSegmentDescriptor descriptor = new JournalSegmentDescriptor(buffer);
// Load the segment.
JournalSegment<E> segment = loadSegment(descriptor.id());
// Add the segment to the segments list.
log.debug("Found segment: {} ({})", segment.descriptor().id(), segmentFile.file().getName()); // depends on control dependency: [for], data = [file]
segments.put(segment.index(), segment); // depends on control dependency: [for], data = [none]
}
}
// Verify that all the segments in the log align with one another.
JournalSegment<E> previousSegment = null;
boolean corrupted = false;
Iterator<Map.Entry<Long, JournalSegment<E>>> iterator = segments.entrySet().iterator();
while (iterator.hasNext()) {
JournalSegment<E> segment = iterator.next().getValue();
if (previousSegment != null && previousSegment.lastIndex() != segment.index() - 1) {
log.warn("Journal is inconsistent. {} is not aligned with prior segment {}", segment.file().file(), previousSegment.file().file());
corrupted = true;
}
if (corrupted) {
segment.close();
segment.delete();
iterator.remove();
}
previousSegment = segment;
}
return segments.values();
} } |
public class class_name {
public static void populate(WritableColumnVector col, InternalRow row, int fieldIdx) {
int capacity = col.capacity;
DataType t = col.dataType();
if (row.isNullAt(fieldIdx)) {
col.putNulls(0, capacity);
} else {
if (t == DataTypes.BooleanType) {
col.putBooleans(0, capacity, row.getBoolean(fieldIdx));
} else if (t == DataTypes.ByteType) {
col.putBytes(0, capacity, row.getByte(fieldIdx));
} else if (t == DataTypes.ShortType) {
col.putShorts(0, capacity, row.getShort(fieldIdx));
} else if (t == DataTypes.IntegerType) {
col.putInts(0, capacity, row.getInt(fieldIdx));
} else if (t == DataTypes.LongType) {
col.putLongs(0, capacity, row.getLong(fieldIdx));
} else if (t == DataTypes.FloatType) {
col.putFloats(0, capacity, row.getFloat(fieldIdx));
} else if (t == DataTypes.DoubleType) {
col.putDoubles(0, capacity, row.getDouble(fieldIdx));
} else if (t == DataTypes.StringType) {
UTF8String v = row.getUTF8String(fieldIdx);
byte[] bytes = v.getBytes();
for (int i = 0; i < capacity; i++) {
col.putByteArray(i, bytes);
}
} else if (t instanceof DecimalType) {
DecimalType dt = (DecimalType)t;
Decimal d = row.getDecimal(fieldIdx, dt.precision(), dt.scale());
if (dt.precision() <= Decimal.MAX_INT_DIGITS()) {
col.putInts(0, capacity, (int)d.toUnscaledLong());
} else if (dt.precision() <= Decimal.MAX_LONG_DIGITS()) {
col.putLongs(0, capacity, d.toUnscaledLong());
} else {
final BigInteger integer = d.toJavaBigDecimal().unscaledValue();
byte[] bytes = integer.toByteArray();
for (int i = 0; i < capacity; i++) {
col.putByteArray(i, bytes, 0, bytes.length);
}
}
} else if (t instanceof CalendarIntervalType) {
CalendarInterval c = (CalendarInterval)row.get(fieldIdx, t);
col.getChild(0).putInts(0, capacity, c.months);
col.getChild(1).putLongs(0, capacity, c.microseconds);
} else if (t instanceof DateType) {
col.putInts(0, capacity, row.getInt(fieldIdx));
} else if (t instanceof TimestampType) {
col.putLongs(0, capacity, row.getLong(fieldIdx));
}
}
} } | public class class_name {
public static void populate(WritableColumnVector col, InternalRow row, int fieldIdx) {
int capacity = col.capacity;
DataType t = col.dataType();
if (row.isNullAt(fieldIdx)) {
col.putNulls(0, capacity); // depends on control dependency: [if], data = [none]
} else {
if (t == DataTypes.BooleanType) {
col.putBooleans(0, capacity, row.getBoolean(fieldIdx)); // depends on control dependency: [if], data = [none]
} else if (t == DataTypes.ByteType) {
col.putBytes(0, capacity, row.getByte(fieldIdx)); // depends on control dependency: [if], data = [none]
} else if (t == DataTypes.ShortType) {
col.putShorts(0, capacity, row.getShort(fieldIdx)); // depends on control dependency: [if], data = [none]
} else if (t == DataTypes.IntegerType) {
col.putInts(0, capacity, row.getInt(fieldIdx)); // depends on control dependency: [if], data = [none]
} else if (t == DataTypes.LongType) {
col.putLongs(0, capacity, row.getLong(fieldIdx)); // depends on control dependency: [if], data = [none]
} else if (t == DataTypes.FloatType) {
col.putFloats(0, capacity, row.getFloat(fieldIdx)); // depends on control dependency: [if], data = [none]
} else if (t == DataTypes.DoubleType) {
col.putDoubles(0, capacity, row.getDouble(fieldIdx)); // depends on control dependency: [if], data = [none]
} else if (t == DataTypes.StringType) {
UTF8String v = row.getUTF8String(fieldIdx);
byte[] bytes = v.getBytes();
for (int i = 0; i < capacity; i++) {
col.putByteArray(i, bytes); // depends on control dependency: [for], data = [i]
}
} else if (t instanceof DecimalType) {
DecimalType dt = (DecimalType)t;
Decimal d = row.getDecimal(fieldIdx, dt.precision(), dt.scale());
if (dt.precision() <= Decimal.MAX_INT_DIGITS()) {
col.putInts(0, capacity, (int)d.toUnscaledLong()); // depends on control dependency: [if], data = [none]
} else if (dt.precision() <= Decimal.MAX_LONG_DIGITS()) {
col.putLongs(0, capacity, d.toUnscaledLong()); // depends on control dependency: [if], data = [none]
} else {
final BigInteger integer = d.toJavaBigDecimal().unscaledValue();
byte[] bytes = integer.toByteArray();
for (int i = 0; i < capacity; i++) {
col.putByteArray(i, bytes, 0, bytes.length); // depends on control dependency: [for], data = [i]
}
}
} else if (t instanceof CalendarIntervalType) {
CalendarInterval c = (CalendarInterval)row.get(fieldIdx, t);
col.getChild(0).putInts(0, capacity, c.months); // depends on control dependency: [if], data = [none]
col.getChild(1).putLongs(0, capacity, c.microseconds); // depends on control dependency: [if], data = [none]
} else if (t instanceof DateType) {
col.putInts(0, capacity, row.getInt(fieldIdx)); // depends on control dependency: [if], data = [none]
} else if (t instanceof TimestampType) {
col.putLongs(0, capacity, row.getLong(fieldIdx)); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public MemcachedNode getPrimary(String k) {
if (partialStringHash.get()) {
final int index = k.indexOf(hashDelimiter.get());
if (index > 0) {
k = k.substring(0, index);
}
}
final long _hash = hashingAlgorithm.hash(k);
Long hash = Long.valueOf(_hash);
hash = ketamaNodes.ceilingKey(hash);
if (hash == null) {
hash = ketamaNodes.firstKey();
}
return ketamaNodes.get(hash);
} } | public class class_name {
public MemcachedNode getPrimary(String k) {
if (partialStringHash.get()) {
final int index = k.indexOf(hashDelimiter.get());
if (index > 0) {
k = k.substring(0, index); // depends on control dependency: [if], data = [none]
}
}
final long _hash = hashingAlgorithm.hash(k);
Long hash = Long.valueOf(_hash);
hash = ketamaNodes.ceilingKey(hash);
if (hash == null) {
hash = ketamaNodes.firstKey(); // depends on control dependency: [if], data = [none]
}
return ketamaNodes.get(hash);
} } |
public class class_name {
public static int parseInt (@Nullable final String sStr, @Nonnegative final int nRadix, final int nDefault)
{
if (sStr != null && sStr.length () > 0)
try
{
return Integer.parseInt (sStr, nRadix);
}
catch (final NumberFormatException ex)
{
// Fall through
}
return nDefault;
} } | public class class_name {
public static int parseInt (@Nullable final String sStr, @Nonnegative final int nRadix, final int nDefault)
{
if (sStr != null && sStr.length () > 0)
try
{
return Integer.parseInt (sStr, nRadix); // depends on control dependency: [try], data = [none]
}
catch (final NumberFormatException ex)
{
// Fall through
} // depends on control dependency: [catch], data = [none]
return nDefault;
} } |
public class class_name {
@Override
public CPDefinitionVirtualSetting remove(Serializable primaryKey)
throws NoSuchCPDefinitionVirtualSettingException {
Session session = null;
try {
session = openSession();
CPDefinitionVirtualSetting cpDefinitionVirtualSetting = (CPDefinitionVirtualSetting)session.get(CPDefinitionVirtualSettingImpl.class,
primaryKey);
if (cpDefinitionVirtualSetting == null) {
if (_log.isDebugEnabled()) {
_log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
}
throw new NoSuchCPDefinitionVirtualSettingException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
primaryKey);
}
return remove(cpDefinitionVirtualSetting);
}
catch (NoSuchCPDefinitionVirtualSettingException nsee) {
throw nsee;
}
catch (Exception e) {
throw processException(e);
}
finally {
closeSession(session);
}
} } | public class class_name {
@Override
public CPDefinitionVirtualSetting remove(Serializable primaryKey)
throws NoSuchCPDefinitionVirtualSettingException {
Session session = null;
try {
session = openSession();
CPDefinitionVirtualSetting cpDefinitionVirtualSetting = (CPDefinitionVirtualSetting)session.get(CPDefinitionVirtualSettingImpl.class,
primaryKey);
if (cpDefinitionVirtualSetting == null) {
if (_log.isDebugEnabled()) {
_log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); // depends on control dependency: [if], data = [none]
}
throw new NoSuchCPDefinitionVirtualSettingException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
primaryKey);
}
return remove(cpDefinitionVirtualSetting);
}
catch (NoSuchCPDefinitionVirtualSettingException nsee) {
throw nsee;
}
catch (Exception e) {
throw processException(e);
}
finally {
closeSession(session);
}
} } |
public class class_name {
@Override public V get() {
// check priorities - FJ task can only block on a task with higher priority!
Thread cThr = Thread.currentThread();
int priority = (cThr instanceof FJWThr) ? ((FJWThr)cThr)._priority : -1;
assert _dt.priority() > priority || (_dt.priority() == priority && _dt instanceof MRTask)
: "*** Attempting to block on task (" + _dt.getClass() + ") with equal or lower priority. Can lead to deadlock! " + _dt.priority() + " <= " + priority;
if( _done ) return result(); // Fast-path shortcut, or throw if exception
// Use FJP ManagedBlock for this blocking-wait - so the FJP can spawn
// another thread if needed.
try { ForkJoinPool.managedBlock(this); } catch( InterruptedException ignore ) { }
if( _done ) return result(); // Fast-path shortcut or throw if exception
assert isCancelled();
return null;
} } | public class class_name {
@Override public V get() {
// check priorities - FJ task can only block on a task with higher priority!
Thread cThr = Thread.currentThread();
int priority = (cThr instanceof FJWThr) ? ((FJWThr)cThr)._priority : -1;
assert _dt.priority() > priority || (_dt.priority() == priority && _dt instanceof MRTask)
: "*** Attempting to block on task (" + _dt.getClass() + ") with equal or lower priority. Can lead to deadlock! " + _dt.priority() + " <= " + priority;
if( _done ) return result(); // Fast-path shortcut, or throw if exception
// Use FJP ManagedBlock for this blocking-wait - so the FJP can spawn
// another thread if needed.
try { ForkJoinPool.managedBlock(this); } catch( InterruptedException ignore ) { } // depends on control dependency: [try], data = [none] // depends on control dependency: [catch], data = [none]
if( _done ) return result(); // Fast-path shortcut or throw if exception
assert isCancelled();
return null;
} } |
public class class_name {
public static long parseLong(String num, long defaultLong) {
if (num == null) {
return defaultLong;
} else {
try {
return Long.parseLong(num);
} catch (Exception e) {
return defaultLong;
}
}
} } | public class class_name {
public static long parseLong(String num, long defaultLong) {
if (num == null) {
return defaultLong; // depends on control dependency: [if], data = [none]
} else {
try {
return Long.parseLong(num); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
return defaultLong;
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
void onReadingThreadFinished(WebSocketFrame closeFrame)
{
synchronized (mThreadsLock)
{
mReadingThreadFinished = true;
mServerCloseFrame = closeFrame;
if (mWritingThreadFinished == false)
{
// Wait for the writing thread to finish.
return;
}
}
// Both the reading thread and the writing thread have finished.
onThreadsFinished();
} } | public class class_name {
void onReadingThreadFinished(WebSocketFrame closeFrame)
{
synchronized (mThreadsLock)
{
mReadingThreadFinished = true;
mServerCloseFrame = closeFrame;
if (mWritingThreadFinished == false)
{
// Wait for the writing thread to finish.
return; // depends on control dependency: [if], data = [none]
}
}
// Both the reading thread and the writing thread have finished.
onThreadsFinished();
} } |
public class class_name {
public static Serializable deserialize(byte[] bytes, String errorMessage) {
try {
return deserialize(bytes);
} catch (Exception e) {
throw new RuntimeException(errorMessage, e);
}
} } | public class class_name {
public static Serializable deserialize(byte[] bytes, String errorMessage) {
try {
return deserialize(bytes); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RuntimeException(errorMessage, e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public Object get(Object name) {
if (bean != null) {
BeanInvoker invoker = getReadInvoker((String) name);
if (invoker != null) {
try {
return transform(invoker);
} catch (Throwable e) {
throw new IllegalArgumentException(e);
}
}
}
return null;
} } | public class class_name {
@Override
public Object get(Object name) {
if (bean != null) {
BeanInvoker invoker = getReadInvoker((String) name);
if (invoker != null) {
try {
return transform(invoker); // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
throw new IllegalArgumentException(e);
} // depends on control dependency: [catch], data = [none]
}
}
return null;
} } |
public class class_name {
public static Map getInterfaceMethodsFromInterface(CtClass interfaceClass,
Map exceptMethods) {
HashMap interfaceMethods = new HashMap();
CtMethod[] methods = interfaceClass.getDeclaredMethods();
for (int i = 0; i < methods.length; i++)
{
if (exceptMethods.get(methods[i].getName()) == null)
{
ConcreteClassGeneratorUtils.logger.trace(methods[i].getName());
interfaceMethods.put(getMethodKey(methods[i]), methods[i]);
}
}
Map temp = getSuperClassesAbstractMethodsFromInterface(interfaceClass);
for (Iterator i= temp.keySet().iterator(); i.hasNext(); )
{
String key = (String)i.next();
if (!exceptMethods.containsKey(key)) {
interfaceMethods.put(key, temp.get(key));
}
}
return interfaceMethods;
} } | public class class_name {
public static Map getInterfaceMethodsFromInterface(CtClass interfaceClass,
Map exceptMethods) {
HashMap interfaceMethods = new HashMap();
CtMethod[] methods = interfaceClass.getDeclaredMethods();
for (int i = 0; i < methods.length; i++)
{
if (exceptMethods.get(methods[i].getName()) == null)
{
ConcreteClassGeneratorUtils.logger.trace(methods[i].getName()); // depends on control dependency: [if], data = [none]
interfaceMethods.put(getMethodKey(methods[i]), methods[i]); // depends on control dependency: [if], data = [none]
}
}
Map temp = getSuperClassesAbstractMethodsFromInterface(interfaceClass);
for (Iterator i= temp.keySet().iterator(); i.hasNext(); )
{
String key = (String)i.next();
if (!exceptMethods.containsKey(key)) {
interfaceMethods.put(key, temp.get(key)); // depends on control dependency: [if], data = [none]
}
}
return interfaceMethods;
} } |
public class class_name {
@Override
public void sawOpcode(int seen) {
IOIUserValue uvSawType = null;
try {
switch (seen) {
case Const.INVOKESPECIAL:
uvSawType = processInvokeSpecial();
break;
case Const.INVOKESTATIC:
processInvokeStatic();
break;
case Const.INVOKEVIRTUAL:
processInvokeVirtual();
break;
case Const.ASTORE:
case Const.ASTORE_0:
case Const.ASTORE_1:
case Const.ASTORE_2:
case Const.ASTORE_3:
processAStore(seen);
break;
default:
break;
}
} catch (ClassNotFoundException cnfe) {
bugReporter.reportMissingClass(cnfe);
} finally {
stack.sawOpcode(this, seen);
if ((uvSawType != null) && (stack.getStackDepth() > 0)) {
OpcodeStack.Item itm = stack.getStackItem(0);
itm.setUserValue(uvSawType);
}
}
} } | public class class_name {
@Override
public void sawOpcode(int seen) {
IOIUserValue uvSawType = null;
try {
switch (seen) {
case Const.INVOKESPECIAL:
uvSawType = processInvokeSpecial();
break;
case Const.INVOKESTATIC:
processInvokeStatic();
break;
case Const.INVOKEVIRTUAL:
processInvokeVirtual();
break;
case Const.ASTORE:
case Const.ASTORE_0:
case Const.ASTORE_1:
case Const.ASTORE_2:
case Const.ASTORE_3:
processAStore(seen);
break;
default:
break;
}
} catch (ClassNotFoundException cnfe) {
bugReporter.reportMissingClass(cnfe);
} finally { // depends on control dependency: [catch], data = [none]
stack.sawOpcode(this, seen);
if ((uvSawType != null) && (stack.getStackDepth() > 0)) {
OpcodeStack.Item itm = stack.getStackItem(0);
itm.setUserValue(uvSawType); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public boolean callbackHooks(final TYPE iType, final OIdentifiable id) {
if (!OHookThreadLocal.INSTANCE.push(id))
return false;
try {
final ORecord<?> rec = id.getRecord();
if (rec == null)
return false;
boolean recordChanged = false;
for (ORecordHook hook : hooks)
if (hook.onTrigger(iType, rec))
recordChanged = true;
return recordChanged;
} finally {
OHookThreadLocal.INSTANCE.pop(id);
}
} } | public class class_name {
public boolean callbackHooks(final TYPE iType, final OIdentifiable id) {
if (!OHookThreadLocal.INSTANCE.push(id))
return false;
try {
final ORecord<?> rec = id.getRecord();
if (rec == null)
return false;
boolean recordChanged = false;
for (ORecordHook hook : hooks)
if (hook.onTrigger(iType, rec))
recordChanged = true;
return recordChanged;
// depends on control dependency: [try], data = [none]
} finally {
OHookThreadLocal.INSTANCE.pop(id);
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
private ApiAdapter<A> nullSafeApiAdapter(ApiAdapter<A> apiAdapter) {
if (apiAdapter != null) {
return apiAdapter;
}
return (ApiAdapter<A>) NullApiAdapter.INSTANCE;
} } | public class class_name {
@SuppressWarnings("unchecked")
private ApiAdapter<A> nullSafeApiAdapter(ApiAdapter<A> apiAdapter) {
if (apiAdapter != null) {
return apiAdapter; // depends on control dependency: [if], data = [none]
}
return (ApiAdapter<A>) NullApiAdapter.INSTANCE;
} } |
public class class_name {
private static char[] getPassword(TextDevice textDevice, String key) {
boolean noMatch;
char[] cred = new char[0];
char[] passwd1;
char[] passwd2;
do {
passwd1 = textDevice.readPassword("Please enter the password value for %s:", key);
passwd2 = textDevice.readPassword("Please enter the password value for %s again:", key);
noMatch = !Arrays.equals(passwd1, passwd2);
if (noMatch) {
if (passwd1 != null) {
Arrays.fill(passwd1, ' ');
}
textDevice.printf("Password entries don't match. Please try again.\n");
} else {
if (passwd1.length == 0) {
textDevice.printf("An empty password is not valid. Please try again.\n");
noMatch = true;
} else {
cred = passwd1;
}
}
if (passwd2 != null) {
Arrays.fill(passwd2, ' ');
}
} while (noMatch);
return cred;
} } | public class class_name {
private static char[] getPassword(TextDevice textDevice, String key) {
boolean noMatch;
char[] cred = new char[0];
char[] passwd1;
char[] passwd2;
do {
passwd1 = textDevice.readPassword("Please enter the password value for %s:", key);
passwd2 = textDevice.readPassword("Please enter the password value for %s again:", key);
noMatch = !Arrays.equals(passwd1, passwd2);
if (noMatch) {
if (passwd1 != null) {
Arrays.fill(passwd1, ' '); // depends on control dependency: [if], data = [(passwd1]
}
textDevice.printf("Password entries don't match. Please try again.\n");
} else {
if (passwd1.length == 0) {
textDevice.printf("An empty password is not valid. Please try again.\n");
noMatch = true;
} else {
cred = passwd1;
}
}
if (passwd2 != null) {
Arrays.fill(passwd2, ' ');
}
} while (noMatch);
return cred;
} } |
public class class_name {
public static String replaceLast(final String s, final String sub, final String with) {
int i = s.lastIndexOf(sub);
if (i == -1) {
return s;
}
return s.substring(0, i) + with + s.substring(i + sub.length());
} } | public class class_name {
public static String replaceLast(final String s, final String sub, final String with) {
int i = s.lastIndexOf(sub);
if (i == -1) {
return s; // depends on control dependency: [if], data = [none]
}
return s.substring(0, i) + with + s.substring(i + sub.length());
} } |
public class class_name {
public static String prepareHeaderParameterName(final String headerName) {
// special cases
if (headerName.equals("etag")) {
return HttpBase.HEADER_ETAG;
}
if (headerName.equals("www-authenticate")) {
return "WWW-Authenticate";
}
char[] name = headerName.toCharArray();
boolean capitalize = true;
for (int i = 0; i < name.length; i++) {
char c = name[i];
if (c == '-') {
capitalize = true;
continue;
}
if (capitalize) {
name[i] = Character.toUpperCase(c);
capitalize = false;
} else {
name[i] = Character.toLowerCase(c);
}
}
return new String(name);
} } | public class class_name {
public static String prepareHeaderParameterName(final String headerName) {
// special cases
if (headerName.equals("etag")) {
return HttpBase.HEADER_ETAG; // depends on control dependency: [if], data = [none]
}
if (headerName.equals("www-authenticate")) {
return "WWW-Authenticate"; // depends on control dependency: [if], data = [none]
}
char[] name = headerName.toCharArray();
boolean capitalize = true;
for (int i = 0; i < name.length; i++) {
char c = name[i];
if (c == '-') {
capitalize = true; // depends on control dependency: [if], data = [none]
continue;
}
if (capitalize) {
name[i] = Character.toUpperCase(c); // depends on control dependency: [if], data = [none]
capitalize = false; // depends on control dependency: [if], data = [none]
} else {
name[i] = Character.toLowerCase(c); // depends on control dependency: [if], data = [none]
}
}
return new String(name);
} } |
public class class_name {
private AbsAxis parseReverceAxis() {
AbsAxis axis;
if (is("parent", true)) {
axis = new ParentAxis(getTransaction());
} else if (is("ancestor", true)) {
axis = new AncestorAxis(getTransaction());
} else if (is("ancestor-or-self", true)) {
axis = new AncestorAxis(getTransaction(), true);
} else if (is("preceding", true)) {
axis = new PrecedingAxis(getTransaction());
} else {
consume("preceding-sibling", true);
axis = new PrecedingSiblingAxis(getTransaction());
}
consume(TokenType.COLON, true);
consume(TokenType.COLON, true);
return axis;
} } | public class class_name {
private AbsAxis parseReverceAxis() {
AbsAxis axis;
if (is("parent", true)) {
axis = new ParentAxis(getTransaction()); // depends on control dependency: [if], data = [none]
} else if (is("ancestor", true)) {
axis = new AncestorAxis(getTransaction()); // depends on control dependency: [if], data = [none]
} else if (is("ancestor-or-self", true)) {
axis = new AncestorAxis(getTransaction(), true); // depends on control dependency: [if], data = [none]
} else if (is("preceding", true)) {
axis = new PrecedingAxis(getTransaction()); // depends on control dependency: [if], data = [none]
} else {
consume("preceding-sibling", true); // depends on control dependency: [if], data = [none]
axis = new PrecedingSiblingAxis(getTransaction()); // depends on control dependency: [if], data = [none]
}
consume(TokenType.COLON, true);
consume(TokenType.COLON, true);
return axis;
} } |
public class class_name {
private void addToBuffer(String document) {
if (timerMDC == null) {
timerMDC = MDC.get("name");
}
int length = document.length();
// If this is the first document in the buffer, record its age
bufferYoungest = new Date().getTime();
if (docBuffer.isEmpty()) {
bufferOldest = new Date().getTime();
log.debug("=== New buffer starting: {}", bufferOldest);
}
// Add to the buffer
docBuffer.add(document);
bufferSize += length;
// Check if submission is required
checkBuffer();
} } | public class class_name {
private void addToBuffer(String document) {
if (timerMDC == null) {
timerMDC = MDC.get("name"); // depends on control dependency: [if], data = [none]
}
int length = document.length();
// If this is the first document in the buffer, record its age
bufferYoungest = new Date().getTime();
if (docBuffer.isEmpty()) {
bufferOldest = new Date().getTime(); // depends on control dependency: [if], data = [none]
log.debug("=== New buffer starting: {}", bufferOldest); // depends on control dependency: [if], data = [none]
}
// Add to the buffer
docBuffer.add(document);
bufferSize += length;
// Check if submission is required
checkBuffer();
} } |
public class class_name {
public void reverse() {
mPlayingBackwards = !mPlayingBackwards;
if (mPlayingState == RUNNING) {
long currentTime = AnimationUtils.currentAnimationTimeMillis();
long currentPlayTime = currentTime - mStartTime;
long timeLeft = mDuration - currentPlayTime;
mStartTime = currentTime - timeLeft;
} else {
start(true);
}
} } | public class class_name {
public void reverse() {
mPlayingBackwards = !mPlayingBackwards;
if (mPlayingState == RUNNING) {
long currentTime = AnimationUtils.currentAnimationTimeMillis();
long currentPlayTime = currentTime - mStartTime;
long timeLeft = mDuration - currentPlayTime;
mStartTime = currentTime - timeLeft; // depends on control dependency: [if], data = [none]
} else {
start(true); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
protected String appendAttributeToQuery(final String queryBuilder, final String dataAttribute, final List<Object> queryValues) {
if (queryBuilder != null) {
return queryBuilder;
}
final String keyAttributeName;
if (this.queryAttributeName != null) {
keyAttributeName = this.queryAttributeName;
} else {
final IUsernameAttributeProvider usernameAttributeProvider = this.getUsernameAttributeProvider();
keyAttributeName = usernameAttributeProvider.getUsernameAttribute();
}
if (keyAttributeName.equals(dataAttribute)) {
return String.valueOf(queryValues.get(0));
}
return null;
} } | public class class_name {
@Override
protected String appendAttributeToQuery(final String queryBuilder, final String dataAttribute, final List<Object> queryValues) {
if (queryBuilder != null) {
return queryBuilder; // depends on control dependency: [if], data = [none]
}
final String keyAttributeName;
if (this.queryAttributeName != null) {
keyAttributeName = this.queryAttributeName; // depends on control dependency: [if], data = [none]
} else {
final IUsernameAttributeProvider usernameAttributeProvider = this.getUsernameAttributeProvider();
keyAttributeName = usernameAttributeProvider.getUsernameAttribute(); // depends on control dependency: [if], data = [none]
}
if (keyAttributeName.equals(dataAttribute)) {
return String.valueOf(queryValues.get(0)); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public synchronized void open(ObjectManagerState objectManagerState)
throws ObjectManagerException {
final String methodName = "open";
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this, cclass, methodName, objectManagerState);
super.open(objectManagerState);
byteArrayOutputStream = new ObjectManagerByteArrayOutputStream(pageSize);
// Now look at the file and initialise the ObjectStore.
// Read the header, to find the directory and free space map.
try {
int versionRead = storeFile.readInt();
// Read a known number of signature charaters.
char[] signatureRead = new char[signature.length()];
for (int i = 0; i < signature.length(); i++)
signatureRead[i] = storeFile.readChar();
if (!(new String(signatureRead).equals(signature))) {
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
"open"
, new Object[] { signatureRead });
throw new InvalidStoreSignatureException(this,
new String(signatureRead), signature);
} // if(!(new String(signatureRead).equals(signature))).
long objectStoreIdentifierRead = storeFile.readLong();
if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled())
trace.debug(this,
cclass,
methodName,
new Object[] { new Integer(versionRead),
new String(signatureRead),
new Long(objectStoreIdentifierRead)
}
);
// Use the saved value if we are a new store.
if (objectStoreIdentifier == IDENTIFIER_NOT_SET)
objectStoreIdentifier = (int) objectStoreIdentifierRead;
// The byte address of the directory root.
long directoryRootByteAddress = storeFile.readLong();
// The current number of bytes in the directory root.
long directoryRootLength = storeFile.readLong();
// The minimumNodeSize of the directory BTree.
int directoryMinimumNodeSize = storeFile.readInt();
long freeSpaceStoreAreaByteAddress = storeFile.readLong();
long freeSpaceStoreAreaLength = storeFile.readLong();
// The actual number of free space entries since we have to overestimate the space we need to store them.
long freeSpaceCount = storeFile.readLong();
sequenceNumber = storeFile.readLong();
// This is the length we assume we have written.
storeFileSizeUsed = storeFile.readLong();
// Administered limits on store file size.
minimumStoreFileSize = storeFile.readLong();
maximumStoreFileSize = storeFile.readLong();
cachedManagedObjectsSize = storeFile.readInt();
storeFileSizeAllocated = storeFile.length();
if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled())
trace.debug(this,
cclass,
methodName,
new Object[] { new Long(directoryRootByteAddress)
, new Long(directoryRootLength)
, new Integer(directoryMinimumNodeSize)
, new Long(freeSpaceStoreAreaByteAddress)
, new Long(freeSpaceStoreAreaLength)
, new Long(freeSpaceCount)
, new Long(sequenceNumber)
, new Long(storeFileSizeUsed)
, new Long(minimumStoreFileSize)
, new Long(maximumStoreFileSize)
, new Integer(cachedManagedObjectsSize)
, new Long(storeFileSizeAllocated)
}
);
// Are we interested in what's already on the disk?
if (storeStrategy == STRATEGY_KEEP_ALWAYS
|| storeStrategy == STRATEGY_SAVE_ONLY_ON_SHUTDOWN) {
// Create the array that locks recently used ManagedObjects into memory.
cachedManagedObjects = new java.lang.ref.SoftReference[cachedManagedObjectsSize];
directory = new Directory(directoryMinimumNodeSize,
directoryRootByteAddress,
directoryRootLength);
if (freeSpaceStoreAreaByteAddress != 0)
freeSpaceStoreArea = directory.makeStoreArea(freeSpaceIdentifier,
freeSpaceStoreAreaByteAddress,
freeSpaceStoreAreaLength);
readFreeSpaceMap(freeSpaceCount);
} else if (storeStrategy == STRATEGY_KEEP_UNTIL_NEXT_OPEN) {
if (Runtime.getRuntime().totalMemory() < Integer.MAX_VALUE)
reservedSize = new Atomic32BitLong(0);
else
reservedSize = new Atomic64BitLong(0);
clear();
} // if (storeStrategy...
} catch (java.io.EOFException exception) {
// The file is empty or did not exist.
// No FFDC Code Needed, this may be first use of a store.
if (Tracing.isAnyTracingEnabled() && trace.isEventEnabled())
trace.event(this,
cclass,
methodName,
exception);
if (objectManagerState.getObjectManagerStateState() == ObjectManagerState.stateReplayingLog) {
ObjectManager.ffdc.processException(this, cclass, methodName, exception, "1:241:1.35");
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this, cclass, methodName, new Object[] { "EndOfFile:244" });
throw new PermanentIOException(this,
exception);
} // if.
// Set initial values.
minimumStoreFileSize = 0;
maximumStoreFileSize = Long.MAX_VALUE;
cachedManagedObjectsSize = initialCachedManagedObjectsSize;
cachedManagedObjects = new java.lang.ref.SoftReference[cachedManagedObjectsSize];
directory = new Directory(initialDirectoryMinimumNodeSize, 0, 0);
freeSpaceByAddressHead = null;
freeSpaceByLength = new java.util.TreeSet(new AbstractSingleFileObjectStore.LengthComparator());
freeSpaceStoreArea = null;
// Sequence numbers 0-200 are reserved.
sequenceNumber = initialSequenceNumber;
// Allow for two headers to be written at the front of the file.
storeFileSizeUsed = pageSize * 2;
storeFileSizeAllocated = storeFileSizeUsed;
// allocateSpace() is now initialized,
// Make sure there is a valid header on the disk, in case we fail after this.
// It is fatal for the ObjectManager to fail after we extend the file system
// in setAllocationAllowed() without writing a header as the header will contain zeros.
writeHeader();
force();
} catch (java.io.IOException exception) {
// No FFDC Code Needed.
ObjectManager.ffdc.processException(this, cclass, methodName, exception, "1:276:1.35");
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
methodName);
throw new PermanentIOException(this,
exception);
} // catch (java.io.IOException exception).
directoryReservedSize = directory.spaceRequired();
if (Runtime.getRuntime().totalMemory() < Integer.MAX_VALUE)
reservedSize = new Atomic32BitLong(0);
else
reservedSize = new Atomic64BitLong(0);
// Assume we have already reserved enough space to completely rewrite the directory so any number of
// node splits or deletions are already accounted for. We now need to say how much space is needed
// each time an object is added or replaced in the store. This will include enough space to also
// complete its removal.
addSpaceOverhead = 4 + 1 // Space for a new Node, numberOfKeys + flagIsLeaf/flagIsNotLeaf.
+ 5 * 8 // Space for a new Entry, Identifier,address,length,childAddress,childLength.
+ 2 * 8 // An entry in the free space map for the node when it is rewritten.
+ 2 * 8; // An entry in the free space map when the ManagedObject is removed.
// For debugging add guardBytes before and after the Node metadata and before and after the payload.
if (useGuardBytes)
addSpaceOverhead = addSpaceOverhead + 2 * 2 * guardBytesLength;
setAllocationAllowed();
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
methodName);
} } | public class class_name {
public synchronized void open(ObjectManagerState objectManagerState)
throws ObjectManagerException {
final String methodName = "open";
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this, cclass, methodName, objectManagerState);
super.open(objectManagerState);
byteArrayOutputStream = new ObjectManagerByteArrayOutputStream(pageSize);
// Now look at the file and initialise the ObjectStore.
// Read the header, to find the directory and free space map.
try {
int versionRead = storeFile.readInt();
// Read a known number of signature charaters.
char[] signatureRead = new char[signature.length()];
for (int i = 0; i < signature.length(); i++)
signatureRead[i] = storeFile.readChar();
if (!(new String(signatureRead).equals(signature))) {
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
"open"
, new Object[] { signatureRead });
throw new InvalidStoreSignatureException(this,
new String(signatureRead), signature);
} // if(!(new String(signatureRead).equals(signature))).
long objectStoreIdentifierRead = storeFile.readLong();
if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled())
trace.debug(this,
cclass,
methodName,
new Object[] { new Integer(versionRead),
new String(signatureRead),
new Long(objectStoreIdentifierRead)
}
);
// Use the saved value if we are a new store.
if (objectStoreIdentifier == IDENTIFIER_NOT_SET)
objectStoreIdentifier = (int) objectStoreIdentifierRead;
// The byte address of the directory root.
long directoryRootByteAddress = storeFile.readLong();
// The current number of bytes in the directory root.
long directoryRootLength = storeFile.readLong();
// The minimumNodeSize of the directory BTree.
int directoryMinimumNodeSize = storeFile.readInt();
long freeSpaceStoreAreaByteAddress = storeFile.readLong();
long freeSpaceStoreAreaLength = storeFile.readLong();
// The actual number of free space entries since we have to overestimate the space we need to store them.
long freeSpaceCount = storeFile.readLong();
sequenceNumber = storeFile.readLong();
// This is the length we assume we have written.
storeFileSizeUsed = storeFile.readLong();
// Administered limits on store file size.
minimumStoreFileSize = storeFile.readLong();
maximumStoreFileSize = storeFile.readLong();
cachedManagedObjectsSize = storeFile.readInt();
storeFileSizeAllocated = storeFile.length();
if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled())
trace.debug(this,
cclass,
methodName,
new Object[] { new Long(directoryRootByteAddress)
, new Long(directoryRootLength)
, new Integer(directoryMinimumNodeSize)
, new Long(freeSpaceStoreAreaByteAddress)
, new Long(freeSpaceStoreAreaLength)
, new Long(freeSpaceCount)
, new Long(sequenceNumber)
, new Long(storeFileSizeUsed)
, new Long(minimumStoreFileSize)
, new Long(maximumStoreFileSize)
, new Integer(cachedManagedObjectsSize)
, new Long(storeFileSizeAllocated)
}
);
// Are we interested in what's already on the disk?
if (storeStrategy == STRATEGY_KEEP_ALWAYS
|| storeStrategy == STRATEGY_SAVE_ONLY_ON_SHUTDOWN) {
// Create the array that locks recently used ManagedObjects into memory.
cachedManagedObjects = new java.lang.ref.SoftReference[cachedManagedObjectsSize]; // depends on control dependency: [if], data = [none]
directory = new Directory(directoryMinimumNodeSize,
directoryRootByteAddress,
directoryRootLength); // depends on control dependency: [if], data = [none]
if (freeSpaceStoreAreaByteAddress != 0)
freeSpaceStoreArea = directory.makeStoreArea(freeSpaceIdentifier,
freeSpaceStoreAreaByteAddress,
freeSpaceStoreAreaLength);
readFreeSpaceMap(freeSpaceCount); // depends on control dependency: [if], data = [none]
} else if (storeStrategy == STRATEGY_KEEP_UNTIL_NEXT_OPEN) {
if (Runtime.getRuntime().totalMemory() < Integer.MAX_VALUE)
reservedSize = new Atomic32BitLong(0);
else
reservedSize = new Atomic64BitLong(0);
clear(); // depends on control dependency: [if], data = [none]
} // if (storeStrategy...
} catch (java.io.EOFException exception) {
// The file is empty or did not exist.
// No FFDC Code Needed, this may be first use of a store.
if (Tracing.isAnyTracingEnabled() && trace.isEventEnabled())
trace.event(this,
cclass,
methodName,
exception);
if (objectManagerState.getObjectManagerStateState() == ObjectManagerState.stateReplayingLog) {
ObjectManager.ffdc.processException(this, cclass, methodName, exception, "1:241:1.35"); // depends on control dependency: [if], data = [none]
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this, cclass, methodName, new Object[] { "EndOfFile:244" });
throw new PermanentIOException(this,
exception);
} // if.
// Set initial values.
minimumStoreFileSize = 0;
maximumStoreFileSize = Long.MAX_VALUE;
cachedManagedObjectsSize = initialCachedManagedObjectsSize;
cachedManagedObjects = new java.lang.ref.SoftReference[cachedManagedObjectsSize];
directory = new Directory(initialDirectoryMinimumNodeSize, 0, 0);
freeSpaceByAddressHead = null;
freeSpaceByLength = new java.util.TreeSet(new AbstractSingleFileObjectStore.LengthComparator());
freeSpaceStoreArea = null;
// Sequence numbers 0-200 are reserved.
sequenceNumber = initialSequenceNumber;
// Allow for two headers to be written at the front of the file.
storeFileSizeUsed = pageSize * 2;
storeFileSizeAllocated = storeFileSizeUsed;
// allocateSpace() is now initialized,
// Make sure there is a valid header on the disk, in case we fail after this.
// It is fatal for the ObjectManager to fail after we extend the file system
// in setAllocationAllowed() without writing a header as the header will contain zeros.
writeHeader();
force();
} catch (java.io.IOException exception) {
// No FFDC Code Needed.
ObjectManager.ffdc.processException(this, cclass, methodName, exception, "1:276:1.35");
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
methodName);
throw new PermanentIOException(this,
exception);
} // catch (java.io.IOException exception).
directoryReservedSize = directory.spaceRequired();
if (Runtime.getRuntime().totalMemory() < Integer.MAX_VALUE)
reservedSize = new Atomic32BitLong(0);
else
reservedSize = new Atomic64BitLong(0);
// Assume we have already reserved enough space to completely rewrite the directory so any number of
// node splits or deletions are already accounted for. We now need to say how much space is needed
// each time an object is added or replaced in the store. This will include enough space to also
// complete its removal.
addSpaceOverhead = 4 + 1 // Space for a new Node, numberOfKeys + flagIsLeaf/flagIsNotLeaf.
+ 5 * 8 // Space for a new Entry, Identifier,address,length,childAddress,childLength.
+ 2 * 8 // An entry in the free space map for the node when it is rewritten.
+ 2 * 8; // An entry in the free space map when the ManagedObject is removed.
// For debugging add guardBytes before and after the Node metadata and before and after the payload.
if (useGuardBytes)
addSpaceOverhead = addSpaceOverhead + 2 * 2 * guardBytesLength;
setAllocationAllowed();
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
methodName);
} } |
public class class_name {
private boolean isInherited(Method m) throws ClassNotFoundException {
JavaClass[] infs = javaClass.getAllInterfaces();
for (JavaClass inf : infs) {
if (hasMethod(inf, m)) {
return true;
}
}
JavaClass[] sups = javaClass.getSuperClasses();
for (JavaClass sup : sups) {
if (hasMethod(sup, m)) {
return true;
}
}
return false;
} } | public class class_name {
private boolean isInherited(Method m) throws ClassNotFoundException {
JavaClass[] infs = javaClass.getAllInterfaces();
for (JavaClass inf : infs) {
if (hasMethod(inf, m)) {
return true; // depends on control dependency: [if], data = [none]
}
}
JavaClass[] sups = javaClass.getSuperClasses();
for (JavaClass sup : sups) {
if (hasMethod(sup, m)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public static Collection<MatchedMethod> filterByClosestParams(
final Collection<MatchedMethod> possibilities, final int paramsCount) {
Collection<MatchedMethod> res = null;
for (int i = 0; i < paramsCount; i++) {
final Collection<MatchedMethod> filtered = filterByParam(possibilities, i);
if (res != null) {
if (filtered.size() < res.size()) {
res = filtered;
}
} else {
res = filtered;
}
}
return res;
} } | public class class_name {
public static Collection<MatchedMethod> filterByClosestParams(
final Collection<MatchedMethod> possibilities, final int paramsCount) {
Collection<MatchedMethod> res = null;
for (int i = 0; i < paramsCount; i++) {
final Collection<MatchedMethod> filtered = filterByParam(possibilities, i);
if (res != null) {
if (filtered.size() < res.size()) {
res = filtered; // depends on control dependency: [if], data = [none]
}
} else {
res = filtered; // depends on control dependency: [if], data = [none]
}
}
return res;
} } |
public class class_name {
private static String wordShapeChris2Long(String s, boolean omitIfInBoundary, int len, Collection<String> knownLCWords) {
final char[] beginChars = new char[BOUNDARY_SIZE];
final char[] endChars = new char[BOUNDARY_SIZE];
int beginUpto = 0;
int endUpto = 0;
final Set<Character> seenSet = new TreeSet<Character>(); // TreeSet guarantees stable ordering; has no size parameter
boolean nonLetters = false;
for (int i = 0; i < len; i++) {
int iIncr = 0;
char c = s.charAt(i);
char m = c;
if (Character.isDigit(c)) {
m = 'd';
} else if (Character.isLowerCase(c)) {
m = 'x';
} else if (Character.isUpperCase(c) || Character.isTitleCase(c)) {
m = 'X';
}
for (String gr : greek) {
if (s.startsWith(gr, i)) {
m = 'g';
//System.out.println(s + " :: " + s.substring(i+1));
iIncr = gr.length() - 1;
break;
}
}
if (m != 'x' && m != 'X') {
nonLetters = true;
}
if (i < BOUNDARY_SIZE) {
beginChars[beginUpto++] = m;
} else if (i < len - BOUNDARY_SIZE) {
seenSet.add(Character.valueOf(m));
} else {
endChars[endUpto++] = m;
}
i += iIncr;
// System.out.println("Position skips to " + i);
}
// Calculate size. This may be an upperbound, but is often correct
int sbSize = beginUpto + endUpto + seenSet.size();
if (knownLCWords != null) { sbSize++; }
final StringBuilder sb = new StringBuilder(sbSize);
// put in the beginning chars
sb.append(beginChars, 0, beginUpto);
// put in the stored ones sorted
if (omitIfInBoundary) {
for (Character chr : seenSet) {
char ch = chr.charValue();
boolean insert = true;
for (int i = 0; i < beginUpto; i++) {
if (beginChars[i] == ch) {
insert = false;
break;
}
}
for (int i = 0; i < endUpto; i++) {
if (endChars[i] == ch) {
insert = false;
break;
}
}
if (insert) {
sb.append(ch);
}
}
} else {
for (Character chr : seenSet) {
sb.append(chr.charValue());
}
}
// and add end ones
sb.append(endChars, 0, endUpto);
if (knownLCWords != null) {
if (!nonLetters && knownLCWords.contains(s.toLowerCase())) {
sb.append('k');
}
}
// System.out.println(s + " became " + sb);
return sb.toString();
} } | public class class_name {
private static String wordShapeChris2Long(String s, boolean omitIfInBoundary, int len, Collection<String> knownLCWords) {
final char[] beginChars = new char[BOUNDARY_SIZE];
final char[] endChars = new char[BOUNDARY_SIZE];
int beginUpto = 0;
int endUpto = 0;
final Set<Character> seenSet = new TreeSet<Character>(); // TreeSet guarantees stable ordering; has no size parameter
boolean nonLetters = false;
for (int i = 0; i < len; i++) {
int iIncr = 0;
char c = s.charAt(i);
char m = c;
if (Character.isDigit(c)) {
m = 'd';
// depends on control dependency: [if], data = [none]
} else if (Character.isLowerCase(c)) {
m = 'x';
// depends on control dependency: [if], data = [none]
} else if (Character.isUpperCase(c) || Character.isTitleCase(c)) {
m = 'X';
// depends on control dependency: [if], data = [none]
}
for (String gr : greek) {
if (s.startsWith(gr, i)) {
m = 'g';
// depends on control dependency: [if], data = [none]
//System.out.println(s + " :: " + s.substring(i+1));
iIncr = gr.length() - 1;
// depends on control dependency: [if], data = [none]
break;
}
}
if (m != 'x' && m != 'X') {
nonLetters = true;
// depends on control dependency: [if], data = [none]
}
if (i < BOUNDARY_SIZE) {
beginChars[beginUpto++] = m;
// depends on control dependency: [if], data = [none]
} else if (i < len - BOUNDARY_SIZE) {
seenSet.add(Character.valueOf(m));
// depends on control dependency: [if], data = [none]
} else {
endChars[endUpto++] = m;
// depends on control dependency: [if], data = [none]
}
i += iIncr;
// depends on control dependency: [for], data = [i]
// System.out.println("Position skips to " + i);
}
// Calculate size. This may be an upperbound, but is often correct
int sbSize = beginUpto + endUpto + seenSet.size();
if (knownLCWords != null) { sbSize++; }
// depends on control dependency: [if], data = [none]
final StringBuilder sb = new StringBuilder(sbSize);
// put in the beginning chars
sb.append(beginChars, 0, beginUpto);
// put in the stored ones sorted
if (omitIfInBoundary) {
for (Character chr : seenSet) {
char ch = chr.charValue();
boolean insert = true;
for (int i = 0; i < beginUpto; i++) {
if (beginChars[i] == ch) {
insert = false;
// depends on control dependency: [if], data = [none]
break;
}
}
for (int i = 0; i < endUpto; i++) {
if (endChars[i] == ch) {
insert = false;
// depends on control dependency: [if], data = [none]
break;
}
}
if (insert) {
sb.append(ch);
// depends on control dependency: [if], data = [none]
}
}
} else {
for (Character chr : seenSet) {
sb.append(chr.charValue());
// depends on control dependency: [for], data = [chr]
}
}
// and add end ones
sb.append(endChars, 0, endUpto);
if (knownLCWords != null) {
if (!nonLetters && knownLCWords.contains(s.toLowerCase())) {
sb.append('k');
// depends on control dependency: [if], data = [none]
}
}
// System.out.println(s + " became " + sb);
return sb.toString();
} } |
public class class_name {
@Override
public final Iterable<SourceDocument> findAll(final String filename) {
final Query searchQuery =
new Query(Criteria.where("filename").is(filename));
final List<SourceDocumentMongo> sourceDocumentsMongo =
mongoTemplate.find(searchQuery, SourceDocumentMongo.class);
if (sourceDocumentsMongo == null) {
return null;
}
final List<SourceDocument> sourceDocuments = new ArrayList<>();
for (final SourceDocument sourceDocument : sourceDocumentsMongo) {
final Source source = (Source) toObjConverter.createGedObject(
null, sourceDocument);
sourceDocument.setGedObject(source);
sourceDocuments.add(sourceDocument);
}
return sourceDocuments;
} } | public class class_name {
@Override
public final Iterable<SourceDocument> findAll(final String filename) {
final Query searchQuery =
new Query(Criteria.where("filename").is(filename));
final List<SourceDocumentMongo> sourceDocumentsMongo =
mongoTemplate.find(searchQuery, SourceDocumentMongo.class);
if (sourceDocumentsMongo == null) {
return null; // depends on control dependency: [if], data = [none]
}
final List<SourceDocument> sourceDocuments = new ArrayList<>();
for (final SourceDocument sourceDocument : sourceDocumentsMongo) {
final Source source = (Source) toObjConverter.createGedObject(
null, sourceDocument);
sourceDocument.setGedObject(source); // depends on control dependency: [for], data = [sourceDocument]
sourceDocuments.add(sourceDocument); // depends on control dependency: [for], data = [sourceDocument]
}
return sourceDocuments;
} } |
public class class_name {
public static boolean contains(LatLong[] latLongs, LatLong latLong) {
boolean result = false;
for (int i = 0, j = latLongs.length - 1; i < latLongs.length; j = i++) {
if ((latLongs[i].latitude > latLong.latitude) != (latLongs[j].latitude > latLong.latitude)
&& (latLong.longitude < (latLongs[j].longitude - latLongs[i].longitude) * (latLong.latitude - latLongs[i].latitude)
/ (latLongs[j].latitude - latLongs[i].latitude) + latLongs[i].longitude)) {
result = !result;
}
}
return result;
} } | public class class_name {
public static boolean contains(LatLong[] latLongs, LatLong latLong) {
boolean result = false;
for (int i = 0, j = latLongs.length - 1; i < latLongs.length; j = i++) {
if ((latLongs[i].latitude > latLong.latitude) != (latLongs[j].latitude > latLong.latitude)
&& (latLong.longitude < (latLongs[j].longitude - latLongs[i].longitude) * (latLong.latitude - latLongs[i].latitude)
/ (latLongs[j].latitude - latLongs[i].latitude) + latLongs[i].longitude)) {
result = !result; // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
@Override
public TimeZone getUserTimeZone() {
TimeZone timeZone = findCachedTimeZone();
if (timeZone != null) {
// mainly here if you call this in action process
// because time-zone process is called before action
return timeZone;
}
timeZone = findSessionTimeZone();
if (timeZone != null) {
return timeZone;
}
return getRequestedTimeZone();
} } | public class class_name {
@Override
public TimeZone getUserTimeZone() {
TimeZone timeZone = findCachedTimeZone();
if (timeZone != null) {
// mainly here if you call this in action process
// because time-zone process is called before action
return timeZone; // depends on control dependency: [if], data = [none]
}
timeZone = findSessionTimeZone();
if (timeZone != null) {
return timeZone; // depends on control dependency: [if], data = [none]
}
return getRequestedTimeZone();
} } |
public class class_name {
@Override
public byte[] serialize(Object obj) throws IOException {
KryoHolder kryoHolder = null;
if (obj == null)
throw new RuntimeException("obj can not be null");
try {
kryoHolder = KryoPoolImpl.getInstance().get();
kryoHolder.output.clear(); // clear Output -->每次调用的时候 重置
kryoHolder.kryo.writeClassAndObject(kryoHolder.output, obj);
return kryoHolder.output.toBytes();// 无法避免拷贝 ~~~
} catch (RuntimeException e) {
throw new RuntimeException(e);
} finally {
if (kryoHolder != null) {
KryoPoolImpl.getInstance().offer(kryoHolder);
}
// obj = null; //GC
}
} } | public class class_name {
@Override
public byte[] serialize(Object obj) throws IOException {
KryoHolder kryoHolder = null;
if (obj == null)
throw new RuntimeException("obj can not be null");
try {
kryoHolder = KryoPoolImpl.getInstance().get();
kryoHolder.output.clear(); // clear Output -->每次调用的时候 重置
kryoHolder.kryo.writeClassAndObject(kryoHolder.output, obj);
return kryoHolder.output.toBytes();// 无法避免拷贝 ~~~
} catch (RuntimeException e) {
throw new RuntimeException(e);
} finally {
if (kryoHolder != null) {
KryoPoolImpl.getInstance().offer(kryoHolder); // depends on control dependency: [if], data = [(kryoHolder]
}
// obj = null; //GC
}
} } |
public class class_name {
private boolean matches(String filter, String value) {
if (filter == null) {
return true;
}
return filter.equals(value);
} } | public class class_name {
private boolean matches(String filter, String value) {
if (filter == null) {
return true; // depends on control dependency: [if], data = [none]
}
return filter.equals(value);
} } |
public class class_name {
private void discardSubtaskState(
final JobID jobId,
final ExecutionAttemptID executionAttemptID,
final long checkpointId,
final TaskStateSnapshot subtaskState) {
if (subtaskState != null) {
executor.execute(new Runnable() {
@Override
public void run() {
try {
subtaskState.discardState();
} catch (Throwable t2) {
LOG.warn("Could not properly discard state object of checkpoint {} " +
"belonging to task {} of job {}.", checkpointId, executionAttemptID, jobId, t2);
}
}
});
}
} } | public class class_name {
private void discardSubtaskState(
final JobID jobId,
final ExecutionAttemptID executionAttemptID,
final long checkpointId,
final TaskStateSnapshot subtaskState) {
if (subtaskState != null) {
executor.execute(new Runnable() {
@Override
public void run() {
try {
subtaskState.discardState(); // depends on control dependency: [try], data = [none]
} catch (Throwable t2) {
LOG.warn("Could not properly discard state object of checkpoint {} " +
"belonging to task {} of job {}.", checkpointId, executionAttemptID, jobId, t2);
} // depends on control dependency: [catch], data = [none]
}
}); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private RaConnector mergeConnectors(RaConnector rxConnector, RaConnector annoConnector) {
final boolean trace = TraceComponent.isAnyTracingEnabled();
RaResourceAdapter rxRa = rxConnector.getResourceAdapter();
boolean useRxOra = false;
RaOutboundResourceAdapter rxOra = null;
if (rxRa.getOutboundResourceAdapter() != null) {
useRxOra = true;
rxOra = rxRa.getOutboundResourceAdapter();
}
boolean useAnno = false;
RaResourceAdapter annoRa = null;
boolean useAnnoOra = false;
RaOutboundResourceAdapter annoOra = null;
if (annoConnector != null) {
useAnno = true;
annoRa = annoConnector.getResourceAdapter();
if (annoRa.getOutboundResourceAdapter() != null) {
useAnnoOra = true;
annoOra = annoConnector.getResourceAdapter().getOutboundResourceAdapter();
}
}
RaConnector connector = new RaConnector();
RaResourceAdapter ra = new RaResourceAdapter();
connector.setResourceAdapter(ra);
RaOutboundResourceAdapter ora = new RaOutboundResourceAdapter();
if (rxRa.getResourceAdapterClass() != null) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "rar.xml resource adapter class", rxRa.getResourceAdapterClass());
connector.getResourceAdapter().setResourceAdapterClass(rxRa.getResourceAdapterClass());
} else if (useAnno) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "annotated resource adapter class", annoRa.getResourceAdapterClass());
// No need to check if there is a resource adapter class since this will be set to the annotated classname
connector.getResourceAdapter().setResourceAdapterClass(annoRa.getResourceAdapterClass());
}
if (!rxConnector.getDescription().isEmpty()) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "rar.xml description", rxConnector.getDescription());
connector.setDescription(rxConnector.getDescription());
}
else if (useAnno && !annoConnector.getDescription().isEmpty()) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "@Connector description", annoConnector.getDescription());
connector.setDescription(annoConnector.getDescription());
}
if (!rxConnector.getDisplayName().isEmpty()) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "rar.xml display name", rxConnector.getDisplayName());
connector.setDisplayName(rxConnector.getDisplayName());
}
else if (useAnno && !annoConnector.getDisplayName().isEmpty()) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "@Connector display name", annoConnector.getDisplayName());
connector.setDisplayName(annoConnector.getDisplayName());
}
if (rxConnector.getResourceAdapterVersion() != null) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "rar.xml resource adapter version", rxConnector.getResourceAdapterVersion());
connector.setResourceAdapterVersion(rxConnector.getResourceAdapterVersion());
}
else if (useAnno && annoConnector.getResourceAdapterVersion() != null) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "@Connector resource adapter version", annoConnector.getResourceAdapterVersion());
connector.setResourceAdapterVersion(annoConnector.getResourceAdapterVersion());
}
// security permissions must be copied. It's not used but an Info
// message will be logged that this is not supported
if (!rxRa.getSecurityPermissions().isEmpty()) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "rar.xml resource adapter security permissions", rxRa.getSecurityPermissions());
connector.getResourceAdapter().setSecurityPermissions(rxRa.getSecurityPermissions());
}
else if (useAnno && !annoRa.getSecurityPermissions().isEmpty()) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "@Connector resource adapter security permissions", annoRa.getSecurityPermissions());
connector.getResourceAdapter().setSecurityPermissions(annoRa.getSecurityPermissions());
}
// Set outbound resource adapter properties
boolean setRaOra = false;
if (useRxOra && rxOra.getTransactionSupport() != null) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "rar.xml transaction support", rxOra.getTransactionSupport());
setRaOra = true;
ora.setTransactionSupport(rxOra.getTransactionSupport());
} else if (useAnnoOra && annoOra.getTransactionSupport() != null) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "@Connector transaction support", annoOra.getTransactionSupport());
setRaOra = true;
ora.setTransactionSupport(annoOra.getTransactionSupport());
}
// Getting authenticationMechanisms since it's not added to the metatype but it is
// needed to enforce this:
// JCA 1.6 spec schema definition
// If any of the outbound resource adapter elements (transaction-support,
// authentication-mechanism, reauthentication-support) is specified through
// this element or metadata annotations, and no connection-definition is
// specified as part of this element or through annotations, the
// application server must consider this an error and fail deployment.
if (useRxOra && !rxOra.getAuthenticationMechanisms().isEmpty()) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "rar.xml authentication mechanisms", rxOra.getAuthenticationMechanisms());
setRaOra = true;
ora.setAuthenticationMechanisms(rxOra.getAuthenticationMechanisms());
} else if (useAnnoOra && !annoOra.getAuthenticationMechanisms().isEmpty()) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "@Connector authentication mechanisms", annoOra.getAuthenticationMechanisms());
setRaOra = true;
ora.setAuthenticationMechanisms(annoOra.getAuthenticationMechanisms());
}
if (useRxOra && rxOra.getReauthenticationSupport() != null) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "rar.xml reauthentication support", rxOra.getReauthenticationSupport());
setRaOra = true;
ora.setReauthenticationSupport(rxOra.getReauthenticationSupport());
} else if (useAnnoOra && annoOra.getReauthenticationSupport() != null) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "@Connector reauthentication support", annoOra.getReauthenticationSupport());
setRaOra = true;
ora.setReauthenticationSupport(annoOra.getReauthenticationSupport());
}
if (setRaOra)
ra.setOutboundResourceAdapter(ora);
if (!rxConnector.getRequiredWorkContext().isEmpty()) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "rar.xml required work context", rxConnector.getRequiredWorkContext());
if (useAnno && !annoConnector.getRequiredWorkContext().isEmpty()) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "@Connector required work context", rxConnector.getRequiredWorkContext());
List<String> requiredWorkContexts = new ArrayList<String>(rxConnector.getRequiredWorkContext());
for (String requiredWorkContext : annoConnector.getRequiredWorkContext()) {
if (!rxConnector.getRequiredWorkContext().contains(requiredWorkContext)) {
requiredWorkContexts.add(requiredWorkContext);
}
}
connector.setRequiredWorkContext(requiredWorkContexts);
} else {
connector.setRequiredWorkContext(rxConnector.getRequiredWorkContext());
}
} else if (useAnno && !annoConnector.getRequiredWorkContext().isEmpty()) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "@Connector required work context", annoConnector.getRequiredWorkContext());
connector.setRequiredWorkContext(annoConnector.getRequiredWorkContext());
}
return connector;
} } | public class class_name {
private RaConnector mergeConnectors(RaConnector rxConnector, RaConnector annoConnector) {
final boolean trace = TraceComponent.isAnyTracingEnabled();
RaResourceAdapter rxRa = rxConnector.getResourceAdapter();
boolean useRxOra = false;
RaOutboundResourceAdapter rxOra = null;
if (rxRa.getOutboundResourceAdapter() != null) {
useRxOra = true; // depends on control dependency: [if], data = [none]
rxOra = rxRa.getOutboundResourceAdapter(); // depends on control dependency: [if], data = [none]
}
boolean useAnno = false;
RaResourceAdapter annoRa = null;
boolean useAnnoOra = false;
RaOutboundResourceAdapter annoOra = null;
if (annoConnector != null) {
useAnno = true; // depends on control dependency: [if], data = [none]
annoRa = annoConnector.getResourceAdapter(); // depends on control dependency: [if], data = [none]
if (annoRa.getOutboundResourceAdapter() != null) {
useAnnoOra = true; // depends on control dependency: [if], data = [none]
annoOra = annoConnector.getResourceAdapter().getOutboundResourceAdapter(); // depends on control dependency: [if], data = [none]
}
}
RaConnector connector = new RaConnector();
RaResourceAdapter ra = new RaResourceAdapter();
connector.setResourceAdapter(ra);
RaOutboundResourceAdapter ora = new RaOutboundResourceAdapter();
if (rxRa.getResourceAdapterClass() != null) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "rar.xml resource adapter class", rxRa.getResourceAdapterClass());
connector.getResourceAdapter().setResourceAdapterClass(rxRa.getResourceAdapterClass()); // depends on control dependency: [if], data = [(rxRa.getResourceAdapterClass()]
} else if (useAnno) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "annotated resource adapter class", annoRa.getResourceAdapterClass());
// No need to check if there is a resource adapter class since this will be set to the annotated classname
connector.getResourceAdapter().setResourceAdapterClass(annoRa.getResourceAdapterClass()); // depends on control dependency: [if], data = [none]
}
if (!rxConnector.getDescription().isEmpty()) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "rar.xml description", rxConnector.getDescription());
connector.setDescription(rxConnector.getDescription()); // depends on control dependency: [if], data = [none]
}
else if (useAnno && !annoConnector.getDescription().isEmpty()) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "@Connector description", annoConnector.getDescription());
connector.setDescription(annoConnector.getDescription()); // depends on control dependency: [if], data = [none]
}
if (!rxConnector.getDisplayName().isEmpty()) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "rar.xml display name", rxConnector.getDisplayName());
connector.setDisplayName(rxConnector.getDisplayName()); // depends on control dependency: [if], data = [none]
}
else if (useAnno && !annoConnector.getDisplayName().isEmpty()) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "@Connector display name", annoConnector.getDisplayName());
connector.setDisplayName(annoConnector.getDisplayName()); // depends on control dependency: [if], data = [none]
}
if (rxConnector.getResourceAdapterVersion() != null) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "rar.xml resource adapter version", rxConnector.getResourceAdapterVersion());
connector.setResourceAdapterVersion(rxConnector.getResourceAdapterVersion()); // depends on control dependency: [if], data = [(rxConnector.getResourceAdapterVersion()]
}
else if (useAnno && annoConnector.getResourceAdapterVersion() != null) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "@Connector resource adapter version", annoConnector.getResourceAdapterVersion());
connector.setResourceAdapterVersion(annoConnector.getResourceAdapterVersion()); // depends on control dependency: [if], data = [none]
}
// security permissions must be copied. It's not used but an Info
// message will be logged that this is not supported
if (!rxRa.getSecurityPermissions().isEmpty()) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "rar.xml resource adapter security permissions", rxRa.getSecurityPermissions());
connector.getResourceAdapter().setSecurityPermissions(rxRa.getSecurityPermissions()); // depends on control dependency: [if], data = [none]
}
else if (useAnno && !annoRa.getSecurityPermissions().isEmpty()) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "@Connector resource adapter security permissions", annoRa.getSecurityPermissions());
connector.getResourceAdapter().setSecurityPermissions(annoRa.getSecurityPermissions()); // depends on control dependency: [if], data = [none]
}
// Set outbound resource adapter properties
boolean setRaOra = false;
if (useRxOra && rxOra.getTransactionSupport() != null) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "rar.xml transaction support", rxOra.getTransactionSupport());
setRaOra = true; // depends on control dependency: [if], data = [none]
ora.setTransactionSupport(rxOra.getTransactionSupport()); // depends on control dependency: [if], data = [none]
} else if (useAnnoOra && annoOra.getTransactionSupport() != null) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "@Connector transaction support", annoOra.getTransactionSupport());
setRaOra = true; // depends on control dependency: [if], data = [none]
ora.setTransactionSupport(annoOra.getTransactionSupport()); // depends on control dependency: [if], data = [none]
}
// Getting authenticationMechanisms since it's not added to the metatype but it is
// needed to enforce this:
// JCA 1.6 spec schema definition
// If any of the outbound resource adapter elements (transaction-support,
// authentication-mechanism, reauthentication-support) is specified through
// this element or metadata annotations, and no connection-definition is
// specified as part of this element or through annotations, the
// application server must consider this an error and fail deployment.
if (useRxOra && !rxOra.getAuthenticationMechanisms().isEmpty()) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "rar.xml authentication mechanisms", rxOra.getAuthenticationMechanisms());
setRaOra = true; // depends on control dependency: [if], data = [none]
ora.setAuthenticationMechanisms(rxOra.getAuthenticationMechanisms()); // depends on control dependency: [if], data = [none]
} else if (useAnnoOra && !annoOra.getAuthenticationMechanisms().isEmpty()) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "@Connector authentication mechanisms", annoOra.getAuthenticationMechanisms());
setRaOra = true; // depends on control dependency: [if], data = [none]
ora.setAuthenticationMechanisms(annoOra.getAuthenticationMechanisms()); // depends on control dependency: [if], data = [none]
}
if (useRxOra && rxOra.getReauthenticationSupport() != null) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "rar.xml reauthentication support", rxOra.getReauthenticationSupport());
setRaOra = true; // depends on control dependency: [if], data = [none]
ora.setReauthenticationSupport(rxOra.getReauthenticationSupport()); // depends on control dependency: [if], data = [none]
} else if (useAnnoOra && annoOra.getReauthenticationSupport() != null) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "@Connector reauthentication support", annoOra.getReauthenticationSupport());
setRaOra = true; // depends on control dependency: [if], data = [none]
ora.setReauthenticationSupport(annoOra.getReauthenticationSupport()); // depends on control dependency: [if], data = [none]
}
if (setRaOra)
ra.setOutboundResourceAdapter(ora);
if (!rxConnector.getRequiredWorkContext().isEmpty()) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "rar.xml required work context", rxConnector.getRequiredWorkContext());
if (useAnno && !annoConnector.getRequiredWorkContext().isEmpty()) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "@Connector required work context", rxConnector.getRequiredWorkContext());
List<String> requiredWorkContexts = new ArrayList<String>(rxConnector.getRequiredWorkContext());
for (String requiredWorkContext : annoConnector.getRequiredWorkContext()) {
if (!rxConnector.getRequiredWorkContext().contains(requiredWorkContext)) {
requiredWorkContexts.add(requiredWorkContext); // depends on control dependency: [if], data = [none]
}
}
connector.setRequiredWorkContext(requiredWorkContexts); // depends on control dependency: [if], data = [none]
} else {
connector.setRequiredWorkContext(rxConnector.getRequiredWorkContext()); // depends on control dependency: [if], data = [none]
}
} else if (useAnno && !annoConnector.getRequiredWorkContext().isEmpty()) {
if (trace && tc.isDebugEnabled())
Tr.debug(this, tc, "@Connector required work context", annoConnector.getRequiredWorkContext());
connector.setRequiredWorkContext(annoConnector.getRequiredWorkContext()); // depends on control dependency: [if], data = [none]
}
return connector;
} } |
public class class_name {
protected Boolean parseOptionalBooleanValue(final String path) {
final I_CmsXmlContentValue value = m_xml.getValue(path, m_locale);
if (value == null) {
return null;
} else {
final String stringValue = value.getStringValue(null);
try {
final Boolean boolValue = Boolean.valueOf(stringValue);
return boolValue;
} catch (final NumberFormatException e) {
LOG.info(Messages.get().getBundle().key(Messages.LOG_OPTIONAL_BOOLEAN_MISSING_1, path), e);
return null;
}
}
} } | public class class_name {
protected Boolean parseOptionalBooleanValue(final String path) {
final I_CmsXmlContentValue value = m_xml.getValue(path, m_locale);
if (value == null) {
return null; // depends on control dependency: [if], data = [none]
} else {
final String stringValue = value.getStringValue(null);
try {
final Boolean boolValue = Boolean.valueOf(stringValue);
return boolValue; // depends on control dependency: [try], data = [none]
} catch (final NumberFormatException e) {
LOG.info(Messages.get().getBundle().key(Messages.LOG_OPTIONAL_BOOLEAN_MISSING_1, path), e);
return null;
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
private static int processId() {
// Note: may fail in some JVM implementations
// something like '<pid>@<hostname>', at least in SUN / Oracle JVMs
final String jvmName = ManagementFactory.getRuntimeMXBean().getName();
final int index = jvmName.indexOf('@');
if (index < 1)
throw new RuntimeException("Could not get PID");
try {
return Integer.parseInt(jvmName.substring(0, index)) % MAX_PID;
} catch (NumberFormatException e) {
throw new RuntimeException("Could not get PID");
}
} } | public class class_name {
private static int processId() {
// Note: may fail in some JVM implementations
// something like '<pid>@<hostname>', at least in SUN / Oracle JVMs
final String jvmName = ManagementFactory.getRuntimeMXBean().getName();
final int index = jvmName.indexOf('@');
if (index < 1)
throw new RuntimeException("Could not get PID");
try {
return Integer.parseInt(jvmName.substring(0, index)) % MAX_PID; // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
throw new RuntimeException("Could not get PID");
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public <T extends IChemObject> T read(T object) throws CDKException {
if (object instanceof IChemFile) {
IChemFile cf = (IChemFile) object;
try {
cf = readChemFile(cf);
} catch (IOException e) {
logger.error("Input/Output error while reading from input.");
}
return (T) cf;
} else {
throw new CDKException("Only supported is reading of ChemFile.");
}
} } | public class class_name {
@Override
public <T extends IChemObject> T read(T object) throws CDKException {
if (object instanceof IChemFile) {
IChemFile cf = (IChemFile) object;
try {
cf = readChemFile(cf); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
logger.error("Input/Output error while reading from input.");
} // depends on control dependency: [catch], data = [none]
return (T) cf;
} else {
throw new CDKException("Only supported is reading of ChemFile.");
}
} } |
public class class_name {
@SuppressWarnings({ "cast", "unchecked" })
public static <O extends SpatialComparable> RangeQuery<O> getRangeQuery(AbstractRStarTree<?, ?, ?> tree, SpatialDistanceQuery<O> distanceQuery, Object... hints) {
// Can we support this distance function - spatial distances only!
SpatialPrimitiveDistanceFunction<? super O> df = distanceQuery.getDistanceFunction();
if(EuclideanDistanceFunction.STATIC.equals(df)) {
return (RangeQuery<O>) new EuclideanRStarTreeRangeQuery<>(tree, (Relation<NumberVector>) distanceQuery.getRelation());
}
return new RStarTreeRangeQuery<>(tree, distanceQuery.getRelation(), df);
} } | public class class_name {
@SuppressWarnings({ "cast", "unchecked" })
public static <O extends SpatialComparable> RangeQuery<O> getRangeQuery(AbstractRStarTree<?, ?, ?> tree, SpatialDistanceQuery<O> distanceQuery, Object... hints) {
// Can we support this distance function - spatial distances only!
SpatialPrimitiveDistanceFunction<? super O> df = distanceQuery.getDistanceFunction();
if(EuclideanDistanceFunction.STATIC.equals(df)) {
return (RangeQuery<O>) new EuclideanRStarTreeRangeQuery<>(tree, (Relation<NumberVector>) distanceQuery.getRelation()); // depends on control dependency: [if], data = [none]
}
return new RStarTreeRangeQuery<>(tree, distanceQuery.getRelation(), df);
} } |
public class class_name {
protected static void checkStaticIndexes(SourceRange sourceRange,
Operation... operations) throws SyntaxException {
for (int i = 0; i < operations.length; i++) {
if (operations[i] instanceof Element) {
try {
TermFactory.create((Element) operations[i]);
} catch (EvaluationException ee) {
throw SyntaxException.create(sourceRange, MSG_INVALID_TERM,
i);
}
}
}
} } | public class class_name {
protected static void checkStaticIndexes(SourceRange sourceRange,
Operation... operations) throws SyntaxException {
for (int i = 0; i < operations.length; i++) {
if (operations[i] instanceof Element) {
try {
TermFactory.create((Element) operations[i]); // depends on control dependency: [try], data = [none]
} catch (EvaluationException ee) {
throw SyntaxException.create(sourceRange, MSG_INVALID_TERM,
i);
} // depends on control dependency: [catch], data = [none]
}
}
} } |
public class class_name {
String generateAuthorizationHeader() {
String encoded = "";
try {
encoded = URLEncoder.encode(accessToken, "UTF-8");
} catch (UnsupportedEncodingException ignore) {
}
return "Bearer " + encoded;
} } | public class class_name {
String generateAuthorizationHeader() {
String encoded = "";
try {
encoded = URLEncoder.encode(accessToken, "UTF-8"); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException ignore) {
} // depends on control dependency: [catch], data = [none]
return "Bearer " + encoded;
} } |
public class class_name {
private boolean validateNull(Object validationObject, Annotation annotate)
{
if (checkNullObject(validationObject))
{
return true;
}
if (!validationObject.equals(null) || validationObject != null)
{
throwValidationException(((Null) annotate).message());
}
return true;
} } | public class class_name {
private boolean validateNull(Object validationObject, Annotation annotate)
{
if (checkNullObject(validationObject))
{
return true; // depends on control dependency: [if], data = [none]
}
if (!validationObject.equals(null) || validationObject != null)
{
throwValidationException(((Null) annotate).message()); // depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
private static DoubleArrayTire loadDAT() {
long start = System.currentTimeMillis();
try {
DoubleArrayTire dat = DoubleArrayTire.loadText(DicReader.getInputStream("core.dic"), AnsjItem.class);
// 人名识别必备的
personNameFull(dat);
// 记录词典中的词语,并且清除部分数据
for (Item item : dat.getDAT()) {
if (item == null || item.getName() == null) {
continue;
}
if (item.getStatus() < 2) {
item.setName(null);
continue;
}
}
LOG.info("init core library ok use time : " + (System.currentTimeMillis() - start));
return dat;
} catch (InstantiationException e) {
LOG.warn("无法实例化", e);
} catch (IllegalAccessException e) {
LOG.warn("非法访问", e);
} catch (NumberFormatException e) {
LOG.warn("数字格式异常", e);
} catch (IOException e) {
LOG.warn("IO异常", e);
}
return null;
} } | public class class_name {
private static DoubleArrayTire loadDAT() {
long start = System.currentTimeMillis();
try {
DoubleArrayTire dat = DoubleArrayTire.loadText(DicReader.getInputStream("core.dic"), AnsjItem.class);
// 人名识别必备的
personNameFull(dat); // depends on control dependency: [try], data = [none]
// 记录词典中的词语,并且清除部分数据
for (Item item : dat.getDAT()) {
if (item == null || item.getName() == null) {
continue;
}
if (item.getStatus() < 2) {
item.setName(null); // depends on control dependency: [if], data = [none]
continue;
}
}
LOG.info("init core library ok use time : " + (System.currentTimeMillis() - start)); // depends on control dependency: [try], data = [none]
return dat; // depends on control dependency: [try], data = [none]
} catch (InstantiationException e) {
LOG.warn("无法实例化", e);
} catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none]
LOG.warn("非法访问", e);
} catch (NumberFormatException e) { // depends on control dependency: [catch], data = [none]
LOG.warn("数字格式异常", e);
} catch (IOException e) { // depends on control dependency: [catch], data = [none]
LOG.warn("IO异常", e);
} // depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
public final void setOrientation(int orientation) {
mOrientation = orientation;
mOrientationState = getOrientationStateFromParam(mOrientation);
invalidate();
if (mOuterAdapter != null) {
mOuterAdapter.setOrientation(mOrientation);
}
} } | public class class_name {
public final void setOrientation(int orientation) {
mOrientation = orientation;
mOrientationState = getOrientationStateFromParam(mOrientation);
invalidate();
if (mOuterAdapter != null) {
mOuterAdapter.setOrientation(mOrientation); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void refreshDataForCell(Row row, String fullSaveAttr) {
if (fullSaveAttr != null) {
try {
String fullName = ConfigurationUtility.getFullNameFromRow(row);
if (fullName != null) {
parent.getCellHelper().restoreDataContext(fullName);
SaveAttrsUtility.refreshSheetRowFromContext(parent.getSerialDataContext().getDataContext(),
fullSaveAttr, row, parent.getExpEngine());
}
}catch (Exception ex) {
LOG.log(Level.SEVERE, "refreshDataForCell with fullAaveAttr ="+fullSaveAttr+" error = " + ex.getMessage(), ex);
}
}
} } | public class class_name {
private void refreshDataForCell(Row row, String fullSaveAttr) {
if (fullSaveAttr != null) {
try {
String fullName = ConfigurationUtility.getFullNameFromRow(row);
if (fullName != null) {
parent.getCellHelper().restoreDataContext(fullName);
// depends on control dependency: [if], data = [(fullName]
SaveAttrsUtility.refreshSheetRowFromContext(parent.getSerialDataContext().getDataContext(),
fullSaveAttr, row, parent.getExpEngine());
// depends on control dependency: [if], data = [none]
}
}catch (Exception ex) {
LOG.log(Level.SEVERE, "refreshDataForCell with fullAaveAttr ="+fullSaveAttr+" error = " + ex.getMessage(), ex);
}
// depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public Object extFunction(FuncExtFunction extFunction, Vector argVec,
ExpressionContext exprContext)
throws javax.xml.transform.TransformerException
{
Object result = null;
String ns = extFunction.getNamespace();
if (null != ns)
{
ExtensionHandler extNS =
(ExtensionHandler) m_extensionFunctionNamespaces.get(ns);
if (null != extNS)
{
try
{
result = extNS.callFunction(extFunction, argVec, exprContext);
}
catch (javax.xml.transform.TransformerException e)
{
throw e;
}
catch (Exception e)
{
throw new javax.xml.transform.TransformerException(e);
}
}
else
{
throw new XPathProcessorException(XSLMessages.createMessage(XSLTErrorResources.ER_EXTENSION_FUNC_UNKNOWN,
new Object[]{ns, extFunction.getFunctionName()}));
}
}
return result;
} } | public class class_name {
public Object extFunction(FuncExtFunction extFunction, Vector argVec,
ExpressionContext exprContext)
throws javax.xml.transform.TransformerException
{
Object result = null;
String ns = extFunction.getNamespace();
if (null != ns)
{
ExtensionHandler extNS =
(ExtensionHandler) m_extensionFunctionNamespaces.get(ns);
if (null != extNS)
{
try
{
result = extNS.callFunction(extFunction, argVec, exprContext); // depends on control dependency: [try], data = [none]
}
catch (javax.xml.transform.TransformerException e)
{
throw e;
} // depends on control dependency: [catch], data = [none]
catch (Exception e)
{
throw new javax.xml.transform.TransformerException(e);
} // depends on control dependency: [catch], data = [none]
}
else
{
throw new XPathProcessorException(XSLMessages.createMessage(XSLTErrorResources.ER_EXTENSION_FUNC_UNKNOWN,
new Object[]{ns, extFunction.getFunctionName()}));
}
}
return result;
} } |
public class class_name {
final public Boolean checkRealOffset() {
if ((tokenRealOffset == null) || !provideRealOffset) {
return false;
} else if (tokenOffset == null) {
return true;
} else if (tokenOffset.getStart() == tokenRealOffset.getStart()
&& tokenOffset.getEnd() == tokenRealOffset.getEnd()) {
return false;
} else {
return true;
}
} } | public class class_name {
final public Boolean checkRealOffset() {
if ((tokenRealOffset == null) || !provideRealOffset) {
return false; // depends on control dependency: [if], data = [none]
} else if (tokenOffset == null) {
return true; // depends on control dependency: [if], data = [none]
} else if (tokenOffset.getStart() == tokenRealOffset.getStart()
&& tokenOffset.getEnd() == tokenRealOffset.getEnd()) {
return false; // depends on control dependency: [if], data = [none]
} else {
return true; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static boolean isProcessCase(final ProcessCase currentCase, ProcessCase[] cases) {
ArgUtils.notNull(currentCase, "currentCase");
if(currentCase == ProcessCase.Load) {
return isLoadCase(cases);
} else if(currentCase == ProcessCase.Save) {
return isSaveCase(cases);
} else {
throw new IllegalArgumentException("currentCase is not support:" + currentCase);
}
} } | public class class_name {
public static boolean isProcessCase(final ProcessCase currentCase, ProcessCase[] cases) {
ArgUtils.notNull(currentCase, "currentCase");
if(currentCase == ProcessCase.Load) {
return isLoadCase(cases);
// depends on control dependency: [if], data = [none]
} else if(currentCase == ProcessCase.Save) {
return isSaveCase(cases);
// depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("currentCase is not support:" + currentCase);
}
} } |
public class class_name {
private JobPushRequest getNewJob(String taskTrackerNodeGroup, String taskTrackerIdentity) {
JobSender.SendResult sendResult = appContext.getJobSender().send(taskTrackerNodeGroup, taskTrackerIdentity, 1, new JobSender.SendInvoker() {
@Override
public JobSender.SendResult invoke(List<JobPo> jobPos) {
JobPushRequest jobPushRequest = appContext.getCommandBodyWrapper().wrapper(new JobPushRequest());
jobPushRequest.setJobMetaList(JobDomainConverter.convert(jobPos));
return new JobSender.SendResult(true, jobPushRequest);
}
});
if (sendResult.isSuccess()) {
return (JobPushRequest) sendResult.getReturnValue();
}
return null;
} } | public class class_name {
private JobPushRequest getNewJob(String taskTrackerNodeGroup, String taskTrackerIdentity) {
JobSender.SendResult sendResult = appContext.getJobSender().send(taskTrackerNodeGroup, taskTrackerIdentity, 1, new JobSender.SendInvoker() {
@Override
public JobSender.SendResult invoke(List<JobPo> jobPos) {
JobPushRequest jobPushRequest = appContext.getCommandBodyWrapper().wrapper(new JobPushRequest());
jobPushRequest.setJobMetaList(JobDomainConverter.convert(jobPos));
return new JobSender.SendResult(true, jobPushRequest);
}
});
if (sendResult.isSuccess()) {
return (JobPushRequest) sendResult.getReturnValue(); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public void marshall(Volume volume, ProtocolMarshaller protocolMarshaller) {
if (volume == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(volume.getHost(), HOST_BINDING);
protocolMarshaller.marshall(volume.getName(), NAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(Volume volume, ProtocolMarshaller protocolMarshaller) {
if (volume == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(volume.getHost(), HOST_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(volume.getName(), NAME_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 long extractCommittedSpHandle(ExportRow row, long committedSeqNo) {
long ret = 0;
if (committedSeqNo == ExportDataSource.NULL_COMMITTED_SEQNO) {
return ret;
}
// Get the rows's sequence number (3rd column)
long seqNo = (long) row.values[2];
if (seqNo != committedSeqNo) {
return ret;
}
// Get the row's sp handle (1rst column)
ret = (long) row.values[0];
return ret;
} } | public class class_name {
private long extractCommittedSpHandle(ExportRow row, long committedSeqNo) {
long ret = 0;
if (committedSeqNo == ExportDataSource.NULL_COMMITTED_SEQNO) {
return ret; // depends on control dependency: [if], data = [none]
}
// Get the rows's sequence number (3rd column)
long seqNo = (long) row.values[2];
if (seqNo != committedSeqNo) {
return ret; // depends on control dependency: [if], data = [none]
}
// Get the row's sp handle (1rst column)
ret = (long) row.values[0];
return ret;
} } |
public class class_name {
protected int getEntryTypeInt(int flags) {
for (int i = 0; i < getTypesInt().length; i++) {
if ((flags & getTypesInt()[i]) > 0) {
return i;
}
}
return -1;
} } | public class class_name {
protected int getEntryTypeInt(int flags) {
for (int i = 0; i < getTypesInt().length; i++) {
if ((flags & getTypesInt()[i]) > 0) {
return i; // depends on control dependency: [if], data = [none]
}
}
return -1;
} } |
public class class_name {
private State calculateNextState(final long timeoutInNanos, final State activeState) {
long cyclePeriodInNanos = activeState.config.getLimitRefreshPeriodInNanos();
int permissionsPerCycle = activeState.config.getLimitForPeriod();
long currentNanos = currentNanoTime();
long currentCycle = currentNanos / cyclePeriodInNanos;
long nextCycle = activeState.activeCycle;
int nextPermissions = activeState.activePermissions;
if (nextCycle != currentCycle) {
long elapsedCycles = currentCycle - nextCycle;
long accumulatedPermissions = elapsedCycles * permissionsPerCycle;
nextCycle = currentCycle;
nextPermissions = (int) min(nextPermissions + accumulatedPermissions, permissionsPerCycle);
}
long nextNanosToWait = nanosToWaitForPermission(
cyclePeriodInNanos, permissionsPerCycle, nextPermissions, currentNanos, currentCycle
);
State nextState = reservePermissions(activeState.config, timeoutInNanos, nextCycle, nextPermissions, nextNanosToWait);
return nextState;
} } | public class class_name {
private State calculateNextState(final long timeoutInNanos, final State activeState) {
long cyclePeriodInNanos = activeState.config.getLimitRefreshPeriodInNanos();
int permissionsPerCycle = activeState.config.getLimitForPeriod();
long currentNanos = currentNanoTime();
long currentCycle = currentNanos / cyclePeriodInNanos;
long nextCycle = activeState.activeCycle;
int nextPermissions = activeState.activePermissions;
if (nextCycle != currentCycle) {
long elapsedCycles = currentCycle - nextCycle;
long accumulatedPermissions = elapsedCycles * permissionsPerCycle;
nextCycle = currentCycle; // depends on control dependency: [if], data = [none]
nextPermissions = (int) min(nextPermissions + accumulatedPermissions, permissionsPerCycle); // depends on control dependency: [if], data = [none]
}
long nextNanosToWait = nanosToWaitForPermission(
cyclePeriodInNanos, permissionsPerCycle, nextPermissions, currentNanos, currentCycle
);
State nextState = reservePermissions(activeState.config, timeoutInNanos, nextCycle, nextPermissions, nextNanosToWait);
return nextState;
} } |
public class class_name {
public void destroy(boolean removeFromQueue) {
if (mState == State.IDLE) {
return;
}
if (removeFromQueue) {
mThreadPoolExecutor.remove(this);
}
if (mState == State.DECODED) {
mMemoryCache.put(getCacheKey(), mBitmap);
}
mBitmap = null;
mDrawingOptions.inBitmap = null;
// since tiles are pooled and reused, make sure to reset the cache key or you'll render the wrong tile from cache
mCacheKey = null;
mState = State.IDLE;
mListener.onTileDestroyed(this);
} } | public class class_name {
public void destroy(boolean removeFromQueue) {
if (mState == State.IDLE) {
return; // depends on control dependency: [if], data = [none]
}
if (removeFromQueue) {
mThreadPoolExecutor.remove(this); // depends on control dependency: [if], data = [none]
}
if (mState == State.DECODED) {
mMemoryCache.put(getCacheKey(), mBitmap); // depends on control dependency: [if], data = [none]
}
mBitmap = null;
mDrawingOptions.inBitmap = null;
// since tiles are pooled and reused, make sure to reset the cache key or you'll render the wrong tile from cache
mCacheKey = null;
mState = State.IDLE;
mListener.onTileDestroyed(this);
} } |
public class class_name {
public int read(byte[] array, int offset, int length) {
if(curr==null)return -1;
int len;
int count=0;
while(length>0) { // loop through while there's data needed
if((len=curr.remaining())>length) { // if enough data in curr buffer, use this code
curr.get(array,offset,length);
count+=length;
length=0;
} else { // get data from curr, mark how much is needed to fulfil, and loop for next curr.
curr.get(array,offset,len);
count+=len;
offset+=len;
length-=len;
if(idx<bbs.size()) {
curr=bbs.get(idx++);
} else {
length=0; // stop, and return the count of how many we were able to load
}
}
}
return count;
} } | public class class_name {
public int read(byte[] array, int offset, int length) {
if(curr==null)return -1;
int len;
int count=0;
while(length>0) { // loop through while there's data needed
if((len=curr.remaining())>length) { // if enough data in curr buffer, use this code
curr.get(array,offset,length); // depends on control dependency: [if], data = [length)]
count+=length; // depends on control dependency: [if], data = [none]
length=0; // depends on control dependency: [if], data = [none]
} else { // get data from curr, mark how much is needed to fulfil, and loop for next curr.
curr.get(array,offset,len); // depends on control dependency: [if], data = [none]
count+=len; // depends on control dependency: [if], data = [none]
offset+=len; // depends on control dependency: [if], data = [none]
length-=len; // depends on control dependency: [if], data = [none]
if(idx<bbs.size()) {
curr=bbs.get(idx++); // depends on control dependency: [if], data = [(idx]
} else {
length=0; // stop, and return the count of how many we were able to load // depends on control dependency: [if], data = [none]
}
}
}
return count;
} } |
public class class_name {
public final void setMaxNumberOfCharacters(final int maxNumberOfCharacters) {
if (maxNumberOfCharacters != -1) {
Condition.INSTANCE.ensureAtLeast(maxNumberOfCharacters, 1,
"The maximum number of characters must be at least 1");
}
this.maxNumberOfCharacters = maxNumberOfCharacters;
adaptMaxNumberOfCharactersMessage();
} } | public class class_name {
public final void setMaxNumberOfCharacters(final int maxNumberOfCharacters) {
if (maxNumberOfCharacters != -1) {
Condition.INSTANCE.ensureAtLeast(maxNumberOfCharacters, 1,
"The maximum number of characters must be at least 1"); // depends on control dependency: [if], data = [(maxNumberOfCharacters]
}
this.maxNumberOfCharacters = maxNumberOfCharacters;
adaptMaxNumberOfCharactersMessage();
} } |
public class class_name {
private boolean doesIndexExists(Connection con, String indexName) {
if (usingDB2) {
if (usingAS400DB2) {
return doesIndexExistsiSeries(con, indexName);
}
return doesIndexExistsDistributed(con, indexName);
} else
return false;
} } | public class class_name {
private boolean doesIndexExists(Connection con, String indexName) {
if (usingDB2) {
if (usingAS400DB2) {
return doesIndexExistsiSeries(con, indexName); // depends on control dependency: [if], data = [none]
}
return doesIndexExistsDistributed(con, indexName); // depends on control dependency: [if], data = [none]
} else
return false;
} } |
public class class_name {
public Status checkLinkable(CmsResource firstResource, CmsResource secondResource) {
String debugPrefix = "checkLinkable [" + Thread.currentThread().getName() + "]: ";
LOG.debug(
debugPrefix
+ (firstResource != null ? firstResource.getRootPath() : null)
+ " -- "
+ (secondResource != null ? secondResource.getRootPath() : null));
try {
CmsResource firstResourceCorrected = getDefaultFileOrSelf(firstResource);
CmsResource secondResourceCorrected = getDefaultFileOrSelf(secondResource);
if ((firstResourceCorrected == null) || (secondResourceCorrected == null)) {
LOG.debug(debugPrefix + " rejected - no resource");
return Status.other;
}
Locale locale1 = OpenCms.getLocaleManager().getDefaultLocale(m_cms, firstResourceCorrected);
Locale locale2 = OpenCms.getLocaleManager().getDefaultLocale(m_cms, secondResourceCorrected);
if (locale1.equals(locale2)) {
LOG.debug(debugPrefix + " rejected - same locale " + locale1);
return Status.other;
}
Locale mainLocale1 = getMainLocale(firstResourceCorrected.getRootPath());
Locale mainLocale2 = getMainLocale(secondResourceCorrected.getRootPath());
if ((mainLocale1 == null) || !(mainLocale1.equals(mainLocale2))) {
LOG.debug(debugPrefix + " rejected - incompatible main locale " + mainLocale1 + "/" + mainLocale2);
return Status.other;
}
CmsLocaleGroup group1 = readLocaleGroup(firstResourceCorrected);
Set<Locale> locales1 = group1.getLocales();
CmsLocaleGroup group2 = readLocaleGroup(secondResourceCorrected);
Set<Locale> locales2 = group2.getLocales();
if (!(Sets.intersection(locales1, locales2).isEmpty())) {
LOG.debug(debugPrefix + " rejected - already linked (case 1)");
return Status.alreadyLinked;
}
if (group1.isMarkedNoTranslation(group2.getLocales())
|| group2.isMarkedNoTranslation(group1.getLocales())) {
LOG.debug(debugPrefix + " rejected - marked 'no translation'");
return Status.notranslation;
}
if (group1.isRealGroupOrPotentialGroupHead() == group2.isRealGroupOrPotentialGroupHead()) {
LOG.debug(debugPrefix + " rejected - incompatible locale group states");
return Status.other;
}
CmsResource permCheckResource = null;
if (group1.isRealGroupOrPotentialGroupHead()) {
permCheckResource = group2.getPrimaryResource();
} else {
permCheckResource = group1.getPrimaryResource();
}
if (!m_cms.hasPermissions(
permCheckResource,
CmsPermissionSet.ACCESS_WRITE,
false,
CmsResourceFilter.IGNORE_EXPIRATION)) {
LOG.debug(debugPrefix + " no write permissions: " + permCheckResource.getRootPath());
return Status.other;
}
if (!checkLock(permCheckResource)) {
LOG.debug(debugPrefix + " lock state: " + permCheckResource.getRootPath());
return Status.other;
}
if (group2.getPrimaryResource().getStructureId().equals(group1.getPrimaryResource().getStructureId())) {
LOG.debug(debugPrefix + " rejected - already linked (case 2)");
return Status.alreadyLinked;
}
} catch (Exception e) {
LOG.error(debugPrefix + e.getLocalizedMessage(), e);
LOG.debug(debugPrefix + " rejected - exception (see previous)");
return Status.other;
}
LOG.debug(debugPrefix + " OK");
return Status.linkable;
} } | public class class_name {
public Status checkLinkable(CmsResource firstResource, CmsResource secondResource) {
String debugPrefix = "checkLinkable [" + Thread.currentThread().getName() + "]: ";
LOG.debug(
debugPrefix
+ (firstResource != null ? firstResource.getRootPath() : null)
+ " -- "
+ (secondResource != null ? secondResource.getRootPath() : null));
try {
CmsResource firstResourceCorrected = getDefaultFileOrSelf(firstResource);
CmsResource secondResourceCorrected = getDefaultFileOrSelf(secondResource);
if ((firstResourceCorrected == null) || (secondResourceCorrected == null)) {
LOG.debug(debugPrefix + " rejected - no resource"); // depends on control dependency: [if], data = [none]
return Status.other; // depends on control dependency: [if], data = [none]
}
Locale locale1 = OpenCms.getLocaleManager().getDefaultLocale(m_cms, firstResourceCorrected);
Locale locale2 = OpenCms.getLocaleManager().getDefaultLocale(m_cms, secondResourceCorrected);
if (locale1.equals(locale2)) {
LOG.debug(debugPrefix + " rejected - same locale " + locale1); // depends on control dependency: [if], data = [none]
return Status.other; // depends on control dependency: [if], data = [none]
}
Locale mainLocale1 = getMainLocale(firstResourceCorrected.getRootPath());
Locale mainLocale2 = getMainLocale(secondResourceCorrected.getRootPath());
if ((mainLocale1 == null) || !(mainLocale1.equals(mainLocale2))) {
LOG.debug(debugPrefix + " rejected - incompatible main locale " + mainLocale1 + "/" + mainLocale2); // depends on control dependency: [if], data = [none]
return Status.other; // depends on control dependency: [if], data = [none]
}
CmsLocaleGroup group1 = readLocaleGroup(firstResourceCorrected);
Set<Locale> locales1 = group1.getLocales();
CmsLocaleGroup group2 = readLocaleGroup(secondResourceCorrected);
Set<Locale> locales2 = group2.getLocales();
if (!(Sets.intersection(locales1, locales2).isEmpty())) {
LOG.debug(debugPrefix + " rejected - already linked (case 1)"); // depends on control dependency: [if], data = [none]
return Status.alreadyLinked; // depends on control dependency: [if], data = [none]
}
if (group1.isMarkedNoTranslation(group2.getLocales())
|| group2.isMarkedNoTranslation(group1.getLocales())) {
LOG.debug(debugPrefix + " rejected - marked 'no translation'"); // depends on control dependency: [if], data = [none]
return Status.notranslation; // depends on control dependency: [if], data = [none]
}
if (group1.isRealGroupOrPotentialGroupHead() == group2.isRealGroupOrPotentialGroupHead()) {
LOG.debug(debugPrefix + " rejected - incompatible locale group states"); // depends on control dependency: [if], data = [none]
return Status.other; // depends on control dependency: [if], data = [none]
}
CmsResource permCheckResource = null;
if (group1.isRealGroupOrPotentialGroupHead()) {
permCheckResource = group2.getPrimaryResource(); // depends on control dependency: [if], data = [none]
} else {
permCheckResource = group1.getPrimaryResource(); // depends on control dependency: [if], data = [none]
}
if (!m_cms.hasPermissions(
permCheckResource,
CmsPermissionSet.ACCESS_WRITE,
false,
CmsResourceFilter.IGNORE_EXPIRATION)) {
LOG.debug(debugPrefix + " no write permissions: " + permCheckResource.getRootPath()); // depends on control dependency: [if], data = [none]
return Status.other; // depends on control dependency: [if], data = [none]
}
if (!checkLock(permCheckResource)) {
LOG.debug(debugPrefix + " lock state: " + permCheckResource.getRootPath());
return Status.other;
}
if (group2.getPrimaryResource().getStructureId().equals(group1.getPrimaryResource().getStructureId())) {
LOG.debug(debugPrefix + " rejected - already linked (case 2)");
return Status.alreadyLinked;
}
} catch (Exception e) {
LOG.error(debugPrefix + e.getLocalizedMessage(), e);
LOG.debug(debugPrefix + " rejected - exception (see previous)");
return Status.other;
}
LOG.debug(debugPrefix + " OK");
return Status.linkable;
} } |
public class class_name {
public static int[] add (int[] list, int startIdx, int value)
{
// make sure we've got a list to work with
if (list == null) {
list = new int[DEFAULT_LIST_SIZE];
}
// search for a spot to insert yon value; assuming we'll insert
// it at the end of the list if we don't find one
int llength = list.length;
int index = llength;
for (int i = startIdx; i < llength; i++) {
if (list[i] == 0) {
index = i;
break;
}
}
// expand the list if necessary
if (index >= list.length) {
list = accomodate(list, index);
}
// stick the value on in
list[index] = value;
return list;
} } | public class class_name {
public static int[] add (int[] list, int startIdx, int value)
{
// make sure we've got a list to work with
if (list == null) {
list = new int[DEFAULT_LIST_SIZE]; // depends on control dependency: [if], data = [none]
}
// search for a spot to insert yon value; assuming we'll insert
// it at the end of the list if we don't find one
int llength = list.length;
int index = llength;
for (int i = startIdx; i < llength; i++) {
if (list[i] == 0) {
index = i; // depends on control dependency: [if], data = [none]
break;
}
}
// expand the list if necessary
if (index >= list.length) {
list = accomodate(list, index); // depends on control dependency: [if], data = [none]
}
// stick the value on in
list[index] = value;
return list;
} } |
public class class_name {
public static StmtOutput execute(StmtInput stmtInput) throws SFException,
SnowflakeSQLException
{
HttpPost httpRequest = null;
AssertUtil.assertTrue(stmtInput.serverUrl != null,
"Missing server url for statement execution");
AssertUtil.assertTrue(stmtInput.sql != null,
"Missing sql for statement execution");
AssertUtil.assertTrue(stmtInput.requestId != null,
"Missing request id for statement execution");
AssertUtil.assertTrue(stmtInput.sequenceId >= 0,
"Negative sequence id for statement execution");
AssertUtil.assertTrue(stmtInput.mediaType != null,
"Missing media type for statement execution");
try
{
String resultAsString = null;
// SNOW-20443: if we are retrying and there is get result URL, we
// don't need to execute the query again
if (stmtInput.retry && stmtInput.prevGetResultURL != null)
{
logger.debug(
"retrying statement execution with get result URL: {}",
stmtInput.prevGetResultURL);
}
else
{
URIBuilder uriBuilder = new URIBuilder(stmtInput.serverUrl);
uriBuilder.setPath(SF_PATH_QUERY_V1);
uriBuilder.addParameter(SF_QUERY_REQUEST_ID, stmtInput.requestId);
if (stmtInput.combineDescribe)
{
uriBuilder.addParameter(SF_QUERY_COMBINE_DESCRIBE_EXECUTE, "true");
}
httpRequest = new HttpPost(uriBuilder.build());
/**
* sequence id is only needed for old query API, when old query API
* is deprecated, we can remove sequence id.
*/
QueryExecDTO sqlJsonBody = new QueryExecDTO(
stmtInput.sql,
stmtInput.describeOnly,
stmtInput.sequenceId,
stmtInput.bindValues,
stmtInput.bindStage,
stmtInput.parametersMap,
stmtInput.querySubmissionTime,
stmtInput.describeOnly || stmtInput.internal);
if (stmtInput.combineDescribe && !stmtInput.describeOnly)
{
sqlJsonBody.setDescribedJobId(stmtInput.describedJobId);
}
String json = mapper.writeValueAsString(sqlJsonBody);
if (logger.isDebugEnabled())
{
logger.debug("JSON: {}", json);
}
// SNOW-18057: compress the post body in gzip
ByteArrayOutputStream baos = new ByteArrayOutputStream();
GZIPOutputStream gzos = new GZIPOutputStream(baos);
byte[] bytes = json.getBytes("UTF-8");
gzos.write(bytes);
gzos.finish();
ByteArrayEntity input = new ByteArrayEntity(baos.toByteArray());
input.setContentType("application/json");
httpRequest.setEntity(input);
httpRequest.addHeader("content-encoding", "gzip");
httpRequest.addHeader("accept", stmtInput.mediaType);
httpRequest.setHeader(SF_HEADER_AUTHORIZATION,
SF_HEADER_SNOWFLAKE_AUTHTYPE + " " + SF_HEADER_TOKEN_TAG
+ "=\"" + stmtInput.sessionToken + "\"");
setServiceNameHeader(stmtInput, httpRequest);
eventHandler.triggerStateTransition(BasicEvent.QueryState.SENDING_QUERY,
String.format(QueryState.SENDING_QUERY.getArgString(), stmtInput.requestId));
resultAsString =
HttpUtil.executeRequest(httpRequest,
stmtInput.networkTimeoutInMillis / 1000,
stmtInput.injectSocketTimeout,
stmtInput.canceling,
true // include retry parameters
);
}
return pollForOutput(resultAsString, stmtInput, httpRequest);
}
catch (Exception ex)
{
if (!(ex instanceof SnowflakeSQLException))
{
if (ex instanceof IOException)
{
logger.error("IOException encountered", ex);
// network error
throw new SFException(ex, ErrorCode.NETWORK_ERROR,
"Exception encountered when executing statement: " +
ex.getLocalizedMessage());
}
else
{
logger.error("Exception encountered", ex);
// raise internal exception if this is not a snowflake exception
throw new SFException(ex, ErrorCode.INTERNAL_ERROR,
ex.getLocalizedMessage());
}
}
else
{
throw (SnowflakeSQLException) ex;
}
}
finally
{
// we can release the http connection now
if (httpRequest != null)
{
httpRequest.releaseConnection();
}
}
} } | public class class_name {
public static StmtOutput execute(StmtInput stmtInput) throws SFException,
SnowflakeSQLException
{
HttpPost httpRequest = null;
AssertUtil.assertTrue(stmtInput.serverUrl != null,
"Missing server url for statement execution");
AssertUtil.assertTrue(stmtInput.sql != null,
"Missing sql for statement execution");
AssertUtil.assertTrue(stmtInput.requestId != null,
"Missing request id for statement execution");
AssertUtil.assertTrue(stmtInput.sequenceId >= 0,
"Negative sequence id for statement execution");
AssertUtil.assertTrue(stmtInput.mediaType != null,
"Missing media type for statement execution");
try
{
String resultAsString = null;
// SNOW-20443: if we are retrying and there is get result URL, we
// don't need to execute the query again
if (stmtInput.retry && stmtInput.prevGetResultURL != null)
{
logger.debug(
"retrying statement execution with get result URL: {}",
stmtInput.prevGetResultURL); // depends on control dependency: [if], data = [none]
}
else
{
URIBuilder uriBuilder = new URIBuilder(stmtInput.serverUrl);
uriBuilder.setPath(SF_PATH_QUERY_V1); // depends on control dependency: [if], data = [none]
uriBuilder.addParameter(SF_QUERY_REQUEST_ID, stmtInput.requestId); // depends on control dependency: [if], data = [none]
if (stmtInput.combineDescribe)
{
uriBuilder.addParameter(SF_QUERY_COMBINE_DESCRIBE_EXECUTE, "true"); // depends on control dependency: [if], data = [none]
}
httpRequest = new HttpPost(uriBuilder.build()); // depends on control dependency: [if], data = [none]
/**
* sequence id is only needed for old query API, when old query API
* is deprecated, we can remove sequence id.
*/
QueryExecDTO sqlJsonBody = new QueryExecDTO(
stmtInput.sql,
stmtInput.describeOnly,
stmtInput.sequenceId,
stmtInput.bindValues,
stmtInput.bindStage,
stmtInput.parametersMap,
stmtInput.querySubmissionTime,
stmtInput.describeOnly || stmtInput.internal);
if (stmtInput.combineDescribe && !stmtInput.describeOnly)
{
sqlJsonBody.setDescribedJobId(stmtInput.describedJobId); // depends on control dependency: [if], data = [none]
}
String json = mapper.writeValueAsString(sqlJsonBody);
if (logger.isDebugEnabled())
{
logger.debug("JSON: {}", json); // depends on control dependency: [if], data = [none]
}
// SNOW-18057: compress the post body in gzip
ByteArrayOutputStream baos = new ByteArrayOutputStream();
GZIPOutputStream gzos = new GZIPOutputStream(baos);
byte[] bytes = json.getBytes("UTF-8");
gzos.write(bytes); // depends on control dependency: [if], data = [none]
gzos.finish(); // depends on control dependency: [if], data = [none]
ByteArrayEntity input = new ByteArrayEntity(baos.toByteArray());
input.setContentType("application/json"); // depends on control dependency: [if], data = [none]
httpRequest.setEntity(input); // depends on control dependency: [if], data = [none]
httpRequest.addHeader("content-encoding", "gzip"); // depends on control dependency: [if], data = [none]
httpRequest.addHeader("accept", stmtInput.mediaType); // depends on control dependency: [if], data = [none]
httpRequest.setHeader(SF_HEADER_AUTHORIZATION,
SF_HEADER_SNOWFLAKE_AUTHTYPE + " " + SF_HEADER_TOKEN_TAG
+ "=\"" + stmtInput.sessionToken + "\""); // depends on control dependency: [if], data = [none]
setServiceNameHeader(stmtInput, httpRequest); // depends on control dependency: [if], data = [none]
eventHandler.triggerStateTransition(BasicEvent.QueryState.SENDING_QUERY,
String.format(QueryState.SENDING_QUERY.getArgString(), stmtInput.requestId)); // depends on control dependency: [if], data = [none]
resultAsString =
HttpUtil.executeRequest(httpRequest,
stmtInput.networkTimeoutInMillis / 1000,
stmtInput.injectSocketTimeout,
stmtInput.canceling,
true // include retry parameters
); // depends on control dependency: [if], data = [none]
}
return pollForOutput(resultAsString, stmtInput, httpRequest);
}
catch (Exception ex)
{
if (!(ex instanceof SnowflakeSQLException))
{
if (ex instanceof IOException)
{
logger.error("IOException encountered", ex); // depends on control dependency: [if], data = [none]
// network error
throw new SFException(ex, ErrorCode.NETWORK_ERROR,
"Exception encountered when executing statement: " +
ex.getLocalizedMessage());
}
else
{
logger.error("Exception encountered", ex); // depends on control dependency: [if], data = [none]
// raise internal exception if this is not a snowflake exception
throw new SFException(ex, ErrorCode.INTERNAL_ERROR,
ex.getLocalizedMessage());
}
}
else
{
throw (SnowflakeSQLException) ex;
}
}
finally
{
// we can release the http connection now
if (httpRequest != null)
{
httpRequest.releaseConnection(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@Override
public ServerBartender findServerByName(String name)
{
for (ClusterHeartbeat cluster : _clusterMap.values()) {
ServerBartender server = cluster.findServerByName(name);
if (server != null) {
return server;
}
}
return null;
} } | public class class_name {
@Override
public ServerBartender findServerByName(String name)
{
for (ClusterHeartbeat cluster : _clusterMap.values()) {
ServerBartender server = cluster.findServerByName(name);
if (server != null) {
return server; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public static void main(final String[] args)
{
for (int i = 0; i < 10; i++)
{
perfTestEncode(i);
perfTestDecode(i);
}
} } | public class class_name {
public static void main(final String[] args)
{
for (int i = 0; i < 10; i++)
{
perfTestEncode(i); // depends on control dependency: [for], data = [i]
perfTestDecode(i); // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
public static synchronized void updateLog(Map<String, Object> newConfig) {
if (newConfig == null)
throw new NullPointerException("Updated config must not be null");
HpelTraceServiceConfig config = loggingConfig.get();
if (config != null) {
config.updateLog(newConfig);
config.getTrDelegate().update(config);
}
} } | public class class_name {
public static synchronized void updateLog(Map<String, Object> newConfig) {
if (newConfig == null)
throw new NullPointerException("Updated config must not be null");
HpelTraceServiceConfig config = loggingConfig.get();
if (config != null) {
config.updateLog(newConfig); // depends on control dependency: [if], data = [none]
config.getTrDelegate().update(config); // depends on control dependency: [if], data = [(config]
}
} } |
public class class_name {
protected String getXMLVersion(Node nodeArg) {
Document doc = null;
// Determine the XML Version of the document
if (nodeArg != null) {
if (nodeArg.getNodeType() == Node.DOCUMENT_NODE) {
// The Document node is the Node argument
doc = (Document)nodeArg;
} else {
// The Document node is the Node argument's ownerDocument
doc = nodeArg.getOwnerDocument();
}
// Determine the DOM Version.
if (doc != null && doc.getImplementation().hasFeature("Core","3.0")) {
return doc.getXmlVersion();
}
}
// The version will be treated as "1.0" which may result in
// an ill-formed document being serialized.
// If nodeArg does not have an ownerDocument, treat this as XML 1.0
return "1.0";
} } | public class class_name {
protected String getXMLVersion(Node nodeArg) {
Document doc = null;
// Determine the XML Version of the document
if (nodeArg != null) {
if (nodeArg.getNodeType() == Node.DOCUMENT_NODE) {
// The Document node is the Node argument
doc = (Document)nodeArg; // depends on control dependency: [if], data = [none]
} else {
// The Document node is the Node argument's ownerDocument
doc = nodeArg.getOwnerDocument(); // depends on control dependency: [if], data = [none]
}
// Determine the DOM Version.
if (doc != null && doc.getImplementation().hasFeature("Core","3.0")) {
return doc.getXmlVersion(); // depends on control dependency: [if], data = [none]
}
}
// The version will be treated as "1.0" which may result in
// an ill-formed document being serialized.
// If nodeArg does not have an ownerDocument, treat this as XML 1.0
return "1.0";
} } |
public class class_name {
private void showAdminFormMemBasedLoadMgr(PrintWriter out,
boolean advancedView) {
if (!(loadMgr instanceof MemBasedLoadManager)) {
return;
}
out.print("<h2>Memory Based Scheduling</h2>\n");
MemBasedLoadManager memLoadMgr = (MemBasedLoadManager)loadMgr;
Collection<String> possibleThresholds =
Arrays.asList(("0,1,2,3,4,5,6,7,8,9,10,1000").split(","));
long reservedMemGB =
(long)(memLoadMgr.getReservedPhysicalMemoryOnTT() / 1024D + 0.5);
out.printf("<p>Reserve %s GB memory on one node.",
generateSelect(possibleThresholds, "" + reservedMemGB,
"/fairscheduler?setTtThreshold=<CHOICE>" +
(advancedView ? "&advanced" : "")));
} } | public class class_name {
private void showAdminFormMemBasedLoadMgr(PrintWriter out,
boolean advancedView) {
if (!(loadMgr instanceof MemBasedLoadManager)) {
return; // depends on control dependency: [if], data = [none]
}
out.print("<h2>Memory Based Scheduling</h2>\n");
MemBasedLoadManager memLoadMgr = (MemBasedLoadManager)loadMgr;
Collection<String> possibleThresholds =
Arrays.asList(("0,1,2,3,4,5,6,7,8,9,10,1000").split(","));
long reservedMemGB =
(long)(memLoadMgr.getReservedPhysicalMemoryOnTT() / 1024D + 0.5);
out.printf("<p>Reserve %s GB memory on one node.",
generateSelect(possibleThresholds, "" + reservedMemGB,
"/fairscheduler?setTtThreshold=<CHOICE>" +
(advancedView ? "&advanced" : "")));
} } |
public class class_name {
protected void setValue(int newPosition, T1[] values, int number,
boolean currentExisting) {
if (number > 0) {
if (currentExisting) {
T1[] tmpList = operations
.createVector1(newFullValueList[newPosition].length + number);
System.arraycopy(newFullValueList[newPosition], 0, tmpList, 0,
newFullValueList[newPosition].length);
System.arraycopy(values, 0, tmpList,
newFullValueList[newPosition].length, number);
newFullValueList[newPosition] = tmpList;
} else {
if (number < values.length) {
T1[] tmpList = operations.createVector1(number);
System.arraycopy(values, 0, tmpList, 0, number);
newFullValueList[newPosition] = tmpList;
} else {
newFullValueList[newPosition] = values;
}
}
}
} } | public class class_name {
protected void setValue(int newPosition, T1[] values, int number,
boolean currentExisting) {
if (number > 0) {
if (currentExisting) {
T1[] tmpList = operations
.createVector1(newFullValueList[newPosition].length + number);
System.arraycopy(newFullValueList[newPosition], 0, tmpList, 0,
newFullValueList[newPosition].length); // depends on control dependency: [if], data = [none]
System.arraycopy(values, 0, tmpList,
newFullValueList[newPosition].length, number); // depends on control dependency: [if], data = [none]
newFullValueList[newPosition] = tmpList; // depends on control dependency: [if], data = [none]
} else {
if (number < values.length) {
T1[] tmpList = operations.createVector1(number);
System.arraycopy(values, 0, tmpList, 0, number); // depends on control dependency: [if], data = [none]
newFullValueList[newPosition] = tmpList; // depends on control dependency: [if], data = [none]
} else {
newFullValueList[newPosition] = values; // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public static void dump(final List<Difference> sortedDifferences, final PrintStream out) {
String currentClassName = "";
for (final Difference difference : sortedDifferences) {
if (!currentClassName.equals(difference.getClassName())) {
out.println("Class "+difference.getClassName());
}
out.println(" "+extractActionType(difference)+" "+extractInfoType(difference.getInfo())+" "+extractDetails(difference));
currentClassName = difference.getClassName();
}
} } | public class class_name {
public static void dump(final List<Difference> sortedDifferences, final PrintStream out) {
String currentClassName = "";
for (final Difference difference : sortedDifferences) {
if (!currentClassName.equals(difference.getClassName())) {
out.println("Class "+difference.getClassName()); // depends on control dependency: [if], data = [none]
}
out.println(" "+extractActionType(difference)+" "+extractInfoType(difference.getInfo())+" "+extractDetails(difference)); // depends on control dependency: [for], data = [difference]
currentClassName = difference.getClassName(); // depends on control dependency: [for], data = [difference]
}
} } |
public class class_name {
public long resample(final long samples, final Timebase oldRate)
{
try
{
return resample(samples, oldRate, false);
}
catch (ResamplingException e)
{
// should never happen
throw new RuntimeException(e);
}
} } | public class class_name {
public long resample(final long samples, final Timebase oldRate)
{
try
{
return resample(samples, oldRate, false); // depends on control dependency: [try], data = [none]
}
catch (ResamplingException e)
{
// should never happen
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
static <T> ArraySet<T> fromArray(List<T> aArray, Boolean aAllowDuplicates) {
ArraySet<T> set = new ArraySet<>();
for (int i = 0, len = aArray.size(); i < len; i++) {
set.add(aArray.get(i), aAllowDuplicates);
}
return set;
} } | public class class_name {
static <T> ArraySet<T> fromArray(List<T> aArray, Boolean aAllowDuplicates) {
ArraySet<T> set = new ArraySet<>();
for (int i = 0, len = aArray.size(); i < len; i++) {
set.add(aArray.get(i), aAllowDuplicates); // depends on control dependency: [for], data = [i]
}
return set;
} } |
public class class_name {
protected MimePart setupTextPart(CardView view, MimePart part, String text, TextType textType) {
assertArgumentNotNull("view", view);
assertArgumentNotNull("part", part);
assertArgumentNotNull("text", text);
assertArgumentNotNull("textType", textType);
final String textEncoding = getTextEncoding(view);
final ByteBuffer buffer = prepareTextByteBuffer(view, text, textEncoding);
final DataSource source = prepareTextDataSource(view, buffer);
try {
part.setDataHandler(createDataHandler(source));
if (!isSuppressTextTransferEncoding(view)) {
part.setHeader("Content-Transfer-Encoding", getTextTransferEncoding(view));
}
part.setHeader("Content-Type", buildTextContentType(view, textType, textEncoding));
} catch (MessagingException e) {
throw new SMailMessageSettingFailureException("Failed to set headers: postcard=" + view, e);
}
return part;
} } | public class class_name {
protected MimePart setupTextPart(CardView view, MimePart part, String text, TextType textType) {
assertArgumentNotNull("view", view);
assertArgumentNotNull("part", part);
assertArgumentNotNull("text", text);
assertArgumentNotNull("textType", textType);
final String textEncoding = getTextEncoding(view);
final ByteBuffer buffer = prepareTextByteBuffer(view, text, textEncoding);
final DataSource source = prepareTextDataSource(view, buffer);
try {
part.setDataHandler(createDataHandler(source)); // depends on control dependency: [try], data = [none]
if (!isSuppressTextTransferEncoding(view)) {
part.setHeader("Content-Transfer-Encoding", getTextTransferEncoding(view)); // depends on control dependency: [if], data = [none]
}
part.setHeader("Content-Type", buildTextContentType(view, textType, textEncoding)); // depends on control dependency: [try], data = [none]
} catch (MessagingException e) {
throw new SMailMessageSettingFailureException("Failed to set headers: postcard=" + view, e);
} // depends on control dependency: [catch], data = [none]
return part;
} } |
public class class_name {
@Override
public boolean hasLink(String name1, String name2, String... domain) {
if(super.hasLink(name1, name2, domain)) {
return true;
}
// check name1's groups
if (domain.length == 1) {
try {
List<String> groups = Optional.ofNullable(super.getRoles(name1)).orElse(new ArrayList<>());
for(String group : groups) {
if(hasLink(group, name2, domain)) {
return true;
}
}
} catch (Error e) {
return false;
}
}
return false;
} } | public class class_name {
@Override
public boolean hasLink(String name1, String name2, String... domain) {
if(super.hasLink(name1, name2, domain)) {
return true; // depends on control dependency: [if], data = [none]
}
// check name1's groups
if (domain.length == 1) {
try {
List<String> groups = Optional.ofNullable(super.getRoles(name1)).orElse(new ArrayList<>());
for(String group : groups) {
if(hasLink(group, name2, domain)) {
return true; // depends on control dependency: [if], data = [none]
}
}
} catch (Error e) {
return false;
} // depends on control dependency: [catch], data = [none]
}
return false;
} } |
public class class_name {
public void marshall(ImportServerCatalogRequest importServerCatalogRequest, ProtocolMarshaller protocolMarshaller) {
if (importServerCatalogRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ImportServerCatalogRequest importServerCatalogRequest, ProtocolMarshaller protocolMarshaller) {
if (importServerCatalogRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
} 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 void done(T response) throws IllegalArgumentException {
lock.lock();
try {
if (response != null) {
this.response = response;
condition.signal();
} else {
throw new IllegalArgumentException("response cannot be null");
}
} finally {
lock.unlock();
}
} } | public class class_name {
public void done(T response) throws IllegalArgumentException {
lock.lock();
try {
if (response != null) {
this.response = response; // depends on control dependency: [if], data = [none]
condition.signal(); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("response cannot be null");
}
} finally {
lock.unlock();
}
} } |
public class class_name {
private synchronized Producer<CloseableReference<CloseableImage>>
getLocalContentUriFetchSequence() {
if (mLocalContentUriFetchSequence == null) {
LocalContentUriFetchProducer localContentUriFetchProducer =
mProducerFactory.newLocalContentUriFetchProducer();
ThumbnailProducer<EncodedImage>[] thumbnailProducers = new ThumbnailProducer[2];
thumbnailProducers[0] = mProducerFactory.newLocalContentUriThumbnailFetchProducer();
thumbnailProducers[1] = mProducerFactory.newLocalExifThumbnailProducer();
mLocalContentUriFetchSequence = newBitmapCacheGetToLocalTransformSequence(
localContentUriFetchProducer,
thumbnailProducers);
}
return mLocalContentUriFetchSequence;
} } | public class class_name {
private synchronized Producer<CloseableReference<CloseableImage>>
getLocalContentUriFetchSequence() {
if (mLocalContentUriFetchSequence == null) {
LocalContentUriFetchProducer localContentUriFetchProducer =
mProducerFactory.newLocalContentUriFetchProducer();
ThumbnailProducer<EncodedImage>[] thumbnailProducers = new ThumbnailProducer[2];
thumbnailProducers[0] = mProducerFactory.newLocalContentUriThumbnailFetchProducer(); // depends on control dependency: [if], data = [none]
thumbnailProducers[1] = mProducerFactory.newLocalExifThumbnailProducer(); // depends on control dependency: [if], data = [none]
mLocalContentUriFetchSequence = newBitmapCacheGetToLocalTransformSequence(
localContentUriFetchProducer,
thumbnailProducers); // depends on control dependency: [if], data = [none]
}
return mLocalContentUriFetchSequence;
} } |
public class class_name {
public String createHash(final String iInput, final String iAlgorithm, final boolean iIncludeAlgorithm) {
if (iInput == null)
throw new IllegalArgumentException("Input string is null");
if (iAlgorithm == null)
throw new IllegalArgumentException("Algorithm is null");
final StringBuilder buffer = new StringBuilder(128);
final String algorithm = validateAlgorithm(iAlgorithm);
if (iIncludeAlgorithm) {
buffer.append('{');
buffer.append(algorithm);
buffer.append('}');
}
final String transformed;
if (HASH_ALGORITHM.equalsIgnoreCase(algorithm)) {
transformed = createSHA256(iInput);
} else if (PBKDF2_ALGORITHM.equalsIgnoreCase(algorithm)) {
transformed = createHashWithSalt(iInput, OGlobalConfiguration.SECURITY_USER_PASSWORD_SALT_ITERATIONS.getValueAsInteger(),
algorithm);
} else if (PBKDF2_SHA256_ALGORITHM.equalsIgnoreCase(algorithm)) {
transformed = createHashWithSalt(iInput, OGlobalConfiguration.SECURITY_USER_PASSWORD_SALT_ITERATIONS.getValueAsInteger(),
algorithm);
} else
throw new IllegalArgumentException("Algorithm '" + algorithm + "' is not supported");
buffer.append(transformed);
return buffer.toString();
} } | public class class_name {
public String createHash(final String iInput, final String iAlgorithm, final boolean iIncludeAlgorithm) {
if (iInput == null)
throw new IllegalArgumentException("Input string is null");
if (iAlgorithm == null)
throw new IllegalArgumentException("Algorithm is null");
final StringBuilder buffer = new StringBuilder(128);
final String algorithm = validateAlgorithm(iAlgorithm);
if (iIncludeAlgorithm) {
buffer.append('{');
// depends on control dependency: [if], data = [none]
buffer.append(algorithm);
// depends on control dependency: [if], data = [none]
buffer.append('}');
// depends on control dependency: [if], data = [none]
}
final String transformed;
if (HASH_ALGORITHM.equalsIgnoreCase(algorithm)) {
transformed = createSHA256(iInput);
// depends on control dependency: [if], data = [none]
} else if (PBKDF2_ALGORITHM.equalsIgnoreCase(algorithm)) {
transformed = createHashWithSalt(iInput, OGlobalConfiguration.SECURITY_USER_PASSWORD_SALT_ITERATIONS.getValueAsInteger(),
algorithm);
// depends on control dependency: [if], data = [none]
} else if (PBKDF2_SHA256_ALGORITHM.equalsIgnoreCase(algorithm)) {
transformed = createHashWithSalt(iInput, OGlobalConfiguration.SECURITY_USER_PASSWORD_SALT_ITERATIONS.getValueAsInteger(),
algorithm);
// depends on control dependency: [if], data = [none]
} else
throw new IllegalArgumentException("Algorithm '" + algorithm + "' is not supported");
buffer.append(transformed);
return buffer.toString();
} } |
public class class_name {
public void setPattern(final ConwayPattern pattern) {
final boolean[][] gridData = pattern.getPattern();
int gridWidth = gridData[0].length;
int gridHeight = gridData.length;
int columnOffset = 0;
int rowOffset = 0;
if ( gridWidth > getNumberOfColumns() ) {
gridWidth = getNumberOfColumns();
} else {
columnOffset = (getNumberOfColumns() - gridWidth) / 2;
}
if ( gridHeight > getNumberOfRows() ) {
gridHeight = getNumberOfRows();
} else {
rowOffset = (getNumberOfRows() - gridHeight) / 2;
}
this.delegate.killAll();
for ( int column = 0; column < gridWidth; column++ ) {
for ( int row = 0; row < gridHeight; row++ ) {
if ( gridData[row][column] ) {
final Cell cell = getCellAt( row + rowOffset,
column + columnOffset );
updateCell( cell, CellState.LIVE );
}
}
}
//this.delegate.setPattern();
} } | public class class_name {
public void setPattern(final ConwayPattern pattern) {
final boolean[][] gridData = pattern.getPattern();
int gridWidth = gridData[0].length;
int gridHeight = gridData.length;
int columnOffset = 0;
int rowOffset = 0;
if ( gridWidth > getNumberOfColumns() ) {
gridWidth = getNumberOfColumns(); // depends on control dependency: [if], data = [none]
} else {
columnOffset = (getNumberOfColumns() - gridWidth) / 2; // depends on control dependency: [if], data = [none]
}
if ( gridHeight > getNumberOfRows() ) {
gridHeight = getNumberOfRows(); // depends on control dependency: [if], data = [none]
} else {
rowOffset = (getNumberOfRows() - gridHeight) / 2; // depends on control dependency: [if], data = [none]
}
this.delegate.killAll();
for ( int column = 0; column < gridWidth; column++ ) {
for ( int row = 0; row < gridHeight; row++ ) {
if ( gridData[row][column] ) {
final Cell cell = getCellAt( row + rowOffset,
column + columnOffset );
updateCell( cell, CellState.LIVE ); // depends on control dependency: [if], data = [none]
}
}
}
//this.delegate.setPattern();
} } |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.