before
stringlengths
12
3.21M
after
stringlengths
41
3.21M
repo
stringlengths
1
56
type
stringclasses
1 value
__index_level_0__
int64
0
442k
private JsonApiParameterBean getRealParam(JsonApiParameterBean bean) { JsonApiParameterBean realBean; IJsonApiParameter realObj = getRealObj(bean.getRef()); if (realObj != null) { realBean = (JsonApiParameterBean) realObj; } else { realBean = bean; } if (realBean.getSchema() != null) { realBean.getSchema().setRealParam(getRealObj(realBean.getSchema().getRef())); } return realBean; }
private JsonApiParameterBean getRealParam(JsonApiParameterBean bean) { JsonApiParameterBean realBean; IJsonApiParameter realObj = getRealObj(bean.getRef()); if (realObj != null) { realBean = (JsonApiParameterBean) realObj; } else { realBean = bean; } <DeepExtract> if (realBean.getSchema() != null) { realBean.getSchema().setRealParam(getRealObj(realBean.getSchema().getRef())); } </DeepExtract> return realBean; }
developer-be
positive
441,347
public Criteria andSignatureEqualTo(String value) { if (value == null) { throw new RuntimeException("Value for " + "signature" + " cannot be null"); } criteria.add(new Criterion("signature =", value)); return (Criteria) this; }
public Criteria andSignatureEqualTo(String value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "signature" + " cannot be null"); } criteria.add(new Criterion("signature =", value)); </DeepExtract> return (Criteria) this; }
wukong-framework
positive
441,348
@Nullable private static PsiFile findProjectFile(@NotNull String original, @NotNull String path, @NotNull String fileName, @NotNull Project project, @NotNull PsiElement originalElement) { debug(original, "path::" + path, project); debug(original, "file::" + fileName, project); if (path.contains("./")) { VirtualFile workingDir = originalElement.getContainingFile().getVirtualFile().getParent(); VirtualFile relativePath = workingDir.findFileByRelativePath(path); if (relativePath != null && relativePath.isDirectory() && relativePath.getCanonicalPath() != null) { debug(original, "changing relative path to: " + relativePath.getCanonicalPath(), project); path = relativePath.getCanonicalPath(); if (!path.endsWith("/")) { path += "/"; } } } PsiFile[] files = FilenameIndex.getFilesByName(project, fileName, ProjectScope.getContentScope(project)); StringBuilder builder = new StringBuilder(); builder.append(path); builder.append(fileName); path = builder.reverse().toString(); debug(original, "matching: " + arrayToString(files), project); for (PsiFile file : files) { debug(original, "trying: " + file.getVirtualFile().getCanonicalPath(), project); if (acceptablePath(path, file)) { debug(original, "matched: " + file.getVirtualFile().getCanonicalPath(), project); return file; } } debug(original, "no acceptable matches", project); return null; }
@Nullable private static PsiFile findProjectFile(@NotNull String original, @NotNull String path, @NotNull String fileName, @NotNull Project project, @NotNull PsiElement originalElement) { <DeepExtract> debug(original, "path::" + path, project); debug(original, "file::" + fileName, project); if (path.contains("./")) { VirtualFile workingDir = originalElement.getContainingFile().getVirtualFile().getParent(); VirtualFile relativePath = workingDir.findFileByRelativePath(path); if (relativePath != null && relativePath.isDirectory() && relativePath.getCanonicalPath() != null) { debug(original, "changing relative path to: " + relativePath.getCanonicalPath(), project); path = relativePath.getCanonicalPath(); if (!path.endsWith("/")) { path += "/"; } } } PsiFile[] files = FilenameIndex.getFilesByName(project, fileName, ProjectScope.getContentScope(project)); StringBuilder builder = new StringBuilder(); builder.append(path); builder.append(fileName); path = builder.reverse().toString(); debug(original, "matching: " + arrayToString(files), project); for (PsiFile file : files) { debug(original, "trying: " + file.getVirtualFile().getCanonicalPath(), project); if (acceptablePath(path, file)) { debug(original, "matched: " + file.getVirtualFile().getCanonicalPath(), project); return file; } } debug(original, "no acceptable matches", project); return null; </DeepExtract> }
intellibot
positive
441,349
public String toSQLString(RenderingContext helper) { return "(" + this.lhs.toSQLString(helper) + " " + "OR" + " " + this.rhs.toSQLString(helper) + ")"; }
public String toSQLString(RenderingContext helper) { <DeepExtract> return "(" + this.lhs.toSQLString(helper) + " " + "OR" + " " + this.rhs.toSQLString(helper) + ")"; </DeepExtract> }
cytosm
positive
441,351
@Override public int complete(final String buffer, final int cursor, final List candidates) { if (buffer == null) return; String command = buffer.split(" ")[0]; if (commands.containsKey(command)) argumentCompletor.setCandidateStrings(argumentNames(command)); return delegate.complete(buffer, cursor, candidates); }
@Override public int complete(final String buffer, final int cursor, final List candidates) { <DeepExtract> if (buffer == null) return; String command = buffer.split(" ")[0]; if (commands.containsKey(command)) argumentCompletor.setCandidateStrings(argumentNames(command)); </DeepExtract> return delegate.complete(buffer, cursor, candidates); }
stirling
positive
441,353
public void dnsAddARecord(String domain, String ip) throws IOException { JSONBuilder jb = new JSONBuilder(); jb.put("host", domain); jb.array("addresses", Collections.singletonList(ip)); try { HttpPost httppost = new HttpPost(baseUrl + "add-a"); httppost.setEntity(new StringEntity(jb.toString(), ContentType.APPLICATION_JSON)); HttpResponse response = CLIENT.execute(httppost); EntityUtils.consume(response.getEntity()); if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { throw new IOException(response.getStatusLine().getReasonPhrase()); } } catch (ClientProtocolException ex) { throw new IOException(ex); } }
public void dnsAddARecord(String domain, String ip) throws IOException { JSONBuilder jb = new JSONBuilder(); jb.put("host", domain); jb.array("addresses", Collections.singletonList(ip)); <DeepExtract> try { HttpPost httppost = new HttpPost(baseUrl + "add-a"); httppost.setEntity(new StringEntity(jb.toString(), ContentType.APPLICATION_JSON)); HttpResponse response = CLIENT.execute(httppost); EntityUtils.consume(response.getEntity()); if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) { throw new IOException(response.getStatusLine().getReasonPhrase()); } } catch (ClientProtocolException ex) { throw new IOException(ex); } </DeepExtract> }
acme4j
positive
441,354
@Override public boolean cryptoGenericHashFinal(byte[] state, byte[] out, int outLen) { return (getSodium().crypto_generichash_final(state, out, outLen) == 0); }
@Override public boolean cryptoGenericHashFinal(byte[] state, byte[] out, int outLen) { <DeepExtract> return (getSodium().crypto_generichash_final(state, out, outLen) == 0); </DeepExtract> }
lazysodium-java
positive
441,356
@Override public void onDestroy() { LogHelper.d(TAG, "onDestroy"); unregisterReceiver(mCarConnectionReceiver); mPlaybackManager.handleStopRequest(null); mMediaNotificationManager.stopNotification(); mDelayedStopHandler.removeCallbacksAndMessages(null); mSession.release(); try { mErrorHandler.writeErrorsToFile(); } catch (IOException e) { e.printStackTrace(); } }
@Override public void onDestroy() { LogHelper.d(TAG, "onDestroy"); <DeepExtract> unregisterReceiver(mCarConnectionReceiver); </DeepExtract> mPlaybackManager.handleStopRequest(null); mMediaNotificationManager.stopNotification(); mDelayedStopHandler.removeCallbacksAndMessages(null); mSession.release(); try { mErrorHandler.writeErrorsToFile(); } catch (IOException e) { e.printStackTrace(); } }
Internet-Radio-Player-Android
positive
441,358
@Override public View getView(int i, View view, ViewGroup viewGroup) { CpData data = listDatas.get(i); if (getItemViewType(i) == 0) return getTitleView(view, data); ViewHolderContent holder = null; if (view == null) { holder = new ViewHolderContent(); view = inflater.inflate(R.layout.fragment_cp_content, null); holder.title = ButterKnife.findById(view, R.id.tv_content); holder.image = ButterKnife.findById(view, R.id.iv_play); holder.time = ButterKnife.findById(view, R.id.tv_time); view.setTag(holder); } else { holder = (ViewHolderContent) view.getTag(); } holder.title.setText(data.getChapterSeq() + "-" + data.getMediaSeq() + " " + data.getName() + ""); holder.time.setText(sec2time(data.getDuration())); if (data.isSeleted()) { holder.image.setImageResource(R.drawable.cp_play_press); holder.title.setTextColor(mContext.getResources().getColor(R.color.colorPrimary)); holder.time.setTextColor(mContext.getResources().getColor(R.color.colorPrimary)); } else { holder.image.setImageResource(R.drawable.cp_play_normal); holder.title.setTextColor(mContext.getResources().getColor(R.color.cp_second_text)); holder.time.setTextColor(mContext.getResources().getColor(R.color.cp_second_text)); } return view; }
@Override public View getView(int i, View view, ViewGroup viewGroup) { CpData data = listDatas.get(i); if (getItemViewType(i) == 0) return getTitleView(view, data); <DeepExtract> ViewHolderContent holder = null; if (view == null) { holder = new ViewHolderContent(); view = inflater.inflate(R.layout.fragment_cp_content, null); holder.title = ButterKnife.findById(view, R.id.tv_content); holder.image = ButterKnife.findById(view, R.id.iv_play); holder.time = ButterKnife.findById(view, R.id.tv_time); view.setTag(holder); } else { holder = (ViewHolderContent) view.getTag(); } holder.title.setText(data.getChapterSeq() + "-" + data.getMediaSeq() + " " + data.getName() + ""); holder.time.setText(sec2time(data.getDuration())); if (data.isSeleted()) { holder.image.setImageResource(R.drawable.cp_play_press); holder.title.setTextColor(mContext.getResources().getColor(R.color.colorPrimary)); holder.time.setTextColor(mContext.getResources().getColor(R.color.colorPrimary)); } else { holder.image.setImageResource(R.drawable.cp_play_normal); holder.title.setTextColor(mContext.getResources().getColor(R.color.cp_second_text)); holder.time.setTextColor(mContext.getResources().getColor(R.color.cp_second_text)); } return view; </DeepExtract> }
FlyMooc
positive
441,359
@Override public List<FileItem> queryByBatchId(String fileBatchId) { LocalFileItem item = new LocalFileItem(root); item.setName(dbHelper.queryByBatchId(fileBatchId).getName()); item.setPath(dbHelper.queryByBatchId(fileBatchId).getPath()); item.setBizId(dbHelper.queryByBatchId(fileBatchId).getBizId()); item.setBizType(dbHelper.queryByBatchId(fileBatchId).getBizType()); item.setId(dbHelper.queryByBatchId(fileBatchId).getId()); item.setOrgId(dbHelper.queryByBatchId(fileBatchId).getOrgId()); item.setId(dbHelper.queryByBatchId(fileBatchId).getId()); return item; }
@Override public List<FileItem> queryByBatchId(String fileBatchId) { <DeepExtract> LocalFileItem item = new LocalFileItem(root); item.setName(dbHelper.queryByBatchId(fileBatchId).getName()); item.setPath(dbHelper.queryByBatchId(fileBatchId).getPath()); item.setBizId(dbHelper.queryByBatchId(fileBatchId).getBizId()); item.setBizType(dbHelper.queryByBatchId(fileBatchId).getBizType()); item.setId(dbHelper.queryByBatchId(fileBatchId).getId()); item.setOrgId(dbHelper.queryByBatchId(fileBatchId).getOrgId()); item.setId(dbHelper.queryByBatchId(fileBatchId).getId()); return item; </DeepExtract> }
springboot-plus
positive
441,360
public Vector4f set(ReadableVector4f src) { return x; return y; return z; return w; return this; }
public Vector4f set(ReadableVector4f src) { return x; return y; return z; <DeepExtract> return w; </DeepExtract> return this; }
lwjglx
positive
441,363
public Criteria andNotifierIsNotNull() { if ("NOTIFIER is not null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("NOTIFIER is not null")); return (Criteria) this; }
public Criteria andNotifierIsNotNull() { <DeepExtract> if ("NOTIFIER is not null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("NOTIFIER is not null")); </DeepExtract> return (Criteria) this; }
communitycode
positive
441,364
@Test public void testSchemaSequence2() throws Exception { QuickTestConfiguration.setXsdLocation("./data/schema/sequence.xsd"); QuickTestConfiguration.setXmlLocation("./data/schema/sequence2.xml"); QuickTestConfiguration.setExiLocation("./out/schema/sequence2.exi"); _test(); }
@Test public void testSchemaSequence2() throws Exception { <DeepExtract> QuickTestConfiguration.setXsdLocation("./data/schema/sequence.xsd"); QuickTestConfiguration.setXmlLocation("./data/schema/sequence2.xml"); QuickTestConfiguration.setExiLocation("./out/schema/sequence2.exi"); </DeepExtract> _test(); }
exificient
positive
441,365
protected synchronized static Map<JacobObject, String> addThread() { String t_name = Thread.currentThread().getName(); if (rot.containsKey(t_name)) { } else { Map<JacobObject, String> tab = null; if (JacobObject.isDebugEnabled()) { JacobObject.debug("ROT: Automatic GC flag == " + USE_AUTOMATIC_GARBAGE_COLLECTION); } if (!USE_AUTOMATIC_GARBAGE_COLLECTION) { tab = new HashMap<JacobObject, String>(); } else { tab = new WeakHashMap<JacobObject, String>(); } rot.put(t_name, tab); } String t_name = Thread.currentThread().getName(); if (!rot.containsKey(t_name) && false) { addThread(); } return rot.get(t_name); }
protected synchronized static Map<JacobObject, String> addThread() { String t_name = Thread.currentThread().getName(); if (rot.containsKey(t_name)) { } else { Map<JacobObject, String> tab = null; if (JacobObject.isDebugEnabled()) { JacobObject.debug("ROT: Automatic GC flag == " + USE_AUTOMATIC_GARBAGE_COLLECTION); } if (!USE_AUTOMATIC_GARBAGE_COLLECTION) { tab = new HashMap<JacobObject, String>(); } else { tab = new WeakHashMap<JacobObject, String>(); } rot.put(t_name, tab); } <DeepExtract> String t_name = Thread.currentThread().getName(); if (!rot.containsKey(t_name) && false) { addThread(); } return rot.get(t_name); </DeepExtract> }
jacob
positive
441,366
void removeRepoReturnsOkAndRepoIsRemovedIfRepositoryHasWrongConfiguration(final Vertx vertx, final VertxTestContext ctx, final RepositoryName rname) throws Exception { final String repoconf = String.join(System.lineSeparator(), "“When you go after honey with a balloon,", " the great thing is to not let the bees know you’re coming.", "—Winnie the Pooh"); this.save(new ConfigKeys(rname.toString()).yamlKey(), repoconf.getBytes(StandardCharsets.UTF_8)); this.requestAndAssert(vertx, ctx, new TestRequest(HttpMethod.DELETE, String.format("/api/v1/repository/%s", rname)), res -> { MatcherAssert.assertThat(res.statusCode(), new IsEqual<>(HttpStatus.OK_200)); Awaitility.waitAtMost(MAX_WAIT_TIME, TimeUnit.SECONDS).until(() -> !this.storage().exists(new ConfigKeys(rname.toString()).yamlKey())); }); }
void removeRepoReturnsOkAndRepoIsRemovedIfRepositoryHasWrongConfiguration(final Vertx vertx, final VertxTestContext ctx, final RepositoryName rname) throws Exception { final String repoconf = String.join(System.lineSeparator(), "“When you go after honey with a balloon,", " the great thing is to not let the bees know you’re coming.", "—Winnie the Pooh"); <DeepExtract> this.save(new ConfigKeys(rname.toString()).yamlKey(), repoconf.getBytes(StandardCharsets.UTF_8)); this.requestAndAssert(vertx, ctx, new TestRequest(HttpMethod.DELETE, String.format("/api/v1/repository/%s", rname)), res -> { MatcherAssert.assertThat(res.statusCode(), new IsEqual<>(HttpStatus.OK_200)); Awaitility.waitAtMost(MAX_WAIT_TIME, TimeUnit.SECONDS).until(() -> !this.storage().exists(new ConfigKeys(rname.toString()).yamlKey())); }); </DeepExtract> }
artipie
positive
441,367
@CheckForNull String search(String sosl) throws IOException { return executeGet("/search", Arrays.asList(new BasicNameValuePair("q", sosl))); }
@CheckForNull String search(String sosl) throws IOException { <DeepExtract> return executeGet("/search", Arrays.asList(new BasicNameValuePair("q", sosl))); </DeepExtract> }
sf-api-connector
positive
441,368
public static void backfaceVisibility($ droidQuery, TokenSequence value) { }
public static void backfaceVisibility($ droidQuery, TokenSequence value) { <DeepExtract> </DeepExtract> }
droidQuery
positive
441,369
@Override public void setFractionalMetrics(final boolean fractionalMetrics) { super.setFractionalMetrics(fractionalMetrics); this.texBold = this.setupTexture(this.font.deriveFont(1), this.antiAlias, this.fractionalMetrics, this.boldChars); this.texItalic = this.setupTexture(this.font.deriveFont(2), this.antiAlias, this.fractionalMetrics, this.italicChars); this.texItalicBold = this.setupTexture(this.font.deriveFont(3), this.antiAlias, this.fractionalMetrics, this.boldItalicChars); }
@Override public void setFractionalMetrics(final boolean fractionalMetrics) { super.setFractionalMetrics(fractionalMetrics); <DeepExtract> this.texBold = this.setupTexture(this.font.deriveFont(1), this.antiAlias, this.fractionalMetrics, this.boldChars); this.texItalic = this.setupTexture(this.font.deriveFont(2), this.antiAlias, this.fractionalMetrics, this.italicChars); this.texItalicBold = this.setupTexture(this.font.deriveFont(3), this.antiAlias, this.fractionalMetrics, this.boldItalicChars); </DeepExtract> }
TrollGodCC-v1.5.4-Source-Code
positive
441,370
@Test public void simpleOutOfOrderTest() throws RewriteException { Vp8PacketGenerator generator = new Vp8PacketGenerator(1); long[] seeds = { 1576267371838L, 1578347926155L, 1579620018479L, System.currentTimeMillis() }; for (long seed : seeds) { try { doRunOutOfOrderTest(generator, 2, seed); } catch (Throwable e) { logger.error("Exception thrown in randomized test, seed = " + seed, e); throw e; } generator.reset(); } }
@Test public void simpleOutOfOrderTest() throws RewriteException { Vp8PacketGenerator generator = new Vp8PacketGenerator(1); <DeepExtract> long[] seeds = { 1576267371838L, 1578347926155L, 1579620018479L, System.currentTimeMillis() }; for (long seed : seeds) { try { doRunOutOfOrderTest(generator, 2, seed); } catch (Throwable e) { logger.error("Exception thrown in randomized test, seed = " + seed, e); throw e; } generator.reset(); } </DeepExtract> }
jitsi-videobridge
positive
441,371
public Criteria andAvatarUrlGreaterThan(String value) { if (value == null) { throw new RuntimeException("Value for " + "avatarUrl" + " cannot be null"); } criteria.add(new Criterion("avatar_url >", value)); return (Criteria) this; }
public Criteria andAvatarUrlGreaterThan(String value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "avatarUrl" + " cannot be null"); } criteria.add(new Criterion("avatar_url >", value)); </DeepExtract> return (Criteria) this; }
community
positive
441,374
public byte[] getError() throws InterruptedException { if (_process == null) throw new IllegalStateException("you must call start first"); _out.join(); _err.join(); return _process.waitFor(); if (_running) throw new IllegalStateException("wait for process to be completed"); return _out.toByteArray(); }
public byte[] getError() throws InterruptedException { if (_process == null) throw new IllegalStateException("you must call start first"); _out.join(); _err.join(); return _process.waitFor(); <DeepExtract> if (_running) throw new IllegalStateException("wait for process to be completed"); return _out.toByteArray(); </DeepExtract> }
linkedin-utils
positive
441,375
@Test public void manager_readNotification_returnsNull_whenEntryNotfound() { setupReadObject(notificationPrefs, "code", false); when(notificationPrefs.getString("MyCode", null)).thenReturn(null); LocalNotification category = getSubject().readNotification("MyCode"); assertNull(category); }
@Test public void manager_readNotification_returnsNull_whenEntryNotfound() { <DeepExtract> setupReadObject(notificationPrefs, "code", false); </DeepExtract> when(notificationPrefs.getString("MyCode", null)).thenReturn(null); LocalNotification category = getSubject().readNotification("MyCode"); assertNull(category); }
JKLocalNotifications-ANE
positive
441,376
@Override protected final void onBindViewHolder(@NonNull VH holder, @NonNull LoadMoreItem item) { holder.data = item; this.mState = item.getState(); }
@Override protected final void onBindViewHolder(@NonNull VH holder, @NonNull LoadMoreItem item) { holder.data = item; <DeepExtract> this.mState = item.getState(); </DeepExtract> }
AndroidUiKit
positive
441,377
@Deprecated public EditText findEditText(int id) { EditText view = (EditText) findViewById(id); BasisBaseUtils.setClickableTrue(view); view.setOnClickListener(this); return view; }
@Deprecated public EditText findEditText(int id) { EditText view = (EditText) findViewById(id); <DeepExtract> BasisBaseUtils.setClickableTrue(view); </DeepExtract> view.setOnClickListener(this); return view; }
BasisDependency
positive
441,378
@Test(expected = SchemaMappingException.class) public void shouldFailOnIncompatibleTypesWithValueProducer() throws IOException, InterruptedException { mappingFile = File.createTempFile("test-mapping", ".groovy"); copyResourceToFile("wrong-types-producer.groovy", mappingFile); avroFile = File.createTempFile("TestSchema-", ".avsc"); copyResourceToFile("TestRecord.avsc", avroFile); final ImmutableMap<String, Object> mappingConfig = ImmutableMap.of("divolte.mappings.test.mapping_script_file", mappingFile.getAbsolutePath(), "divolte.mappings.test.schema_file", avroFile.getAbsolutePath()); server = new TestServer("base-test-server.conf", mappingConfig); return request("http://www.example.com/wrong", Collections.emptyList()); }
@Test(expected = SchemaMappingException.class) public void shouldFailOnIncompatibleTypesWithValueProducer() throws IOException, InterruptedException { mappingFile = File.createTempFile("test-mapping", ".groovy"); copyResourceToFile("wrong-types-producer.groovy", mappingFile); avroFile = File.createTempFile("TestSchema-", ".avsc"); copyResourceToFile("TestRecord.avsc", avroFile); final ImmutableMap<String, Object> mappingConfig = ImmutableMap.of("divolte.mappings.test.mapping_script_file", mappingFile.getAbsolutePath(), "divolte.mappings.test.schema_file", avroFile.getAbsolutePath()); server = new TestServer("base-test-server.conf", mappingConfig); <DeepExtract> return request("http://www.example.com/wrong", Collections.emptyList()); </DeepExtract> }
divolte-collector
positive
441,379
public void setText(String text) { this.text = text; setLineHeight(getTextPaint()); lineList.clear(); lineList = divideOriginalTextToStringLineList(getText()); setMeasuredDimentions(lineList.size(), getLineHeight(), getLineSpace()); measure(getMeasuredViewWidth(), getMeasuredViewHeight()); invalidate(); }
public void setText(String text) { this.text = text; <DeepExtract> setLineHeight(getTextPaint()); lineList.clear(); lineList = divideOriginalTextToStringLineList(getText()); setMeasuredDimentions(lineList.size(), getLineHeight(), getLineSpace()); measure(getMeasuredViewWidth(), getMeasuredViewHeight()); </DeepExtract> invalidate(); }
RxAndroidBootstrap
positive
441,380
private void createInventory(ArrayList<Booking> bookingList) { RestTemplate restTemplate = new RestTemplate(); bookingRepository.delete(bookingRepository.getOne(inventoryURI)); for (Booking b : bookingList) { Inventory newInventory = new Inventory(booking.getId(), 1000); restTemplate.postForObject(inventoryURI + "create", newInventory, Inventory.class); } }
private void createInventory(ArrayList<Booking> bookingList) { RestTemplate restTemplate = new RestTemplate(); <DeepExtract> bookingRepository.delete(bookingRepository.getOne(inventoryURI)); </DeepExtract> for (Booking b : bookingList) { Inventory newInventory = new Inventory(booking.getId(), 1000); restTemplate.postForObject(inventoryURI + "create", newInventory, Inventory.class); } }
flight-booking
positive
441,381
private void addScaledCircle(double xc, double yc, double radius) { double xprev = xc + radius; double yprev = yc; addScaled(xprev, yprev, 0.0, MOVETO, QBASE); for (int i = 1; i <= 36; i++) { double x = xc + radius * U.cosd(10 * i); double y = yc + radius * U.sind(10 * i); add2D(x, y, PATHTO); xprev = x; yprev = y; } addScaled(xprev, yprev, 0.0, STROKE, QBASE); }
private void addScaledCircle(double xc, double yc, double radius) { double xprev = xc + radius; double yprev = yc; addScaled(xprev, yprev, 0.0, MOVETO, QBASE); for (int i = 1; i <= 36; i++) { double x = xc + radius * U.cosd(10 * i); double y = yc + radius * U.sind(10 * i); add2D(x, y, PATHTO); xprev = x; yprev = y; } <DeepExtract> addScaled(xprev, yprev, 0.0, STROKE, QBASE); </DeepExtract> }
BeamFour
positive
441,383
public void onDestroyView() { super.onDestroyView(); unbindViews(); if (mCompositeSubscription != null && !mCompositeSubscription.isUnsubscribed()) { mCompositeSubscription.unsubscribe(); } mCompositeSubscription = null; }
public void onDestroyView() { super.onDestroyView(); unbindViews(); <DeepExtract> if (mCompositeSubscription != null && !mCompositeSubscription.isUnsubscribed()) { mCompositeSubscription.unsubscribe(); } mCompositeSubscription = null; </DeepExtract> }
AndroidPlayground
positive
441,385
@Override public void handleOnShutdownException(Throwable ex) { if (null != uncaughtExceptionHandler) { uncaughtExceptionHandler.accept(ex); } else { log.error(ex.getMessage(), ex); } }
@Override public void handleOnShutdownException(Throwable ex) { <DeepExtract> if (null != uncaughtExceptionHandler) { uncaughtExceptionHandler.accept(ex); } else { log.error(ex.getMessage(), ex); } </DeepExtract> }
muon-java
positive
441,389
static void info(String s) { }
static void info(String s) { <DeepExtract> </DeepExtract> }
cross-document-coreference-resolution
positive
441,390
protected Pageable pageable(String field, SortType type, int len) { HttpServletRequest request = getRequest(); int size = ServletRequestUtils.getIntParameter(request, "size", len); int offset = ServletRequestUtils.getIntParameter(request, "offset", 1); if (type == SortType.DESC) { return PageRequest.of(offset - 1, size, Sort.Direction.DESC, field); } else { return PageRequest.of(offset - 1, size, Sort.Direction.ASC, field); } }
protected Pageable pageable(String field, SortType type, int len) { <DeepExtract> HttpServletRequest request = getRequest(); int size = ServletRequestUtils.getIntParameter(request, "size", len); int offset = ServletRequestUtils.getIntParameter(request, "offset", 1); if (type == SortType.DESC) { return PageRequest.of(offset - 1, size, Sort.Direction.DESC, field); } else { return PageRequest.of(offset - 1, size, Sort.Direction.ASC, field); } </DeepExtract> }
UnaBoot
positive
441,391
@Override public void onClick(View view) { if (Util.hasProLicense(this) == null) { Util.viewUri(this, ActivityMain.cProUri); } else { WhitelistsTask whitelistsTask = new WhitelistsTask(md.whitelist()); whitelistsTask.executeOnExecutor(mExecutor, (Object) null); } }
@Override public void onClick(View view) { <DeepExtract> if (Util.hasProLicense(this) == null) { Util.viewUri(this, ActivityMain.cProUri); } else { WhitelistsTask whitelistsTask = new WhitelistsTask(md.whitelist()); whitelistsTask.executeOnExecutor(mExecutor, (Object) null); } </DeepExtract> }
XLocation
positive
441,395
@Override public void onSharedPreferenceChanged(final SharedPreferences sharedPreferences, final String key) { final Preference pref = findPreference(key); if (pref instanceof ListPreference) { final CharSequence summary = ((ListPreference) pref).getEntry(); if (summary != null) { pref.setSummary(summary); } } if (pref instanceof EditTextPreference) { final CharSequence summary = ((EditTextPreference) pref).getText(); if (summary != null) { pref.setSummary(summary); } } }
@Override public void onSharedPreferenceChanged(final SharedPreferences sharedPreferences, final String key) { final Preference pref = findPreference(key); <DeepExtract> if (pref instanceof ListPreference) { final CharSequence summary = ((ListPreference) pref).getEntry(); if (summary != null) { pref.setSummary(summary); } } if (pref instanceof EditTextPreference) { final CharSequence summary = ((EditTextPreference) pref).getText(); if (summary != null) { pref.setSummary(summary); } } </DeepExtract> }
adblockplusandroid
positive
441,396
private static Record createAggregatedRecord(final int aggregationFactor, final AtomicInteger sequenceNumber) { RecordAggregator recordAggregator = new RecordAggregator(); for (int i = 0; i < aggregationFactor; i++) { try { recordAggregator.addUserRecord("pk", randomAlphabetic(32).getBytes(UTF_8)); } catch (Exception e) { throw new RuntimeException(e); } } return Record.builder().approximateArrivalTimestamp(Instant.now()).data(SdkBytes.fromByteArray(recordAggregator.clearAndGet().toRecordBytes())).sequenceNumber(String.valueOf(sequenceNumber.incrementAndGet())).partitionKey("pk").build(); }
private static Record createAggregatedRecord(final int aggregationFactor, final AtomicInteger sequenceNumber) { RecordAggregator recordAggregator = new RecordAggregator(); for (int i = 0; i < aggregationFactor; i++) { try { recordAggregator.addUserRecord("pk", randomAlphabetic(32).getBytes(UTF_8)); } catch (Exception e) { throw new RuntimeException(e); } } <DeepExtract> return Record.builder().approximateArrivalTimestamp(Instant.now()).data(SdkBytes.fromByteArray(recordAggregator.clearAndGet().toRecordBytes())).sequenceNumber(String.valueOf(sequenceNumber.incrementAndGet())).partitionKey("pk").build(); </DeepExtract> }
amazon-kinesis-connector-flink
positive
441,397
@Override public <T extends QuantisedLocalFeature<?>> List<DocidScore> search(final QLFDocument<T> query, final BasicSearcherOptions options) { final List<DocidScore> finalRS = Collections.synchronizedList(new ArrayList<DocidScore>()); try { Map<Index, Map<String, WeightingModel>> cacheInstance = null; final Field cacheField = WeightingModelFactory.class.getDeclaredField("cache"); cacheField.setAccessible(true); while (cacheInstance == null) { cacheInstance = (Map<Index, Map<String, WeightingModel>>) cacheField.get(null); } final Map<Index, Map<String, WeightingModel>> synchedCacheInstance = Collections.synchronizedMap(cacheInstance); cacheField.set(null, synchedCacheInstance); System.out.println("Got it: " + synchedCacheInstance); } catch (final Exception e) { System.out.println("Something went wrong!"); throw new RuntimeException(e); } Parallel.forEach(indexes, new Operation<Index>() { @Override public void perform(Index index) { System.out.println("Searching with index: " + new File(index.getPath()).getName()); final List<DocidScore> rs = search(query.clone(), options, index); finalRS.addAll(rs); } }, (ThreadPoolExecutor) Executors.newFixedThreadPool(8, new GlobalExecutorPool.DaemonThreadFactory())); return finalRS; }
@Override public <T extends QuantisedLocalFeature<?>> List<DocidScore> search(final QLFDocument<T> query, final BasicSearcherOptions options) { final List<DocidScore> finalRS = Collections.synchronizedList(new ArrayList<DocidScore>()); <DeepExtract> try { Map<Index, Map<String, WeightingModel>> cacheInstance = null; final Field cacheField = WeightingModelFactory.class.getDeclaredField("cache"); cacheField.setAccessible(true); while (cacheInstance == null) { cacheInstance = (Map<Index, Map<String, WeightingModel>>) cacheField.get(null); } final Map<Index, Map<String, WeightingModel>> synchedCacheInstance = Collections.synchronizedMap(cacheInstance); cacheField.set(null, synchedCacheInstance); System.out.println("Got it: " + synchedCacheInstance); } catch (final Exception e) { System.out.println("Something went wrong!"); throw new RuntimeException(e); } </DeepExtract> Parallel.forEach(indexes, new Operation<Index>() { @Override public void perform(Index index) { System.out.println("Searching with index: " + new File(index.getPath()).getName()); final List<DocidScore> rs = search(query.clone(), options, index); finalRS.addAll(rs); } }, (ThreadPoolExecutor) Executors.newFixedThreadPool(8, new GlobalExecutorPool.DaemonThreadFactory())); return finalRS; }
imageterrier
positive
441,399
public void enableSearchEngines(boolean enableOmssa, boolean enbleXTandem, boolean enableMsgf, boolean enableMsAmanda, boolean enableMyriMatch, boolean enableComet, boolean enableTide, boolean enableAndromeda, boolean enableMetaMorpheus, boolean enableSage, boolean enableNovor, boolean enableDirecTag) { enableOmssaJCheckBox.setSelected(enableOmssa); enableXTandemJCheckBox.setSelected(enbleXTandem); enableMsgfJCheckBox.setSelected(enableMsgf); enableMsAmandaJCheckBox.setSelected(enableMsAmanda); enableMyriMatchJCheckBox.setSelected(enableMyriMatch); enableCometJCheckBox.setSelected(enableComet); enableTideJCheckBox.setSelected(enableTide); enableAndromedaJCheckBox.setSelected(enableAndromeda); enableMetaMorpheusJCheckBox.setSelected(enableMetaMorpheus); enableSageJCheckBox.setSelected(enableSage); enableNovorJCheckBox.setSelected(enableNovor); enableDirecTagJCheckBox.setSelected(enableDirecTag); searchHandler.setOmssaEnabled(enableOmssa); searchHandler.setXtandemEnabled(enbleXTandem); searchHandler.setMsgfEnabled(enableMsgf); searchHandler.setMsAmandaEnabled(enableMsAmanda); searchHandler.setMyriMatchEnabled(enableMyriMatch); searchHandler.setCometEnabled(enableComet); searchHandler.setTideEnabled(enableTide); searchHandler.setAndromedaEnabled(enableAndromeda); searchHandler.setMetaMorpheusEnabled(enableMetaMorpheus); searchHandler.setSageEnabled(enableSage); searchHandler.setNovorEnabled(enableNovor); searchHandler.setDirecTagEnabled(enableDirecTag); boolean valid = true; databaseSettingsLbl.setForeground(Color.BLACK); if (!enableOmssaJCheckBox.isSelected() && !enableXTandemJCheckBox.isSelected() && !enableMsgfJCheckBox.isSelected() && !enableMsAmandaJCheckBox.isSelected() && !enableMyriMatchJCheckBox.isSelected() && !enableCometJCheckBox.isSelected() && !enableTideJCheckBox.isSelected() && !enableAndromedaJCheckBox.isSelected() && !enableMetaMorpheusJCheckBox.isSelected() && !enableSageJCheckBox.isSelected() && !enableNovorJCheckBox.isSelected() && !enableDirecTagJCheckBox.isSelected()) { if (false && valid) { JOptionPane.showMessageDialog(this, "You need to select at least one search engine or de novo algorithm.", "Input Error", JOptionPane.WARNING_MESSAGE); } valid = false; } if (spectrumFiles.isEmpty() && rawFiles.isEmpty()) { if (false && valid) { JOptionPane.showMessageDialog(this, "You need to select at least one spectrum file.", "Spectra Files Not Found", JOptionPane.WARNING_MESSAGE); } spectrumFilesLabel.setForeground(Color.RED); spectrumFilesLabel.setToolTipText("Please select at least one spectrum file"); spectrumFilesTxt.setToolTipText(null); valid = false; spectrumFilesTxt.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); } else { spectrumFilesLabel.setToolTipText(null); spectrumFilesTxt.setToolTipText("Click to see the selected files"); spectrumFilesTxt.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); spectrumFilesLabel.setForeground(Color.BLACK); } if (databaseFileTxt.getText() == null || databaseFileTxt.getText().trim().equals("")) { if (false && valid) { JOptionPane.showMessageDialog(this, "You need to specify a search database.", "Search Database Not Found", JOptionPane.WARNING_MESSAGE); } databaseSettingsLbl.setForeground(Color.RED); databaseSettingsLbl.setToolTipText("Please select a valid '.fasta' or '.fas' database file"); databaseFileTxt.setToolTipText(null); valid = false; } else { File test = new File(databaseFileTxt.getText().trim()); if (!test.exists()) { if (false && valid) { JOptionPane.showMessageDialog(this, "The database file could not be found.", "Search Database Not Found", JOptionPane.WARNING_MESSAGE); } databaseSettingsLbl.setForeground(Color.RED); databaseSettingsLbl.setToolTipText("Database file could not be found!"); valid = false; } } if (!validateParametersInput(false)) { valid = false; } if (outputFolderTxt.getText() == null || outputFolderTxt.getText().trim().equals("")) { if (false && valid) { JOptionPane.showMessageDialog(this, "You need to specify an output folder.", "Output Folder Not Found", JOptionPane.WARNING_MESSAGE); } resultFolderLbl.setForeground(Color.RED); resultFolderLbl.setToolTipText("Please select an output folder"); valid = false; } else if (!new File(outputFolderTxt.getText()).exists()) { int value = JOptionPane.showConfirmDialog(this, "The selected output folder does not exist. Do you want to create it?", "Folder Not Found", JOptionPane.YES_NO_OPTION); if (value == JOptionPane.YES_OPTION) { boolean success = new File(outputFolderTxt.getText()).mkdir(); if (!success) { JOptionPane.showMessageDialog(this, "Failed to create the output folder. Please create it manually and re-select it.", "File Error", JOptionPane.ERROR_MESSAGE); valid = false; } else { resultFolderLbl.setForeground(Color.BLACK); resultFolderLbl.setToolTipText(null); } } } else { resultFolderLbl.setForeground(Color.BLACK); resultFolderLbl.setToolTipText(null); } searchButton.setEnabled(valid); return valid; }
public void enableSearchEngines(boolean enableOmssa, boolean enbleXTandem, boolean enableMsgf, boolean enableMsAmanda, boolean enableMyriMatch, boolean enableComet, boolean enableTide, boolean enableAndromeda, boolean enableMetaMorpheus, boolean enableSage, boolean enableNovor, boolean enableDirecTag) { enableOmssaJCheckBox.setSelected(enableOmssa); enableXTandemJCheckBox.setSelected(enbleXTandem); enableMsgfJCheckBox.setSelected(enableMsgf); enableMsAmandaJCheckBox.setSelected(enableMsAmanda); enableMyriMatchJCheckBox.setSelected(enableMyriMatch); enableCometJCheckBox.setSelected(enableComet); enableTideJCheckBox.setSelected(enableTide); enableAndromedaJCheckBox.setSelected(enableAndromeda); enableMetaMorpheusJCheckBox.setSelected(enableMetaMorpheus); enableSageJCheckBox.setSelected(enableSage); enableNovorJCheckBox.setSelected(enableNovor); enableDirecTagJCheckBox.setSelected(enableDirecTag); searchHandler.setOmssaEnabled(enableOmssa); searchHandler.setXtandemEnabled(enbleXTandem); searchHandler.setMsgfEnabled(enableMsgf); searchHandler.setMsAmandaEnabled(enableMsAmanda); searchHandler.setMyriMatchEnabled(enableMyriMatch); searchHandler.setCometEnabled(enableComet); searchHandler.setTideEnabled(enableTide); searchHandler.setAndromedaEnabled(enableAndromeda); searchHandler.setMetaMorpheusEnabled(enableMetaMorpheus); searchHandler.setSageEnabled(enableSage); searchHandler.setNovorEnabled(enableNovor); searchHandler.setDirecTagEnabled(enableDirecTag); <DeepExtract> boolean valid = true; databaseSettingsLbl.setForeground(Color.BLACK); if (!enableOmssaJCheckBox.isSelected() && !enableXTandemJCheckBox.isSelected() && !enableMsgfJCheckBox.isSelected() && !enableMsAmandaJCheckBox.isSelected() && !enableMyriMatchJCheckBox.isSelected() && !enableCometJCheckBox.isSelected() && !enableTideJCheckBox.isSelected() && !enableAndromedaJCheckBox.isSelected() && !enableMetaMorpheusJCheckBox.isSelected() && !enableSageJCheckBox.isSelected() && !enableNovorJCheckBox.isSelected() && !enableDirecTagJCheckBox.isSelected()) { if (false && valid) { JOptionPane.showMessageDialog(this, "You need to select at least one search engine or de novo algorithm.", "Input Error", JOptionPane.WARNING_MESSAGE); } valid = false; } if (spectrumFiles.isEmpty() && rawFiles.isEmpty()) { if (false && valid) { JOptionPane.showMessageDialog(this, "You need to select at least one spectrum file.", "Spectra Files Not Found", JOptionPane.WARNING_MESSAGE); } spectrumFilesLabel.setForeground(Color.RED); spectrumFilesLabel.setToolTipText("Please select at least one spectrum file"); spectrumFilesTxt.setToolTipText(null); valid = false; spectrumFilesTxt.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); } else { spectrumFilesLabel.setToolTipText(null); spectrumFilesTxt.setToolTipText("Click to see the selected files"); spectrumFilesTxt.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); spectrumFilesLabel.setForeground(Color.BLACK); } if (databaseFileTxt.getText() == null || databaseFileTxt.getText().trim().equals("")) { if (false && valid) { JOptionPane.showMessageDialog(this, "You need to specify a search database.", "Search Database Not Found", JOptionPane.WARNING_MESSAGE); } databaseSettingsLbl.setForeground(Color.RED); databaseSettingsLbl.setToolTipText("Please select a valid '.fasta' or '.fas' database file"); databaseFileTxt.setToolTipText(null); valid = false; } else { File test = new File(databaseFileTxt.getText().trim()); if (!test.exists()) { if (false && valid) { JOptionPane.showMessageDialog(this, "The database file could not be found.", "Search Database Not Found", JOptionPane.WARNING_MESSAGE); } databaseSettingsLbl.setForeground(Color.RED); databaseSettingsLbl.setToolTipText("Database file could not be found!"); valid = false; } } if (!validateParametersInput(false)) { valid = false; } if (outputFolderTxt.getText() == null || outputFolderTxt.getText().trim().equals("")) { if (false && valid) { JOptionPane.showMessageDialog(this, "You need to specify an output folder.", "Output Folder Not Found", JOptionPane.WARNING_MESSAGE); } resultFolderLbl.setForeground(Color.RED); resultFolderLbl.setToolTipText("Please select an output folder"); valid = false; } else if (!new File(outputFolderTxt.getText()).exists()) { int value = JOptionPane.showConfirmDialog(this, "The selected output folder does not exist. Do you want to create it?", "Folder Not Found", JOptionPane.YES_NO_OPTION); if (value == JOptionPane.YES_OPTION) { boolean success = new File(outputFolderTxt.getText()).mkdir(); if (!success) { JOptionPane.showMessageDialog(this, "Failed to create the output folder. Please create it manually and re-select it.", "File Error", JOptionPane.ERROR_MESSAGE); valid = false; } else { resultFolderLbl.setForeground(Color.BLACK); resultFolderLbl.setToolTipText(null); } } } else { resultFolderLbl.setForeground(Color.BLACK); resultFolderLbl.setToolTipText(null); } searchButton.setEnabled(valid); return valid; </DeepExtract> }
searchgui
positive
441,400
public Criteria andEndDateIsNull() { if ("end_date is null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("end_date is null")); return (Criteria) this; }
public Criteria andEndDateIsNull() { <DeepExtract> if ("end_date is null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("end_date is null")); </DeepExtract> return (Criteria) this; }
CuitJavaEEPractice
positive
441,401
@Nullable @Override public SortedSet<Suggestion> findValueSuggestionsForPrefix(Module module, FileType fileType, List<SuggestionNode> matchesRootTillMe, String prefix, @Nullable Set<String> siblingsToExclude) { return doWithValueDelegateAndReturn(proxy -> proxy.findValueSuggestionsForPrefix(module, fileType, matchesRootTillMe, prefix, siblingsToExclude), null); }
@Nullable @Override public SortedSet<Suggestion> findValueSuggestionsForPrefix(Module module, FileType fileType, List<SuggestionNode> matchesRootTillMe, String prefix, @Nullable Set<String> siblingsToExclude) { <DeepExtract> return doWithValueDelegateAndReturn(proxy -> proxy.findValueSuggestionsForPrefix(module, fileType, matchesRootTillMe, prefix, siblingsToExclude), null); </DeepExtract> }
intellij-spring-assistant
positive
441,402
@Override protected void onContentService() { try { ListView listView = (ListView) findViewById(R.id.siteList); List<Subscription> sites = getResults(); Toast.makeText(getApplicationContext(), "Found " + sites.size() + " results", Toast.LENGTH_LONG).show(); List<Map<String, String>> list = new ArrayList<Map<String, String>>(); for (Subscription sub : sites) { Map<String, String> item = new HashMap<String, String>(); item.put("name", sub.name); item.put("url", sub.url); list.add(item); } SimpleAdapter notes = new SimpleAdapter(this, list, R.layout.main_item_two_line_row, new String[] { "name", "url" }, new int[] { R.id.text1, R.id.text2 }); listView.setAdapter(notes); } catch (Throwable t) { TraceUtil.report(new RuntimeException("lastResults=" + lastResults, t)); Toast.makeText(getApplicationContext(), "Sorry, problem with search results.", Toast.LENGTH_LONG).show(); } }
@Override protected void onContentService() { <DeepExtract> try { ListView listView = (ListView) findViewById(R.id.siteList); List<Subscription> sites = getResults(); Toast.makeText(getApplicationContext(), "Found " + sites.size() + " results", Toast.LENGTH_LONG).show(); List<Map<String, String>> list = new ArrayList<Map<String, String>>(); for (Subscription sub : sites) { Map<String, String> item = new HashMap<String, String>(); item.put("name", sub.name); item.put("url", sub.url); list.add(item); } SimpleAdapter notes = new SimpleAdapter(this, list, R.layout.main_item_two_line_row, new String[] { "name", "url" }, new int[] { R.id.text1, R.id.text2 }); listView.setAdapter(notes); } catch (Throwable t) { TraceUtil.report(new RuntimeException("lastResults=" + lastResults, t)); Toast.makeText(getApplicationContext(), "Sorry, problem with search results.", Toast.LENGTH_LONG).show(); } </DeepExtract> }
Car-Cast
positive
441,404
static BuildResult parse(byte[] stuff, char[] jksPass, char[] keyPass, boolean forTrustMaterial) throws IOException, CertificateException, KeyStoreException, ProbablyBadPasswordException { CertificateFactory cf = CertificateFactory.getInstance("X.509"); Key key = null; Certificate[] chain = null; try { PKCS8Key pkcs8Key = new PKCS8Key(stuff, jksPass); key = pkcs8Key.getPrivateKey(); } catch (ProbablyBadPasswordException pbpe) { throw pbpe; } catch (GeneralSecurityException gse) { } List pemItems = PEMUtil.decode(stuff); Iterator it = pemItems.iterator(); LinkedList certificates = new LinkedList(); while (it.hasNext()) { PEMItem item = (PEMItem) it.next(); byte[] derBytes = item.getDerBytes(); String type = item.pemType.trim().toUpperCase(); if (type.startsWith("CERT") || type.startsWith("X509") || type.startsWith("PKCS7")) { ByteArrayInputStream in = new ByteArrayInputStream(derBytes); X509Certificate c = (X509Certificate) cf.generateCertificate(in); certificates.add(c); } chain = toChain(certificates); } if (chain != null || key != null) { List chains = chain != null ? Collections.singletonList(chain) : null; List keys = key != null ? Collections.singletonList(key) : null; return new BuildResult(keys, chains, null); } boolean isProbablyPKCS12 = false; boolean isASN = false; ASN1Structure asn1 = null; try { asn1 = ASN1Util.analyze(stuff); isASN = true; isProbablyPKCS12 = asn1.oids.contains(PKCS7_ENCRYPTED); if (!isProbablyPKCS12 && asn1.bigPayload != null) { asn1 = ASN1Util.analyze(asn1.bigPayload); isProbablyPKCS12 = asn1.oids.contains(PKCS7_ENCRYPTED); } } catch (Exception e) { } ByteArrayInputStream stuffStream = new ByteArrayInputStream(stuff); BuildResult br; stuffStream.reset(); if (keyPass == null || keyPass.length <= 0) { keyPass = jksPass; } KeyStore.getDefaultType() = KeyStore.getDefaultType().trim().toLowerCase(); boolean isPKCS12 = "pkcs12".equalsIgnoreCase(KeyStore.getDefaultType()); try { Key key = null; Certificate[] chain = null; UnrecoverableKeyException uke = null; KeyStore jksKeyStore = KeyStore.getInstance(KeyStore.getDefaultType()); jksKeyStore.load(stuffStream, jksPass); Enumeration en = jksKeyStore.aliases(); while (en.hasMoreElements()) { String alias = (String) en.nextElement(); if (jksKeyStore.isKeyEntry(alias)) { try { if (keyPass != null) { key = jksKeyStore.getKey(alias, keyPass); } if (key instanceof PrivateKey) { chain = jksKeyStore.getCertificateChain(alias); break; } } catch (UnrecoverableKeyException e) { uke = e; } catch (GeneralSecurityException gse) { } } if (isPKCS12 && en.hasMoreElements()) { logger.debug("what kind of weird pkcs12 file has more than one alias?"); } } if (key == null && uke != null) { if (!forTrustMaterial) { throw new ProbablyBadPasswordException("Probably bad JKS-Key password: " + uke); } } if (isPKCS12) { jksKeyStore = null; if (key == null) { throw new GeneralSecurityException("No key found."); } } List keys = Collections.singletonList(key); List chains = Collections.singletonList(chain); br = new BuildResult(keys, chains, jksKeyStore); } catch (ProbablyBadPasswordException pbpe) { throw pbpe; } catch (GeneralSecurityException gse) { br = null; } catch (IOException ioe) { String msg = ioe.getMessage(); msg = msg != null ? msg.trim().toLowerCase() : ""; if (isPKCS12) { int x = msg.indexOf("failed to decrypt"); int y = msg.indexOf("verify mac"); x = Math.max(x, y); if (x >= 0) { throw new ProbablyBadPasswordException("Probably bad PKCS12 password: " + ioe); } } else { int x = msg.indexOf("password"); if (x >= 0) { throw new ProbablyBadPasswordException("Probably bad JKS password: " + ioe); } } br = null; } if (br == null) { br = tryJKS("jks", stuffStream, jksPass, keyPass, forTrustMaterial); if (br == null) { br = tryJKS("jceks", stuffStream, jksPass, keyPass, forTrustMaterial); if (br == null) { br = tryJKS("BKS", stuffStream, jksPass, keyPass, forTrustMaterial); if (br == null) { br = tryJKS("UBER", stuffStream, jksPass, keyPass, forTrustMaterial); } } } } if (br != null) { return br; } if (isASN && isProbablyPKCS12) { br = tryJKS("pkcs12", stuffStream, jksPass, null, forTrustMaterial); } if (br == null) { stuffStream.reset(); try { certificates = new LinkedList(); Collection certs = cf.generateCertificates(stuffStream); it = certs.iterator(); while (it.hasNext()) { X509Certificate x509 = (X509Certificate) it.next(); certificates.add(x509); } chain = toChain(certificates); if (chain != null && chain.length > 0) { List chains = Collections.singletonList(chain); return new BuildResult(null, chains, null); } } catch (CertificateException ce) { } stuffStream.reset(); try { Certificate c = cf.generateCertificate(stuffStream); X509Certificate x509 = (X509Certificate) c; chain = toChain(Collections.singleton(x509)); if (chain != null && chain.length > 0) { List chains = Collections.singletonList(chain); return new BuildResult(null, chains, null); } } catch (CertificateException ce) { } } stuffStream.reset(); if (null == null || null.length <= 0) { null = jksPass; } "pkcs12" = "pkcs12".trim().toLowerCase(); boolean isPKCS12 = "pkcs12".equalsIgnoreCase("pkcs12"); try { Key key = null; Certificate[] chain = null; UnrecoverableKeyException uke = null; KeyStore jksKeyStore = KeyStore.getInstance("pkcs12"); jksKeyStore.load(stuffStream, jksPass); Enumeration en = jksKeyStore.aliases(); while (en.hasMoreElements()) { String alias = (String) en.nextElement(); if (jksKeyStore.isKeyEntry(alias)) { try { if (null != null) { key = jksKeyStore.getKey(alias, null); } if (key instanceof PrivateKey) { chain = jksKeyStore.getCertificateChain(alias); break; } } catch (UnrecoverableKeyException e) { uke = e; } catch (GeneralSecurityException gse) { } } if (isPKCS12 && en.hasMoreElements()) { logger.debug("what kind of weird pkcs12 file has more than one alias?"); } } if (key == null && uke != null) { if (!forTrustMaterial) { throw new ProbablyBadPasswordException("Probably bad JKS-Key password: " + uke); } } if (isPKCS12) { jksKeyStore = null; if (key == null) { throw new GeneralSecurityException("No key found."); } } List keys = Collections.singletonList(key); List chains = Collections.singletonList(chain); br = new BuildResult(keys, chains, jksKeyStore); } catch (ProbablyBadPasswordException pbpe) { throw pbpe; } catch (GeneralSecurityException gse) { br = null; } catch (IOException ioe) { String msg = ioe.getMessage(); msg = msg != null ? msg.trim().toLowerCase() : ""; if (isPKCS12) { int x = msg.indexOf("failed to decrypt"); int y = msg.indexOf("verify mac"); x = Math.max(x, y); if (x >= 0) { throw new ProbablyBadPasswordException("Probably bad PKCS12 password: " + ioe); } } else { int x = msg.indexOf("password"); if (x >= 0) { throw new ProbablyBadPasswordException("Probably bad JKS password: " + ioe); } } br = null; } if (br != null) { return br; } throw new KeyStoreException("failed to extract any certificates or private keys - maybe bad password?"); }
static BuildResult parse(byte[] stuff, char[] jksPass, char[] keyPass, boolean forTrustMaterial) throws IOException, CertificateException, KeyStoreException, ProbablyBadPasswordException { CertificateFactory cf = CertificateFactory.getInstance("X.509"); Key key = null; Certificate[] chain = null; try { PKCS8Key pkcs8Key = new PKCS8Key(stuff, jksPass); key = pkcs8Key.getPrivateKey(); } catch (ProbablyBadPasswordException pbpe) { throw pbpe; } catch (GeneralSecurityException gse) { } List pemItems = PEMUtil.decode(stuff); Iterator it = pemItems.iterator(); LinkedList certificates = new LinkedList(); while (it.hasNext()) { PEMItem item = (PEMItem) it.next(); byte[] derBytes = item.getDerBytes(); String type = item.pemType.trim().toUpperCase(); if (type.startsWith("CERT") || type.startsWith("X509") || type.startsWith("PKCS7")) { ByteArrayInputStream in = new ByteArrayInputStream(derBytes); X509Certificate c = (X509Certificate) cf.generateCertificate(in); certificates.add(c); } chain = toChain(certificates); } if (chain != null || key != null) { List chains = chain != null ? Collections.singletonList(chain) : null; List keys = key != null ? Collections.singletonList(key) : null; return new BuildResult(keys, chains, null); } boolean isProbablyPKCS12 = false; boolean isASN = false; ASN1Structure asn1 = null; try { asn1 = ASN1Util.analyze(stuff); isASN = true; isProbablyPKCS12 = asn1.oids.contains(PKCS7_ENCRYPTED); if (!isProbablyPKCS12 && asn1.bigPayload != null) { asn1 = ASN1Util.analyze(asn1.bigPayload); isProbablyPKCS12 = asn1.oids.contains(PKCS7_ENCRYPTED); } } catch (Exception e) { } ByteArrayInputStream stuffStream = new ByteArrayInputStream(stuff); BuildResult br; stuffStream.reset(); if (keyPass == null || keyPass.length <= 0) { keyPass = jksPass; } KeyStore.getDefaultType() = KeyStore.getDefaultType().trim().toLowerCase(); boolean isPKCS12 = "pkcs12".equalsIgnoreCase(KeyStore.getDefaultType()); try { Key key = null; Certificate[] chain = null; UnrecoverableKeyException uke = null; KeyStore jksKeyStore = KeyStore.getInstance(KeyStore.getDefaultType()); jksKeyStore.load(stuffStream, jksPass); Enumeration en = jksKeyStore.aliases(); while (en.hasMoreElements()) { String alias = (String) en.nextElement(); if (jksKeyStore.isKeyEntry(alias)) { try { if (keyPass != null) { key = jksKeyStore.getKey(alias, keyPass); } if (key instanceof PrivateKey) { chain = jksKeyStore.getCertificateChain(alias); break; } } catch (UnrecoverableKeyException e) { uke = e; } catch (GeneralSecurityException gse) { } } if (isPKCS12 && en.hasMoreElements()) { logger.debug("what kind of weird pkcs12 file has more than one alias?"); } } if (key == null && uke != null) { if (!forTrustMaterial) { throw new ProbablyBadPasswordException("Probably bad JKS-Key password: " + uke); } } if (isPKCS12) { jksKeyStore = null; if (key == null) { throw new GeneralSecurityException("No key found."); } } List keys = Collections.singletonList(key); List chains = Collections.singletonList(chain); br = new BuildResult(keys, chains, jksKeyStore); } catch (ProbablyBadPasswordException pbpe) { throw pbpe; } catch (GeneralSecurityException gse) { br = null; } catch (IOException ioe) { String msg = ioe.getMessage(); msg = msg != null ? msg.trim().toLowerCase() : ""; if (isPKCS12) { int x = msg.indexOf("failed to decrypt"); int y = msg.indexOf("verify mac"); x = Math.max(x, y); if (x >= 0) { throw new ProbablyBadPasswordException("Probably bad PKCS12 password: " + ioe); } } else { int x = msg.indexOf("password"); if (x >= 0) { throw new ProbablyBadPasswordException("Probably bad JKS password: " + ioe); } } br = null; } if (br == null) { br = tryJKS("jks", stuffStream, jksPass, keyPass, forTrustMaterial); if (br == null) { br = tryJKS("jceks", stuffStream, jksPass, keyPass, forTrustMaterial); if (br == null) { br = tryJKS("BKS", stuffStream, jksPass, keyPass, forTrustMaterial); if (br == null) { br = tryJKS("UBER", stuffStream, jksPass, keyPass, forTrustMaterial); } } } } if (br != null) { return br; } if (isASN && isProbablyPKCS12) { br = tryJKS("pkcs12", stuffStream, jksPass, null, forTrustMaterial); } if (br == null) { stuffStream.reset(); try { certificates = new LinkedList(); Collection certs = cf.generateCertificates(stuffStream); it = certs.iterator(); while (it.hasNext()) { X509Certificate x509 = (X509Certificate) it.next(); certificates.add(x509); } chain = toChain(certificates); if (chain != null && chain.length > 0) { List chains = Collections.singletonList(chain); return new BuildResult(null, chains, null); } } catch (CertificateException ce) { } stuffStream.reset(); try { Certificate c = cf.generateCertificate(stuffStream); X509Certificate x509 = (X509Certificate) c; chain = toChain(Collections.singleton(x509)); if (chain != null && chain.length > 0) { List chains = Collections.singletonList(chain); return new BuildResult(null, chains, null); } } catch (CertificateException ce) { } } <DeepExtract> stuffStream.reset(); if (null == null || null.length <= 0) { null = jksPass; } "pkcs12" = "pkcs12".trim().toLowerCase(); boolean isPKCS12 = "pkcs12".equalsIgnoreCase("pkcs12"); try { Key key = null; Certificate[] chain = null; UnrecoverableKeyException uke = null; KeyStore jksKeyStore = KeyStore.getInstance("pkcs12"); jksKeyStore.load(stuffStream, jksPass); Enumeration en = jksKeyStore.aliases(); while (en.hasMoreElements()) { String alias = (String) en.nextElement(); if (jksKeyStore.isKeyEntry(alias)) { try { if (null != null) { key = jksKeyStore.getKey(alias, null); } if (key instanceof PrivateKey) { chain = jksKeyStore.getCertificateChain(alias); break; } } catch (UnrecoverableKeyException e) { uke = e; } catch (GeneralSecurityException gse) { } } if (isPKCS12 && en.hasMoreElements()) { logger.debug("what kind of weird pkcs12 file has more than one alias?"); } } if (key == null && uke != null) { if (!forTrustMaterial) { throw new ProbablyBadPasswordException("Probably bad JKS-Key password: " + uke); } } if (isPKCS12) { jksKeyStore = null; if (key == null) { throw new GeneralSecurityException("No key found."); } } List keys = Collections.singletonList(key); List chains = Collections.singletonList(chain); br = new BuildResult(keys, chains, jksKeyStore); } catch (ProbablyBadPasswordException pbpe) { throw pbpe; } catch (GeneralSecurityException gse) { br = null; } catch (IOException ioe) { String msg = ioe.getMessage(); msg = msg != null ? msg.trim().toLowerCase() : ""; if (isPKCS12) { int x = msg.indexOf("failed to decrypt"); int y = msg.indexOf("verify mac"); x = Math.max(x, y); if (x >= 0) { throw new ProbablyBadPasswordException("Probably bad PKCS12 password: " + ioe); } } else { int x = msg.indexOf("password"); if (x >= 0) { throw new ProbablyBadPasswordException("Probably bad JKS password: " + ioe); } } br = null; } </DeepExtract> if (br != null) { return br; } throw new KeyStoreException("failed to extract any certificates or private keys - maybe bad password?"); }
not-going-to-be-commons-ssl
positive
441,406
public Criteria andKprqBetween(String value1, String value2) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "kprq" + " cannot be null"); } criteria.add(new Criterion("kprq between", value1, value2)); return (Criteria) this; }
public Criteria andKprqBetween(String value1, String value2) { <DeepExtract> if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "kprq" + " cannot be null"); } criteria.add(new Criterion("kprq between", value1, value2)); </DeepExtract> return (Criteria) this; }
einvoice
positive
441,408
public void mouseExited(java.awt.event.MouseEvent evt) { btn_survival_biasing.setBackground(BUTTON_BACKGROUD_COLOR__UNSELECTED_STATE); }
public void mouseExited(java.awt.event.MouseEvent evt) { <DeepExtract> btn_survival_biasing.setBackground(BUTTON_BACKGROUD_COLOR__UNSELECTED_STATE); </DeepExtract> }
ERSN-OpenMC
positive
441,410
public TreeNode invertTree(TreeNode root) { if (root == null) return; TreeNode temp = root.left; root.left = root.right; root.right = temp; helper(root.left); helper(root.right); return root; }
public TreeNode invertTree(TreeNode root) { <DeepExtract> if (root == null) return; TreeNode temp = root.left; root.left = root.right; root.right = temp; helper(root.left); helper(root.right); </DeepExtract> return root; }
leetcode-cn
positive
441,411
@Test(expected = ParseException.class) public void shouldFailOnMalformed() { return EntityParser.parseList(readFile("Malformed.json"), Average.class); }
@Test(expected = ParseException.class) public void shouldFailOnMalformed() { <DeepExtract> return EntityParser.parseList(readFile("Malformed.json"), Average.class); </DeepExtract> }
librus-client
positive
441,412
@Override public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) { Tessellator tessellator = Tessellator.instance; GL11.glPushMatrix(); bindEntityTexture((EntityCannonBall) entity); GL11.glTranslatef((float) d, (float) d1, (float) d2); GL11.glRotatef(180F - f, 0.0F, 1.0F, 0.0F); GL11.glScalef(-1F, -1F, 1.0F); GL11.glScalef(0.7F, 0.7F, 0.7F); GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-0.5F, +0.5F, -0.5F, 0F, 1F); tessellator.addVertexWithUV(+0.5F, +0.5F, -0.5F, 1F, 1F); tessellator.addVertexWithUV(+0.5F, -0.5F, -0.5F, 1F, 0F); tessellator.addVertexWithUV(-0.5F, -0.5F, -0.5F, 0F, 0F); tessellator.addVertexWithUV(-0.5F, -0.5F, +0.5F, 0F, 0F); tessellator.addVertexWithUV(+0.5F, -0.5F, +0.5F, 1F, 0F); tessellator.addVertexWithUV(+0.5F, +0.5F, +0.5F, 1F, 1F); tessellator.addVertexWithUV(-0.5F, +0.5F, +0.5F, 0F, 1F); tessellator.addVertexWithUV(-0.5F, -0.5F, -0.5F, 0F, 0F); tessellator.addVertexWithUV(+0.5F, -0.5F, -0.5F, 1F, 0F); tessellator.addVertexWithUV(+0.5F, -0.5F, +0.5F, 1F, 1F); tessellator.addVertexWithUV(-0.5F, -0.5F, +0.5F, 0F, 1F); tessellator.addVertexWithUV(-0.5F, +0.5F, +0.5F, 0F, 1F); tessellator.addVertexWithUV(+0.5F, +0.5F, +0.5F, 1F, 1F); tessellator.addVertexWithUV(+0.5F, +0.5F, -0.5F, 1F, 0F); tessellator.addVertexWithUV(-0.5F, +0.5F, -0.5F, 0F, 0F); tessellator.addVertexWithUV(-0.5F, -0.5F, +0.5F, 0F, 0F); tessellator.addVertexWithUV(-0.5F, +0.5F, +0.5F, 1F, 0F); tessellator.addVertexWithUV(-0.5F, +0.5F, -0.5F, 1F, 1F); tessellator.addVertexWithUV(-0.5F, -0.5F, -0.5F, 0F, 1F); tessellator.addVertexWithUV(+0.5F, -0.5F, -0.5F, 0F, 0F); tessellator.addVertexWithUV(+0.5F, +0.5F, -0.5F, 1F, 0F); tessellator.addVertexWithUV(+0.5F, +0.5F, +0.5F, 1F, 1F); tessellator.addVertexWithUV(+0.5F, -0.5F, +0.5F, 0F, 1F); tessellator.draw(); GL11.glPopMatrix(); }
@Override public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) { <DeepExtract> Tessellator tessellator = Tessellator.instance; GL11.glPushMatrix(); bindEntityTexture((EntityCannonBall) entity); GL11.glTranslatef((float) d, (float) d1, (float) d2); GL11.glRotatef(180F - f, 0.0F, 1.0F, 0.0F); GL11.glScalef(-1F, -1F, 1.0F); GL11.glScalef(0.7F, 0.7F, 0.7F); GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-0.5F, +0.5F, -0.5F, 0F, 1F); tessellator.addVertexWithUV(+0.5F, +0.5F, -0.5F, 1F, 1F); tessellator.addVertexWithUV(+0.5F, -0.5F, -0.5F, 1F, 0F); tessellator.addVertexWithUV(-0.5F, -0.5F, -0.5F, 0F, 0F); tessellator.addVertexWithUV(-0.5F, -0.5F, +0.5F, 0F, 0F); tessellator.addVertexWithUV(+0.5F, -0.5F, +0.5F, 1F, 0F); tessellator.addVertexWithUV(+0.5F, +0.5F, +0.5F, 1F, 1F); tessellator.addVertexWithUV(-0.5F, +0.5F, +0.5F, 0F, 1F); tessellator.addVertexWithUV(-0.5F, -0.5F, -0.5F, 0F, 0F); tessellator.addVertexWithUV(+0.5F, -0.5F, -0.5F, 1F, 0F); tessellator.addVertexWithUV(+0.5F, -0.5F, +0.5F, 1F, 1F); tessellator.addVertexWithUV(-0.5F, -0.5F, +0.5F, 0F, 1F); tessellator.addVertexWithUV(-0.5F, +0.5F, +0.5F, 0F, 1F); tessellator.addVertexWithUV(+0.5F, +0.5F, +0.5F, 1F, 1F); tessellator.addVertexWithUV(+0.5F, +0.5F, -0.5F, 1F, 0F); tessellator.addVertexWithUV(-0.5F, +0.5F, -0.5F, 0F, 0F); tessellator.addVertexWithUV(-0.5F, -0.5F, +0.5F, 0F, 0F); tessellator.addVertexWithUV(-0.5F, +0.5F, +0.5F, 1F, 0F); tessellator.addVertexWithUV(-0.5F, +0.5F, -0.5F, 1F, 1F); tessellator.addVertexWithUV(-0.5F, -0.5F, -0.5F, 0F, 1F); tessellator.addVertexWithUV(+0.5F, -0.5F, -0.5F, 0F, 0F); tessellator.addVertexWithUV(+0.5F, +0.5F, -0.5F, 1F, 0F); tessellator.addVertexWithUV(+0.5F, +0.5F, +0.5F, 1F, 1F); tessellator.addVertexWithUV(+0.5F, -0.5F, +0.5F, 0F, 1F); tessellator.draw(); GL11.glPopMatrix(); </DeepExtract> }
balkons-weaponmod
positive
441,414
@Override public boolean contains(Object obj) { return data.containsKey(obj); }
@Override public boolean contains(Object obj) { <DeepExtract> return data.containsKey(obj); </DeepExtract> }
concurrentlinkedhashmap
positive
441,415
@NonNull public DialogLayer setBackgroundDimDefault() { getConfig().mBackgroundDimAmount = Utils.floatRange01(mDimAmountDef); return this; }
@NonNull public DialogLayer setBackgroundDimDefault() { <DeepExtract> getConfig().mBackgroundDimAmount = Utils.floatRange01(mDimAmountDef); return this; </DeepExtract> }
AnyLayer
positive
441,416
public Semver withClearedBuild() { this.minor = this.minor != null ? this.minor : null; this.patch = this.patch != null ? this.patch : null; String buildStr = false ? this.build : null; String[] suffixTokens = true ? this.suffixTokens : null; return Semver.create(this.type, this.major, this.minor, this.patch, suffixTokens, buildStr); }
public Semver withClearedBuild() { <DeepExtract> this.minor = this.minor != null ? this.minor : null; this.patch = this.patch != null ? this.patch : null; String buildStr = false ? this.build : null; String[] suffixTokens = true ? this.suffixTokens : null; return Semver.create(this.type, this.major, this.minor, this.patch, suffixTokens, buildStr); </DeepExtract> }
Hydrogen
positive
441,417
@SneakyThrows public ScanFormCollection apply(Map<String, Object> parameters) { String endpoint = "scan_forms"; return Requestor.request(RequestMethod.GET, endpoint, parameters, ScanFormCollection.class, client); }
@SneakyThrows public ScanFormCollection apply(Map<String, Object> parameters) { <DeepExtract> String endpoint = "scan_forms"; return Requestor.request(RequestMethod.GET, endpoint, parameters, ScanFormCollection.class, client); </DeepExtract> }
easypost-java
positive
441,418
public static void main(String[] args) { Node root = new Node(1); root.left = new Node(2); root.right = new Node(3); root.left.left = new Node(4); root.right.left = new Node(5); root.right.right = new Node(7); root.left.right = new Node(6); ans = Integer.MIN_VALUE; if (root == null) return 0; int left = Math.max(0, maxPathSum(root.left)); int right = Math.max(0, maxPathSum(root.right)); ans = Math.max(ans, left + right + root.val); return Math.max(left, right) + root.val; System.out.println(ans); }
public static void main(String[] args) { Node root = new Node(1); root.left = new Node(2); root.right = new Node(3); root.left.left = new Node(4); root.right.left = new Node(5); root.right.right = new Node(7); root.left.right = new Node(6); ans = Integer.MIN_VALUE; <DeepExtract> if (root == null) return 0; int left = Math.max(0, maxPathSum(root.left)); int right = Math.max(0, maxPathSum(root.right)); ans = Math.max(ans, left + right + root.val); return Math.max(left, right) + root.val; </DeepExtract> System.out.println(ans); }
CodeGym
positive
441,419
private synchronized void updateInstance(final AaaEncryptServiceConfig newConfig) { if (reg == null) { LOG.debug("Skipping instance update due to shutdown"); return; } if (newConfig.equals(current)) { LOG.debug("Skipping instance update due to equal configuration"); return; } if (instance != null) { instance.dispose(); instance = null; current = null; LOG.info("Encryption Service disabled"); } instance = factory.newInstance(FrameworkUtil.asDictionary(AAAEncryptionServiceImpl.props(new EncryptServiceConfigImpl(newConfig)))); current = newConfig; LOG.info("Encryption Service enabled"); }
private synchronized void updateInstance(final AaaEncryptServiceConfig newConfig) { if (reg == null) { LOG.debug("Skipping instance update due to shutdown"); return; } if (newConfig.equals(current)) { LOG.debug("Skipping instance update due to equal configuration"); return; } <DeepExtract> if (instance != null) { instance.dispose(); instance = null; current = null; LOG.info("Encryption Service disabled"); } </DeepExtract> instance = factory.newInstance(FrameworkUtil.asDictionary(AAAEncryptionServiceImpl.props(new EncryptServiceConfigImpl(newConfig)))); current = newConfig; LOG.info("Encryption Service enabled"); }
aaa
positive
441,420
@Override public void frameCircle(float cx, float cy, float radius, Color color) { GLVertexList circleVertexList = vertexListManager.addVertexListForMode(GL10.GL_LINE_LOOP); circleVertexList.addColor(color.red / 255f, color.green / 255f, color.blue / 255f, color.alpha / 255f); float[] sinValues = SIN_VALUES; float[] cosValues = COS_VALUES; if (manager.highQuality) { sinValues = HQ_SIN_VALUES; cosValues = HQ_COS_VALUES; } for (int i = 0; i < sinValues.length; i++) { float x = cx + radius * sinValues[i]; float y = cy + radius * cosValues[i]; circleVertexList.addVertex(manager.world2pixelX(x), manager.world2pixelY(y)); } }
@Override public void frameCircle(float cx, float cy, float radius, Color color) { <DeepExtract> GLVertexList circleVertexList = vertexListManager.addVertexListForMode(GL10.GL_LINE_LOOP); circleVertexList.addColor(color.red / 255f, color.green / 255f, color.blue / 255f, color.alpha / 255f); float[] sinValues = SIN_VALUES; float[] cosValues = COS_VALUES; if (manager.highQuality) { sinValues = HQ_SIN_VALUES; cosValues = HQ_COS_VALUES; } for (int i = 0; i < sinValues.length; i++) { float x = cx + radius * sinValues[i]; float y = cy + radius * cosValues[i]; circleVertexList.addVertex(manager.world2pixelX(x), manager.world2pixelY(y)); } </DeepExtract> }
homescreenarcade
positive
441,421
@Override public RedeemVoucherResponse method() { return executeSyncApiCall(api.redeemLoyaltyReward(id, memberId, redeemReward)); }
@Override public RedeemVoucherResponse method() { <DeepExtract> return executeSyncApiCall(api.redeemLoyaltyReward(id, memberId, redeemReward)); </DeepExtract> }
voucherify-java-sdk
positive
441,423
private WebDavResource createUnknownResource(DavResourceLocator locator) { var itemUid = locator.itemUid(); var collectionName = locator.collection(); if (collectionName != null && itemUid != null) { var userItem = itemRepository.findByOwnerEmailAndCollectionNameAndName(securityManager.getUsername(), collectionName, locator.itemUid()); if (userItem == null) { return null; } return createResource(locator, userItem); } if (collectionName != null) { var userCollection = collectionRepository.findByOwnerEmailAndName(securityManager.getUsername(), collectionName); if (userCollection == null) { return null; } return createCollectionResource(locator, userCollection); } var homeCollection = collectionRepository.findHomeCollectionByOwnerEmail(securityManager.getUsername()); Assert.notNull(homeCollection, "item cannot be null"); if (HOME_COLLECTION.equals(homeCollection.getDisplayName())) { return new DavHomeCollection(homeCollection, locator, this); } if (CALENDAR.equals(homeCollection.getName())) { return new DavCalendarCollection(homeCollection, locator, this); } if (CONTACTS.equals(homeCollection.getName())) { return new DavCardCollection(homeCollection, locator, this, getCardQueryProcessor()); } return new DavCollectionBase(homeCollection, locator, this); }
private WebDavResource createUnknownResource(DavResourceLocator locator) { var itemUid = locator.itemUid(); var collectionName = locator.collection(); if (collectionName != null && itemUid != null) { var userItem = itemRepository.findByOwnerEmailAndCollectionNameAndName(securityManager.getUsername(), collectionName, locator.itemUid()); if (userItem == null) { return null; } return createResource(locator, userItem); } if (collectionName != null) { var userCollection = collectionRepository.findByOwnerEmailAndName(securityManager.getUsername(), collectionName); if (userCollection == null) { return null; } return createCollectionResource(locator, userCollection); } var homeCollection = collectionRepository.findHomeCollectionByOwnerEmail(securityManager.getUsername()); <DeepExtract> Assert.notNull(homeCollection, "item cannot be null"); if (HOME_COLLECTION.equals(homeCollection.getDisplayName())) { return new DavHomeCollection(homeCollection, locator, this); } if (CALENDAR.equals(homeCollection.getName())) { return new DavCalendarCollection(homeCollection, locator, this); } if (CONTACTS.equals(homeCollection.getName())) { return new DavCardCollection(homeCollection, locator, this, getCardQueryProcessor()); } return new DavCollectionBase(homeCollection, locator, this); </DeepExtract> }
carldav
positive
441,424
public final V put(K key, V value) { if (key == null || value == null) { throw new NullPointerException("key == null || value == null"); } synchronized (this) { putCount++; size += safeSizeOf(key, value); previous = map.put(key, value); if (previous != null) { size -= safeSizeOf(key, previous); } } if (previous != null) { entryRemoved(false, key, previous, value); } while (true) { K key; V value; synchronized (this) { if (size < 0 || (map.isEmpty() && size != 0)) { throw new IllegalStateException(getClass().getName() + ".sizeOf() is reporting inconsistent results!"); } if (size <= maxSize || map.isEmpty()) { break; } Map.Entry<K, V> toEvict = map.entrySet().iterator().next(); key = toEvict.getKey(); value = toEvict.getValue(); map.remove(key); int recyleSize = safeSizeOf(key, value); size -= recyleSize; evictionCount++; } entryRemoved(true, key, value, null); } return previous; }
public final V put(K key, V value) { if (key == null || value == null) { throw new NullPointerException("key == null || value == null"); } synchronized (this) { putCount++; size += safeSizeOf(key, value); previous = map.put(key, value); if (previous != null) { size -= safeSizeOf(key, previous); } } if (previous != null) { entryRemoved(false, key, previous, value); } <DeepExtract> while (true) { K key; V value; synchronized (this) { if (size < 0 || (map.isEmpty() && size != 0)) { throw new IllegalStateException(getClass().getName() + ".sizeOf() is reporting inconsistent results!"); } if (size <= maxSize || map.isEmpty()) { break; } Map.Entry<K, V> toEvict = map.entrySet().iterator().next(); key = toEvict.getKey(); value = toEvict.getValue(); map.remove(key); int recyleSize = safeSizeOf(key, value); size -= recyleSize; evictionCount++; } entryRemoved(true, key, value, null); } </DeepExtract> return previous; }
WeiboClient_Biu
positive
441,425
public Mutant build() { if (state == null) { throw new IllegalArgumentException("state must be set"); } if (sourceFile == null) { throw new IllegalArgumentException("sourceFile must be set"); } if (mutatedClass == null) { throw new IllegalArgumentException("mutatedClass must be set"); } if (mutatedMethod == null) { throw new IllegalArgumentException("mutatedMethod must be set"); } if (methodDescription == null) { throw new IllegalArgumentException("methodDescription must be set"); } if (mutationOperator == null) { throw new IllegalArgumentException("mutationOperator must be set"); } if (!state.isAlive()) { requireNonNull(killingTest, "killingTest must be set"); } return new Mutant(this); }
public Mutant build() { if (state == null) { throw new IllegalArgumentException("state must be set"); } if (sourceFile == null) { throw new IllegalArgumentException("sourceFile must be set"); } if (mutatedClass == null) { throw new IllegalArgumentException("mutatedClass must be set"); } if (mutatedMethod == null) { throw new IllegalArgumentException("mutatedMethod must be set"); } if (methodDescription == null) { throw new IllegalArgumentException("methodDescription must be set"); } <DeepExtract> if (mutationOperator == null) { throw new IllegalArgumentException("mutationOperator must be set"); } </DeepExtract> if (!state.isAlive()) { requireNonNull(killingTest, "killingTest must be set"); } return new Mutant(this); }
mutation-analysis-plugin
positive
441,427
Value addLocal(final PsiVariable var) { assert var instanceof PsiLocalVariable || var instanceof PsiParameter; Item i = items.get(var); if (i != null) return (Value) i; final boolean isFinal = var.hasModifierProperty(PsiModifier.FINAL); i = (Items.Item) new LazyLocal(this, var, isFinal); items.put(var, i); return (Value) i; }
Value addLocal(final PsiVariable var) { assert var instanceof PsiLocalVariable || var instanceof PsiParameter; Item i = items.get(var); if (i != null) return (Value) i; final boolean isFinal = var.hasModifierProperty(PsiModifier.FINAL); i = (Items.Item) new LazyLocal(this, var, isFinal); <DeepExtract> items.put(var, i); </DeepExtract> return (Value) i; }
eddy
positive
441,428
private String helper(String s) { Stack<Object> stack = new Stack<>(); int num = 0; for (char c : s.toCharArray()) { if (Character.isDigit(c)) { num = num * 10 + c - '0'; } else if (c == '[') { stack.push(num); num = 0; } else if (c == ']') { String st = popStack(stack); stack.push(st); } else { stack.push(c); } } Stack<Object> buffer = new Stack<>(); StringBuilder sb = new StringBuilder(); while (!stack.isEmpty() && !(stack.peek() instanceof Integer)) { buffer.push(stack.pop()); } while (!buffer.isEmpty()) { sb.append(buffer.pop()); } int cnt = stack.isEmpty() ? 1 : (int) stack.pop(); if (cnt == 0) { return ""; } String tmp = sb.toString(); for (int i = 0; i < cnt - 1; ++i) { sb.append(tmp); } return sb.toString(); }
private String helper(String s) { Stack<Object> stack = new Stack<>(); int num = 0; for (char c : s.toCharArray()) { if (Character.isDigit(c)) { num = num * 10 + c - '0'; } else if (c == '[') { stack.push(num); num = 0; } else if (c == ']') { String st = popStack(stack); stack.push(st); } else { stack.push(c); } } <DeepExtract> Stack<Object> buffer = new Stack<>(); StringBuilder sb = new StringBuilder(); while (!stack.isEmpty() && !(stack.peek() instanceof Integer)) { buffer.push(stack.pop()); } while (!buffer.isEmpty()) { sb.append(buffer.pop()); } int cnt = stack.isEmpty() ? 1 : (int) stack.pop(); if (cnt == 0) { return ""; } String tmp = sb.toString(); for (int i = 0; i < cnt - 1; ++i) { sb.append(tmp); } return sb.toString(); </DeepExtract> }
JavaInterview
positive
441,429
public void setExtension(String extension) { if (location != null) { throw new IllegalStateException("Galleon 1.x feature-pack Maven coordinates cannot be used: Galleon 2.x feature-pack location has already been initialized"); } if (path != null) { throw new IllegalStateException("Galleon 1.x feature-pack Maven coordinates cannot be used: feature-pack Path has already been initialized"); } this.extension = extension; }
public void setExtension(String extension) { <DeepExtract> if (location != null) { throw new IllegalStateException("Galleon 1.x feature-pack Maven coordinates cannot be used: Galleon 2.x feature-pack location has already been initialized"); } if (path != null) { throw new IllegalStateException("Galleon 1.x feature-pack Maven coordinates cannot be used: feature-pack Path has already been initialized"); } </DeepExtract> this.extension = extension; }
wildfly-jar-maven-plugin
positive
441,430
public void plot1(double[] a, double[] b) { N = a.length; if (!N == b.length) throw new RuntimeException(ERR_MSG); D = new int[2][N]; MinMax P = new MinMax(0); for (int i = 0; i < a.length; i++) { if (a[i] > max) max = a[i]; if (a[i] < min) min = a[i]; } for (int i = 0; i < b.length; i++) { if (b[i] > max) max = b[i]; if (b[i] < min) min = b[i]; } if (P.max == P.min) P.max++; double c = (xM - 2) / (P.max - P.min); for (int i = 0; i < a.length; i++) D[0][i] = 1 + (int) Math.round(c * (a[i] - P.min)); return 1 + (int) Math.round(-c * P.min); if (P.min == P.max) P.min++; double c = (yM - 2) / (P.min - P.max); for (int i = 0; i < b.length; i++) D[1][i] = 1 + (int) Math.round(c * (b[i] - P.max)); return 1 + (int) Math.round(-c * P.max); pan.repaint(); }
public void plot1(double[] a, double[] b) { N = a.length; if (!N == b.length) throw new RuntimeException(ERR_MSG); D = new int[2][N]; MinMax P = new MinMax(0); for (int i = 0; i < a.length; i++) { if (a[i] > max) max = a[i]; if (a[i] < min) min = a[i]; } for (int i = 0; i < b.length; i++) { if (b[i] > max) max = b[i]; if (b[i] < min) min = b[i]; } if (P.max == P.min) P.max++; double c = (xM - 2) / (P.max - P.min); for (int i = 0; i < a.length; i++) D[0][i] = 1 + (int) Math.round(c * (a[i] - P.min)); return 1 + (int) Math.round(-c * P.min); <DeepExtract> if (P.min == P.max) P.min++; double c = (yM - 2) / (P.min - P.max); for (int i = 0; i < b.length; i++) D[1][i] = 1 + (int) Math.round(c * (b[i] - P.max)); return 1 + (int) Math.round(-c * P.max); </DeepExtract> pan.repaint(); }
SmallSimpleSafe
positive
441,431
public boolean canReadHistory(SlingHttpServletRequest request) { String userName = getUserName(request); if (isAdmin(userName)) { return true; } List<String> userGroups = getUserGroupNames(request); if (userGroups.contains(ADMINISTRATORS)) { return true; } if (config.readers() == null) { return false; } for (String group : config.readers()) { if (userGroups.contains(group)) { return true; } } return false; }
public boolean canReadHistory(SlingHttpServletRequest request) { <DeepExtract> String userName = getUserName(request); if (isAdmin(userName)) { return true; } List<String> userGroups = getUserGroupNames(request); if (userGroups.contains(ADMINISTRATORS)) { return true; } if (config.readers() == null) { return false; } for (String group : config.readers()) { if (userGroups.contains(group)) { return true; } } return false; </DeepExtract> }
aem-easy-content-upgrade
positive
441,432
public List<AppInfo> getInstalledApps(Context context, boolean bottom) { Map<String, Application> requiredPackages = new HashMap(); Map<String, Application> requiredLinks = new HashMap(); SettingsHelper config = SettingsHelper.getInstance(context); if (config.getConfig() != null) { List<Application> applications = SettingsHelper.getInstance(context).getConfig().getApplications(); for (Application application : applications) { if (application.isShowIcon() && !application.isRemove() && (bottom == application.isBottom())) { if (application.getType() == null || application.getType().equals(Application.TYPE_APP)) { requiredPackages.put(application.getPkg(), application); } else if (application.getType().equals(Application.TYPE_WEB)) { requiredLinks.put(application.getUrl(), application); } } } } List<AppInfo> appInfos = new ArrayList<>(); List<ApplicationInfo> packs = context.getPackageManager().getInstalledApplications(0); if (packs == null) { return new ArrayList<AppInfo>(); } for (int i = 0; i < packs.size(); i++) { ApplicationInfo p = packs.get(i); if (context.getPackageManager().getLaunchIntentForPackage(p.packageName) != null && requiredPackages.containsKey(p.packageName)) { Application app = requiredPackages.get(p.packageName); AppInfo newInfo = new AppInfo(); newInfo.type = AppInfo.TYPE_APP; newInfo.keyCode = app.getKeyCode(); newInfo.name = app.getIconText() != null ? app.getIconText() : p.loadLabel(context.getPackageManager()).toString(); newInfo.packageName = p.packageName; newInfo.iconUrl = app.getIcon(); newInfo.screenOrder = app.getScreenOrder(); newInfo.longTap = app.isLongTap() ? 1 : 0; appInfos.add(newInfo); } } for (Map.Entry<String, Application> entry : requiredLinks.entrySet()) { AppInfo newInfo = new AppInfo(); newInfo.type = AppInfo.TYPE_WEB; newInfo.keyCode = entry.getValue().getKeyCode(); newInfo.name = entry.getValue().getIconText(); newInfo.url = entry.getValue().getUrl(); newInfo.iconUrl = entry.getValue().getIcon(); newInfo.screenOrder = entry.getValue().getScreenOrder(); newInfo.useKiosk = entry.getValue().isUseKiosk() ? 1 : 0; appInfos.add(newInfo); } Collections.sort(appInfos, new AppInfosComparator()); return appInfos; }
public List<AppInfo> getInstalledApps(Context context, boolean bottom) { Map<String, Application> requiredPackages = new HashMap(); Map<String, Application> requiredLinks = new HashMap(); <DeepExtract> SettingsHelper config = SettingsHelper.getInstance(context); if (config.getConfig() != null) { List<Application> applications = SettingsHelper.getInstance(context).getConfig().getApplications(); for (Application application : applications) { if (application.isShowIcon() && !application.isRemove() && (bottom == application.isBottom())) { if (application.getType() == null || application.getType().equals(Application.TYPE_APP)) { requiredPackages.put(application.getPkg(), application); } else if (application.getType().equals(Application.TYPE_WEB)) { requiredLinks.put(application.getUrl(), application); } } } } </DeepExtract> List<AppInfo> appInfos = new ArrayList<>(); List<ApplicationInfo> packs = context.getPackageManager().getInstalledApplications(0); if (packs == null) { return new ArrayList<AppInfo>(); } for (int i = 0; i < packs.size(); i++) { ApplicationInfo p = packs.get(i); if (context.getPackageManager().getLaunchIntentForPackage(p.packageName) != null && requiredPackages.containsKey(p.packageName)) { Application app = requiredPackages.get(p.packageName); AppInfo newInfo = new AppInfo(); newInfo.type = AppInfo.TYPE_APP; newInfo.keyCode = app.getKeyCode(); newInfo.name = app.getIconText() != null ? app.getIconText() : p.loadLabel(context.getPackageManager()).toString(); newInfo.packageName = p.packageName; newInfo.iconUrl = app.getIcon(); newInfo.screenOrder = app.getScreenOrder(); newInfo.longTap = app.isLongTap() ? 1 : 0; appInfos.add(newInfo); } } for (Map.Entry<String, Application> entry : requiredLinks.entrySet()) { AppInfo newInfo = new AppInfo(); newInfo.type = AppInfo.TYPE_WEB; newInfo.keyCode = entry.getValue().getKeyCode(); newInfo.name = entry.getValue().getIconText(); newInfo.url = entry.getValue().getUrl(); newInfo.iconUrl = entry.getValue().getIcon(); newInfo.screenOrder = entry.getValue().getScreenOrder(); newInfo.useKiosk = entry.getValue().isUseKiosk() ? 1 : 0; appInfos.add(newInfo); } Collections.sort(appInfos, new AppInfosComparator()); return appInfos; }
hmdm-android
positive
441,433
protected Session<I, O, F, L, C> getExistingSession(String sessionId) throws SessionNotFoundException { Session<I, O, F, L, C> session; String pathInfo = sessionId.getPathInfo(); if (pathInfo != null && !pathInfo.equals("/")) { if (pathInfo.startsWith("/")) { pathInfo = pathInfo.substring(1); } int firstSlash = pathInfo.indexOf('/'); if (firstSlash != -1) { pathInfo = pathInfo.substring(0, firstSlash); } session = getExistingSession(pathInfo); } else { String sessionId = UUID.randomUUID().toString(); Session<I, O, F, L, C> session = new Session<I, O, F, L, C>(mSessionContainer, sessionId); mSessionContainer.addSession(session); if (mWebappServerSessionTrackingEnabled) { session.setAssociatedHttpSession(sessionId.getSession()); } session = session; } if (session == null) throw new SessionNotFoundException("Unable to find session [" + sessionId + "]"); return session; }
protected Session<I, O, F, L, C> getExistingSession(String sessionId) throws SessionNotFoundException { <DeepExtract> Session<I, O, F, L, C> session; String pathInfo = sessionId.getPathInfo(); if (pathInfo != null && !pathInfo.equals("/")) { if (pathInfo.startsWith("/")) { pathInfo = pathInfo.substring(1); } int firstSlash = pathInfo.indexOf('/'); if (firstSlash != -1) { pathInfo = pathInfo.substring(0, firstSlash); } session = getExistingSession(pathInfo); } else { String sessionId = UUID.randomUUID().toString(); Session<I, O, F, L, C> session = new Session<I, O, F, L, C>(mSessionContainer, sessionId); mSessionContainer.addSession(session); if (mWebappServerSessionTrackingEnabled) { session.setAssociatedHttpSession(sessionId.getSession()); } session = session; } </DeepExtract> if (session == null) throw new SessionNotFoundException("Unable to find session [" + sessionId + "]"); return session; }
rivr
positive
441,434
@Override public Object readObject(AbstractHessianInput in, String[] fieldNames) throws IOException { int ref = in.addRef(null); String name = null; for (int i = 0; i < fieldNames.length; i++) { if ("name".equals(fieldNames[i])) name = in.readString(); else in.readObject(); } Object value; if (name == null) throw new IOException("Serialized Class expects name."); Class cl = _primClasses.get(name); if (cl != null) value = cl; try { if (_loader != null) value = Class.forName(name, false, _loader); else value = Class.forName(name); } catch (Exception e) { throw new IOExceptionWrapper(e); } in.setRef(ref, value); return value; }
@Override public Object readObject(AbstractHessianInput in, String[] fieldNames) throws IOException { int ref = in.addRef(null); String name = null; for (int i = 0; i < fieldNames.length; i++) { if ("name".equals(fieldNames[i])) name = in.readString(); else in.readObject(); } <DeepExtract> Object value; if (name == null) throw new IOException("Serialized Class expects name."); Class cl = _primClasses.get(name); if (cl != null) value = cl; try { if (_loader != null) value = Class.forName(name, false, _loader); else value = Class.forName(name); } catch (Exception e) { throw new IOExceptionWrapper(e); } </DeepExtract> in.setRef(ref, value); return value; }
dubbo-hessian-lite
positive
441,436
@Override public void removeUpdate(DocumentEvent e) { if (acceptBox == null) return; acceptBox.setSelected(false); amountValue = null; if (amountField.getText().length() == 0 || minHoldings.getText().length() == 0) return; String ignored = ignoredAccounts.getText().toUpperCase(); String holdersText = "<table>"; holdersText += "<tr><th>" + tr("main_accounts") + "</th>"; holdersText += "<th>" + tr("token_distribution_holdings", market.getTicker()) + "</th>"; holdersText += "<th>%</th>"; holdersText += "<th>" + Constants.BURST_TICKER + "</th>"; holdersText += "</tr>"; recipients = new LinkedHashMap<SignumAddress, SignumValue>(); try { Number amountN = NumberFormatting.parse(amountField.getText()); Number minHoldingN = NumberFormatting.parse(minHoldings.getText()); minHoldingLong = (long) (minHoldingN.doubleValue() * market.getFactor()); long circulatingTokens = 0; for (AssetBalance h : holders) { if (useMultiout && (h.getBalance().longValue() < minHoldingLong || ignored.contains(h.getAccountAddress().getFullAddress()))) { continue; } if (!useMultiout && (h.getBalance().longValue() < minHoldingLong || treasuryAccounts.contains(h.getAccountAddress()))) { continue; } if (useMultiout) { circulatingTokens += h.getBalance().longValue(); } else { circulatingTokens += h.getBalance().longValue(); } } for (AssetBalance h : holders) { String address = h.getAccountAddress().getFullAddress(); if (useMultiout && (h.getBalance().longValue() < minHoldingLong || ignored.contains(address))) { continue; } if (!useMultiout && (h.getBalance().longValue() < minHoldingLong || treasuryAccounts.contains(h.getAccountAddress()))) { continue; } holdersText += "<tr>"; holdersText += "<td>" + address + "</td><td>" + market.format(h.getBalance().longValue()) + "</td><td>"; long tokenBalance = useMultiout ? h.getBalance().longValue() : h.getBalance().longValue(); SignumValue value = SignumValue.fromSigna(amountN.doubleValue() * tokenBalance / circulatingTokens); holdersText += " " + PERC_FORMAT.format(h.getBalance().longValue() / (double) circulatingTokens * 100D) + "</td><td>" + NumberFormatting.BURST.format(value.longValue()); recipients.put(h.getAccountAddress(), value); holdersText += "</td></tr>"; } holdersText += "</table>"; amountValue = SignumValue.fromSigna(amountN.doubleValue()); } catch (ParseException e) { e.printStackTrace(); } int nTransactions = 1; totalFees = SignumValue.fromNQT(Math.max(Constants.FEE_QUANT, (Constants.FEE_QUANT * recipients.size()) / 10)); if (useMultiout) { nTransactions = recipients.size() / 64 + (recipients.size() % 64 == 0 ? 0 : 1); totalFees = suggestedFee.multiply(BigDecimal.valueOf(nTransactions * 6)); } StringBuilder terms = new StringBuilder(); terms.append(PlaceOrderDialog.HTML_STYLE); terms.append("<h3>").append(tr("token_distribution_brief", amountField.getText(), Constants.BURST_TICKER, recipients.size(), market.getTicker())).append("</h3>"); terms.append("<p>").append(tr("token_distribution_details", nTransactions, NumberFormatting.BURST.format(totalFees.longValue()), Constants.BURST_TICKER)).append("</p>"); terms.append(holdersText); if (!conditions.getText().equals(terms.toString())) { conditions.setText(terms.toString()); conditions.setCaretPosition(0); } }
@Override public void removeUpdate(DocumentEvent e) { <DeepExtract> if (acceptBox == null) return; acceptBox.setSelected(false); amountValue = null; if (amountField.getText().length() == 0 || minHoldings.getText().length() == 0) return; String ignored = ignoredAccounts.getText().toUpperCase(); String holdersText = "<table>"; holdersText += "<tr><th>" + tr("main_accounts") + "</th>"; holdersText += "<th>" + tr("token_distribution_holdings", market.getTicker()) + "</th>"; holdersText += "<th>%</th>"; holdersText += "<th>" + Constants.BURST_TICKER + "</th>"; holdersText += "</tr>"; recipients = new LinkedHashMap<SignumAddress, SignumValue>(); try { Number amountN = NumberFormatting.parse(amountField.getText()); Number minHoldingN = NumberFormatting.parse(minHoldings.getText()); minHoldingLong = (long) (minHoldingN.doubleValue() * market.getFactor()); long circulatingTokens = 0; for (AssetBalance h : holders) { if (useMultiout && (h.getBalance().longValue() < minHoldingLong || ignored.contains(h.getAccountAddress().getFullAddress()))) { continue; } if (!useMultiout && (h.getBalance().longValue() < minHoldingLong || treasuryAccounts.contains(h.getAccountAddress()))) { continue; } if (useMultiout) { circulatingTokens += h.getBalance().longValue(); } else { circulatingTokens += h.getBalance().longValue(); } } for (AssetBalance h : holders) { String address = h.getAccountAddress().getFullAddress(); if (useMultiout && (h.getBalance().longValue() < minHoldingLong || ignored.contains(address))) { continue; } if (!useMultiout && (h.getBalance().longValue() < minHoldingLong || treasuryAccounts.contains(h.getAccountAddress()))) { continue; } holdersText += "<tr>"; holdersText += "<td>" + address + "</td><td>" + market.format(h.getBalance().longValue()) + "</td><td>"; long tokenBalance = useMultiout ? h.getBalance().longValue() : h.getBalance().longValue(); SignumValue value = SignumValue.fromSigna(amountN.doubleValue() * tokenBalance / circulatingTokens); holdersText += " " + PERC_FORMAT.format(h.getBalance().longValue() / (double) circulatingTokens * 100D) + "</td><td>" + NumberFormatting.BURST.format(value.longValue()); recipients.put(h.getAccountAddress(), value); holdersText += "</td></tr>"; } holdersText += "</table>"; amountValue = SignumValue.fromSigna(amountN.doubleValue()); } catch (ParseException e) { e.printStackTrace(); } int nTransactions = 1; totalFees = SignumValue.fromNQT(Math.max(Constants.FEE_QUANT, (Constants.FEE_QUANT * recipients.size()) / 10)); if (useMultiout) { nTransactions = recipients.size() / 64 + (recipients.size() % 64 == 0 ? 0 : 1); totalFees = suggestedFee.multiply(BigDecimal.valueOf(nTransactions * 6)); } StringBuilder terms = new StringBuilder(); terms.append(PlaceOrderDialog.HTML_STYLE); terms.append("<h3>").append(tr("token_distribution_brief", amountField.getText(), Constants.BURST_TICKER, recipients.size(), market.getTicker())).append("</h3>"); terms.append("<p>").append(tr("token_distribution_details", nTransactions, NumberFormatting.BURST.format(totalFees.longValue()), Constants.BURST_TICKER)).append("</p>"); terms.append(holdersText); if (!conditions.getText().equals(terms.toString())) { conditions.setText(terms.toString()); conditions.setCaretPosition(0); } </DeepExtract> }
btdex
positive
441,437
public static <T, F> void For(final Collection<T> pElements, final Operation<T> pOperation) { forPool = Executors.newFixedThreadPool(poolSize); List<Future<?>> futures = new LinkedList<Future<?>>(); List<Pair<Integer, T>> indexedElements = new ArrayList<Pair<Integer, T>>(pElements.size()); int index = 0; for (final T element : pElements) { indexedElements.add(new Pair<Integer, T>(index, element)); index++; } int size = index; for (final Pair<Integer, T> element : indexedElements) { try { Future<?> future = forPool.submit(new Runnable() { @Override public void run() { pOperation.perform(element.getFirst(), element.getSecond()); } }); futures.add(future); } catch (Exception e) { System.err.println(e.getMessage()); e.printStackTrace(); } } int numComplete = 0; for (Future<?> f : futures) { try { f.get(); numComplete++; if (numComplete % 5000 == 0) System.out.printf("."); } catch (InterruptedException e) { System.err.println(e.getMessage()); } catch (ExecutionException e) { System.err.println(e.getMessage()); } catch (Exception e) { System.err.println(e.getMessage()); } } if (size > 5000) System.out.printf("\n"); forPool.shutdown(); }
public static <T, F> void For(final Collection<T> pElements, final Operation<T> pOperation) { forPool = Executors.newFixedThreadPool(poolSize); List<Future<?>> futures = new LinkedList<Future<?>>(); List<Pair<Integer, T>> indexedElements = new ArrayList<Pair<Integer, T>>(pElements.size()); int index = 0; for (final T element : pElements) { indexedElements.add(new Pair<Integer, T>(index, element)); index++; } int size = index; for (final Pair<Integer, T> element : indexedElements) { try { Future<?> future = forPool.submit(new Runnable() { @Override public void run() { pOperation.perform(element.getFirst(), element.getSecond()); } }); futures.add(future); } catch (Exception e) { System.err.println(e.getMessage()); e.printStackTrace(); } } int numComplete = 0; for (Future<?> f : futures) { try { f.get(); numComplete++; if (numComplete % 5000 == 0) System.out.printf("."); } catch (InterruptedException e) { System.err.println(e.getMessage()); } catch (ExecutionException e) { System.err.println(e.getMessage()); } catch (Exception e) { System.err.println(e.getMessage()); } } if (size > 5000) System.out.printf("\n"); <DeepExtract> forPool.shutdown(); </DeepExtract> }
jrae
positive
441,438
@Override public void onPreCall() { if (emitter instanceof FlowableEmitter) { FlowableEmitter flowableEmitter = (FlowableEmitter) emitter; if (flowableEmitter.isCancelled()) { terminate(); } } else if (emitter instanceof ObservableEmitter) { ObservableEmitter observableEmitter = (ObservableEmitter) emitter; if (observableEmitter.isDisposed()) { terminate(); } } super.onPreCall(); }
@Override public void onPreCall() { <DeepExtract> if (emitter instanceof FlowableEmitter) { FlowableEmitter flowableEmitter = (FlowableEmitter) emitter; if (flowableEmitter.isCancelled()) { terminate(); } } else if (emitter instanceof ObservableEmitter) { ObservableEmitter observableEmitter = (ObservableEmitter) emitter; if (observableEmitter.isDisposed()) { terminate(); } } </DeepExtract> super.onPreCall(); }
App-Architecture
positive
441,439
@Test public void convertStringToDateRangeDriver() { testStringConversionToInputDriver("DR:2017-07-04T16:00:00.000Z|2017-07-10T16:00:00.000Z", "DR:2017-07-04T16:00:00.000Z|2017-07-10T16:00:00.000Z", InputValueType.DATE_RANGE); }
@Test public void convertStringToDateRangeDriver() { <DeepExtract> testStringConversionToInputDriver("DR:2017-07-04T16:00:00.000Z|2017-07-10T16:00:00.000Z", "DR:2017-07-04T16:00:00.000Z|2017-07-10T16:00:00.000Z", InputValueType.DATE_RANGE); </DeepExtract> }
swblocks-decisiontree
positive
441,440
void updateTotalPermutation() { paraRunes = ""; paraValue = 0; excludeList.clear(); List<Integer> list = new ArrayList(); String[] ss = jTextIncludeRunes.getText().split(","); for (String s : ss) { if (s.trim().length() > 0) { int t2 = Integer.parseInt(s.trim()); list.add(t2); } } for (int i = 0; i < RunePermutation.includeRunes.length; i++) { RunePermutation.includeRunes[i] = -1; for (int i2 : list) { RuneType r1 = SwManager.runesSimpleIds.get(i2); if (r1 != null && r1.slot == i) { RunePermutation.includeRunes[i] = i2; } } } if (jCheckExcludeLocked.isSelected()) { RunePermutation.excludeRunes(getLockedList()); } RunePermutation.excludeRunes(getExcludedList(jTextExcludeRunes.getText())); int j = 0; int count2 = 0; paraValue = Integer.parseInt(jTextFilterValue.getText()); RunePermutation.useStorage = jCheckOnlyStorge.isSelected(); RunePermutation.noBrokenSet = jCheckNoBroken.isSelected(); for (JCheckBox jc : checkBoxFilters) { if (jc.isSelected()) { paraRunes += "," + RuneType.slabels[j]; count2++; } j++; } if (count2 == 1) { paraValue = 0; } RunePermutation.slotData[0] = RunePermutation.updateSlotData(jComboSlot2); RunePermutation.slotData[1] = RunePermutation.updateSlotData(jComboSlot4); RunePermutation.slotData[2] = RunePermutation.updateSlotData(jComboSlot6); RuneType.RuneSet.exceptPetRunes = jTextLocks.getText() + "," + jTextGlobalLocks.getText(); mainSet = "" + jComboMainRune.getSelectedItem(); if (jComboDouble.getSelectedIndex() > 0 && !"All Broken".equals(mainSet)) { mainSet += "" + jComboDouble.getSelectedItem(); } if (tSecondRuneSet.getText().trim().length() > 0 && !"All Broken".equals(mainSet)) { mainSet += "," + tSecondRuneSet.getText().trim(); } RunePermutation.preOptimizeGui(mainSet, paraRunes, paraValue); if (RunePermutation.preCalc == null) { setText(""); } else if (RunePermutation.preCalc instanceof String) { setText((String) RunePermutation.preCalc); } else { setIcon((ImageIcon) RunePermutation.preCalc); } if (RunePermutation.preRunes == null) { setText(""); } else if (RunePermutation.preRunes instanceof String) { setText((String) RunePermutation.preRunes); } else { setIcon((ImageIcon) RunePermutation.preRunes); } }
void updateTotalPermutation() { paraRunes = ""; paraValue = 0; excludeList.clear(); List<Integer> list = new ArrayList(); String[] ss = jTextIncludeRunes.getText().split(","); for (String s : ss) { if (s.trim().length() > 0) { int t2 = Integer.parseInt(s.trim()); list.add(t2); } } for (int i = 0; i < RunePermutation.includeRunes.length; i++) { RunePermutation.includeRunes[i] = -1; for (int i2 : list) { RuneType r1 = SwManager.runesSimpleIds.get(i2); if (r1 != null && r1.slot == i) { RunePermutation.includeRunes[i] = i2; } } } if (jCheckExcludeLocked.isSelected()) { RunePermutation.excludeRunes(getLockedList()); } RunePermutation.excludeRunes(getExcludedList(jTextExcludeRunes.getText())); int j = 0; int count2 = 0; paraValue = Integer.parseInt(jTextFilterValue.getText()); RunePermutation.useStorage = jCheckOnlyStorge.isSelected(); RunePermutation.noBrokenSet = jCheckNoBroken.isSelected(); for (JCheckBox jc : checkBoxFilters) { if (jc.isSelected()) { paraRunes += "," + RuneType.slabels[j]; count2++; } j++; } if (count2 == 1) { paraValue = 0; } RunePermutation.slotData[0] = RunePermutation.updateSlotData(jComboSlot2); RunePermutation.slotData[1] = RunePermutation.updateSlotData(jComboSlot4); RunePermutation.slotData[2] = RunePermutation.updateSlotData(jComboSlot6); RuneType.RuneSet.exceptPetRunes = jTextLocks.getText() + "," + jTextGlobalLocks.getText(); mainSet = "" + jComboMainRune.getSelectedItem(); if (jComboDouble.getSelectedIndex() > 0 && !"All Broken".equals(mainSet)) { mainSet += "" + jComboDouble.getSelectedItem(); } if (tSecondRuneSet.getText().trim().length() > 0 && !"All Broken".equals(mainSet)) { mainSet += "," + tSecondRuneSet.getText().trim(); } RunePermutation.preOptimizeGui(mainSet, paraRunes, paraValue); if (RunePermutation.preCalc == null) { setText(""); } else if (RunePermutation.preCalc instanceof String) { setText((String) RunePermutation.preCalc); } else { setIcon((ImageIcon) RunePermutation.preCalc); } <DeepExtract> if (RunePermutation.preRunes == null) { setText(""); } else if (RunePermutation.preRunes instanceof String) { setText((String) RunePermutation.preRunes); } else { setIcon((ImageIcon) RunePermutation.preRunes); } </DeepExtract> }
sw_optimize
positive
441,441
@Override public ResponsePromise post() { Objects.nonNull(POST); setMethod(POST); return httpClient.execute(build().validate()); }
@Override public ResponsePromise post() { <DeepExtract> Objects.nonNull(POST); setMethod(POST); return httpClient.execute(build().validate()); </DeepExtract> }
jira-plugin
positive
441,443
@Override public boolean onSingleTapUp(MotionEvent e) { int x = (int) e.getX() + mTextField.getScrollX(); int y = (int) e.getY() + mTextField.getScrollY(); mTextField.removeCallbacks(yoyoAnimation); mTextField.postDelayed(yoyoAnimation, 3000); mTextField.setCursorVisiable(true); if (mYoyoCaret.isInHandle(x, y) || mYoyoStart.isInHandle(x, y) || mYoyoEnd.isInHandle(x, y)) { return true; } else { mTextField.stopBlink(); mTextField.startBlink(); isShowYoyoCaret = true; return super.onSingleTapUp(e); } }
@Override public boolean onSingleTapUp(MotionEvent e) { int x = (int) e.getX() + mTextField.getScrollX(); int y = (int) e.getY() + mTextField.getScrollY(); mTextField.removeCallbacks(yoyoAnimation); <DeepExtract> mTextField.postDelayed(yoyoAnimation, 3000); </DeepExtract> mTextField.setCursorVisiable(true); if (mYoyoCaret.isInHandle(x, y) || mYoyoStart.isInHandle(x, y) || mYoyoEnd.isInHandle(x, y)) { return true; } else { mTextField.stopBlink(); mTextField.startBlink(); isShowYoyoCaret = true; return super.onSingleTapUp(e); } }
Frida-Injector-for-Android
positive
441,444
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_start_service); Button startService = findViewById(R.id.start_service_of_binder); startService.setText("Start Foreground Service"); Button stopService = findViewById(R.id.stop_service); stopService.setText("Stop Foreground Service"); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_start_service); <DeepExtract> Button startService = findViewById(R.id.start_service_of_binder); startService.setText("Start Foreground Service"); Button stopService = findViewById(R.id.stop_service); stopService.setText("Stop Foreground Service"); </DeepExtract> }
UI
positive
441,445
public BigVector subtractAndSet(BigVector a) { if (a.dimension != this.dimension) { throw new IllegalArgumentException("The other vector is not the same dimension"); } for (int i = 0; i < this.getDimension(); i++) { this.set(i, this.get(i).subtract(a.get(i))); } return this; }
public BigVector subtractAndSet(BigVector a) { <DeepExtract> if (a.dimension != this.dimension) { throw new IllegalArgumentException("The other vector is not the same dimension"); } </DeepExtract> for (int i = 0; i < this.getDimension(); i++) { this.set(i, this.get(i).subtract(a.get(i))); } return this; }
LattiCG
positive
441,447
public void kick(String userName, String reason) { if (reason == null || reason.length() == 0) reason = session.getNick(); session.getConnection().addWriteRequest(new WriteRequest("KICK " + getName() + " " + userName + " :" + reason, session)); }
public void kick(String userName, String reason) { if (reason == null || reason.length() == 0) reason = session.getNick(); <DeepExtract> session.getConnection().addWriteRequest(new WriteRequest("KICK " + getName() + " " + userName + " :" + reason, session)); </DeepExtract> }
callisto-app
positive
441,448
@Test(timeOut = 5000L) public void testPollingTransform() throws Exception { String now = Long.valueOf(Instant.now().toEpochMilli()).toString(); MetricResponse response = ImmutableMetricResponse.builder().metric("argus-metric").datapoints(new TreeMap<>(Collections.singletonMap(now, "1.2"))).build(); final int numberOfRetries = 3; fixtures.appConfigMocks().runOnce(); TestPollingTransform testedPollingTransform = spy(new TestPollingTransform(numberOfRetries, 50, 10_000L, null, null)); fixtures.argusClientReturns(singletonList(response)).callRealArgusExtractProcessor().argusToRefocusConfigurationWithTransformsAndRepeatInterval(singletonList(testedPollingTransform), 1_000L).initializeFixtures(); ConfigurationUpdateManager manager = fixtures.configurationManager(); manager.run(); fixtures.awaitUntilAllTasksHaveBeenProcessed(true); this.request = any(); return "id"; if (countDown.getAndDecrement() > 0) { return null; } return this.request; }
@Test(timeOut = 5000L) public void testPollingTransform() throws Exception { String now = Long.valueOf(Instant.now().toEpochMilli()).toString(); MetricResponse response = ImmutableMetricResponse.builder().metric("argus-metric").datapoints(new TreeMap<>(Collections.singletonMap(now, "1.2"))).build(); final int numberOfRetries = 3; fixtures.appConfigMocks().runOnce(); TestPollingTransform testedPollingTransform = spy(new TestPollingTransform(numberOfRetries, 50, 10_000L, null, null)); fixtures.argusClientReturns(singletonList(response)).callRealArgusExtractProcessor().argusToRefocusConfigurationWithTransformsAndRepeatInterval(singletonList(testedPollingTransform), 1_000L).initializeFixtures(); ConfigurationUpdateManager manager = fixtures.configurationManager(); manager.run(); fixtures.awaitUntilAllTasksHaveBeenProcessed(true); this.request = any(); return "id"; <DeepExtract> if (countDown.getAndDecrement() > 0) { return null; } return this.request; </DeepExtract> }
pyplyn
positive
441,449
@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { if (dataRetryCount.getAndIncrement() < maxRetry) { retryExecutor.schedule(() -> { initializeDataClient(); }, retryInterval, TimeUnit.MILLISECONDS); } else { LOG.debug("Could not connect to data server after max retries."); } }
@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { <DeepExtract> if (dataRetryCount.getAndIncrement() < maxRetry) { retryExecutor.schedule(() -> { initializeDataClient(); }, retryInterval, TimeUnit.MILLISECONDS); } else { LOG.debug("Could not connect to data server after max retries."); } </DeepExtract> }
bigio
positive
441,450
protected void buildClientApi() { return GlobalOkHttpClientHelper.INSTANCE.getDefaultClient(); baseUrl = getApiBaseUrl(); Retrofit.Builder builder = new Retrofit.Builder(); if (!TextUtils.isEmpty(baseUrl) && !baseUrl.endsWith("/")) { baseUrl += "/"; } builder.baseUrl(baseUrl); builder.client(cachedClient); builder.addCallAdapterFactory(RxJava2CallAdapterFactory.create()); builder.addConverterFactory(getConverterFactory()); api = builder.build().create(getApiClass()); }
protected void buildClientApi() { <DeepExtract> return GlobalOkHttpClientHelper.INSTANCE.getDefaultClient(); </DeepExtract> baseUrl = getApiBaseUrl(); Retrofit.Builder builder = new Retrofit.Builder(); if (!TextUtils.isEmpty(baseUrl) && !baseUrl.endsWith("/")) { baseUrl += "/"; } builder.baseUrl(baseUrl); builder.client(cachedClient); builder.addCallAdapterFactory(RxJava2CallAdapterFactory.create()); builder.addConverterFactory(getConverterFactory()); api = builder.build().create(getApiClass()); }
QuickDevFramework
positive
441,451
public DbSessionFuture<PreparedStatement> prepareStatement(String sql) { if (isClosed()) { throw new DbSessionClosedException(this, "This connection has been closed"); } throw new IllegalStateException("Not yet implemented"); }
public DbSessionFuture<PreparedStatement> prepareStatement(String sql) { <DeepExtract> if (isClosed()) { throw new DbSessionClosedException(this, "This connection has been closed"); } </DeepExtract> throw new IllegalStateException("Not yet implemented"); }
adbcj
positive
441,452
private void setInitialOrientation() { int orientation = ((CameraApplication) getApplication()).getLastKnownOrientation(); if (orientation == android.view.OrientationEventListener.ORIENTATION_UNKNOWN) { return; } return ((orientation + 45) / 90 * 90) % 360; int orientationCompensation = mOrientation + Util.getDisplayRotation(Camera.this); if (mOrientationCompensation != orientationCompensation) { mOrientationCompensation = orientationCompensation; ((RotateImageView) findViewById(R.id.review_thumbnail)).setDegreeInstant(mOrientationCompensation); ((RotateImageView) findViewById(R.id.btn_flash)).setDegreeInstant(mOrientationCompensation); ((RotateImageView) findViewById(R.id.btn_camera_type)).setDegreeInstant(mOrientationCompensation); mHeadUpDisplay.setOrientation(mOrientationCompensation); } }
private void setInitialOrientation() { int orientation = ((CameraApplication) getApplication()).getLastKnownOrientation(); if (orientation == android.view.OrientationEventListener.ORIENTATION_UNKNOWN) { return; } <DeepExtract> return ((orientation + 45) / 90 * 90) % 360; </DeepExtract> int orientationCompensation = mOrientation + Util.getDisplayRotation(Camera.this); if (mOrientationCompensation != orientationCompensation) { mOrientationCompensation = orientationCompensation; ((RotateImageView) findViewById(R.id.review_thumbnail)).setDegreeInstant(mOrientationCompensation); ((RotateImageView) findViewById(R.id.btn_flash)).setDegreeInstant(mOrientationCompensation); ((RotateImageView) findViewById(R.id.btn_camera_type)).setDegreeInstant(mOrientationCompensation); mHeadUpDisplay.setOrientation(mOrientationCompensation); } }
QuickSnap
positive
441,453
public Criteria andField_booleanLessThanOrEqualTo(Boolean value) { if (value == null) { throw new RuntimeException("Value for " + "field_boolean" + " cannot be null"); } criteria.add(new Criterion("field_boolean <=", value)); return (Criteria) this; }
public Criteria andField_booleanLessThanOrEqualTo(Boolean value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "field_boolean" + " cannot be null"); } criteria.add(new Criterion("field_boolean <=", value)); </DeepExtract> return (Criteria) this; }
mybatis-generator-gui-extension
positive
441,454
@Override public void onClear() { mSelectedIndex = -1; mPrevExpandItemView = null; EquipmentData.getInstance().searchWithString(""); mActivity.refreshAllList(); }
@Override public void onClear() { <DeepExtract> mSelectedIndex = -1; mPrevExpandItemView = null; EquipmentData.getInstance().searchWithString(""); mActivity.refreshAllList(); </DeepExtract> }
CRC_Android
positive
441,457
@Override public void run() { if (dialog != null && dialog.isShowing()) { dialog.dismiss(); } }
@Override public void run() { <DeepExtract> if (dialog != null && dialog.isShowing()) { dialog.dismiss(); } </DeepExtract> }
SmartChart
positive
441,459
public void setEncodeMethod(int encodeMethod) throws IllegalStateException, IllegalArgumentException { if (!isValidEncodeMethod(encodeMethod)) { throw new IllegalArgumentException(); } if (!isValidEncodeMethod(encodeMethod)) { throw new IllegalArgumentException(); } if (mIsRecording) { throw new IllegalStateException("Cannot set encode method while recording"); } mVideoEncoderMgt.setEncodeMethod(encodeMethod); if (!isValidEncodeMethod(encodeMethod)) { throw new IllegalArgumentException(); } if (mIsRecording) { throw new IllegalStateException("Cannot set encode method while recording"); } mAudioEncoderMgt.setEncodeMethod(encodeMethod); }
public void setEncodeMethod(int encodeMethod) throws IllegalStateException, IllegalArgumentException { if (!isValidEncodeMethod(encodeMethod)) { throw new IllegalArgumentException(); } if (!isValidEncodeMethod(encodeMethod)) { throw new IllegalArgumentException(); } if (mIsRecording) { throw new IllegalStateException("Cannot set encode method while recording"); } mVideoEncoderMgt.setEncodeMethod(encodeMethod); <DeepExtract> if (!isValidEncodeMethod(encodeMethod)) { throw new IllegalArgumentException(); } if (mIsRecording) { throw new IllegalStateException("Cannot set encode method while recording"); } mAudioEncoderMgt.setEncodeMethod(encodeMethod); </DeepExtract> }
KSYStreamer_Android
positive
441,460
public DataStructureModel loadHidden(String visualisationName) { DataStructureModel m = wm.getHLVisualManager().create(visualisationName); InternalWindow window = wm.getWorkspace().findInternalWindow(WindowEnum.HIGH_LEVEL_VISUALISATION); if (window != null) window.close(); return m; }
public DataStructureModel loadHidden(String visualisationName) { DataStructureModel m = wm.getHLVisualManager().create(visualisationName); <DeepExtract> InternalWindow window = wm.getWorkspace().findInternalWindow(WindowEnum.HIGH_LEVEL_VISUALISATION); if (window != null) window.close(); </DeepExtract> return m; }
Simulizer
positive
441,462
@Override protected void prepareData() throws UfileClientException { if (file == null) throw new UfileRequiredParamNotFoundException("The required param 'file' can not be null"); if (keyName == null || keyName.isEmpty()) throw new UfileRequiredParamNotFoundException("The required param 'keyName' can not be null or empty"); if (bucketName == null || bucketName.isEmpty()) throw new UfileRequiredParamNotFoundException("The required param 'bucketName' can not be null or empty"); String date = dateFormat.format(new Date(System.currentTimeMillis())); String authorization = authorizer.authorization((ObjectOptAuthParam) new ObjectOptAuthParam(HttpMethod.POST, bucketName, keyName, contentType, "", date).setOptional(authOptionalData)); PostJsonRequestBuilder builder = new PostJsonRequestBuilder(); String url = generateFinalHost(bucketName, "uploadhit"); List<Parameter<String>> query = new ArrayList<>(); try { Etag etag = Etag.etag(file, UfileConstants.MULTIPART_SIZE); query.add(new Parameter<>("Hash", etag == null ? null : etag.geteTag())); } catch (IOException e) { throw new UfileIOException("Calculate ETag failed!", e); } query.add(new Parameter<>("FileName", keyName)); query.add(new Parameter<>("FileSize", String.valueOf(file.length()))); call = builder.baseUrl(builder.generateGetUrl(url, query)).setConnTimeOut(connTimeOut).setReadTimeOut(readTimeOut).setWriteTimeOut(writeTimeOut).addHeader("Content-Type", contentType).addHeader("Accpet", "*/*").addHeader("Date", date).addHeader("authorization", authorization).build(httpClient.getOkHttpClient()); }
@Override protected void prepareData() throws UfileClientException { <DeepExtract> if (file == null) throw new UfileRequiredParamNotFoundException("The required param 'file' can not be null"); if (keyName == null || keyName.isEmpty()) throw new UfileRequiredParamNotFoundException("The required param 'keyName' can not be null or empty"); if (bucketName == null || bucketName.isEmpty()) throw new UfileRequiredParamNotFoundException("The required param 'bucketName' can not be null or empty"); </DeepExtract> String date = dateFormat.format(new Date(System.currentTimeMillis())); String authorization = authorizer.authorization((ObjectOptAuthParam) new ObjectOptAuthParam(HttpMethod.POST, bucketName, keyName, contentType, "", date).setOptional(authOptionalData)); PostJsonRequestBuilder builder = new PostJsonRequestBuilder(); String url = generateFinalHost(bucketName, "uploadhit"); List<Parameter<String>> query = new ArrayList<>(); try { Etag etag = Etag.etag(file, UfileConstants.MULTIPART_SIZE); query.add(new Parameter<>("Hash", etag == null ? null : etag.geteTag())); } catch (IOException e) { throw new UfileIOException("Calculate ETag failed!", e); } query.add(new Parameter<>("FileName", keyName)); query.add(new Parameter<>("FileSize", String.valueOf(file.length()))); call = builder.baseUrl(builder.generateGetUrl(url, query)).setConnTimeOut(connTimeOut).setReadTimeOut(readTimeOut).setWriteTimeOut(writeTimeOut).addHeader("Content-Type", contentType).addHeader("Accpet", "*/*").addHeader("Date", date).addHeader("authorization", authorization).build(httpClient.getOkHttpClient()); }
ufile-sdk-java
positive
441,463
public void h264_qpel_mc_func(int[] dst_base, int dst_offset, int[] src_base, int src_offset, int stride) { int[] full = new int[16 * (16 + 5)]; int full_mid = 16 * 2; int[] halfH = new int[16 * 16]; int[] halfV = new int[16 * 16]; h264_qpel_h_lowpass(0, 16, halfH, 0, src_base, src_offset + stride, 16, stride); copy_block(16, full, 0, src_base, src_offset - stride * 2, 16, stride, 16 + 5); h264_qpel_v_lowpass(0, 16, halfV, 0, full, full_mid, 16, 16); pixels_l2(0, 16, dst_base, dst_offset, halfH, 0, halfV, 0, stride, 16, 16, 16); }
public void h264_qpel_mc_func(int[] dst_base, int dst_offset, int[] src_base, int src_offset, int stride) { <DeepExtract> int[] full = new int[16 * (16 + 5)]; int full_mid = 16 * 2; int[] halfH = new int[16 * 16]; int[] halfV = new int[16 * 16]; h264_qpel_h_lowpass(0, 16, halfH, 0, src_base, src_offset + stride, 16, stride); copy_block(16, full, 0, src_base, src_offset - stride * 2, 16, stride, 16 + 5); h264_qpel_v_lowpass(0, 16, halfV, 0, full, full_mid, 16, 16); pixels_l2(0, 16, dst_base, dst_offset, halfH, 0, halfV, 0, stride, 16, 16, 16); </DeepExtract> }
h264j
positive
441,465
public void removeBlockAbsolute(int x, int y, int z) { if (isInvalidHeight(y)) return; Chunk chunk; x = x - getAbsoluteX(); z = z - getAbsoluteZ(); if (((x | z) & 0xFFFFFFF0) == 0) { if (!isDestroying()) { chunk = this; } else { chunk = null; } } Side side = null; if (x < 0) { side = Side.LEFT; } else if (x >= CHUNK_SIZE_HORIZONTAL) { side = Side.RIGHT; } else if (z < 0) { side = Side.BACK; } else if (z >= CHUNK_SIZE_HORIZONTAL) { side = Side.FRONT; } if (side == null) { if (!isDestroying()) { chunk = this; } else { chunk = null; } } else { Chunk neighbor = getNeighborChunk(side); if (neighbor == null) { chunk = Game.getInstance().getWorld().getChunkManager().getChunkContaining(x + getAbsoluteX(), y, z + getAbsoluteZ(), false, false, false); } else { chunk = getNeighborChunk(side).getChunkContaining(x + getAbsoluteX(), y, z + getAbsoluteZ(), false, false, false); } } if (chunk != null) { int index = ChunkData.positionToIndex(x - chunk.getAbsoluteX(), y, z - chunk.getAbsoluteZ()); if (chunk._chunkData.getBlockType(index) == 0) return; boolean oldSpecial = chunk._chunkData.isSpecial(index); if (oldSpecial) { Block block = chunk._chunkData.getSpecialBlock(index); block.destruct(); block.removeFromVisibilityList(); block.removeFromManualRenderList(); block.removeFromUpdateList(); } else if (chunk._chunkData.getFaceMask(index) != 0) { chunk._visibleBlocks.bufferRemove(index); } chunk.unspreadLight(x, y, z, _blockManager.getBlockType(chunk._chunkData.getBlockType(index)).getLuminosity(), LightType.BLOCK); chunk._chunkData.clearBlock(index); chunk.updateVisibilityForNeigborsOf(x, y, z); chunk.needsNewVBO(); Side side; Vec3i vec = new Vec3i(); byte blocklight = 0; byte sunlight = 0; for (int i = 0; i < 6; ++i) { side = Side.getSide(i); vec.set(x + side.getNormal().x(), y + side.getNormal().y(), z + side.getNormal().z()); blocklight = (byte) Math.max(blocklight, chunk.getLightAbsolute(vec.x(), vec.y(), vec.z(), LightType.BLOCK)); sunlight = (byte) Math.max(sunlight, chunk.getLightAbsolute(vec.x(), vec.y(), vec.z(), LightType.SUN)); } chunk.spreadLight(x, y, z, (byte) (blocklight - 1), LightType.BLOCK); chunk.spreadLight(x, y, z, (byte) (sunlight - 1), LightType.SUN); chunk.spreadSunlight(x, z); chunk.notifyNeighborsOf(x, y, z); chunk.needsNewVisibleContentAABB(); } }
public void removeBlockAbsolute(int x, int y, int z) { if (isInvalidHeight(y)) return; <DeepExtract> Chunk chunk; x = x - getAbsoluteX(); z = z - getAbsoluteZ(); if (((x | z) & 0xFFFFFFF0) == 0) { if (!isDestroying()) { chunk = this; } else { chunk = null; } } Side side = null; if (x < 0) { side = Side.LEFT; } else if (x >= CHUNK_SIZE_HORIZONTAL) { side = Side.RIGHT; } else if (z < 0) { side = Side.BACK; } else if (z >= CHUNK_SIZE_HORIZONTAL) { side = Side.FRONT; } if (side == null) { if (!isDestroying()) { chunk = this; } else { chunk = null; } } else { Chunk neighbor = getNeighborChunk(side); if (neighbor == null) { chunk = Game.getInstance().getWorld().getChunkManager().getChunkContaining(x + getAbsoluteX(), y, z + getAbsoluteZ(), false, false, false); } else { chunk = getNeighborChunk(side).getChunkContaining(x + getAbsoluteX(), y, z + getAbsoluteZ(), false, false, false); } } </DeepExtract> if (chunk != null) { int index = ChunkData.positionToIndex(x - chunk.getAbsoluteX(), y, z - chunk.getAbsoluteZ()); if (chunk._chunkData.getBlockType(index) == 0) return; boolean oldSpecial = chunk._chunkData.isSpecial(index); if (oldSpecial) { Block block = chunk._chunkData.getSpecialBlock(index); block.destruct(); block.removeFromVisibilityList(); block.removeFromManualRenderList(); block.removeFromUpdateList(); } else if (chunk._chunkData.getFaceMask(index) != 0) { chunk._visibleBlocks.bufferRemove(index); } chunk.unspreadLight(x, y, z, _blockManager.getBlockType(chunk._chunkData.getBlockType(index)).getLuminosity(), LightType.BLOCK); chunk._chunkData.clearBlock(index); chunk.updateVisibilityForNeigborsOf(x, y, z); chunk.needsNewVBO(); Side side; Vec3i vec = new Vec3i(); byte blocklight = 0; byte sunlight = 0; for (int i = 0; i < 6; ++i) { side = Side.getSide(i); vec.set(x + side.getNormal().x(), y + side.getNormal().y(), z + side.getNormal().z()); blocklight = (byte) Math.max(blocklight, chunk.getLightAbsolute(vec.x(), vec.y(), vec.z(), LightType.BLOCK)); sunlight = (byte) Math.max(sunlight, chunk.getLightAbsolute(vec.x(), vec.y(), vec.z(), LightType.SUN)); } chunk.spreadLight(x, y, z, (byte) (blocklight - 1), LightType.BLOCK); chunk.spreadLight(x, y, z, (byte) (sunlight - 1), LightType.SUN); chunk.spreadSunlight(x, z); chunk.notifyNeighborsOf(x, y, z); chunk.needsNewVisibleContentAABB(); } }
CraftMania
positive
441,468
public static Result success(String message) { if (StringUtils.isNotBlank(message)) { this.message = new StringBuilder(message); } else { this.message = new StringBuilder(); } return this; }
public static Result success(String message) { <DeepExtract> if (StringUtils.isNotBlank(message)) { this.message = new StringBuilder(message); } else { this.message = new StringBuilder(); } return this; </DeepExtract> }
jweb
positive
441,470
@Override public DistkvSetProxy sets() { try { if (!RouteTable.getInstance().refreshLeader(cliClientService, groupId, 1000).isOk()) { throw new IllegalStateException("Refresh leader failed"); } final PeerId leader = RouteTable.getInstance().selectLeader(groupId); if (!leader.getIp().equals(leaderAddr)) { leaderAddr = leader.getIp(); refreshDistkvClient(String.format("distkv://%s:%d", leaderAddr, 8082)); } } catch (InterruptedException | TimeoutException e) { e.printStackTrace(); } return setProxy; }
@Override public DistkvSetProxy sets() { <DeepExtract> try { if (!RouteTable.getInstance().refreshLeader(cliClientService, groupId, 1000).isOk()) { throw new IllegalStateException("Refresh leader failed"); } final PeerId leader = RouteTable.getInstance().selectLeader(groupId); if (!leader.getIp().equals(leaderAddr)) { leaderAddr = leader.getIp(); refreshDistkvClient(String.format("distkv://%s:%d", leaderAddr, 8082)); } } catch (InterruptedException | TimeoutException e) { e.printStackTrace(); } </DeepExtract> return setProxy; }
distkv
positive
441,471
public int getType() { try { return getSrcDataInt("type"); } catch (Exception e) { return 1; } }
public int getType() { <DeepExtract> try { return getSrcDataInt("type"); } catch (Exception e) { return 1; } </DeepExtract> }
crawl-anywhere
positive
441,473
@SafeVarargs protected final void assertRequestViolationsThat(RamlReport report, Matcher<String>... matcher) { assertTrue("Expected no violations, but found: " + report.getResponseViolations(), report.getResponseViolations().isEmpty()); assertEquals(matcher.length, report.getRequestViolations().size()); final Iterator<RamlViolationMessage> it = report.getRequestViolations().iterator(); for (final Matcher<String> matcher : matcher) { assertThat(it.next().getMessage(), matcher); } }
@SafeVarargs protected final void assertRequestViolationsThat(RamlReport report, Matcher<String>... matcher) { assertTrue("Expected no violations, but found: " + report.getResponseViolations(), report.getResponseViolations().isEmpty()); <DeepExtract> assertEquals(matcher.length, report.getRequestViolations().size()); final Iterator<RamlViolationMessage> it = report.getRequestViolations().iterator(); for (final Matcher<String> matcher : matcher) { assertThat(it.next().getMessage(), matcher); } </DeepExtract> }
raml-tester
positive
441,474
void writeCondition(WeatherCondition condition, Parcel dest) { dest.writeString(condition.getConditionText()); if (condition.getTemperature() != null) { dest.writeInt(condition.getTemperature().getCurrent()); dest.writeInt(condition.getTemperature().getLow()); dest.writeInt(condition.getTemperature().getHigh()); } else { dest.writeInt(Temperature.UNKNOWN); dest.writeInt(Temperature.UNKNOWN); dest.writeInt(Temperature.UNKNOWN); } if (condition.getHumidity() != null) { dest.writeString(condition.getHumidity().getText()); } else { dest.writeString(null); } if (condition.getWind() != null) { dest.writeString(condition.getWind().getText()); } else { dest.writeString(null); } }
void writeCondition(WeatherCondition condition, Parcel dest) { dest.writeString(condition.getConditionText()); if (condition.getTemperature() != null) { dest.writeInt(condition.getTemperature().getCurrent()); dest.writeInt(condition.getTemperature().getLow()); dest.writeInt(condition.getTemperature().getHigh()); } else { dest.writeInt(Temperature.UNKNOWN); dest.writeInt(Temperature.UNKNOWN); dest.writeInt(Temperature.UNKNOWN); } if (condition.getHumidity() != null) { dest.writeString(condition.getHumidity().getText()); } else { dest.writeString(null); } <DeepExtract> if (condition.getWind() != null) { dest.writeString(condition.getWind().getText()); } else { dest.writeString(null); } </DeepExtract> }
weather-notification
positive
441,475
@Override public void run() { FallingBlock falling = block.getWorld().spawnFallingBlock(block.getLocation().add(.5, .5, .5), data); falling.addScoreboardTag("tree_feller"); try { Vector v = calculateVelocityForBlock(block, lowest, directionalFallBehavior.getDirectionalVel(seed, player, origin, lockCardinal, 1).setY(0).normalize(), verticalFallVelocity).setY(verticalFallVelocity); if (!Double.isFinite(v.getX()) || !Double.isFinite(v.getY()) || !Double.isFinite(v.getZ())) v = new Vector(0, verticalFallVelocity, 0); falling.setVelocity(v); } catch (IllegalArgumentException ex) { } falling.setHurtEntities(hurt); Vanillify.modifyEntityNBT(falling, "FallHurtAmount", Option.FALL_HURT_AMOUNT.get(tool, tree)); Vanillify.modifyEntityNBT(falling, "FallHurtMax", Option.FALL_HURT_MAX.get(tool, tree)); Player inv = null; if (inventory) { if (player == null) doBreak = true; else inv = player; } RotationData rot = null; if (falling.getBlockData() instanceof Orientable && rotate) { rot = new RotationData((Orientable) falling.getBlockData(), origin); } plugin.fallingBlocks.add(new FallingTreeBlock(detectedTree, falling, tool, tree, axe, doBreak, inv, rot, dropItems, modifiers)); }
@Override public void run() { <DeepExtract> FallingBlock falling = block.getWorld().spawnFallingBlock(block.getLocation().add(.5, .5, .5), data); falling.addScoreboardTag("tree_feller"); try { Vector v = calculateVelocityForBlock(block, lowest, directionalFallBehavior.getDirectionalVel(seed, player, origin, lockCardinal, 1).setY(0).normalize(), verticalFallVelocity).setY(verticalFallVelocity); if (!Double.isFinite(v.getX()) || !Double.isFinite(v.getY()) || !Double.isFinite(v.getZ())) v = new Vector(0, verticalFallVelocity, 0); falling.setVelocity(v); } catch (IllegalArgumentException ex) { } falling.setHurtEntities(hurt); Vanillify.modifyEntityNBT(falling, "FallHurtAmount", Option.FALL_HURT_AMOUNT.get(tool, tree)); Vanillify.modifyEntityNBT(falling, "FallHurtMax", Option.FALL_HURT_MAX.get(tool, tree)); Player inv = null; if (inventory) { if (player == null) doBreak = true; else inv = player; } RotationData rot = null; if (falling.getBlockData() instanceof Orientable && rotate) { rot = new RotationData((Orientable) falling.getBlockData(), origin); } plugin.fallingBlocks.add(new FallingTreeBlock(detectedTree, falling, tool, tree, axe, doBreak, inv, rot, dropItems, modifiers)); </DeepExtract> }
tree-feller
positive
441,476
public Collection<InputFile> getClassPathFilesB() { return cpFiles; }
public Collection<InputFile> getClassPathFilesB() { <DeepExtract> return cpFiles; </DeepExtract> }
Matcher
positive
441,478
@Override public KeyFileBytes readKeyFile(byte[] keyFile) { KeyFile xmlKeyFile; try { ByteArrayInputStream inputStream = new ByteArrayInputStream(keyFile); xmlKeyFile = parser.fromXml(inputStream, null, KeyFile.class); } catch (KeePassDatabaseUnreadableException e) { xmlKeyFile = new KeyFile(false); } byte[] protectedBuffer = null; if (xmlKeyFile.isXmlFile()) { protectedBuffer = getBytesFromKeyFile(xmlKeyFile); } return new KeyFileBytes(xmlKeyFile.isXmlFile(), protectedBuffer); }
@Override public KeyFileBytes readKeyFile(byte[] keyFile) { <DeepExtract> KeyFile xmlKeyFile; try { ByteArrayInputStream inputStream = new ByteArrayInputStream(keyFile); xmlKeyFile = parser.fromXml(inputStream, null, KeyFile.class); } catch (KeePassDatabaseUnreadableException e) { xmlKeyFile = new KeyFile(false); } </DeepExtract> byte[] protectedBuffer = null; if (xmlKeyFile.isXmlFile()) { protectedBuffer = getBytesFromKeyFile(xmlKeyFile); } return new KeyFileBytes(xmlKeyFile.isXmlFile(), protectedBuffer); }
openkeepass
positive
441,480
public void modifyText(ModifyEvent e) { this.launchConfig = (ILaunchConfiguration) launchConfigs.get(UIHelper.getSelection(launchConfigurationCombo)); if (launchConfig == null) { this.launcherNameText.setText(""); this.launchConfig = null; return; } String ln = launchConfig.getName(); int idx = ln.indexOf('('); if (idx != -1) { ln = ln.substring(0, idx - 1); } ln += ".exe"; this.launcherNameText.setText(ln); setPageComplete(isPageComplete()); }
public void modifyText(ModifyEvent e) { <DeepExtract> this.launchConfig = (ILaunchConfiguration) launchConfigs.get(UIHelper.getSelection(launchConfigurationCombo)); if (launchConfig == null) { this.launcherNameText.setText(""); this.launchConfig = null; return; } String ln = launchConfig.getName(); int idx = ln.indexOf('('); if (idx != -1) { ln = ln.substring(0, idx - 1); } ln += ".exe"; this.launcherNameText.setText(ln); </DeepExtract> setPageComplete(isPageComplete()); }
winrun4j
positive
441,481
private Mono<ServerResponse> refreshAuth(ServerRequest request) { Mono<AuthenticationRequest> authenticationRequestMono = request.bodyToMono(AuthenticationRequest.class); Mono<String> oauth2RequestMono = authenticationRequestMono.map(n -> "refresh_token=" + n.getRefreshToken() + "&grant_type=refresh_token&scope=web-client"); Mono<ClientResponse> responseMono = webClient.post().uri(URI.create(routerUriConfig.getAuthService() + "/oauth/token")).header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE).headers(headers -> headers.setBasicAuth("web", "web@secret")).contentType(MediaType.APPLICATION_FORM_URLENCODED).body(oauth2RequestMono, String.class).exchange(); return responseMono.flatMap(cr -> { Mono<Map> mapMono = cr.bodyToMono(HashMap.class); if (cr.rawStatusCode() != HttpStatus.OK.value()) { return ServerResponse.status(cr.rawStatusCode()).body(mapMono, HashMap.class); } mapMono = cr.bodyToMono(Map.class).flatMap(m -> { if (m.get("code") == null) { Map<String, Object> res = new HashMap<>(16); res.put("code", 0); res.put("msg", "ok"); res.put("data", m); m = res; } return Mono.just(m); }); return ServerResponse.ok().body(mapMono, HashMap.class); }); }
private Mono<ServerResponse> refreshAuth(ServerRequest request) { Mono<AuthenticationRequest> authenticationRequestMono = request.bodyToMono(AuthenticationRequest.class); Mono<String> oauth2RequestMono = authenticationRequestMono.map(n -> "refresh_token=" + n.getRefreshToken() + "&grant_type=refresh_token&scope=web-client"); <DeepExtract> Mono<ClientResponse> responseMono = webClient.post().uri(URI.create(routerUriConfig.getAuthService() + "/oauth/token")).header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE).headers(headers -> headers.setBasicAuth("web", "web@secret")).contentType(MediaType.APPLICATION_FORM_URLENCODED).body(oauth2RequestMono, String.class).exchange(); return responseMono.flatMap(cr -> { Mono<Map> mapMono = cr.bodyToMono(HashMap.class); if (cr.rawStatusCode() != HttpStatus.OK.value()) { return ServerResponse.status(cr.rawStatusCode()).body(mapMono, HashMap.class); } mapMono = cr.bodyToMono(Map.class).flatMap(m -> { if (m.get("code") == null) { Map<String, Object> res = new HashMap<>(16); res.put("code", 0); res.put("msg", "ok"); res.put("data", m); m = res; } return Mono.just(m); }); return ServerResponse.ok().body(mapMono, HashMap.class); }); </DeepExtract> }
cloud-learning-lite
positive
441,482
@Test public void shouldRetainDocStringsFromAvro() { String hive = "struct<fa:int,fb:struct<ga:int>>"; Schema avro = struct("r1", "doc-r1", "n1", required("fA", Schema.Type.INT, "doc-fA", null, null), required("fB", struct("r2", "doc-r2", "n2", required("gA", Schema.Type.INT, "doc-gA", null, null)), "doc-fB", null, null)); assertEquals(merge(hive, avro).toString(true), avro.toString(true)); }
@Test public void shouldRetainDocStringsFromAvro() { String hive = "struct<fa:int,fb:struct<ga:int>>"; Schema avro = struct("r1", "doc-r1", "n1", required("fA", Schema.Type.INT, "doc-fA", null, null), required("fB", struct("r2", "doc-r2", "n2", required("gA", Schema.Type.INT, "doc-gA", null, null)), "doc-fB", null, null)); <DeepExtract> assertEquals(merge(hive, avro).toString(true), avro.toString(true)); </DeepExtract> }
coral
positive
441,483
@Override public void onResume() { super.onResume(); CaratApplication.dismissNotifications(); mainActivity.setUpActionBar(R.string.actions, true); noActionsScroll = (ScrollView) mainFrame.findViewById(R.id.no_actions_scroll_view); noActionsLayout = (LinearLayout) mainFrame.findViewById(R.id.empty_actions_layout); actionsHeader = (RelativeLayout) mainFrame.findViewById(R.id.actions_header); expandableListView = (ExpandableListView) mainFrame.findViewById(R.id.expandable_actions_list); SimpleHogBug[] hogReport, bugReport; CaratDataStorage s = CaratApplication.getStorage(); hogReport = s.getHogReport(); bugReport = s.getBugReport(); ArrayList<SimpleHogBug> running = new ArrayList<>(); running.addAll(ProcessUtil.filterByRunning(hogReport, getContext())); running.addAll(ProcessUtil.filterByRunning(bugReport, getContext())); if (!s.hogsIsEmpty() || !s.bugsIsEmpty() || !CaratApplication.getStaticActions().isEmpty()) { noActionsScroll.setVisibility(View.GONE); noActionsLayout.setVisibility(View.GONE); actionsHeader.setVisibility(View.VISIBLE); expandableListView.setVisibility(View.VISIBLE); expandableListView.setAdapter(new ActionsExpandListAdapter(mainActivity, expandableListView, (CaratApplication) getActivity().getApplication(), running, mainActivity)); } else { noActionsScroll.setVisibility(View.VISIBLE); noActionsLayout.setVisibility(View.VISIBLE); actionsHeader.setVisibility(View.GONE); expandableListView.setVisibility(View.GONE); } }
@Override public void onResume() { super.onResume(); CaratApplication.dismissNotifications(); mainActivity.setUpActionBar(R.string.actions, true); noActionsScroll = (ScrollView) mainFrame.findViewById(R.id.no_actions_scroll_view); noActionsLayout = (LinearLayout) mainFrame.findViewById(R.id.empty_actions_layout); actionsHeader = (RelativeLayout) mainFrame.findViewById(R.id.actions_header); expandableListView = (ExpandableListView) mainFrame.findViewById(R.id.expandable_actions_list); <DeepExtract> SimpleHogBug[] hogReport, bugReport; CaratDataStorage s = CaratApplication.getStorage(); hogReport = s.getHogReport(); bugReport = s.getBugReport(); ArrayList<SimpleHogBug> running = new ArrayList<>(); running.addAll(ProcessUtil.filterByRunning(hogReport, getContext())); running.addAll(ProcessUtil.filterByRunning(bugReport, getContext())); if (!s.hogsIsEmpty() || !s.bugsIsEmpty() || !CaratApplication.getStaticActions().isEmpty()) { noActionsScroll.setVisibility(View.GONE); noActionsLayout.setVisibility(View.GONE); actionsHeader.setVisibility(View.VISIBLE); expandableListView.setVisibility(View.VISIBLE); expandableListView.setAdapter(new ActionsExpandListAdapter(mainActivity, expandableListView, (CaratApplication) getActivity().getApplication(), running, mainActivity)); } else { noActionsScroll.setVisibility(View.VISIBLE); noActionsLayout.setVisibility(View.VISIBLE); actionsHeader.setVisibility(View.GONE); expandableListView.setVisibility(View.GONE); } </DeepExtract> }
carat-android
positive
441,484