bug_id stringlengths 1 3 | task_id stringlengths 64 64 | function_signature stringlengths 15 364 | prompt_chat stringlengths 471 20.2k | code stringlengths 44 19.8k | defective bool 2
classes | project stringclasses 17
values | prompt_complete stringlengths 3.07k 22.8k |
|---|---|---|---|---|---|---|---|
5 | 366305ebc6f7c700952e843c558df2a82701a1df78a2390af8bbc8faee14290e | public Complex reciprocal() | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public Complex reciprocal() {
if (isNaN) {
return NaN;
}
if (real == 0.0 && imaginary == 0.0) {
return NaN;
}
if (isInfinite) {
return ZERO;
}
if (FastMath.abs(real) < FastMath.abs(imaginary)) {
double q = rea... | true | Math | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
35 | 366b3a80a16dbfc64e34e3db7f7b814ea842a23a759f594ed3c029be31f89015 | public List<String> getMatchingOptions(String opt)
| I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public List<String> getMatchingOptions(String opt)
{
opt = Util.stripLeadingHyphens(opt);
List<String> matchingOpts = new ArrayList<String>();
// for a perfect match return the single option only
if(longOpts.keySet().contains(opt)) {
return Collections.singl... | false | Cli | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
93 | 369e39538cfbe2f832a83534ca69227835032e57069d32862416cc0287badaea | public List<Connection.KeyVal> formData() | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public List<Connection.KeyVal> formData() {
ArrayList<Connection.KeyVal> data = new ArrayList<>();
// iterate the form control elements and accumulate their values
for (Element el: elements) {
if (!el.tag().isFormSubmittable()) continue; // contents are form listable, superset o... | true | Jsoup | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
10 | 36cc1745523966b6bb576ffcb5e34014c90a437bfc0bd619a0d4d78766d9ca0d | public String absUrl(String attributeKey) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public String absUrl(String attributeKey) {
Validate.notEmpty(attributeKey);
String relUrl = attr(attributeKey);
if (!hasAttr(attributeKey)) {
return ""; // nothing to make absolute with
} else {
URL base;
try {
try {
... | false | Jsoup | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
15 | 36d0b0761e433811c828ab1c0cf3fe6c3d3ac8c5514e8b7e09a2153b8e75b2f2 | private char getMappingCode(final String str, final int index) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | private char getMappingCode(final String str, final int index) {
// map() throws IllegalArgumentException
final char mappedChar = this.map(str.charAt(index));
// HW rule check
if (index > 1 && mappedChar != '0') {
final char hwChar = str.charAt(index - 1);
if ... | true | Codec | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
11 | 36eac1e29f5262d425a85b3cf67380b660191104c45cecb11a34b6ac4b748081 | private void _verifySharing()
| I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | private void _verifySharing()
{
if (_hashShared) {
_hashArea = Arrays.copyOf(_hashArea, _hashArea.length);
_names = Arrays.copyOf(_names, _names.length);
_hashShared = false;
// 09-Sep-2015, tatu: As per [jackson-core#216], also need to ensure
... | true | JacksonCore | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
17 | 374b9244cafef1c352d9550e14e933cd2bdd2bc3ce99ab1b79b79dd6381868a8 | public static long parseOctal(final byte[] buffer, final int offset, final int length) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public static long parseOctal(final byte[] buffer, final int offset, final int length) {
long result = 0;
int end = offset + length;
int start = offset;
if (length < 2){
throw new IllegalArgumentException("Length "+length+" must be at least 2");
}
... | true | Compress | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
19 | 3755085bc6b324cb77c77a1d3cc2d2b72d54eb790b37fb08a31fb09a0c1390ae | protected void declareNameInScope(FlowScope scope, Node node, JSType type) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | protected void declareNameInScope(FlowScope scope, Node node, JSType type) {
switch (node.getType()) {
case Token.NAME:
scope.inferSlotType(node.getString(), type);
break;
case Token.GETPROP:
String qualifiedName = node.getQualifiedName();
Preconditions.checkNotNull(qu... | false | Closure | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
7 | 380d15991f5eec349a5d89c4a032c87c62e73b84a1accd8db29929db9677f308 | @Override
public JSType caseObjectType(ObjectType type) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | @Override
public JSType caseObjectType(ObjectType type) {
if (value.equals("function")) {
JSType ctorType = getNativeType(U2U_CONSTRUCTOR_TYPE);
if (resultEqualsValue) {
// Objects are restricted to "Function", subtypes are left
return ctorType.getGreatestSubtype(type);... | false | Closure | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
87 | 38160a0ea22f541b0329a0e38cb4929550bd84441cc5571d287f28753ab51ddf | private boolean isFoldableExpressBlock(Node n) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | private boolean isFoldableExpressBlock(Node n) {
if (n.getType() == Token.BLOCK) {
if (n.hasOneChild()) {
Node maybeExpr = n.getFirstChild();
if (maybeExpr.getType() == Token.EXPR_RESULT) {
// IE has a bug where event handlers behave differently when
// their return value... | false | Closure | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
20 | 382510e3fd009ecda782bad978479f425654f19e0b420e76b52a579e9848a3b8 | public ValueMarker(double value, Paint paint, Stroke stroke,
Paint outlinePaint, Stroke outlineStroke, float alpha) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public ValueMarker(double value, Paint paint, Stroke stroke,
Paint outlinePaint, Stroke outlineStroke, float alpha) {
super(paint, stroke, outlinePaint, outlineStroke, alpha);
this.value = value;
} | false | Chart | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
2 | 387f4e487342b5eb59bdb88a22df5ca60da77963f838a41c6ad00a8b365cd5b5 | void encode(byte[] in, int inPos, int inAvail) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | void encode(byte[] in, int inPos, int inAvail) {
if (eof) {
return;
}
// inAvail < 0 is how we're informed of EOF in the underlying data we're
// encoding.
if (inAvail < 0) {
eof = true;
if (buf == null || buf.length - pos < encodeSize) {
... | false | Codec | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
37 | 38c2b1273a9eb651fbad88c6ac5359aa7e09826c21a1d891b087e471d80c22f4 | private boolean isShortOption(String token)
| I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | private boolean isShortOption(String token)
{
// short options (-S, -SV, -S=V, -SV1=V2, -S1S2)
if (!token.startsWith("-") || token.length() == 1)
{
return false;
}
// remove leading "-" and "=value"
int pos = token.indexOf("=");
String optName... | false | Cli | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
6 | 38dddbb8cbf1324d0519d304c0d3b366fd71765cdf5ed50bbcf44b808ecc58be | protected boolean equal(
EvalContext context,
Expression left,
Expression right)
| I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | protected boolean equal(
EvalContext context,
Expression left,
Expression right)
{
Object l = left.compute(context);
Object r = right.compute(context);
// System.err.println("COMPARING: " +
// (l == null ? "null" : l.getClass().getName()) + " " +
// ... | true | JxPath | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
4 | 393ec66314a376228d71cafb9161fa072ea6cc7ff36b001401b23a0c0d14d9f1 | @Override
JSType resolveInternal(ErrorReporter t, StaticScope<JSType> enclosing) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | @Override
JSType resolveInternal(ErrorReporter t, StaticScope<JSType> enclosing) {
// TODO(user): Investigate whether it is really necessary to keep two
// different mechanisms for resolving named types, and if so, which order
// makes more sense. Now, resolution via registry is first in order to
//... | true | Closure | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
6 | 39c06f3ed16f11344dfa55768a09ab1a4a76f123912b9082277ef481313fcdaa | protected boolean equal(
EvalContext context,
Expression left,
Expression right)
| I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | protected boolean equal(
EvalContext context,
Expression left,
Expression right)
{
Object l = left.compute(context);
Object r = right.compute(context);
// System.err.println("COMPARING: " +
// (l == null ? "null" : l.getClass().getName()) + " " +
// ... | false | JxPath | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
24 | 3a0af8dd3e4ed3e01d6e0f6ece2f7d1dd9635e8fafe2c4b50255cdc793bd18f7 | public Object answer(InvocationOnMock invocation) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public Object answer(InvocationOnMock invocation) {
if (methodsGuru.isToString(invocation.getMethod())) {
Object mock = invocation.getMock();
MockName name = mockUtil.getMockName(mock);
if (name.isDefault()) {
return "Mock for " + mockUtil.getMockSettings(... | false | Mockito | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
42 | 3a4f0cae303a12d71965a02345a4b8ef4bb42dcc70058302b1e9fb4201d30609 | @Override
protected Object _deserializeFromEmptyString() throws IOException | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | @Override
protected Object _deserializeFromEmptyString() throws IOException {
// As per [databind#398], URI requires special handling
if (_kind == STD_URI) {
return URI.create("");
}
// As per [databind#1123], Locale too
return ... | true | JacksonDatabind | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
31 | 3a6466065def69d5a81353a313edac4fb0f48ecf6f494a841eaf9612c799ad7b | public double evaluate(double x, double epsilon, int maxIterations) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public double evaluate(double x, double epsilon, int maxIterations) {
final double small = 1e-50;
double hPrev = getA(0, x);
// use the value of small as epsilon criteria for zero checks
if (Precision.equals(hPrev, 0.0, small)) {
hPrev = small;
}
int n =... | false | Math | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
16 | 3abcf5d2198a062d6fe122146e83a43d7cc351fdd351081ef282f7f41510bc59 | public static Number createNumber(String str) throws NumberFormatException | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public static Number createNumber(String str) throws NumberFormatException {
if (str == null) {
return null;
}
if (StringUtils.isBlank(str)) {
throw new NumberFormatException("A blank string is not a valid number");
}
if (str.startsWith("--")) {
... | false | Lang | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
2 | 3b00af5bc69529170a647c6cba29923596467a0e1ade648ac742c13d6c799d9c | protected void burstToken(String token, boolean stopAtNonOption)
| I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | protected void burstToken(String token, boolean stopAtNonOption)
{
int tokenLength = token.length();
for (int i = 1; i < tokenLength; i++)
{
String ch = String.valueOf(token.charAt(i));
boolean hasOption = options.hasOption(ch);
if (hasOption)
... | true | Cli | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
3 | 3bd6a68c6197351575aeca385fabc17acf4854d8e800e3af25af54e33a221e23 | public static double linearCombination(final double[] a, final double[] b)
throws DimensionMismatchException | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public static double linearCombination(final double[] a, final double[] b)
throws DimensionMismatchException {
final int len = a.length;
if (len != b.length) {
throw new DimensionMismatchException(len, b.length);
}
// Revert to scalar multiplication.
... | true | Math | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
5 | 3cb482e2e949e5b891d4cad1465f5d0a53a546f44a830654006bda2bbce63dad | public int read(byte[] buffer, int start, int length) throws IOException | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public int read(byte[] buffer, int start, int length) throws IOException {
if (closed) {
throw new IOException("The stream is closed");
}
if (inf.finished() || current == null) {
return -1;
}
// avoid int overflow, check null buffer
if (start ... | false | Compress | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
44 | 3cca9cc9eed361c3eedb533ec701b336efdd24a5a8230a9e385a8d5b4ef4e84b | public ChecksumCalculatingInputStream(final Checksum checksum, final InputStream in) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public ChecksumCalculatingInputStream(final Checksum checksum, final InputStream in) {
if ( checksum == null ){
throw new NullPointerException("Parameter checksum must not be null");
}
if ( in == null ){
throw new NullPointerException("Parameter in must not be null"... | false | Compress | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
28 | 3cfc569fb3f4bf2e0e351ff7ab9967c7fa8d1beb291d87b3ad78c36f03b238d8 | @Override
public int read(byte[] buf, int offset, int numToRead) throws IOException | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | @Override
public int read(byte[] buf, int offset, int numToRead) throws IOException {
int totalRead = 0;
if (hasHitEOF || entryOffset >= entrySize) {
return -1;
}
if (currEntry == null) {
throw new IllegalStateException("No current tar entry");
}
... | false | Compress | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
86 | 3e7abd1c402c8e4f86ea5511af24232ba54521501322e4802f5aeeee4ceadb2a | static boolean evaluatesToLocalValue(Node value, Predicate<Node> locals) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | static boolean evaluatesToLocalValue(Node value, Predicate<Node> locals) {
switch (value.getType()) {
case Token.ASSIGN:
// A result that is aliased by a non-local name, is the effectively the
// same as returning a non-local name, but this doesn't matter if the
// value is immutable... | false | Closure | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
45 | 3effed3d2af2d7069f6ab40db9f60a7ae548990eaca4bf32819b59fc08fa3db5 | public OpenMapRealMatrix(int rowDimension, int columnDimension) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public OpenMapRealMatrix(int rowDimension, int columnDimension) {
super(rowDimension, columnDimension);
long lRow = (long) rowDimension;
long lCol = (long) columnDimension;
if (lRow * lCol >= (long) Integer.MAX_VALUE) {
throw new NumberIsTooLargeException(lRow * lCol, Int... | false | Math | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
40 | 3f42a5ab6a0fdebad780bc3e398e098e938741f7212d784f5308e715fc17f26c | @SuppressWarnings("unchecked") // returned value will have type T because it is fixed by clazz
public static <T> T createValue(final String str, final Class<T> clazz) throws ParseException
| I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | @SuppressWarnings("unchecked") // returned value will have type T because it is fixed by clazz
public static <T> T createValue(final String str, final Class<T> clazz) throws ParseException
{
if (PatternOptionBuilder.STRING_VALUE == clazz)
{
return (T) str;
}
else ... | true | Cli | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
89 | 3f57932c5c681fad8bf50a031cbe00b982f8caaffc8ae001bb0ee51a36b840c1 | @Deprecated
public void addValue(Object v) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | @Deprecated
public void addValue(Object v) {
if (v instanceof Comparable<?>){
addValue((Comparable<?>) v);
} else {
throw new IllegalArgumentException("Object must implement Comparable");
}
} | false | Math | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
98 | 3f91fd3b2102d4aa26695ba0eb9ef76130cd71abc97e04575036108d926c09d6 | public Object complete(JsonParser p, DeserializationContext ctxt,
PropertyValueBuffer buffer, PropertyBasedCreator creator)
throws IOException
| I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public Object complete(JsonParser p, DeserializationContext ctxt,
PropertyValueBuffer buffer, PropertyBasedCreator creator)
throws IOException
{
// first things first: deserialize all data buffered:
final int len = _properties.length;
Object[] values = new Object[len]... | true | JacksonDatabind | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
75 | 3fc4735b82620958a55c2adfdcc8760bc2081f4417b148a00189d3923a4e04cc | final void html(final Appendable accum, final Document.OutputSettings out) throws IOException | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | final void html(final Appendable accum, final Document.OutputSettings out) throws IOException {
final int sz = size;
for (int i = 0; i < sz; i++) {
// inlined from Attribute.html()
final String key = keys[i];
final String val = vals[i];
accum.append(' ... | false | Jsoup | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
97 | 3fe9cb34326a1594b06efacdea1437896108e8141d5030bcaa7b09f8b2a9bf12 | private Node tryFoldShift(Node n, Node left, Node right) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | private Node tryFoldShift(Node n, Node left, Node right) {
if (left.getType() == Token.NUMBER &&
right.getType() == Token.NUMBER) {
double result;
double lval = left.getDouble();
double rval = right.getDouble();
// check ranges. We do not do anything that would clip the double t... | true | Closure | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
40 | 406c05b04f33e28b8ee3c630b3b640bdec14a66e5482fc528e29ca80e80cb8bd | public DocumentType(String name, String publicId, String systemId, String baseUri) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public DocumentType(String name, String publicId, String systemId, String baseUri) {
super(baseUri);
attr("name", name);
attr("publicId", publicId);
attr("systemId", systemId);
} | false | Jsoup | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
94 | 406c15f03dccaedac47ca63490706e88e47cfe2b522c630517c44cf0f7203e1e | public static int gcd(int u, int v) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public static int gcd(int u, int v) {
if ((u == 0) || (v == 0)) {
return (Math.abs(u) + Math.abs(v));
}
// keep u and v negative, as negative integers range down to
// -2^31, while positive numbers can only be as large as 2^31-1
// (i.e. we can't necessarily negat... | false | Math | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
117 | 4074b7be07ba56fb3229ac9e1566b973dfc791c702dd572e1b5a76434d803fa3 | String getReadableJSTypeName(Node n, boolean dereference) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | String getReadableJSTypeName(Node n, boolean dereference) {
// The best type name is the actual type name.
// If we're analyzing a GETPROP, the property may be inherited by the
// prototype chain. So climb the prototype chain and find out where
// the property was originally defined.
if (n.isGet... | true | Closure | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
54 | 40a2f9f34fd784168f28f558314ea7a5fe946eff2887e6f900ee3c4abfa425cf | public static Locale toLocale(String str) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public static Locale toLocale(String str) {
if (str == null) {
return null;
}
int len = str.length();
if (len != 2 && len != 5 && len < 7) {
throw new IllegalArgumentException("Invalid locale format: " + str);
}
char ch0 = str.charAt(0);
... | true | Lang | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
50 | 418c7d2ef63355c694a4e9b5a5b52ce48aa9ef49b802d315d49c1e3c80ec055e | protected final double doSolve() | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | protected final double doSolve() {
// Get initial solution
double x0 = getMin();
double x1 = getMax();
double f0 = computeObjectiveValue(x0);
double f1 = computeObjectiveValue(x1);
// If one of the bounds is the exact root, return it. Since these are
// not u... | false | Math | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
40 | 418ef3a199e373b2b12820c00bc89e6fdc421eaaa9d98266d9bb8c5fcbe53bfd | @Override
protected double doSolve() | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | @Override
protected double doSolve() {
// prepare arrays with the first points
final double[] x = new double[maximalOrder + 1];
final double[] y = new double[maximalOrder + 1];
x[0] = getMin();
x[1] = getStartValue();
x[2] = getMax();
verifySequence(x[0],... | true | Math | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
4 | 420b3b682e0e313b6c4d9b0e8e0a19186f16ddd84734bd990f28f102c2a6a8df | public Range getDataRange(ValueAxis axis) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public Range getDataRange(ValueAxis axis) {
Range result = null;
List mappedDatasets = new ArrayList();
List includedAnnotations = new ArrayList();
boolean isDomainAxis = true;
// is it a domain axis?
int domainIndex = getDomainAxisIndex(axis);
if (domainInd... | false | Chart | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
11 | 42967114e16de4c5ef90fc2e0b6dd7b129e5f5386dd515331434afa7938cc377 | public double density(final double[] vals) throws DimensionMismatchException | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public double density(final double[] vals) throws DimensionMismatchException {
final int dim = getDimension();
if (vals.length != dim) {
throw new DimensionMismatchException(vals.length, dim);
}
return FastMath.pow(2 * FastMath.PI, -0.5 * dim) *
FastMath.pow(... | false | Math | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
12 | 42de3726650f3902d60f9d8fb6eabb473d3eb2b9f413d873537bdc5de4635698 | public Class getGenericType(Field field) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public Class getGenericType(Field field) {
Type generic = field.getGenericType();
if (generic != null && generic instanceof ParameterizedType) {
Type actual = ((ParameterizedType) generic).getActualTypeArguments()[0];
if (actual instanceof Class) {
ret... | false | Mockito | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
11 | 43750fac284be2062ba176fa6ff49659167479594eea9d71ed04a83545b401c8 | public ArchiveInputStream createArchiveInputStream(final InputStream in)
throws ArchiveException | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public ArchiveInputStream createArchiveInputStream(final InputStream in)
throws ArchiveException {
if (in == null) {
throw new IllegalArgumentException("Stream must not be null.");
}
if (!in.markSupported()) {
throw new IllegalArgumentException("Mark is n... | false | Compress | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
58 | 43e8e0af17887e3066429466d09ecc3fea42dd7b69faed5455c1bbe2b7a226ae | private void computeGenKill(Node n, BitSet gen, BitSet kill,
boolean conditional) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | private void computeGenKill(Node n, BitSet gen, BitSet kill,
boolean conditional) {
switch (n.getType()) {
case Token.SCRIPT:
case Token.BLOCK:
case Token.FUNCTION:
return;
case Token.WHILE:
case Token.DO:
case Token.IF:
computeGenKill(NodeUtil.getCondit... | true | Closure | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
15 | 44666cd937affcc578e6f40a060cd270c19c8f750b249f2fda27a6f09dc9707d | @Override
public boolean equals(Object obj) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
ZipArchiveEntry other = (ZipArchiveEntry) obj;
String myName = getName();
String othe... | false | Compress | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
4 | 4479e7e62b9e84d7d843806b8ac568891db6449153aa81bb4c845185eca274b9 | public Partial with(DateTimeFieldType fieldType, int value) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public Partial with(DateTimeFieldType fieldType, int value) {
if (fieldType == null) {
throw new IllegalArgumentException("The field type must not be null");
}
int index = indexOf(fieldType);
if (index == -1) {
DateTimeFieldType[] newTypes = new DateTimeFieldT... | false | Time | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
159 | 4494195d42d2aba283669952b7fd3d272c25d30facbd4003fc712d41add34280 | private void findCalledFunctions(
Node node, Set<String> changed) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | private void findCalledFunctions(
Node node, Set<String> changed) {
Preconditions.checkArgument(changed != null);
// For each referenced function, add a new reference
if (node.getType() == Token.NAME) {
if (isCandidateUsage(node)) {
changed.add(node.getString());
}
}
for... | false | Closure | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
130 | 4514c57fa6501281e244503bd510c769ed4bd1d85a965aa605d8e7aa76c586a1 | private void inlineAliases(GlobalNamespace namespace) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | private void inlineAliases(GlobalNamespace namespace) {
// Invariant: All the names in the worklist meet condition (a).
Deque<Name> workList = new ArrayDeque<Name>(namespace.getNameForest());
while (!workList.isEmpty()) {
Name name = workList.pop();
// Don't attempt to inline a getter or sett... | true | Closure | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
13 | 45848e3ed0b67244942179c7ec710a6d5f8eaf9b68c628abfa7d4edb4efcd2ff | public Object handle(Invocation invocation) throws Throwable | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public Object handle(Invocation invocation) throws Throwable {
if (invocationContainerImpl.hasAnswersForStubbing()) {
// stubbing voids with stubVoid() or doAnswer() style
InvocationMatcher invocationMatcher = matchersBinder.bindMatchers(mockingProgress
.g... | true | Mockito | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
4 | 4596e77a36c5dcad96c03b8b136d3be4c812f9def987e425b5954913b7f771e1 | public Map<String, Integer> getHeaderMap() | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public Map<String, Integer> getHeaderMap() {
return new LinkedHashMap<String, Integer>(this.headerMap);
} | true | Csv | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
12 | 45e127ad8d9349a25c4fc91351f5bdc54866efa52fbfa33ff911cd8921b7a6de | protected String[] flatten(Options options, String[] arguments, boolean stopAtNonOption)
| I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | protected String[] flatten(Options options, String[] arguments, boolean stopAtNonOption)
{
List tokens = new ArrayList();
boolean eatTheRest = false;
for (int i = 0; i < arguments.length; i++)
{
String arg = arguments[i];
if ("--".equals(arg))
... | true | Cli | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
97 | 468532214507917118d685ce70b2f9706b1d35d3e44a23cab2ad5f369088bd77 | @Override
public final void serialize(JsonGenerator gen, SerializerProvider ctxt) throws IOException
| I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | @Override
public final void serialize(JsonGenerator gen, SerializerProvider ctxt) throws IOException
{
if (_value == null) {
ctxt.defaultSerializeNull(gen);
} else if (_value instanceof JsonSerializable) {
((JsonSerializable) _value).serialize(gen, ctxt);
} el... | true | JacksonDatabind | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
2 | 46c61cf81ab186dfd075eaa67dd0353f5f30998c39714c5788f82daad183c3a2 | public String get(final String name) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public String get(final String name) {
if (mapping == null) {
throw new IllegalStateException(
"No header mapping was specified, the record values can't be accessed by name");
}
final Integer index = mapping.get(name);
try {
return index !=... | false | Csv | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
20 | 46cdac5c57e04ceba2712e0c3e363b98b633e388673cf84d5bb9a90ee36dd0ac | public int parseInto(DateTimeParserBucket bucket, String text, int position) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public int parseInto(DateTimeParserBucket bucket, String text, int position) {
String str = text.substring(position);
String best = null;
for (String id : ALL_IDS) {
if (str.startsWith(id)) {
if (best == null || id.length() > best.length()) {
... | false | Time | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
6 | 46e3ca19e3121bcd59cf1e95689312186fa4227b241aac1af323ecfa2c25e0db | public final void translate(CharSequence input, Writer out) throws IOException | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public final void translate(CharSequence input, Writer out) throws IOException {
if (out == null) {
throw new IllegalArgumentException("The Writer must not be null");
}
if (input == null) {
return;
}
int pos = 0;
int len = input.length();
... | false | Lang | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
74 | 4782684d7c42a7d52ef57ce8fafa8f64774d9fe95d1860b14803c286e24c1607 | @SuppressWarnings("resource")
protected Object _deserializeTypedUsingDefaultImpl(JsonParser p, DeserializationContext ctxt,
TokenBuffer tb) throws IOException
| I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | @SuppressWarnings("resource")
protected Object _deserializeTypedUsingDefaultImpl(JsonParser p, DeserializationContext ctxt,
TokenBuffer tb) throws IOException
{
// As per [JACKSON-614], may have default implementation to use
JsonDeserializer<Object> deser = _findDefaultImplDeseri... | true | JacksonDatabind | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
30 | 479fb1427cbe58db4e173b0cc02d8b1b907653e0220690d4997d3ddb060767bc | private double calculateAsymptoticPValue(final double Umin,
final int n1,
final int n2)
throws ConvergenceException, MaxCountExceededException | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | private double calculateAsymptoticPValue(final double Umin,
final int n1,
final int n2)
throws ConvergenceException, MaxCountExceededException {
final int n1n2prod = n1 * n2;
// http://en.wikipedia.or... | true | Math | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
17 | 47bca00d947a8c6e455dd089e895ceed780f1e04c78a1d9d640884abdf256539 | private JSType getDeclaredType(String sourceName, JSDocInfo info,
Node lValue, @Nullable Node rValue) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | private JSType getDeclaredType(String sourceName, JSDocInfo info,
Node lValue, @Nullable Node rValue) {
if (info != null && info.hasType()) {
return getDeclaredTypeInAnnotation(sourceName, lValue, info);
} else if (rValue != null && rValue.isFunction() &&
shouldUseFunctionLiter... | false | Closure | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
14 | 4841ee0ed4be8b1a8658e79e686722bb9efe4d8700446004b9ae3af2a9c128d5 | public int[] add(ReadablePartial partial, int fieldIndex, int[] values, int valueToAdd) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public int[] add(ReadablePartial partial, int fieldIndex, int[] values, int valueToAdd) {
// overridden as superclass algorithm can't handle
// 2004-02-29 + 48 months -> 2008-02-29 type dates
if (valueToAdd == 0) {
return values;
}
// month is largest field an... | true | Time | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
84 | 488f995e5f16497f45faba5a06a993325d32815a4e7e920ccec8c27e3027fecd | public void head(org.jsoup.nodes.Node source, int depth) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public void head(org.jsoup.nodes.Node source, int depth) {
namespacesStack.push(new HashMap<>(namespacesStack.peek())); // inherit from above on the stack
if (source instanceof org.jsoup.nodes.Element) {
org.jsoup.nodes.Element sourceEl = (org.jsoup.nodes.Element) source;... | true | Jsoup | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
3 | 48d00d82b8b334c8be4493bd96ccacf7eedf86b4bf21fadb3d0abbc38b6dcbfd | @Override
public String nextTextValue() throws IOException
| I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | @Override
public String nextTextValue() throws IOException
{
_binaryValue = null;
if (_nextToken != null) {
JsonToken t = _nextToken;
_currToken = t;
_nextToken = null;
// expected case; yes, got a String
if (t == JsonToken.VALUE_S... | true | JacksonXml | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
112 | 491aa043b8f794f713af19ab83fc53b29d13123a0c75fc81088acf87bc0dcead | @Override
public JsonDeserializer<?> createContextual(DeserializationContext ctxt,
BeanProperty property) throws JsonMappingException
| I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | @Override
public JsonDeserializer<?> createContextual(DeserializationContext ctxt,
BeanProperty property) throws JsonMappingException
{
// May need to resolve types for delegate-based creators:
JsonDeserializer<Object> delegate = null;
if (_valueInstantiator != null) {
... | true | JacksonDatabind | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
27 | 499465725cfeeea6d8fa1be0c091c8d20133663cb1a16495da87ef72a0ab3f1d | static String getCharsetFromContentType(String contentType) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | static String getCharsetFromContentType(String contentType) {
if (contentType == null) return null;
Matcher m = charsetPattern.matcher(contentType);
if (m.find()) {
String charset = m.group(1).trim();
charset = charset.toUpperCase(Locale.ENGLISH);
return c... | true | Jsoup | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
131 | 4a2a1450f5078cb75b1aac3a1484093b3a28dab55ceed894e4d330a479cf6e1e | public static boolean isJSIdentifier(String s) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public static boolean isJSIdentifier(String s) {
int length = s.length();
if (length == 0 ||
Character.isIdentifierIgnorable(s.charAt(0)) ||
!Character.isJavaIdentifierStart(s.charAt(0))) {
return false;
}
for (int i = 1; i < length; i++) {
if (Character... | false | Closure | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
11 | 4ae750cfadb8cf9890cf6d7cc0c7ef400f34c36b52feeb78c911a5926b4e5ac0 | private Map<String, Integer> initializeHeader() throws IOException | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | private Map<String, Integer> initializeHeader() throws IOException {
Map<String, Integer> hdrMap = null;
final String[] formatHeader = this.format.getHeader();
if (formatHeader != null) {
hdrMap = new LinkedHashMap<String, Integer>();
String[] headerRecord = null;
... | false | Csv | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
21 | 4bd974ea0ace3b7700c19aa2cc6514631c9f2ebe2cdf21f23259a48e33d519c5 | @Override
public void visit(NodeTraversal t, Node n, Node parent) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | @Override
public void visit(NodeTraversal t, Node n, Node parent) {
// VOID nodes appear when there are extra semicolons at the BLOCK level.
// I've been unable to think of any cases where this indicates a bug,
// and apparently some people like keeping these semicolons around,
// so we'll allow it.... | true | Closure | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
16 | 4c3e8b99f1a9e6c99d29cd96a667f5c32933a78bfaa924e395db7c93b42766e1 | protected final boolean _add(Annotation ann) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | protected final boolean _add(Annotation ann) {
if (_annotations == null) {
_annotations = new HashMap<Class<? extends Annotation>,Annotation>();
}
Annotation previous = _annotations.put(ann.annotationType(), ann);
return (previous != null) && previous.equals(ann);
} | true | JacksonDatabind | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
48 | 4d255105cdde2e31f3a58bae739422ca78e5848de1f0b93fd5833b06407a6d5d | void maybeDeclareQualifiedName(NodeTraversal t, JSDocInfo info,
Node n, Node parent, Node rhsValue) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | void maybeDeclareQualifiedName(NodeTraversal t, JSDocInfo info,
Node n, Node parent, Node rhsValue) {
Node ownerNode = n.getFirstChild();
String ownerName = ownerNode.getQualifiedName();
String qName = n.getQualifiedName();
String propName = n.getLastChild().getString();
Precon... | false | Closure | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
5 | 4d6ac2c2107113f5373474ae57ad8723a7fbc29307589e420d93436531f4b4f9 | private final static int _parseIndex(String str) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | private final static int _parseIndex(String str) {
final int len = str.length();
// [Issue#133]: beware of super long indexes; assume we never
// have arrays over 2 billion entries so ints are fine.
if (len == 0 || len > 10) {
return -1;
}
for (int i = 0; ... | true | JacksonCore | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
34 | 4f53638ec6e69fa85a1ec279f87931bf9438237025de439b0dde12e5fff80b6b | public Iterator<Chromosome> iterator() | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public Iterator<Chromosome> iterator() {
return getChromosomes().iterator();
} | false | Math | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
15 | 4fa7e1fd6cdef41c8943d60b824f24d52d4fe12576bb043206cd4538c3477f82 | public static long safeMultiply(long val1, int val2) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public static long safeMultiply(long val1, int val2) {
switch (val2) {
case -1:
if (val1 == Long.MIN_VALUE) {
throw new ArithmeticException("Multiplication overflows a long: " + val1 + " * " + val2);
}
return -val1;
... | false | Time | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
7 | 4fdda0a543bc8df8b9425ec1a8db87f548f2c5749085bd61b59300cd079f83ea | public int parseInto(ReadWritableInstant instant, String text, int position) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public int parseInto(ReadWritableInstant instant, String text, int position) {
DateTimeParser parser = requireParser();
if (instant == null) {
throw new IllegalArgumentException("Instant must not be null");
}
long instantMillis = instant.getMillis();
Chro... | true | Time | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
26 | 4fdde7aee8168c872ced01fa31f4f07547a62d8d1ccda7015a927c782fe19f57 | protected AxisState drawLabel(String label, Graphics2D g2,
Rectangle2D plotArea, Rectangle2D dataArea, RectangleEdge edge,
AxisState state, PlotRenderingInfo plotState) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | protected AxisState drawLabel(String label, Graphics2D g2,
Rectangle2D plotArea, Rectangle2D dataArea, RectangleEdge edge,
AxisState state, PlotRenderingInfo plotState) {
// it is unlikely that 'state' will be null, but check anyway...
if (state == null) {
thro... | false | Chart | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
1 | 507620c195343cf0854da676972de386ee51452761e9c98e6e77123589a1c989 | @Override
public JsonToken nextToken() throws IOException
| I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | @Override
public JsonToken nextToken() throws IOException
{
_binaryValue = null;
if (_nextToken != null) {
JsonToken t = _nextToken;
_currToken = t;
_nextToken = null;
switch (t) {
case START_OBJECT:
_parsingContext ... | false | JacksonXml | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
81 | 508f64458d4bc7dbeb9393861588d31e789708cb7531b90303b3ff30044eed39 | @Override
Node processFunctionNode(FunctionNode functionNode) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | @Override
Node processFunctionNode(FunctionNode functionNode) {
Name name = functionNode.getFunctionName();
Boolean isUnnamedFunction = false;
if (name == null) {
int functionType = functionNode.getFunctionType();
if (functionType != FunctionNode.FUNCTION_EXPRESSION) {
... | false | Closure | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
37 | 50cd2926ee9064f53ddc9371c4c3db24ce91af2c6598a0df69d9f5cca2dce44a | Map<String, String> parsePaxHeaders(final InputStream i)
throws IOException | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | Map<String, String> parsePaxHeaders(final InputStream i)
throws IOException {
final Map<String, String> headers = new HashMap<String, String>(globalPaxHeaders);
// Format is "length keyword=value\n";
while(true){ // get length
int ch;
int len = 0;
... | true | Compress | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
21 | 517ab964151a4bec4a20e1b983ef0e10ba210a6430a1b864ecdd3e4919980f77 | public int getLength() | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public int getLength() {
return ValueUtils.getLength(getBaseValue());
} | true | JxPath | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
29 | 51bf02a991fb3cf4699d3a5fddc2b2efe84e2d8ead2b96d513913ff84e584621 | static String stripLeadingAndTrailingQuotes(String str)
| I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | static String stripLeadingAndTrailingQuotes(String str)
{
if (str.startsWith("\""))
{
str = str.substring(1, str.length());
}
int length = str.length();
if (str.endsWith("\""))
{
str = str.substring(0, length - 1);
}
... | true | Cli | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
105 | 523d2cbadafadd929bdee35bf9b4a7505fcbe78370ca962294533099099d7ec0 | void tryFoldStringJoin(NodeTraversal t, Node n, Node left, Node right,
Node parent) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | void tryFoldStringJoin(NodeTraversal t, Node n, Node left, Node right,
Node parent) {
if (!NodeUtil.isGetProp(left) || !NodeUtil.isImmutableValue(right)) {
return;
}
Node arrayNode = left.getFirstChild();
Node functionName = arrayNode.getNext();
if ((arrayNode.getT... | true | Closure | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
87 | 529c8020b475481ef2a438f7384c56d25fa617fabc5a24a71c62fff5f7b1eda0 | private Integer getBasicRow(final int col) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | private Integer getBasicRow(final int col) {
Integer row = null;
for (int i = getNumObjectiveFunctions(); i < getHeight(); i++) {
if (!MathUtils.equals(getEntry(i, col), 0.0, epsilon)) {
if (row == null) {
row = i;
} else {
... | true | Math | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
66 | 52a3ebc9d8ed2080a334007c017faa3bdfd1b32dd26f25e005c4ba9dd0ca45a1 | public void visit(NodeTraversal t, Node n, Node parent) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public void visit(NodeTraversal t, Node n, Node parent) {
JSType childType;
JSType leftType, rightType;
Node left, right;
// To be explicitly set to false if the node is not typeable.
boolean typeable = true;
switch (n.getType()) {
case Token.NAME:
typeable = visitName(t, n, par... | false | Closure | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
10 | 52d6dba4eb93e002b6aea28654383abb9fd6b3bb8593838175f87be328d5b7da | private static StringBuilder escapeRegex(StringBuilder regex, String value, boolean unquote) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | private static StringBuilder escapeRegex(StringBuilder regex, String value, boolean unquote) {
for(int i= 0; i<value.length(); ++i) {
char c= value.charAt(i);
switch(c) {
case '\'':
if(unquote) {
if(++i==value.length()) {
... | false | Lang | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
17 | 52e44e642530af8eb7c4489de0a13f1bac9f410a1c15ebaf7ded8137e3ccf9fe | public final void translate(CharSequence input, Writer out) throws IOException | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public final void translate(CharSequence input, Writer out) throws IOException {
if (out == null) {
throw new IllegalArgumentException("The Writer must not be null");
}
if (input == null) {
return;
}
int pos = 0;
int len = Character.codePointCo... | true | Lang | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
2 | 52f815fdf61f3d0723d7758da87917d2826d324d35062e3dd955420f1bcbd32e | private void checkInterfaceConflictProperties(NodeTraversal t, Node n,
String functionName, HashMap<String, ObjectType> properties,
HashMap<String, ObjectType> currentProperties,
ObjectType interfaceType) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | private void checkInterfaceConflictProperties(NodeTraversal t, Node n,
String functionName, HashMap<String, ObjectType> properties,
HashMap<String, ObjectType> currentProperties,
ObjectType interfaceType) {
ObjectType implicitProto = interfaceType.getImplicitPrototype();
Set<String> currentP... | true | Closure | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
100 | 53287b475ce1abe3ebc623a33c3b3444974bd89f4082d583d81fbbdd036801f1 | @Override
public byte[] getBinaryValue(Base64Variant b64variant)
throws IOException, JsonParseException
| I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | @Override
public byte[] getBinaryValue(Base64Variant b64variant)
throws IOException, JsonParseException
{
// Multiple possibilities...
JsonNode n = currentNode();
if (n != null) {
// [databind#2096]: although `binaryValue()` works for real binary node
... | true | JacksonDatabind | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
48 | 532f621b243f0cce62fc8483290f863041732782e81bff0e925e942687b625dc | public EqualsBuilder append(Object lhs, Object rhs) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public EqualsBuilder append(Object lhs, Object rhs) {
if (isEquals == false) {
return this;
}
if (lhs == rhs) {
return this;
}
if (lhs == null || rhs == null) {
this.setEquals(false);
return this;
}
Class lhsClas... | true | Lang | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
20 | 53a51820959f94f6548aa8f8d61946d84d0fe0496c36cd3a95711b93e0307b4e | private Node tryFoldSimpleFunctionCall(Node n) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | private Node tryFoldSimpleFunctionCall(Node n) {
Preconditions.checkState(n.isCall());
Node callTarget = n.getFirstChild();
if (callTarget != null && callTarget.isName() &&
callTarget.getString().equals("String")) {
// Fold String(a) to '' + (a) on immutable literals,
// which allows... | false | Closure | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
15 | 53b491b9dec5cfef045c63e73c26dd1f5c295239eae2ba880215dd65e76cf8c2 | public JsonWriter value(double value) throws IOException | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public JsonWriter value(double value) throws IOException {
writeDeferredName();
if (Double.isNaN(value) || Double.isInfinite(value)) {
throw new IllegalArgumentException("Numeric values must be finite, but was " + value);
}
beforeValue();
out.append(Double.toString(value));
return this;
... | true | Gson | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
101 | 53ccfdbab19593cacf8f65263e6a99f0286a3dcce06abb7d6d0f71d3ab22eda9 | @Override
protected CompilerOptions createOptions() | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | @Override
protected CompilerOptions createOptions() {
CompilerOptions options = new CompilerOptions();
options.setCodingConvention(new ClosureCodingConvention());
CompilationLevel level = flags.compilation_level;
level.setOptionsForCompilationLevel(options);
if (flags.debug) {
level.setDeb... | false | Closure | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
10 | 5436c79807ff2a5531d11d47c1e227108a47b7ff3c504a1e9738e8e364df3c52 | public void atan2(final double[] y, final int yOffset,
final double[] x, final int xOffset,
final double[] result, final int resultOffset) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public void atan2(final double[] y, final int yOffset,
final double[] x, final int xOffset,
final double[] result, final int resultOffset) {
// compute r = sqrt(x^2+y^2)
double[] tmp1 = new double[getSize()];
multiply(x, xOffset, x, xOffset, tmp1,... | false | Math | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
87 | 544d051a743b828f2d9b529becbaa89eed908f1f02e2a7898577be397405fb57 | private Integer getBasicRow(final int col) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | private Integer getBasicRow(final int col) {
Integer row = null;
for (int i = getNumObjectiveFunctions(); i < getHeight(); i++) {
if (MathUtils.equals(getEntry(i, col), 1.0, epsilon) && (row == null)) {
row = i;
} else if (!MathUtils.equals(getEntry(i, col), 0... | false | Math | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
9 | 544fb103a2eee802a556e9000f13b6d21e1c7bb7c8fba3e2f7201d5ca7cc8f62 | private void init() | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | private void init() {
thisYear= Calendar.getInstance(timeZone, locale).get(Calendar.YEAR);
nameValues= new ConcurrentHashMap<Integer, KeyValue[]>();
StringBuilder regex= new StringBuilder();
List<Strategy> collector = new ArrayList<Strategy>();
Matcher patternMatcher= form... | false | Lang | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
40 | 5485528aefc8eb8ffd2343e7a565e2389b89f890fc6fa7f87324b53e684f7cdc | public DocumentType(String name, String publicId, String systemId, String baseUri) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public DocumentType(String name, String publicId, String systemId, String baseUri) {
super(baseUri);
Validate.notEmpty(name);
attr("name", name);
attr("publicId", publicId);
attr("systemId", systemId);
} | true | Jsoup | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
15 | 54efb0a2e3fbe21d18f15d8bef9e494ad2c53defd4669db3f1977e24b599d59e | public List getValues(final Option option,
List defaultValues) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public List getValues(final Option option,
List defaultValues) {
// initialize the return list
List valueList = (List) values.get(option);
// grab the correct default values
if (defaultValues == null || defaultValues.isEmpty()) {
defaultValues =... | false | Cli | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
78 | 552b0f172cdd3c84d6d5de1a98aba717f6c7b8f0ef6ecac386d0a1831acf7b00 | private Node performArithmeticOp(int opType, Node left, Node right) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | private Node performArithmeticOp(int opType, Node left, Node right) {
// Unlike other operations, ADD operands are not always converted
// to Number.
if (opType == Token.ADD
&& (NodeUtil.mayBeString(left, false)
|| NodeUtil.mayBeString(right, false))) {
return null;
}
do... | true | Closure | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
11 | 55574722fe8ea96342e3f18aa4bd95b72fb7f8a779827881c15595bbd35fece9 | @Override
public Number read(JsonReader in) throws IOException | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | @Override
public Number read(JsonReader in) throws IOException {
JsonToken jsonToken = in.peek();
switch (jsonToken) {
case NULL:
in.nextNull();
return null;
case NUMBER:
return new LazilyParsedNumber(in.nextString());
default:
throw new JsonSyntaxEx... | true | Gson | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
40 | 555e40e9b26bed999658586184f57e6d4f3f2a1e93d76815059a9c50e8ef80b7 | @Override
public void visit(NodeTraversal t, Node n, Node parent) | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | @Override
public void visit(NodeTraversal t, Node n, Node parent) {
// Record global variable and function declarations
if (t.inGlobalScope()) {
if (NodeUtil.isVarDeclaration(n)) {
NameInformation ns = createNameInformation(t, n, parent);
Preconditions.checkNotNull(ns);
... | false | Closure | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
102 | 55f7790b1b7e19068e7928781d3e01f148d6818819c54f7aa85f6586b297bdfe | @Override
public JsonSerializer<?> createContextual(SerializerProvider serializers,
BeanProperty property) throws JsonMappingException
| I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | @Override
public JsonSerializer<?> createContextual(SerializerProvider serializers,
BeanProperty property) throws JsonMappingException
{
// Note! Should not skip if `property` null since that'd skip check
// for config overrides, in case of root value
JsonFormat.Value for... | false | JacksonDatabind | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
25 | 560f0eb193d7a404946d0d198f1aae4ed386958179bef6ea9415a5e952749e7d | private String _handleOddName2(int startPtr, int hash, int[] codes) throws IOException
| I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | private String _handleOddName2(int startPtr, int hash, int[] codes) throws IOException
{
_textBuffer.resetWithShared(_inputBuffer, startPtr, (_inputPtr - startPtr));
char[] outBuf = _textBuffer.getCurrentSegment();
int outPtr = _textBuffer.getCurrentSegmentSize();
final int maxCo... | true | JacksonCore | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
49 | 561763ac4839034f2aa73b571ed68ce340d46ef63e8c8dc04e734e9fd7d2465c | public Fraction reduce() | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public Fraction reduce() {
if (numerator == 0) {
return equals(ZERO) ? this : ZERO;
}
int gcd = greatestCommonDivisor(Math.abs(numerator), denominator);
if (gcd == 1) {
return this;
}
return Fraction.getFraction(numerator / gcd, denominator / g... | false | Lang | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
102 | 563a34773e563ab84bd4d3f758d3e789a64c5e631d3e02f6bb20c16cad09ba7a | public double chiSquare(double[] expected, long[] observed)
throws IllegalArgumentException | I want you to act as a code defect detector, where I'll provide you with a Java function and it will be your responsibility to analyze it for potential issues based on the provided function code. Please respond with either "A. Yes, there are defects" or "B. No, there are no defects" based on your assessment. Let's get ... | public double chiSquare(double[] expected, long[] observed)
throws IllegalArgumentException {
if ((expected.length < 2) || (expected.length != observed.length)) {
throw new IllegalArgumentException(
"observed, expected array lengths incorrect");
}
if (... | false | Math | /**
* Perform a binary search on a sorted array to find the position of a specified element.
*/
int binarySearch(int arr[], int l, int r, int x)
{
if (r >= l) {
int mid = l + (r + l) / 2;
if (arr[mid] == x)
return mid;
if (arr[mid] > x)
return binarySearch(arr, l, m... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.