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 |
|---|---|---|---|---|---|---|---|
88 | 56414f5d5125fe0e22ce438c0ee435056ea77daeda9e68e56d958d590b9daa48 | protected JavaType _typeFromId(String id, DatabindContext 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 ... | protected JavaType _typeFromId(String id, DatabindContext ctxt) throws IOException
{
/* 30-Jan-2010, tatu: Most ids are basic class names; so let's first
* check if any generics info is added; and only then ask factory
* to do translation when necessary
*/
TypeFa... | 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... |
168 | 568f99c03233608439dc8e17f6bdd5070ab637815b6b02f6da1f899d5b047b3d | @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) {
if (t.inGlobalScope()) {
return;
}
if (n.isReturn() && n.getFirstChild() != null) {
data.get(t.getScopeRoot()).recordNonEmptyReturn();
}
if (t.getScopeDepth() <= 2) {
// The first-order functi... | 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... |
8 | 588fd786cf48fffd44911eadca049dd297c04698b44eacde6b1636433024b2d4 | public T[] sample(int sampleSize) throws NotStrictlyPositiveException | 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 T[] sample(int sampleSize) throws NotStrictlyPositiveException {
if (sampleSize <= 0) {
throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_SAMPLES,
sampleSize);
}
final T[]out = (T[]) java.lang.reflect.Array.newInstance(singletons.get(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... |
5 | 58ac90638dc83dda797c44d27aa5da206305b5c30fe3e9df5f7fadb4f79a7f72 | public void println() 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 void println() throws IOException {
final String recordSeparator = format.getRecordSeparator();
out.append(recordSeparator);
newRecord = true;
} | 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... |
3 | 59061baaaedbb47dabf169629dc1b8fb1d47feb398ebec1f9a87b328fd179bdc | public UTF8StreamJsonParser(IOContext ctxt, int features, InputStream in,
ObjectCodec codec, BytesToNameCanonicalizer sym,
byte[] inputBuffer, int start, int end,
boolean bufferRecyclable)
| 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 UTF8StreamJsonParser(IOContext ctxt, int features, InputStream in,
ObjectCodec codec, BytesToNameCanonicalizer sym,
byte[] inputBuffer, int start, int end,
boolean bufferRecyclable)
{
super(ctxt, features);
_inputStream = in;
_objectCodec = code... | false | 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... |
46 | 591bb2aac5817c3a863c0bd981052a72b2905d6eebdff06ff078d9fd43bedb0a | static void escape(StringBuilder accum, String string, Document.OutputSettings out,
boolean inAttribute, boolean normaliseWhite, boolean stripLeadingWhite) | 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 void escape(StringBuilder accum, String string, Document.OutputSettings out,
boolean inAttribute, boolean normaliseWhite, boolean stripLeadingWhite) {
boolean lastWasWhite = false;
boolean reachedNonWhite = false;
final EscapeMode escapeMode = out.escapeMode();... | 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... |
35 | 598376973818196e637c2f3702ab8d772fcaef0b4891b59e19df604b3963aed2 | 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
for (String longOpt : longOpts.keySet())
{
if (longOp... | 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... |
7 | 5987e6ef28cdc27350bce1b302d7532427b67cf48a0a41cb32d41b1fcfafe249 | public int writeValue() | 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 writeValue() {
// Most likely, object:
if (_type == TYPE_OBJECT) {
if (!_gotName) {
return STATUS_EXPECT_NAME;
}
_gotName = false;
++_index;
return STATUS_OK_AFTER_COLON;
}
// Ok, array?
i... | false | 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... |
14 | 59b0322a5dab66021ca7ad54b8a79d1531cebae3be3bd4022852a67c04be3024 | public static boolean equals(CharSequence cs1, CharSequence cs2) | 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 equals(CharSequence cs1, CharSequence cs2) {
if (cs1 == cs2) {
return true;
}
if (cs1 == null || cs2 == null) {
return false;
}
if (cs1 instanceof String && cs2 instanceof String) {
return cs1.equals(cs2);
}
... | 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... |
33 | 5a5f7e32167fe670b0fae8181bd30c1891d0882d84b1d36dfbd34bcab8024b10 | @Override
public PropertyName findNameForSerialization(Annotated a)
| 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 PropertyName findNameForSerialization(Annotated a)
{
String name = null;
JsonGetter jg = _findAnnotation(a, JsonGetter.class);
if (jg != null) {
name = jg.value();
} else {
JsonProperty pann = _findAnnotation(a, JsonProperty.class);
... | 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 | 5ab4d4beceb9c38b988d779ad9ea1a90f9b8b8ac6795df76573aaf86d2ea2029 | public <T> void resetMock(T mock) | 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 <T> void resetMock(T mock) {
MockHandlerInterface<T> oldMockHandler = getMockHandler(mock);
MethodInterceptorFilter newFilter = newMethodInterceptorFilter(oldMockHandler.getMockSettings());
((Factory) mock).setCallback(0, newFilter);
} | 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... |
8 | 5b9541f70e0b8cfa3a908b4fed71b7b936f56eced2f852f8fd54eedf7c5d1e68 | protected StringBuffer renderWrappedText(StringBuffer sb, int width,
int nextLineTabStop, String text)
| 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 StringBuffer renderWrappedText(StringBuffer sb, int width,
int nextLineTabStop, String text)
{
int pos = findWrapPos(text, width, 0);
if (pos == -1)
{
sb.append(rtrim(text));
return sb;
}
sb... | 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... |
119 | 5bb81c89167c12fc9d4f70fd5bd05603359d0cdf9781658c707a6975cb62f41d | public void collect(JSModule module, Scope scope, 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 ... | public void collect(JSModule module, Scope scope, Node n) {
Node parent = n.getParent();
String name;
boolean isSet = false;
Name.Type type = Name.Type.OTHER;
boolean isPropAssign = false;
switch (n.getType()) {
case Token.GETTER_DEF:
case Token.SETTER_DEF:
... | 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 | 5bcfa8046b0f7045f44ea5e306873328b1149bb4d4e702a7568528c3052296dc | <M extends Map<String, String>> M putIn(final M map) | 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 ... | <M extends Map<String, String>> M putIn(final M map) {
for (final Entry<String, Integer> entry : mapping.entrySet()) {
final int col = entry.getValue().intValue();
if (col < values.length) {
map.put(entry.getKey(), values[col]);
}
}
return ... | 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... |
9 | 5bcfa8046b0f7045f44ea5e306873328b1149bb4d4e702a7568528c3052296dc | <M extends Map<String, String>> M putIn(final M map) | 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 ... | <M extends Map<String, String>> M putIn(final M map) {
for (final Entry<String, Integer> entry : mapping.entrySet()) {
final int col = entry.getValue().intValue();
if (col < values.length) {
map.put(entry.getKey(), values[col]);
}
}
return ... | 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... |
129 | 5bfa22e28ee42d9d4f410e8a8ce53f07fef007a4841089d7b00ac1cf9dd724a2 | private void annotateCalls(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 void annotateCalls(Node n) {
Preconditions.checkState(n.isCall());
// Keep track of of the "this" context of a call. A call without an
// explicit "this" is a free call.
Node first = n.getFirstChild();
// ignore cast nodes.
if (!NodeUtil.isGet(first)) {
n.putB... | 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... |
92 | 5c2d63167dd2e683957c0dae1a5816d936d8e5274a48066aefcdac75160324c1 | void replace() | 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 replace() {
if (firstNode == null) {
// Don't touch the base case ('goog').
replacementNode = candidateDefinition;
return;
}
// Handle the case where there is a duplicate definition for an explicitly
// provided symbol.
if (candidateDefinition != null && e... | 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... |
22 | 5cebdb6c015b313757e222428f46f5833059f31cbfe1fbab56da07abf5d6d560 | public static String getNamespaceURI(Node node) | 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 String getNamespaceURI(Node node) {
if (node instanceof Document) {
node = ((Document) node).getDocumentElement();
}
Element element = (Element) node;
String uri = element.getNamespaceURI();
if (uri == null) {
String prefix = getPrefix(... | 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... |
48 | 5da8ab3f005dddcb5f271d5bd41d9735b35f041f72dfea44edec7cf06c2af82d | void processResponseHeaders(Map<String, List<String>> resHeaders) | 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 processResponseHeaders(Map<String, List<String>> resHeaders) {
for (Map.Entry<String, List<String>> entry : resHeaders.entrySet()) {
String name = entry.getKey();
if (name == null)
continue; // http/1.1 line
List<String> value... | 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... |
120 | 5ded3cd8794e39baf3dc969862eb1dcdb28bcb5b90a83a962058c2f9d7cf4afd | boolean isAssignedOnceInLifetime() | 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 ... | boolean isAssignedOnceInLifetime() {
Reference ref = getOneAndOnlyAssignment();
if (ref == null) {
return false;
}
// Make sure this assignment is not in a loop.
for (BasicBlock block = ref.getBasicBlock();
block != null; block = block.getParent()) {
if (blo... | 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... |
39 | 5e594f85d4eb7af44459315fb8f22e97705d40491663ec2aa37e75594a5fab8d | @Override
public void integrate(final ExpandableStatefulODE equations, final double t)
throws MathIllegalStateException, MathIllegalArgumentException | 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 integrate(final ExpandableStatefulODE equations, final double t)
throws MathIllegalStateException, MathIllegalArgumentException {
sanityChecks(equations, t);
setEquations(equations);
final boolean forward = t > equations.getTime();
// create some internal working arrays... | 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... |
91 | 5ede8b554f416ab7e23729be8fa30ef0564985c4d4bff1f9c4589bc99b641bd6 | public int compareTo(Fraction object) | 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 compareTo(Fraction object) {
double nOd = doubleValue();
double dOn = object.doubleValue();
return (nOd < dOn) ? -1 : ((nOd > dOn) ? +1 : 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... |
25 | 5f0c4e6828c04378e0c542261cb9ad8b5ed0e80ee3b83a1a861043b52df58d5f | private void guessAOmega() | 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 guessAOmega() {
// initialize the sums for the linear model between the two integrals
double sx2 = 0;
double sy2 = 0;
double sxy = 0;
double sxz = 0;
double syz = 0;
double currentX = observations[0].getX();
... | 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... |
5 | 5fc37335db2dcd69da0859e57345d23abf4397f96923da91e23208d92ea77b7d | void decode(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 decode(byte[] in, int inPos, int inAvail) {
if (eof) {
return;
}
if (inAvail < 0) {
eof = true;
}
for (int i = 0; i < inAvail; i++) {
if (buffer == null || buffer.length - pos < decodeSize) {
resizeBuffer();
... | 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... |
25 | 600c37843e7185ce6b208590231a5821555ef433dc230aee1a40db9fe8a00708 | private FlowScope traverseNew(Node n, FlowScope scope) | 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 FlowScope traverseNew(Node n, FlowScope scope) {
Node constructor = n.getFirstChild();
scope = traverse(constructor, scope);
JSType constructorType = constructor.getJSType();
JSType type = null;
if (constructorType != null) {
constructorType = constructorType.restrictByNotNullOrUnde... | 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... |
125 | 602c4a2c367133e0d06f2344ac495a87916b942f50574ed1406282b17176f772 | private void visitNew(NodeTraversal t, 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 void visitNew(NodeTraversal t, Node n) {
Node constructor = n.getFirstChild();
JSType type = getJSType(constructor).restrictByNotNullOrUndefined();
if (type.isConstructor() || type.isEmptyType() || type.isUnknownType()) {
FunctionType fnType = type.toMaybeFunctionType();
if (fnType != ... | 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... |
101 | 6042db12e247f278f75268601339fc9c84a07cf52a8f766e53c694bbb3ececb4 | public Complex parse(String source, ParsePosition pos) | 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 parse(String source, ParsePosition pos) {
int initialIndex = pos.getIndex();
// parse whitespace
parseAndIgnoreWhitespace(source, pos);
// parse real
Number re = parseNumber(source, getRealFormat(), pos);
if (re == null) {
// invalid real ... | 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... |
59 | 6060f86c5a2d0196255ddad05dc5787e9bc4f29134440b1509ef081ec32e40da | final void newAttribute() | 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 newAttribute() {
if (attributes == null)
attributes = new Attributes();
if (pendingAttributeName != null) {
// the tokeniser has skipped whitespace control chars, but trimming could collapse to empty for other control codes, so verify here
... | 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... |
5 | 608ff873170a33f4f1aae8235d95949feb125cd4b90e4fb558f693dabf70d6fe | 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; ... | false | 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... |
51 | 60d37b8cf9b8f1dcacd85d0a6aa362ab948cdf0c450d245e0babec8a0e596530 | boolean matchesLetter() | 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 ... | boolean matchesLetter() {
if (isEmpty())
return false;
char c = input[pos];
return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z');
} | 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... |
53 | 61012afa47b8d0f36162e44ca34389489132a1e6f4801a5653e401e735d1806e | public String chompBalanced(char open, char close) | 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 chompBalanced(char open, char close) {
int start = -1;
int end = -1;
int depth = 0;
char last = 0;
do {
if (isEmpty()) break;
Character c = consume();
if (last == 0 || last != ESC) {
if (c.equals(open)) {
... | 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... |
11 | 611c8807e92f3a3ff47625d14cce81b6cedfaf702dee2c3627489a559e4e95ad | private static void appendOption(final StringBuffer buff,
final Option option,
final boolean required)
| 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 void appendOption(final StringBuffer buff,
final Option option,
final boolean required)
{
if (!required)
{
buff.append("[");
}
if (option.getOpt() != null)
{
... | 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... |
23 | 611d6b303bed94b64d2a1401709b5b26bbf3d05c3c2cfbedd6be3778e010d849 | protected StringBuffer renderWrappedText(StringBuffer sb, int width,
int nextLineTabStop, String text)
| 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 StringBuffer renderWrappedText(StringBuffer sb, int width,
int nextLineTabStop, String text)
{
int pos = findWrapPos(text, width, 0);
if (pos == -1)
{
sb.append(rtrim(text));
return sb;
}
sb... | 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... |
7 | 6155e294d88f1109758e8134b95e4f84bf9adfd9462f7641ffc0df4b46bf397c | public static String parseName(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 String parseName(byte[] buffer, final int offset, final int length) {
StringBuffer result = new StringBuffer(length);
int end = offset + length;
for (int i = offset; i < end; ++i) {
if (buffer[i] == 0) {
break;
}
res... | 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... |
52 | 61ab0ecee24ca1302a7f81d63813f8992f745b3accdf476f29ed19d9e65f7f21 | private static void escapeJavaStyleString(Writer out, String str, boolean escapeSingleQuote) 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 static void escapeJavaStyleString(Writer out, String str, boolean escapeSingleQuote) throws IOException {
if (out == null) {
throw new IllegalArgumentException("The Writer must not be null");
}
if (str == null) {
return;
}
int sz;
sz = ... | 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... |
8 | 61ec5277bc8af5c781f0e2816282575b4add305c22984e06ba4412856cb9e997 | private boolean compute(Object left, Object 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 boolean compute(Object left, Object right) {
left = reduce(left);
right = reduce(right);
if (left instanceof InitialContext) {
((InitialContext) left).reset();
}
if (right instanceof InitialContext) {
((InitialContext) right).reset();
... | 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... |
16 | 626d2197d1ff9c1afb990f2847f5305559009cf781d55fece90c5b59125fae35 | private static Type resolve(Type context, Class<?> contextRawType, Type toResolve,
Collection<TypeVariable> visitedTypeVariables) | 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 Type resolve(Type context, Class<?> contextRawType, Type toResolve,
Collection<TypeVariable> visitedTypeVariables) {
// this implementation is made a little more complicated in an attempt to avoid object-creation
while (true) {
if (toResolve instanceof TypeVa... | 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... |
5 | 628ac3e0b4c6afdfb9ee9811dd59d43d3e58b1752d0727722e16a317658d058f | 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 INF;
}
if (isInfinite) {
return ZERO;
}
if (FastMath.abs(real) < FastMath.abs(imaginary)) {
double q = rea... | 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... |
5 | 62b35683549259ff608e5d2375392bb0b5482ce0df2b4658def6feb90d2efac9 | private boolean isInlinableObject(List<Reference> refs) | 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 isInlinableObject(List<Reference> refs) {
boolean ret = false;
Set<String> validProperties = Sets.newHashSet();
for (Reference ref : refs) {
Node name = ref.getNode();
Node parent = ref.getParent();
Node gramps = ref.getGrandparent();
// Ignore most... | 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... |
42 | 62cc965f84f10f89b3921042390d9645e37f15eb9a3e76ed5b8009d097ec31e8 | 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<Connection.KeyVal>();
// iterate the form control elements and accumulate their values
for (Element el: elements) {
if (!el.tag().isFormSubmittable()) continue; // contents are form lis... | 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 | 62dc8a6f82d808a59699c6dc9c9a6eeb2d018a6f1457bfad10014e0c7babfaca | public final Object computeValue(EvalContext context) | 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 Object computeValue(EvalContext context) {
return compute(args[0].compute(context), args[1].compute(context))
? Boolean.TRUE : Boolean.FALSE;
} | 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... |
36 | 62ee68d2b13a79bc4ed49ee98d2b9fad07714ece1c55125264ea2c5c188d98a1 | private InputStream getCurrentStream() 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 InputStream getCurrentStream() throws IOException {
if (deferredBlockStreams.isEmpty()) {
throw new IllegalStateException("No current 7z entry (call getNextEntry() first).");
}
while (deferredBlockStreams.size() > 1) {
// In solid compression mode we ... | 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... |
17 | 63752fb12433643a33c8335c571f1046e88a2f7ce6fcb8e1451f677bd5dd5bf8 | public Object clone() throws CloneNotSupportedException | 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 clone() throws CloneNotSupportedException {
Object clone = createCopy(0, getItemCount() - 1);
return clone;
} | true | 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... |
103 | 63ee1d69547c5f7e6310853f41887dda6d2a6f36afd9bac3aea729e502879a14 | public double cumulativeProbability(double x) throws MathException | 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 cumulativeProbability(double x) throws MathException {
return 0.5 * (1.0 + Erf.erf((x - mean) /
(standardDeviation * Math.sqrt(2.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... |
12 | 63ee9a7bd435bd2b3fd095d55cf9ac6e10629e53cacd4a356cded8ce2c9ddae9 | 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];
return (Class) actual;
//in ca... | 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... |
63 | 6488a2a0df6fa3b6508b4775009679a2cad6249bc4e3d952bef94f8c3c3a0470 | public static boolean equals(double x, double y) | 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 equals(double x, double y) {
return equals(x, y, 1);
} | 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... |
4 | 64eb032a2a3291c6afbe24351a0779c56e67ddc7e6c8d5c801dddad54486b02c | private void checkRequiredOptions()
throws MissingOptionException
| 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 checkRequiredOptions()
throws MissingOptionException
{
// if there are required options that have not been
// processsed
if (requiredOptions.size() > 0)
{
Iterator iter = requiredOptions.iterator();
StringBuffer buff = new StringBuffer... | 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... |
7 | 650e1b6d7f7ddab93bdee0a6e769a653949625f398fc31f1fcf0494620577a3b | public TokenBuffer deserialize(JsonParser jp, DeserializationContext 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 ... | public TokenBuffer deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException
{
copyCurrentStructure(jp);
/* 28-Oct-2014, tatu: As per #592, need to support a special case of starting from
* FIELD_NAME, which is taken to mean that we are missing START_OBJECT, but ... | 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... |
18 | 65624a4a0260931cb091a97e7a1f2db6ab46cf6e3c09e2069912a7dbe22a72df | public long getDateTimeMillis(int year, int monthOfYear, int dayOfMonth,
int hourOfDay, int minuteOfHour,
int secondOfMinute, int millisOfSecond)
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 long getDateTimeMillis(int year, int monthOfYear, int dayOfMonth,
int hourOfDay, int minuteOfHour,
int secondOfMinute, int millisOfSecond)
throws IllegalArgumentException
{
Chronology base;
if ((base = getBase()) ... | 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 | 657019c7c20d72a349404c60b21fd844abadbf30472e9c8d53f1d1d2f415929b | 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... | 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... |
18 | 658f5867b9708075c5cc8a7f3e6dfd9e50476c82ef6b7a8fbd48f8fc036b0a25 | public long getDateTimeMillis(int year, int monthOfYear, int dayOfMonth,
int hourOfDay, int minuteOfHour,
int secondOfMinute, int millisOfSecond)
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 long getDateTimeMillis(int year, int monthOfYear, int dayOfMonth,
int hourOfDay, int minuteOfHour,
int secondOfMinute, int millisOfSecond)
throws IllegalArgumentException
{
Chronology base;
if ((base = getBase()) ... | 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... |
11 | 65fd36a052de259bba7996bbe80da58d084b409eb923dfe994bb6f02fcc59234 | private void visitGetProp(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 ... | private void visitGetProp(NodeTraversal t, Node n, Node parent) {
// obj.prop or obj.method()
// Lots of types can appear on the left, a call to a void function can
// never be on the left. getPropertyType will decide what is acceptable
// and what isn't.
Node property = n.getLastChild();
Node... | 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... |
8 | 6667d5177aef6505a149a75ca96c1646e63edbfe45099eac8d072f21cf118ed0 | 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");
}
... | 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... |
14 | 6667d5177aef6505a149a75ca96c1646e63edbfe45099eac8d072f21cf118ed0 | 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... |
34 | 66ababb77236f6df9ba50a3a5b0c615efbdf0bab4ae8ef0196ea92f180c4a68c | int nextIndexOf(CharSequence seq) | 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 ... | int nextIndexOf(CharSequence seq) {
// doesn't handle scanning for surrogates
char startChar = seq.charAt(0);
for (int offset = pos; offset < length; offset++) {
// scan to first instance of startchar:
if (startChar != input[offset])
while(++offset < l... | 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... |
33 | 66f24deeae9cb99ce86011bd56a66d86189bd8a51d5e0238d75956098ac13b47 | public static Class<?>[] toClass(Object[] array) | 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 Class<?>[] toClass(Object[] array) {
if (array == null) {
return null;
} else if (array.length == 0) {
return ArrayUtils.EMPTY_CLASS_ARRAY;
}
Class<?>[] classes = new Class[array.length];
for (int i = 0; i < array.length; i++) {
... | 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... |
10 | 672a66176d765c230cd662b21340159061af6eb72555d71ec8c29bc14db6e6a7 | static boolean mayBeString(Node n, boolean recurse) | 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 mayBeString(Node n, boolean recurse) {
if (recurse) {
return anyResultsMatch(n, MAY_BE_STRING_PREDICATE);
} else {
return mayBeStringHelper(n);
}
} | 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... |
59 | 68420d5f3d5773f9c3eaaefdbae34c8ea7f2d6f71154a5907e4b912cc566b22a | public static float max(final float a, final float b) | 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 float max(final float a, final float b) {
return (a <= b) ? b : (Float.isNaN(a + b) ? Float.NaN : a);
} | 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... |
60 | 687352afd4a8453dd137321c43d7c47ed8e72fdafe623957cbe731da06f8d5f1 | public double cumulativeProbability(double x) throws MathException | 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 cumulativeProbability(double x) throws MathException {
final double dev = x - mean;
try {
return 0.5 * (1.0 + Erf.erf((dev) /
(standardDeviation * FastMath.sqrt(2.0))));
} catch (MaxIterationsExceededException ex) {
if (x < (mean - 20 * s... | 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... |
115 | 688ae47f4a9486f8378a54c9ad2b17c4b8b021d062c0433ecae02d1a4993c082 | private CanInlineResult canInlineReferenceDirectly(
Node callNode, Node fnNode) | 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 CanInlineResult canInlineReferenceDirectly(
Node callNode, Node fnNode) {
if (!isDirectCallNodeReplacementPossible(fnNode)) {
return CanInlineResult.NO;
}
Node block = fnNode.getLastChild();
boolean hasSideEffects = false;
if (block.hasChildren()) {
Preconditions.checkS... | 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... |
3 | 696a9ae3441e5b7ac55b7296922d2027479d6a48d14f55301798b35e544aa263 | public TimeSeries createCopy(int start, int end)
throws CloneNotSupportedException | 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 TimeSeries createCopy(int start, int end)
throws CloneNotSupportedException {
if (start < 0) {
throw new IllegalArgumentException("Requires start >= 0.");
}
if (end < start) {
throw new IllegalArgumentException("Requires start <= end.");
}
... | 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... |
91 | 6987ce6ec6d07f46e036c7f167f0e44fe5616384e0252b2c121df7470612a3c0 | public int compareTo(Fraction object) | 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 compareTo(Fraction object) {
long nOd = ((long) numerator) * object.denominator;
long dOn = ((long) denominator) * object.numerator;
return (nOd < dOn) ? -1 : ((nOd > dOn) ? +1 : 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... |
10 | 6a413abff7b5e20f816be43bf3aae9aed2f57d738cef2ba045dd51f22893e023 | 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,... | 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... |
56 | 6ae0e36482369556f7542ad71e7f7c4fe63cf2017651d8d9e36d2e0c28074c77 | public int[] getCounts(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 ... | public int[] getCounts(int index) {
if (index < 0 ||
index >= totalSize) {
throw new OutOfRangeException(index, 0, totalSize);
}
final int[] indices = new int[dimension];
int count = 0;
for (int i = 0; i < last; i++) {
int idx = 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... |
126 | 6ae23291227098db690cc8132d097dab07c6a291d000aaaef87801f322b72f98 | void tryMinimizeExits(Node n, int exitType, String labelName) | 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 tryMinimizeExits(Node n, int exitType, String labelName) {
// Just an 'exit'.
if (matchingExitNode(n, exitType, labelName)) {
NodeUtil.removeChild(n.getParent(), n);
compiler.reportCodeChange();
return;
}
// Just an 'if'.
if (n.isIf()) {
Node ifBlock = n.getFirstChil... | 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 | 6b23d6564a26ea0cd07049c0f803868b709059eefe539495772244975f78e090 | 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') {
for (int i=index-1 ; i>=0 ; i--) {
final c... | 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... |
27 | 6b2552b696ee61f64e73787f6944787cc9e7660b763377587fe4eb12ac4a71c1 | 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("--")) {
... | 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... |
37 | 6b44f9acdcd3a5f2616c28b10863c8e17cc1934b56bf00f6613d6a9da08b633f | @Override
protected JavaType _narrow(Class<?> subclass)
| 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 JavaType _narrow(Class<?> subclass)
{
if (_class == subclass) {
return this;
}
// Should we check that there is a sub-class relationship?
// 15-Jan-2016, tatu: Almost yes, but there are some complications with
// placeholder values, ... | 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... |
72 | 6b90ad9ab29c040eba522ca543473b581d2798e2a6802858fd9903c868363504 | public double solve(final UnivariateRealFunction f,
final double min, final double max, final double initial)
throws MaxIterationsExceededException, FunctionEvaluationException | 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 solve(final UnivariateRealFunction f,
final double min, final double max, final double initial)
throws MaxIterationsExceededException, FunctionEvaluationException {
clearResult();
verifySequence(min, initial, max);
// return the initial guess i... | 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... |
73 | 6b90ad9ab29c040eba522ca543473b581d2798e2a6802858fd9903c868363504 | public double solve(final UnivariateRealFunction f,
final double min, final double max, final double initial)
throws MaxIterationsExceededException, FunctionEvaluationException | 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 solve(final UnivariateRealFunction f,
final double min, final double max, final double initial)
throws MaxIterationsExceededException, FunctionEvaluationException {
clearResult();
verifySequence(min, initial, max);
// return the initial guess i... | 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... |
82 | 6bc2cc3306522bc74172970424760ab0f952bcafe270251324bbeff17e2dd4e8 | protected void addBeanProps(DeserializationContext ctxt,
BeanDescription beanDesc, BeanDeserializerBuilder builder)
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 ... | protected void addBeanProps(DeserializationContext ctxt,
BeanDescription beanDesc, BeanDeserializerBuilder builder)
throws JsonMappingException
{
final boolean isConcrete = !beanDesc.getType().isAbstract();
final SettableBeanProperty[] creatorProps = isConcrete
... | 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... |
46 | 6cc8d8445771766c4898071f83e3ead4cbea514bbcd2de41314931f9abcc4bc5 | private static ZipLong unixTimeToZipLong(long l) | 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 ZipLong unixTimeToZipLong(long l) {
final long TWO_TO_32 = 0x100000000L;
if (l >= TWO_TO_32) {
throw new IllegalArgumentException("X5455 timestamps must fit in a signed 32 bit integer: " + l);
}
return new ZipLong(l);
} | 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... |
82 | 6ce1be0fdceeecca216148dbdb23fd0291e20e4ba8f1aadbe972c170259a6805 | static Document parseInputStream(InputStream input, String charsetName, String baseUri, Parser parser) 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 ... | static Document parseInputStream(InputStream input, String charsetName, String baseUri, Parser parser) throws IOException {
if (input == null) // empty body
return new Document(baseUri);
input = ConstrainableInputStream.wrap(input, bufferSize, 0);
Document doc = null;
b... | 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... |
107 | 6d42dc40c15309ba1aca80441f5d88550844dbc8f59c918b7b4d322a7e8e0859 | protected final JsonDeserializer<Object> _findDeserializer(DeserializationContext ctxt,
String typeId) 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 ... | protected final JsonDeserializer<Object> _findDeserializer(DeserializationContext ctxt,
String typeId) throws IOException
{
JsonDeserializer<Object> deser = _deserializers.get(typeId);
if (deser == null) {
/* As per [databind#305], need to provide contextual info. But for... | 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... |
97 | 6d43292cf0dfb19d09b02bf6566a1e3b2c56fbc58c56cd4eaa567581a47abd5e | public double solve(double min, double max) throws MaxIterationsExceededException,
FunctionEvaluationException | 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 solve(double min, double max) throws MaxIterationsExceededException,
FunctionEvaluationException {
clearResult();
verifyInterval(min, max);
double ret = Double.NaN;
double yMin = f.value(min);
double yMax = f.value(max);
... | 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... |
27 | 6d447eda0b62adbaf1a706acc032f45f5a934da5cb1f07b5f0c82988d3cfa453 | @SuppressWarnings("resource")
protected Object deserializeUsingPropertyBasedWithExternalTypeId(JsonParser p, DeserializationContext 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 ... | @SuppressWarnings("resource")
protected Object deserializeUsingPropertyBasedWithExternalTypeId(JsonParser p, DeserializationContext ctxt)
throws IOException
{
final ExternalTypeHandler ext = _externalTypeIdHandler.start();
final PropertyBasedCreator creator = _propertyBasedCreator;
... | 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... |
39 | 6d4b9cb5e08ec167f4185e158bff0272451468773a08a2a6113777b7badc75b1 | @Override
String toStringHelper(boolean forAnnotations) | 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
String toStringHelper(boolean forAnnotations) {
if (hasReferenceName()) {
return getReferenceName();
} else if (prettyPrint) {
// Don't pretty print recursively.
prettyPrint = false;
// Use a tree set so that the properties are sorted.
Set<String> propertyNames = Set... | 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 | 6d9263f8f6b9ee2d7992938d39b557e3b236296b5600d3268f45b92a9ff351d2 | @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:
case STRING:
return new LazilyParsedNumber(in.nextString());
default:
thr... | false | 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... |
6 | 6dc619741ab79c0db0ab0ff6c644f59e1227e9a6721ad0965be06171be9eeff9 | 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 ... | public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof ShapeList)) {
return false;
}
return super.equals(obj);
} | true | 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... |
70 | 6ddd5903ae17fc4e8359b2c18b9dd27e08b42955402a21591b47632eda2f7e65 | private void declareArguments(Node 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 ... | private void declareArguments(Node functionNode) {
Node astParameters = functionNode.getFirstChild().getNext();
Node body = astParameters.getNext();
FunctionType functionType = (FunctionType) functionNode.getJSType();
if (functionType != null) {
Node jsDocParameters = functionType.ge... | 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 | 6de8330b8e0f402253f8a18caa6d4792d59bf882d4a7770bb9103c4c06ec28fa | @Override
public void process(Node externs, Node root) | 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 process(Node externs, Node root) {
NodeTraversal.traverse(compiler, root, this);
if (MAKE_LOCAL_NAMES_UNIQUE) {
MakeDeclaredNamesUnique renamer = new MakeDeclaredNamesUnique();
NodeTraversal t = new NodeTraversal(compiler, renamer);
t.traverseRoots(externs, root);
... | 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 | 6df395e90350dedfee4dd9a93af1e0b6760c1f42875fef1705e064dd5de832b4 | 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... |
38 | 6e0aad84e8b4a093328a4bc6df19dd565b2d7e48c8ad3f63b1c5bd090805e4c9 | public StringBuffer format(Calendar calendar, StringBuffer buf) | 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 StringBuffer format(Calendar calendar, StringBuffer buf) {
if (mTimeZoneForced) {
calendar.getTime(); /// LANG-538
calendar = (Calendar) calendar.clone();
calendar.setTimeZone(mTimeZone);
}
return applyRules(calendar, buf);
} | 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... |
45 | 6e2a1aea1d777f18b1703820fe1092857e2b74d6d4efedbf5747162cba720153 | @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
{
if (property != null) {
JsonFormat.Value format = serializers.getAnnotationIntrospector().findFormat((Annotated)property.getMember());
... | 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... |
87 | 6e53116b5b0191e7ca49481008c21400a795c9ddc8c2df72e64736c71c7fce2a | 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();
// IE has a bug where event handlers behave differently when
// their return value is used vs. when their return value is in
// ... | 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... |
46 | 6e5393357bd3924b9bab1c8035fe1ab26bf891ddc993b5623536a53ebbd07f8b | @Override
public StringBuilder getGenericSignature(StringBuilder sb)
| 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 StringBuilder getGenericSignature(StringBuilder sb)
{
_classSignature(_class, sb, false);
sb.append('<');
sb = _referencedType.getGenericSignature(sb);
sb.append(';');
return sb;
} | 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... |
38 | 6e8a85a9b4d5805db842753f826dc5713629be502dbea36ee4bf410d59660c63 | @Override
public boolean isDirectory() | 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 isDirectory() {
if (file != null) {
return file.isDirectory();
}
if (linkFlag == LF_DIR) {
return true;
}
if (getName().endsWith("/")) {
return true;
}
return false;
} | 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... |
132 | 6e97cc02f573a42dc706a8dae57a0d65e6982dbe288cc81d4fb378ddb295bf76 | private Node tryMinimizeIf(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 tryMinimizeIf(Node n) {
Node parent = n.getParent();
Node cond = n.getFirstChild();
/* If the condition is a literal, we'll let other
* optimizations try to remove useless code.
*/
if (NodeUtil.isLiteralValue(cond, true)) {
return n;
}
Node thenBranch = cond.ge... | 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... |
57 | 6ee8e5176a7f4ba4400432f42f8c5b72923ee2c353d0adbb0521f2d5d082959a | public <T> MappingIterator<T> readValues(byte[] src, int offset, int length)
throws IOException, JsonProcessingException
| 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 <T> MappingIterator<T> readValues(byte[] src, int offset, int length)
throws IOException, JsonProcessingException
{
if (_dataFormatReaders != null) {
return _detectBindAndReadValues(_dataFormatReaders.findFormat(src, offset, length), false);
}
return _bindAndRe... | 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... |
6 | 6ef4cd1388b7b592abb1c48ac14948d4e5f4b9f96741184282b9c5588471b7c7 | 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();
... | 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... |
17 | 6ef4cd1388b7b592abb1c48ac14948d4e5f4b9f96741184282b9c5588471b7c7 | 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... |
94 | 6f357fbe6f2168d337a1563a9687d1e1221d02a5660cf5a118ded561db5a63cc | static boolean isValidDefineValue(Node val, Set<String> defines) | 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 isValidDefineValue(Node val, Set<String> defines) {
switch (val.getType()) {
case Token.STRING:
case Token.NUMBER:
case Token.TRUE:
case Token.FALSE:
return true;
// Binary operators are only valid if both children are valid.
case Token.BITAND:
cas... | 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... |
49 | 6f422ca3471edccca6884dfc717f498e5af342d375f47316c90cf6809ff6d338 | public Object generateId(Object forPojo) | 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 generateId(Object forPojo) {
// 04-Jun-2016, tatu: As per [databind#1255], need to consider possibility of
// id being generated for "alwaysAsId", but not being written as POJO; regardless,
// need to use existing id if there is one:
if (id == null) {
... | 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... |
152 | 6f636e042bc162224e945bac42f13a1888a80421eab118d6566a17cacebb60bc | @Override
JSType resolveInternal(ErrorReporter t, StaticScope<JSType> scope) | 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> scope) {
setResolvedTypeInternal(this);
call = (ArrowType) safeResolve(call, t, scope);
prototype = (FunctionPrototypeType) safeResolve(prototype, t, scope);
// Warning about typeOfThis if it doesn't resolve to an ObjectType
... | 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... |
46 | 6f63d7773ef58f469f3500eff8b1d39282d69d07eeb1392ce12781187abc0235 | private static ZipLong unixTimeToZipLong(long l) | 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 ZipLong unixTimeToZipLong(long l) {
if (l < Integer.MIN_VALUE || l > Integer.MAX_VALUE) {
throw new IllegalArgumentException("X5455 timestamps must fit in a signed 32 bit integer: " + l);
}
return new ZipLong(l);
} | 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... |
91 | 6fb97b94504135466070e4095a989c1f81cfe25e03160517412456e6ee600942 | public boolean shouldTraverse(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 boolean shouldTraverse(NodeTraversal t, Node n, Node parent) {
if (n.getType() == Token.FUNCTION) {
// Don't traverse functions that are constructors or have the @this
// or @override annotation.
JSDocInfo jsDoc = getFunctionJsDocInfo(n);
if (jsDoc != null &&
(jsDoc.isCon... | 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 | 708f2cc60be9e96d5179da234f438f86863905e1fd717a8ab502a95b9f57852d | public String html() | 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 html() {
StringBuilder accum = new StringBuilder();
html(accum);
return accum.toString().trim();
} | 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... |
62 | 7090d9e84bf1f08a3df09abc9f64e04b303db5ba45a4157b76a2494f020191bc | private String format(JSError error, boolean warning) | 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 format(JSError error, boolean warning) {
// extract source excerpt
SourceExcerptProvider source = getSource();
String sourceExcerpt = source == null ? null :
excerpt.get(
source, error.sourceName, error.lineNumber, excerptFormatter);
// formatting the message
St... | 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... |
10 | 70d1c1e0cd19ce484b92dee1b43a9efab2e5bee2fc34326486598fa5cee3dee1 | public CSVPrinter(final Appendable out, final CSVFormat format) 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 CSVPrinter(final Appendable out, final CSVFormat format) throws IOException {
Assertions.notNull(out, "out");
Assertions.notNull(format, "format");
this.out = out;
this.format = format;
this.format.validate();
// TODO: Is it a good idea to do this here instead... | 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... |
6 | 71644af752960bb260b357a3aa9136fb9c3ff5d677ad50d9f1d4a9c6426f4df8 | protected Date parseAsISO8601(String dateStr, ParsePosition pos)
| 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 Date parseAsISO8601(String dateStr, ParsePosition pos)
{
/* 21-May-2009, tatu: DateFormat has very strict handling of
* timezone modifiers for ISO-8601. So we need to do some scrubbing.
*/
/* First: do we have "zulu" format ('Z' == "GMT")? If yes, that's
* ... | 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.