auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testJsonFunction() throws JsonProcessingException { String jsonString = "{" + " \"id\": \"7044885078\"," + " \"type\": \"CreateEvent\"," + " \"actor\": {" + " \"id\": 33500718," + " \"login\": \"dipper-github-icn-bom-cdg\"," + " \"display_login\": \"dipper-github-icn-bom-cdg\"," + " \"gravatar_id\": \"\"," + " \"url\": \"<LINK_1>\"," + " \"avatar_url\": \"<LINK_0>\"" + " }," + " \"repo\": {" + " \"id\": 112368043," + " \"name\": \"dipper-github-icn-bom-cdg/test-ruby-sample\"," + " \"url\": \"<LINK_2>\"" + " }," + " \"payload\": {" + " \"ref\": \"canary-test-7f3af0db-3ffa-4259-894f-950d2c76594b\"," + " \"ref_type\": \"branch\"," + " \"master_branch\": \"master\"," + " \"description\": null," + " \"pusher_type\": \"user\"" + " }," + " \"public\": true," + " \"created_at\": \"2018-01-01T11:12:53Z\"" + "}"; assertEquals(JsonFunctions.jsonPathString(jsonString, "$.actor.id"), "33500718"); assertEquals(JsonFunctions.jsonPathLong(jsonString, "$.actor.id"), Long.valueOf(33500718L)); assertEquals(JsonFunctions.jsonPathDouble(jsonString, "$.actor.id"), 33500718.0); }

Target:
public void testJsonFunction() throws JsonProcessingException { String jsonString = "{" + " \"id\": \"7044885078\"," + " \"type\": \"CreateEvent\"," + " \"actor\": {" + " \"id\": 33500718," + " \"login\": \"dipper-github-icn-bom-cdg\"," + " \"display_login\": \"dipper-github-icn-bom-cdg\"," + " \"gravatar_id\": \"\"," + " \"url\": \"<LINK_1>\"," + " \"avatar_url\": \"<LINK_0>\"" + " }," + " \"repo\": {" + " \"id\": 112368043," + " \"name\": \"dipper-github-icn-bom-cdg/test-ruby-sample\"," + " \"url\": \"<LINK_2>\"" + " }," + " \"payload\": {" + " \"ref\": \"canary-test-7f3af0db-3ffa-4259-894f-950d2c76594b\"," + " \"ref_type\": \"branch\"," + " \"master_branch\": \"master\"," + " \"description\": null," + " \"pusher_type\": \"user\"" + " }," + " \"public\": true," + " \"created_at\": \"2018-01-01T11:12:53Z\"" + "}"; assertEquals(JsonFunctions.jsonPathString(jsonString, "$.actor.id"), "33500718"); assertEquals(JsonFunctions.jsonPathLong(jsonString, "$.actor.id"), 33500718L); assertEquals(JsonFunctions.jsonPathDouble(jsonString, "$.actor.id"), 33500718.0); }
Source:
public GlowLightningStrike(Random random, Location location, boolean effect) { super(location); this.effect = effect; this.ticksToLive = random.nextInt(3) + 1; this.random = random; }

Target:
public GlowLightningStrike(Random random, Location location, boolean effect) { super(location); this.effect = effect; this.ticksToLive = 30; this.random = random; }
Source:
private boolean isCommit(String sql) { return "COMMIT".equals(sql); }

Target:
private static boolean isCommit(String sql) { return "COMMIT".equals(sql); }
Source:
private boolean loadPropertiesFromFile(final String file) { if (CommonUtils.isEmpty(file)) { return false; } if(file.startsWith(CLASSPATH_PREFIX)){ String classpathFile = file.substring(CLASSPATH_PREFIX.length()); try { properties.load(this.getClass().getClassLoader().getResourceAsStream(classpathFile)); return true; } catch (IOException e) { LOGGER.warn("Unable to load properties for file {}", file, e); return false; } } FileInputStream fis = null; try { fis = new FileInputStream(file); this.properties.load(fis); return true; } catch (final IOException e) { LOGGER.warn("Unable to load properties for file {}", file, e); return false; } finally { CommonUtils.closeQuietly(fis); } }

Target:
private boolean loadPropertiesFromFile(final String file) { if (CommonUtils.isEmpty(file)) { return false; } String filteredFile = filterFileName(file); if (filteredFile.startsWith(CLASSPATH_PREFIX)) { String classpathFile = filteredFile.substring(CLASSPATH_PREFIX.length()); try { properties.load(this.getClass().getClassLoader().getResourceAsStream(classpathFile)); return true; } catch (IOException e) { LOGGER.warn("Unable to load properties for file {}", filteredFile, e); return false; } } else { FileInputStream fis = null; try { fis = new FileInputStream(filteredFile); this.properties.load(fis); return true; } catch (final IOException e) { LOGGER.warn("Unable to load properties for file {}", filteredFile, e); return false; } finally { CommonUtils.closeQuietly(fis); } } }
Source:
private String[] addStudentAuthenticationInfo(String[] params) { StudentAttributes unregStudent = StudentsLogic.inst().getStudentForEmail("idOfTypicalCourse1", "student6InCourse1@gmail.tmt"); List<String> list = new ArrayList<String>(); list.add(Const.ParamsNames.REGKEY); list.add(StringHelper.encrypt(unregStudent.key)); list.add(Const.ParamsNames.STUDENT_EMAIL); list.add(unregStudent.email); for (String s : params) { list.add(s); } return list.toArray(new String[list.size()]); }

Target:
private String[] addStudentAuthenticationInfo(String[] params) { StudentAttributes unregStudent = StudentsLogic.inst().getStudentForEmail("idOfTypicalCourse1", "student6InCourse1@gmail.tmt"); List<String> list = new ArrayList<>(); list.add(Const.ParamsNames.REGKEY); list.add(StringHelper.encrypt(unregStudent.key)); list.add(Const.ParamsNames.STUDENT_EMAIL); list.add(unregStudent.email); for (String s : params) { list.add(s); } return list.toArray(new String[list.size()]); }
Source:
private void replaceAntiCsrfTokenValueIfRequired(HttpMessage requestMessage, HttpMessage loginMsgWithFreshAcsrfToken) throws IOException { if(extAntiCsrf == null) { extAntiCsrf = Control.getSingleton().getExtensionLoader().getExtension(ExtensionAntiCSRF.class); } List<AntiCsrfToken> antiCsrfTokensOfFirstLoginMsg = null; if(extAntiCsrf != null) { antiCsrfTokensOfFirstLoginMsg = extAntiCsrf.getTokens(requestMessage); } AntiCsrfToken antiCsrfTokenOfFirstLoginMsg = null; if(antiCsrfTokensOfFirstLoginMsg != null && antiCsrfTokensOfFirstLoginMsg.size() > 0) { antiCsrfTokenOfFirstLoginMsg = antiCsrfTokensOfFirstLoginMsg.get(0); } if (antiCsrfTokenOfFirstLoginMsg != null) { String regeneratedAntiCsrfTokenValue = extAntiCsrf.getTokenValue(loginMsgWithFreshAcsrfToken, antiCsrfTokenOfFirstLoginMsg.getName()); String requestBody = requestMessage.getRequestBody().toString(); if (regeneratedAntiCsrfTokenValue != null) { requestBody = requestBody.replace( antiCsrfTokenOfFirstLoginMsg.getValue(), paramEncoder.apply(regeneratedAntiCsrfTokenValue)); requestMessage.getRequestBody().setBody(requestBody); } } }

Target:
private void replaceAntiCsrfTokenValueIfRequired(HttpMessage requestMessage, HttpMessage loginMsgWithFreshAcsrfToken) { if(extAntiCsrf == null) { extAntiCsrf = Control.getSingleton().getExtensionLoader().getExtension(ExtensionAntiCSRF.class); } List<AntiCsrfToken> freshAcsrfTokens = null; if(extAntiCsrf != null) { freshAcsrfTokens = extAntiCsrf.getTokensFromResponse(loginMsgWithFreshAcsrfToken); } else { LOGGER.debug("ExtensionAntiCSRF is not available, skipping ACSRF replacing task"); return; } if(freshAcsrfTokens == null || freshAcsrfTokens.size() == 0) { if(LOGGER.isDebugEnabled()) { LOGGER.debug("No ACSRF token found in the response of " + loginMsgWithFreshAcsrfToken.getRequestHeader()); } return; } if(LOGGER.isDebugEnabled()) { LOGGER.debug("The login page has " + freshAcsrfTokens.size() + " ACSRF token(s)"); } String postRequestBody = requestMessage.getRequestBody().toString(); Map<String, String> parameters = extractParametersFromPostData(postRequestBody); if(parameters != null) { String oldAcsrfTokenValue = null; String replacedPostData = null; for (AntiCsrfToken antiCsrfToken : freshAcsrfTokens) { oldAcsrfTokenValue = parameters.get(antiCsrfToken.getName()); replacedPostData = postRequestBody.replace(oldAcsrfTokenValue, antiCsrfToken.getValue()); if(LOGGER.isDebugEnabled()) { LOGGER.debug("replaced " + oldAcsrfTokenValue + " old ACSRF token value with " + antiCsrfToken.getValue()); } } requestMessage.getRequestBody().setBody(replacedPostData); } else { LOGGER.debug("ACSRF token found but could not replace old value with fresh value"); } }
Source:
public Properties lookupProperties(String key) { if (log.isDebugEnabled()) { log.debug("==> Repository fetch of resource with key : " + key); } key = appendPropertyFile(key); String resolvedRegKeyPath = resolveRegistryPath(key); URLConnection urlConnection; URL url = null; try { url = new URL(resolvedRegKeyPath); } catch (MalformedURLException e) { handleException("Invalid path '" + resolvedRegKeyPath + "' for URL", e); } if (url == null) { handleException("Unable to create URL for target resource : " + key); } if ("file".equals(url.getProtocol())) { try { url.openStream(); } catch (FileNotFoundException e) { return null; } catch (IOException e) { if (log.isDebugEnabled()) { log.debug("Error occurred while accessing registry resource: " + key, e); } return null; } } try { urlConnection = url.openConnection(); urlConnection.connect(); } catch (IOException e) { return null; } InputStream input = null; try { input = urlConnection.getInputStream(); } catch (IOException e) { handleException("Error when getting a stream from the URL", e); } if (input == null) { return null; } Properties result = new Properties(); try { result.load(input); } catch (IOException e) { log.error("Error in loading properties"); } finally { try { input.close(); } catch (IOException e) { log.error("Error in closing the input stream.", e); } } return result; }

Target:
public Properties lookupProperties(String key) { if (log.isDebugEnabled()) { log.debug("==> Repository fetch of resource with key : " + key); } String resolvedRegKeyPath = resolveRegistryPath(key); URLConnection urlConnection; Properties result = new Properties(); try { resolvedRegKeyPath = getPropertyFilePath(resolvedRegKeyPath); URL url = new URL(resolvedRegKeyPath); if ("file".equals(url.getProtocol())) { url.openStream(); } urlConnection = url.openConnection(); urlConnection.connect(); try (InputStream input = urlConnection.getInputStream()) { if (input == null) { return null; } result.load(input); } } catch (MalformedURLException e) { handleException("Invalid path '" + resolvedRegKeyPath + "' for URL", e); } catch (IOException e) { log.error("Error in loading properties", e); return null; } return result; }
Source:
public final String toString() { return String.format("[OptionDescriptor %s, %d, %d, %s ]", this.name, this.id, this.flags, this.description); }

Target:
public final String toString() { return "[OptionDescriptor " + name + ", " + id + ", " + flags + ", " + description + "]"; }
Source:
private static ImmutableWorkerInfo selectFromEligibleWorkers(final Map<String, ImmutableWorkerInfo> eligibleWorkers) { TreeSet<ImmutableWorkerInfo> sortedWorkers = Sets.newTreeSet( Comparator.comparing(ImmutableWorkerInfo::getCurrCapacityUsed).reversed() ); sortedWorkers.addAll(eligibleWorkers.values()); return Iterables.getFirst(sortedWorkers, null); }

Target:
private static ImmutableWorkerInfo selectFromEligibleWorkers(final Map<String, ImmutableWorkerInfo> eligibleWorkers) { return eligibleWorkers.values().stream().max( Comparator.comparing(ImmutableWorkerInfo::getCurrCapacityUsed) ).orElse(null); }
Source:
public void openAddInputWizardDialog() { final AddInputContractFromDataWizardDialog dialog = new AddInputContractFromDataWizardDialog(Display.getCurrent().getActiveShell(), new ContractInputGenerationWizard( (ContractContainer) selectionProvider.getAdapter(EObject.class), getEditingDomain(), repositoryAccessor, fieldToContractInputMappingOperationBuilder, fieldToContractInputMappingExpressionBuilder, BonitaStudioPreferencesPlugin.getDefault().getPreferenceStore(), sharedImages, new ContractInputGenerationInfoDialog()), this, true); dialog.open(); }

Target:
public void openAddInputWizardDialog() { final AddInputContractFromDataWizardDialog dialog = new AddInputContractFromDataWizardDialog(Display.getCurrent().getActiveShell(), new ContractInputGenerationWizard( (ContractContainer) selectionProvider.getAdapter(EObject.class), getEditingDomain(), repositoryAccessor, fieldToContractInputMappingOperationBuilder, fieldToContractInputMappingExpressionBuilder, BonitaStudioPreferencesPlugin.getDefault().getPreferenceStore(), sharedImages, new ContractInputGenerationInfoDialogFactory()), this, true); dialog.open(); }
Source:
public void resetRoute(String id) throws Exception { camelContext.getManagedCamelContext().reset(true); }

Target:
public void resetRoute(String id) throws Exception { ManagedRouteMBean resetRoute = camelContext.getManagedRoute(id, ManagedRouteMBean.class); resetRoute.reset(); }
Source:
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { String editPrefLabel = ""; switch(key) { case SUPERUSER_ENABLED: editPrefLabel = GoogleAnalyticsFields.LABEL_DEV_MODE; break; case ACTION_BAR_ENABLED: editPrefLabel = GoogleAnalyticsFields.LABEL_ACTION_BAR; break; case GRID_MENUS_ENABLED: editPrefLabel = GoogleAnalyticsFields.LABEL_GRID_MENUS; break; case NAV_UI_ENABLED: editPrefLabel = GoogleAnalyticsFields.LABEL_NAV_UI; break; case LIST_REFRESH_ENABLED: editPrefLabel = GoogleAnalyticsFields.LABEL_ENTITY_LIST_REFRESH; break; case NEWEST_APP_VERSION_ENABLED: editPrefLabel = GoogleAnalyticsFields.LABEL_NEWEST_APP_VERSION; break; case ENABLE_AUTO_LOGIN: editPrefLabel = GoogleAnalyticsFields.LABEL_AUTO_LOGIN; if (!isAutoLoginEnabled()) { DevSessionRestorer.clearPassword(sharedPreferences); } break; case ENABLE_SAVE_SESSION: editPrefLabel = GoogleAnalyticsFields.LABEL_SESSION_SAVING; if (!isSessionSavingEnabled()) { DevSessionRestorer.clearSession(); } break; case CSS_ENABLED: editPrefLabel = GoogleAnalyticsFields.LABEL_CSS; break; case MARKDOWN_ENABLED: editPrefLabel = GoogleAnalyticsFields.LABEL_MARKDOWN; break; case ALTERNATE_QUESTION_LAYOUT_ENABLED: editPrefLabel = GoogleAnalyticsFields.LABEL_IMAGE_ABOVE_TEXT; break; case FIRE_TRIGGERS_ON_SAVE: editPrefLabel = GoogleAnalyticsFields.LABEL_TRIGGERS_ON_SAVE; break; case HOME_REPORT_ENABLED: editPrefLabel = GoogleAnalyticsFields.LABEL_REPORT_BUTTON_ENABLED; break; } if (!"".equals(editPrefLabel)) { GoogleAnalyticsUtils.reportEditPref(GoogleAnalyticsFields.CATEGORY_DEV_PREFS, editPrefLabel, getEditPrefValue(key)); } }

Target:
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { GoogleAnalyticsUtils.reportEditPref(GoogleAnalyticsFields.CATEGORY_DEV_PREFS, getEditPrefLabel(key), getEditPrefValue(key)); switch(key) { case ENABLE_AUTO_LOGIN: if (!isAutoLoginEnabled()) { DevSessionRestorer.clearPassword(sharedPreferences); } break; case ENABLE_SAVE_SESSION: if (!isSessionSavingEnabled()) { DevSessionRestorer.clearSession(); } break; } }
Source:
protected FSDataOutputStream openStream(Path filepath, boolean append) throws IOException { FSDataOutputStream fsOutput; if (append) { return openStreamForNonAppendFS(filepath); } else { fsOutput = fs.create(filepath, (short)replication); fs.setPermission(filepath, FsPermission.createImmutable(filePermission)); } return fsOutput; }

Target:
protected FSDataOutputStream openStream(Path filepath, boolean append) throws IOException { FSDataOutputStream fsOutput; if (append) { fsOutput = openStreamInAppendMode(filepath); } else { fsOutput = fs.create(filepath, (short)replication); fs.setPermission(filepath, FsPermission.createImmutable(filePermission)); } return fsOutput; }
Source:
protected ITmfTreeColumnDataProvider getColumnDataProvider() { return new ITmfTreeColumnDataProvider() { @Override public List<@Nullable TmfTreeColumnData> getColumnData() { return ImmutableList.of( createTmfTreeColumnData(COLUMN_NAMES[0], Objects.requireNonNull(Comparator.comparing(SegmentStoreStatisticsEntry::getName))), createTmfTreeColumnData(COLUMN_NAMES[1], Objects.requireNonNull(Comparator.comparingLong(s -> s.getEntry().getMin()))), createTmfTreeColumnData(COLUMN_NAMES[2], Objects.requireNonNull(Comparator.comparingLong(s -> s.getEntry().getMax()))), createTmfTreeColumnData(COLUMN_NAMES[3], Objects.requireNonNull(Comparator.comparingDouble(s -> s.getEntry().getMean()))), createTmfTreeColumnData(COLUMN_NAMES[4], Objects.requireNonNull(Comparator.comparingDouble(s -> s.getEntry().getStdDev()))), createTmfTreeColumnData(COLUMN_NAMES[5], Objects.requireNonNull(Comparator.comparingLong(s -> s.getEntry().getNbElements()))), createTmfTreeColumnData(COLUMN_NAMES[6], Objects.requireNonNull(Comparator.comparingDouble(s -> s.getEntry().getTotal()))), new TmfTreeColumnData("")); } }; }

Target:
protected ITmfTreeColumnDataProvider getColumnDataProvider() { return () -> ImmutableList.of( createTmfTreeColumnData(COLUMN_NAMES[0], Comparator.comparing(SegmentStoreStatisticsEntry::getName)), createTmfTreeColumnData(COLUMN_NAMES[1], Comparator.comparingLong(s -> s.getEntry().getMin())), createTmfTreeColumnData(COLUMN_NAMES[2], Comparator.comparingLong(s -> s.getEntry().getMax())), createTmfTreeColumnData(COLUMN_NAMES[3], Comparator.comparingDouble(s -> s.getEntry().getMean())), createTmfTreeColumnData(COLUMN_NAMES[4], Comparator.comparingDouble(s -> s.getEntry().getStdDev())), createTmfTreeColumnData(COLUMN_NAMES[5], Comparator.comparingLong(s -> s.getEntry().getNbElements())), createTmfTreeColumnData(COLUMN_NAMES[6], Comparator.comparingDouble(s -> s.getEntry().getTotal())), new TmfTreeColumnData("")); }
Source:
public GraphResultSet execute(AbstractGraphStatement statement) { if (!AbstractGraphStatement.checkStatement(statement)) { throw new InvalidQueryException("Invalid Graph Statement, you need to specify at least the keyspace containing the Graph data."); } return new GraphResultSet(session.execute(statement.configureAndGetWrappedStatement())); }

Target:
public GraphResultSet execute(AbstractGraphStatement statement) { return new GraphResultSet(session.execute(statement.configureAndGetWrappedStatement(getDefaultGraphOptions()))); }
Source:
private void sendInfo(XMPPContact contact) { String sarosJid = contact.getSarosJid().map(JID::toString).orElse(null); if (sarosJid == null) return; IQ packet = InfoExchangeExtension.PROVIDER.createIQ(new InfoExchangeExtension(localInfo)); packet.setType(IQ.Type.SET); packet.setTo(sarosJid); try { transmitter.sendPacket(packet); } catch (IOException e) { log.error("could not send version response to " + sarosJid, e); } }

Target:
private void sendInfo(XMPPContact contact) { String sarosJid = contact.getSarosJid().map(JID::toString).orElse(null); if (sarosJid == null) return; IQ packet = InfoExchangeExtension.PROVIDER.createIQ(new InfoExchangeExtension(localInfo)); packet.setType(IQ.Type.SET); packet.setTo(sarosJid); try { transmitter.sendPacket(packet); } catch (IOException e) { log.error("could not send info packet to " + sarosJid, e); } }
Source:
public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) { if (!Projects.isBuildWithGradle(myProject)) { return null; } Module module = ModuleUtilCore.findModuleForFile(file, myProject); if (module == null) { return null; } AppEngineGradleFacet facet = AppEngineGradleFacet.getInstance(module); if(facet != null) { AppEngineConfigurationProperties state = facet.getConfiguration().getState(); if (state != null && !(new File(state.APPENGINE_SDKROOT).exists())) { System.out.println("hello"); return new DownloadSdkNotification(module); } } return null; }

Target:
public EditorNotificationPanel createNotificationPanel(@NotNull VirtualFile file, @NotNull FileEditor fileEditor) { if (!Projects.isBuildWithGradle(myProject)) { return null; } Module module = ModuleUtilCore.findModuleForFile(file, myProject); if (module == null) { return null; } AppEngineGradleFacet facet = AppEngineGradleFacet.getInstance(module); if(facet != null) { AppEngineConfigurationProperties state = facet.getConfiguration().getState(); if (state != null && !(new File(state.APPENGINE_SDKROOT).exists())) { return new DownloadSdkNotification(module); } } return null; }
Source:
private String getVmIsBeingImportedMessage() { StringBuilder builder = new StringBuilder(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_BEING_IMPORTED.name()); builder.append(String.format("$VmName %1$s", getVmName())); return builder.toString(); }

Target:
private String getVmIsBeingImportedMessage() { StringBuilder builder = new StringBuilder(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_BEING_IMPORTED.name()); if (getVmName() != null) { builder.append(String.format("$VmName %1$s", getVmName())); } return builder.toString(); }
Source:
public void close() { IOUtils.closeQuietly(inputStreamDataCache); }

Target:
public synchronized void close() { IOUtils.closeQuietly(streamCloser); }
Source:
public void loadContent(Bounds bounds) { content.getChildren().clear(); HBox hbox = new HBox(); Range ranks = getRange(bounds); List<Annotation> annotations = graph.getAnnotationByRank(ranks).stream() .sorted((a1, a2) -> (a1.getStart() < a2.getStart()) ? -1 : 1) .collect(Collectors.toList()); annotations.forEach(a -> hbox.getChildren().add(new Gene(a))); content.getChildren().add(hbox); }

Target:
protected void loadContent(Bounds bounds) { content.getChildren().clear(); HBox hbox = new HBox(); Range ranks = getRange(bounds); List<Annotation> annotations = getSortedAnnotations(ranks); annotations.forEach(a -> hbox.getChildren().add(new Gene(a))); content.getChildren().add(hbox); }
Source:
public ClusteredCacheQueryImpl(Query luceneQuery, SearchIntegrator searchFactory, ExecutorService asyncExecutor, AdvancedCache<?, ?> cache, KeyTransformationHandler keyTransformationHandler, Class<?>... classes) { super(luceneQuery, searchFactory, cache, keyTransformationHandler, classes); this.asyncExecutor = asyncExecutor; this.hSearchQuery = searchFactory.createHSQuery().luceneQuery(luceneQuery) .targetedEntities(Arrays.asList(classes)); this.marshaller = ComponentRegistryUtils.getComponent(cache, StreamingMarshaller.class); }

Target:
public ClusteredCacheQueryImpl(Query luceneQuery, SearchIntegrator searchFactory, ExecutorService asyncExecutor, AdvancedCache<?, ?> cache, KeyTransformationHandler keyTransformationHandler, Class<?>... classes) { super(luceneQuery, searchFactory, cache, keyTransformationHandler, classes); this.asyncExecutor = asyncExecutor; this.hSearchQuery = searchFactory.createHSQuery().luceneQuery(luceneQuery) .targetedEntities(Arrays.asList(classes)); }
Source:
public void fallbackChunk_givenInInitParameter_passedOnToDeploymentConfiguration() throws ServletException { FallbackChunk fallbackChunk = new FallbackChunk(Collections.emptyList(), Collections.emptyList()); final Properties properties = new Properties(); properties.put(DeploymentConfigurationFactory.FALLBACK_CHUNK, fallbackChunk); VaadinService service = SpringInstantiatorTest.getService(context, properties, true); Assert.assertEquals(fallbackChunk, service.getDeploymentConfiguration().getInitParameters() .get(DeploymentConfigurationFactory.FALLBACK_CHUNK)); }

Target:
public void fallbackChunk_givenInInitParameter_passedOnToDeploymentConfiguration() throws ServletException { FallbackChunk fallbackChunk = new FallbackChunk(Collections.emptyList(), Collections.emptyList()); final Properties properties = new Properties(); properties.put(DeploymentConfigurationFactory.FALLBACK_CHUNK, fallbackChunk); VaadinService service = SpringInstantiatorTest.getService(context, properties, true); Assert.assertSame(fallbackChunk, service.getDeploymentConfiguration().getInitParameters() .get(DeploymentConfigurationFactory.FALLBACK_CHUNK)); }
Source:
public void testScheduleSplitsBatched() { StageExecutionPlan plan = createPlan(createFixedSplitSource(60, TestingSplit::createRemoteSplit)); NodeTaskMap nodeTaskMap = new NodeTaskMap(finalizerService); SqlStageExecution stage = createSqlStageExecution(plan, nodeTaskMap); StageScheduler scheduler = getSourcePartitionedScheduler(plan, stage, nodeManager, nodeTaskMap, 7); for (int i = 0; i <= (60 / 7); i++) { ScheduleResult scheduleResult = scheduler.schedule(); assertFalse(scheduleResult.isFinished()); assertEquals(scheduleResult.getBlockedReason(), i == (60 / 7) ? Optional.of(NO_ACTIVE_DRIVER_GROUP) : Optional.empty()); assertTrue(scheduleResult.getBlocked().isDone()); assertEquals(scheduleResult.getNewTasks().size(), i == 0 ? 3 : 0); assertEquals(stage.getAllTasks().size(), 3); assertPartitionedSplitCount(stage, min((i + 1) * 7, 60)); } assertCleanupScheduleResult(scheduler.schedule()); for (RemoteTask remoteTask : stage.getAllTasks()) { assertEquals(remoteTask.getPartitionedSplitCount(), 20); } stage.abort(); }

Target:
public void testScheduleSplitsBatched() { StageExecutionPlan plan = createPlan(createFixedSplitSource(60, TestingSplit::createRemoteSplit)); NodeTaskMap nodeTaskMap = new NodeTaskMap(finalizerService); SqlStageExecution stage = createSqlStageExecution(plan, nodeTaskMap); StageScheduler scheduler = getSourcePartitionedScheduler(plan, stage, nodeManager, nodeTaskMap, 7); for (int i = 0; i <= (60 / 7); i++) { ScheduleResult scheduleResult = scheduler.schedule(); if (i == (60 / 7)) { assertEffectivelyFinished(scheduleResult, scheduler); } else { assertFalse(scheduleResult.isFinished()); } assertTrue(scheduleResult.getBlocked().isDone()); assertEquals(scheduleResult.getNewTasks().size(), i == 0 ? 3 : 0); assertEquals(stage.getAllTasks().size(), 3); assertPartitionedSplitCount(stage, min((i + 1) * 7, 60)); } for (RemoteTask remoteTask : stage.getAllTasks()) { assertEquals(remoteTask.getPartitionedSplitCount(), 20); } stage.abort(); }
Source:
private void testDoubleCheckpointHandling(ProcessingMode processingMode) throws Exception { WindowGenerator windowGenerator = new WindowGenerator(new ScheduledThreadPoolExecutor(1, "WindowGenerator"), 1024); windowGenerator.setResetWindow(0L); windowGenerator.setFirstWindow(0L); windowGenerator.setWindowWidth(100); windowGenerator.setCheckpointCount(1, 0); GenericCheckpointOperator gco = new GenericCheckpointOperator(); DefaultAttributeMap dam = new DefaultAttributeMap(); dam.put(OperatorContext.APPLICATION_WINDOW_COUNT, 2); dam.put(OperatorContext.CHECKPOINT_WINDOW_COUNT, 2); final GenericNode in = new GenericNode(gco, new com.datatorrent.stram.engine.OperatorContext(0, dam, null)); in.setId(1); TestSink testSink = new TestSink(); in.connectInputPort("ip1", windowGenerator.acquireReservoir(String.valueOf(in.id), 1024)); in.connectOutputPort("output", testSink); windowGenerator.activate(null); final AtomicBoolean ab = new AtomicBoolean(false); Thread t = new Thread() { @Override public void run() { ab.set(true); in.activate(); in.run(); in.deactivate(); } }; t.start(); Thread.sleep(3000); t.stop(); windowGenerator.deactivate(); Assert.assertFalse(gco.checkpointTwice); }

Target:
private void testDoubleCheckpointHandling(ProcessingMode processingMode) throws Exception { WindowGenerator windowGenerator = new WindowGenerator(new ScheduledThreadPoolExecutor(1, "WindowGenerator"), 1024); windowGenerator.setResetWindow(0L); windowGenerator.setFirstWindow(0L); windowGenerator.setWindowWidth(100); windowGenerator.setCheckpointCount(1, 0); GenericCheckpointOperator gco = new GenericCheckpointOperator(); DefaultAttributeMap dam = new DefaultAttributeMap(); dam.put(OperatorContext.APPLICATION_WINDOW_COUNT, 2); dam.put(OperatorContext.CHECKPOINT_WINDOW_COUNT, 2); dam.put(OperatorContext.PROCESSING_MODE, processingMode); final GenericNode in = new GenericNode(gco, new com.datatorrent.stram.engine.OperatorContext(0, dam, null)); in.setId(1); TestSink testSink = new TestSink(); in.connectInputPort("ip1", windowGenerator.acquireReservoir(String.valueOf(in.id), 1024)); in.connectOutputPort("output", testSink); windowGenerator.activate(null); final AtomicBoolean ab = new AtomicBoolean(false); Thread t = new Thread() { @Override public void run() { ab.set(true); in.activate(); in.run(); in.deactivate(); } }; t.start(); long startTime = System.currentTimeMillis(); long endTime = 0; while (gco.numWindows < 3 && ((endTime = System.currentTimeMillis()) - startTime) < 5000) { Thread.sleep(50); } in.shutdown(); t.join(); windowGenerator.deactivate(); Assert.assertFalse(gco.checkpointTwice); Assert.assertTrue("Timed out", (endTime - startTime) < 5000); }
Source:
public void blockedLockRequestThrows503OnLeaderElection() throws InterruptedException { LockRefreshToken lock = CLUSTER.lock(CLIENT_1, BLOCKING_LOCK_REQUEST); assertThat(lock).isNotNull(); TestableTimelockServer leader = CLUSTER.currentLeader(); Future<LockRefreshToken> lock2 = Executors.newSingleThreadExecutor() .submit(() -> leader.lock(CLIENT_2, BLOCKING_LOCK_REQUEST)); Uninterruptibles.sleepUninterruptibly(5, TimeUnit.SECONDS); CLUSTER.nonLeaders().forEach(TestableTimelockServer::kill); assertThatThrownBy(() -> leader.lock(CLIENT_3, BLOCKING_LOCK_REQUEST)) .satisfies(ExceptionMatchers::isRetryableExceptionWhereLeaderCannotBeFound); try { lock2.get(); fail(String.format("Lock client %s should have thrown an execution exception as leader is not available", CLIENT_2)); } catch (ExecutionException e) { assertThat(e.getCause()).satisfies(ExceptionMatchers::isRetryableExceptionWhereLeaderCannotBeFound); } }

Target:
public void blockedLockRequestThrows503OnLeaderElection() throws InterruptedException { LockRefreshToken lock = CLUSTER.lock(CLIENT_1, BLOCKING_LOCK_REQUEST); assertThat(lock).isNotNull(); TestableTimelockServer leader = CLUSTER.currentLeader(); CompletableFuture<LockRefreshToken> lockRefreshTokenCompletableFuture = CompletableFuture.supplyAsync(() -> { try { return leader.lock(CLIENT_2, BLOCKING_LOCK_REQUEST); } catch (InterruptedException e) { return null; } }); Uninterruptibles.sleepUninterruptibly(5, TimeUnit.SECONDS); CLUSTER.nonLeaders().forEach(TestableTimelockServer::kill); assertThatThrownBy(() -> leader.lock(CLIENT_3, BLOCKING_LOCK_REQUEST)) .satisfies(ExceptionMatchers::isRetryableExceptionWhereLeaderCannotBeFound); assertThat(catchThrowable(lockRefreshTokenCompletableFuture::get).getCause()) .satisfies(ExceptionMatchers::isRetryableExceptionWhereLeaderCannotBeFound); }
Source:
public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { assert (!PlatformUtil.isHeadless()); login(monitor); synchronized (deployLock) { doDeployBDM(monitor); } }

Target:
public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { Preconditions.checkState(!PlatformUtil.isHeadless()); login(monitor); synchronized (deployLock) { doDeployBDM(monitor); } }
Source:
private OAuth2AuthorizationRequest getB2CAuthorizationRequest(@Nullable OAuth2AuthorizationRequest request, String userFlow) { Assert.hasText(userFlow, "User flow should contain text."); if (request == null) { return null; } cleanupSecurityContextAuthentication(); final Map<String, Object> additional = this.properties.getAdditional(); this.properties.getAdditional().put("p", userFlow); this.properties.getAdditional().put(PARAMETER_X_CLIENT_SKU, AAD_B2C_USER_AGENT); return OAuth2AuthorizationRequest.from(request).additionalParameters(additional).build(); }

Target:
private OAuth2AuthorizationRequest getB2CAuthorizationRequest(@Nullable OAuth2AuthorizationRequest request, String userFlow) { Assert.hasText(userFlow, "User flow should contain text."); if (request == null) { return null; } cleanupSecurityContextAuthentication(); final Map<String, Object> additionalParameters = new HashMap<>(); Optional.ofNullable(this.properties) .map(AADB2CProperties::getAuthenticateAdditionalParameters) .ifPresent(additionalParameters::putAll); additionalParameters.put("p", userFlow); additionalParameters.put(PARAMETER_X_CLIENT_SKU, AAD_B2C_USER_AGENT); return OAuth2AuthorizationRequest.from(request).additionalParameters(additionalParameters).build(); }
Source:
public List metacardValueToJsonValue(WorkspaceTransformer transformer, List metacardValue) { return ((List<String>) metacardValue) .stream() .filter(StringUtils::isNotBlank) .collect(Collectors.toList()); }

Target:
public Optional<List> metacardValueToJsonValue( WorkspaceTransformer transformer, List metacardValue) { return Optional.of( ((List<Object>) metacardValue) .stream() .filter(String.class::isInstance) .map(String.class::cast) .filter(StringUtils::isNotBlank) .collect(Collectors.toList())); }
Source:
public void impl(@Nonnull CorfuRuntime runtime) throws Exception { runtime.invalidateLayout(); Layout layout = new Layout(runtime.getLayoutView().getLayout()); runtime.getLayoutManagementView().removeNode(layout, request.getEndpoint()); }

Target:
public void impl(@Nonnull CorfuRuntime runtime) throws Exception { Layout layout = new Layout(runtime.getLayoutView().getLayout()); runtime.getLayoutManagementView().removeNode(layout, request.getEndpoint()); }
Source:
public ScrollServiceImpl(List<ScrollDescriptor> scrollDescriptors) { descriptors = new HashMap<>(scrollDescriptors.size()); scrollDescriptors.forEach(descriptor -> descriptors.put(descriptor.getName(), descriptor)); scrollDescriptors.stream() .filter(ScrollDescriptor::isDefault) .forEach( descriptor -> descriptors.put(DocumentScrollRequest.Builder.DEFAULT_TYPE, descriptor)); }

Target:
public ScrollServiceImpl(List<ScrollDescriptor> scrollDescriptors) { descriptors = new HashMap<>(scrollDescriptors.size()); scrollDescriptors.forEach(descriptor -> descriptors.put(getKey(descriptor), descriptor)); scrollDescriptors.stream() .filter(ScrollDescriptor::isDefault) .forEach(descriptor -> descriptors.put(getDefaultKey(descriptor), descriptor)); }
Source:
private List<HasMetadata> unmarshalDefaultEnvObjects(WorkspaceConfigImpl workspaceConfig) throws DevfileException { String defaultEnvName = workspaceConfig.getDefaultEnv(); if (defaultEnvName == null) { return new ArrayList<>(); } EnvironmentImpl defaultEnv = workspaceConfig.getEnvironments().get(defaultEnvName); if (defaultEnv == null) { return new ArrayList<>(); } RecipeImpl envRecipe = defaultEnv.getRecipe(); if (!OpenShiftEnvironment.TYPE.equals(envRecipe.getType()) && !KubernetesEnvironment.TYPE.equals(envRecipe.getType())) { throw new DevfileException( String.format( "Kubernetes tool can not be applied to workspace with recipe with not " + "kubernetes nor openshift type but is has recipe with type '%s'", envRecipe.getType())); } return unmarshal(envRecipe.getContent()); }

Target:
private List<HasMetadata> unmarshalDefaultEnvObjects(WorkspaceConfigImpl workspaceConfig) throws DevfileException { String defaultEnvName = workspaceConfig.getDefaultEnv(); if (defaultEnvName == null) { return new ArrayList<>(); } EnvironmentImpl defaultEnv = workspaceConfig.getEnvironments().get(defaultEnvName); if (defaultEnv == null) { return new ArrayList<>(); } RecipeImpl envRecipe = defaultEnv.getRecipe(); if (!OpenShiftEnvironment.TYPE.equals(envRecipe.getType()) && !KubernetesEnvironment.TYPE.equals(envRecipe.getType())) { throw new DevfileException( format( "Kubernetes tool can only be applied to a workspace with either kubernetes or " + "openshift recipe type but workspace has a recipe of type '%s'", envRecipe.getType())); } return unmarshal(envRecipe.getContent()); }
Source:
private PoolingHttpClientConnectionManager createInsecureTlsConnectionManager() { try { SSLContext sslContext = SSLContextBuilder .create() .loadTrustMaterial(new TrustSelfSignedStrategy()) .build(); HostnameVerifier allowAllHosts = new NoopHostnameVerifier(); SSLConnectionSocketFactory connectionFactory = new SSLConnectionSocketFactory(sslContext, allowAllHosts); Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder .<ConnectionSocketFactory>create().register("https", connectionFactory) .build(); PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager( socketFactoryRegistry); return cm; } catch (NoSuchAlgorithmException | KeyManagementException | KeyStoreException e) { e.printStackTrace(); } return null; }

Target:
private PoolingHttpClientConnectionManager createInsecureTlsConnectionManager() { try { SSLContext sslContext = SSLContextBuilder .create() .loadTrustMaterial(new TrustSelfSignedStrategy()) .build(); HostnameVerifier allowAllHosts = new NoopHostnameVerifier(); SSLConnectionSocketFactory connectionFactory = new SSLConnectionSocketFactory(sslContext, allowAllHosts); Registry<ConnectionSocketFactory> socketFactoryRegistry = RegistryBuilder .<ConnectionSocketFactory>create().register("https", connectionFactory) .build(); return new PoolingHttpClientConnectionManager(socketFactoryRegistry); } catch (NoSuchAlgorithmException | KeyManagementException | KeyStoreException e) { throw new RuntimeException(e); } }
Source:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { Log.v(TAG, "onActivityResult: " + requestCode + ", " + resultCode + ", " + data); super.onActivityResult(requestCode, resultCode, data); if (resultCode == RESULT_OK) { Bundle bundle = data.getExtras(); String cookie = bundle.getString("cookie"); Log.v(TAG, "cookie outside: " + cookie); _cookie = cookie; new ResourceAccessAsyncTask().execute(authorization_resource_url+"12345"); } }

Target:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { Log.v(TAG, "onActivityResult: " + requestCode + ", " + resultCode + ", " + data); super.onActivityResult(requestCode, resultCode, data); String AIS_WEBVIEW_COOKIE = getResources().getString(R.string.ais_webview_cookie); if (resultCode == RESULT_OK) { authorizationCookie = data.getExtras().getString(AIS_WEBVIEW_COOKIE); new ResourceAccessAsyncTask().execute(authorizationResourceUrl+"12345"); } }
Source:
public boolean pollSocketsInfo() { if (!mDependencies.isTcpInfoParsingSupported()) return false; FileDescriptor fd = null; try { final long time = SystemClock.elapsedRealtime(); fd = mDependencies.connectToKernel(); mTcpStats.clear(); for (final int family : ADDRESS_FAMILIES) { mDependencies.sendPollingRequest(fd, mSockDiagMsg.get(family)); final ByteBuffer bytes = mDependencies.recvMesssage(fd); while (enoughBytesRemainForValidNlMsg(bytes)) { final StructNlMsgHdr nlmsghdr = StructNlMsgHdr.parse(bytes); final int nlmsgLen = nlmsghdr.nlmsg_len; log("pollSocketsInfo: nlmsgLen=" + nlmsgLen); if (isValidInetDiagMsgSize(nlmsgLen)) { bytes.position(bytes.position() + StructInetDiagMsg.STRUCT_SIZE - 7 * Integer.BYTES); final long cookie = bytes.getLong(); bytes.position(bytes.position() + 5 * Integer.BYTES); final SocketInfo info = parseSockInfo(bytes, family, nlmsgLen, time); mTcpStats.put(cookie, makeTcpStat(info, mSocketInfos.get(cookie))); mSocketInfos.put(cookie, info); } if (nlmsghdr.nlmsg_type == NLMSG_DONE) break; } } cleanupSocketInfo(time); return true; } catch (ErrnoException | SocketException | InterruptedIOException e) { Log.e(TAG, "Fail to get TCP info via netlink.", e); } finally { NetworkStackUtils.closeSocketQuietly(fd); } return false; }

Target:
public boolean pollSocketsInfo() { if (!mDependencies.isTcpInfoParsingSupported()) return false; FileDescriptor fd = null; try { final long time = SystemClock.elapsedRealtime(); fd = mDependencies.connectToKernel(); final TcpStat stat = new TcpStat(); for (final int family : ADDRESS_FAMILIES) { mDependencies.sendPollingRequest(fd, mSockDiagMsg.get(family)); final ByteBuffer bytes = mDependencies.recvMesssage(fd); while (enoughBytesRemainForValidNlMsg(bytes)) { final StructNlMsgHdr nlmsghdr = StructNlMsgHdr.parse(bytes); final int nlmsgLen = nlmsghdr.nlmsg_len; log("pollSocketsInfo: nlmsghdr=" + nlmsghdr); if (nlmsghdr.nlmsg_type == NLMSG_DONE) break; if (isValidInetDiagMsgSize(nlmsgLen)) { bytes.position(bytes.position() + IDIAG_COOKIE_OFFSET); final long cookie = bytes.getLong(); bytes.position(bytes.position() + 5 * Integer.BYTES); final SocketInfo info = parseSockInfo(bytes, family, nlmsgLen, time); stat.accumulate(calculateLatestPacketsStat(info, mSocketInfos.get(cookie))); mSocketInfos.put(cookie, info); } } } mSentSinceLastRecv = (stat.receivedCount == 0) ? (mSentSinceLastRecv + stat.sentCount) : 0; mLatestPacketFailRate = ((stat.sentCount != 0) ? ((stat.retransmitCount + stat.lostCount) * 100 / stat.sentCount) : 0); cleanupSocketInfo(time); return true; } catch (ErrnoException | SocketException | InterruptedIOException e) { Log.e(TAG, "Fail to get TCP info via netlink.", e); } finally { NetworkStackUtils.closeSocketQuietly(fd); } return false; }
Source:
private Map<String, BasicAuthenticatorUser> fetchUserMapFromCoordinator(String prefix, boolean isInit) { try { return RetryUtils.retry( () -> { return tryFetchUserMapFromCoordinator(prefix); }, e -> true, commonCacheConfig.getMaxSyncRetries() ); } catch (Exception e) { LOG.makeAlert(e, "Encountered exception while fetching user map for authenticator [%s]", prefix); if (isInit) { if (commonCacheConfig.getCacheDirectory() != null) { try { LOG.info("Attempting to load user map snapshot from disk."); return loadUserMapFromDisk(prefix); } catch (Exception e2) { LOG.makeAlert(e2, "Encountered exception while loading user map snapshot for authenticator [%s]", prefix); } } } return null; } }

Target:
private Map<String, BasicAuthenticatorUser> fetchUserMapFromCoordinator(String prefix, boolean isInit) { try { return RetryUtils.retry( () -> { return tryFetchUserMapFromCoordinator(prefix); }, e -> true, commonCacheConfig.getMaxSyncRetries() ); } catch (Exception e) { LOG.makeAlert(e, "Encountered exception while fetching user map for authenticator [%s]", prefix); if (isInit) { if (commonCacheConfig.getCacheDirectory() != null) { try { LOG.info("Attempting to load user map snapshot from disk."); return loadUserMapFromDisk(prefix); } catch (Exception e2) { e2.addSuppressed(e); LOG.makeAlert(e2, "Encountered exception while loading user map snapshot for authenticator [%s]", prefix); } } } return null; } }
Source:
protected void terminateMappedConfigurations(IResource resource) { ILaunch[] launches = getLaunches(); ILaunchConfiguration[] configs = getMappedConfigurations(resource); try { for (ILaunch launche : launches) { for (ILaunchConfiguration config : configs) { if(config.equals(launche.getLaunchConfiguration()) & launche.canTerminate()) { launche.terminate(); } } } } catch(CoreException e) {DebugPlugin.log(e);} }

Target:
protected void terminateMappedConfigurations(IResource resource) { ILaunch[] launches = getLaunches(); ILaunchConfiguration[] configs = getMappedConfigurations(resource); try { for (ILaunch launch : launches) { for (ILaunchConfiguration config : configs) { if(config.equals(launch.getLaunchConfiguration()) & launch.canTerminate()) { launch.terminate(); } } } } catch(CoreException e) {DebugPlugin.log(e);} }
Source:
public List<PartitionDescProto> getPartitionsByAlgebra(PartitionsByAlgebraProto request) { throw new TajoRuntimeException(new UnsupportedException("getPartitionsByAlgebra")); }

Target:
public List<PartitionDescProto> getPartitionsByAlgebra(PartitionsByAlgebraProto request) throws UndefinedDatabaseException, UndefinedTableException, UndefinedPartitionMethodException { List<PartitionDescProto> list = null; try { String databaseName = request.getDatabaseName(); String tableName = request.getTableName(); TableDescProto tableDesc = getTable(databaseName, tableName); String filter = getFilter(databaseName, tableName, tableDesc.getPartition().getExpressionSchema().getFieldsList() , request.getAlgebra()); list = getPartitionsByFilterFromHiveMetaStore(databaseName, tableName, filter); } catch (Exception se) { throw new TajoInternalError(se); } return list; }
Source:
public GitHubLastUpdateCache() { this(new File(DRONE_TARGET_DIRECTORY + File.separator + "gh_cache" + File.separator)); }

Target:
public GitHubLastUpdateCache() { this(DEFAULT_CACHE_DIRECTORY); }
Source:
public static DiscloseRequestMessageDTO createInstance(UserDTO actingUser, DiscloseRequestMessage messageEntity) { GoalConflictMessage targetGoalConflictMessage = messageEntity.getTargetGoalConflictMessage(); return new DiscloseRequestMessageDTO(messageEntity.getID(), messageEntity.getCreationTime(), actingUser, messageEntity.getNickname(), messageEntity.getMessage(), messageEntity.getStatus(), targetGoalConflictMessage.getOriginGoalConflictMessageID(), GoalConflictMessageDTO.createInstance(targetGoalConflictMessage, null)); }

Target:
public static DiscloseRequestMessageDTO createInstance(UserDTO actingUser, DiscloseRequestMessage messageEntity) { GoalConflictMessage targetGoalConflictMessage = messageEntity.getTargetGoalConflictMessage(); return new DiscloseRequestMessageDTO(messageEntity.getID(), messageEntity.getCreationTime(), UserDTO.createInstanceIfNotNull(messageEntity.getUser()), messageEntity.getNickname(), messageEntity.getMessage(), messageEntity.getStatus(), targetGoalConflictMessage.getOriginGoalConflictMessageID(), GoalConflictMessageDTO.createInstance(targetGoalConflictMessage, null)); }
Source:
private ExpectedCondition<?> getDefaultCondition(By myBy) { ExpectedCondition<?> waitCondition = null; switch (loadingStrategy) { case BY_PRESENCE: { if (element != null) { waitCondition = ExpectedConditions.or(ExpectedConditions.presenceOfElementLocated(myBy), ExpectedConditions.visibilityOf(element)); } else { waitCondition = ExpectedConditions.presenceOfElementLocated(myBy); } break; } case BY_VISIBILITY: { if (element != null) { waitCondition = ExpectedConditions.or(ExpectedConditions.visibilityOfElementLocated(myBy), ExpectedConditions.visibilityOf(element)); } else { waitCondition = ExpectedConditions.visibilityOfElementLocated(myBy); } break; } case BY_PRESENCE_VISIBILITY: if (element != null) { waitCondition = ExpectedConditions.or(ExpectedConditions.presenceOfElementLocated(myBy), ExpectedConditions.visibilityOfElementLocated(myBy), ExpectedConditions.visibilityOf(element)); } else { waitCondition = ExpectedConditions.or(ExpectedConditions.presenceOfElementLocated(myBy), ExpectedConditions.visibilityOfElementLocated(myBy)); } break; } return waitCondition; }

Target:
private ExpectedCondition<?> getDefaultCondition(By myBy) { ExpectedCondition<?> waitCondition = null; switch (loadingStrategy) { case BY_PRESENCE: { if (element != null) { waitCondition = ExpectedConditions.or(ExpectedConditions.presenceOfElementLocated(myBy), ExpectedConditions.visibilityOf(element)); } else { waitCondition = ExpectedConditions.presenceOfElementLocated(myBy); } break; } case BY_VISIBILITY: { if (element != null) { waitCondition = ExpectedConditions.or(ExpectedConditions.visibilityOfElementLocated(myBy), ExpectedConditions.visibilityOf(element)); } else { waitCondition = ExpectedConditions.visibilityOfElementLocated(myBy); } break; } case BY_PRESENCE_OR_VISIBILITY: if (element != null) { waitCondition = ExpectedConditions.or(ExpectedConditions.presenceOfElementLocated(myBy), ExpectedConditions.visibilityOfElementLocated(myBy), ExpectedConditions.visibilityOf(element)); } else { waitCondition = ExpectedConditions.or(ExpectedConditions.presenceOfElementLocated(myBy), ExpectedConditions.visibilityOfElementLocated(myBy)); } break; } return waitCondition; }
Source:
public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) { cursor.moveToPosition(-1); List<TruckCluster> markers = new ArrayList<>(); while (cursor.moveToNext()) { Truck truck = new Truck.Builder() .id(cursor.getString(ActiveTrucksQuery.INTERNAL_ID)) .name(cursor.getString(ActiveTrucksQuery.NAME)) .build(); LatLng location = new LatLng(cursor.getDouble(ActiveTrucksQuery.LATITUDE), cursor.getDouble(ActiveTrucksQuery.LONGITUDE)); markers.add(createTruckMarker(location)); } clusterManager.clearItems(); clusterManager.addItems(markers); }

Target:
public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) { cursor.moveToPosition(-1); List<TruckCluster> markers = new ArrayList<>(); while (cursor.moveToNext()) { Truck truck = new Truck.Builder() .id(cursor.getString(ActiveTrucksQuery.INTERNAL_ID)) .name(cursor.getString(ActiveTrucksQuery.NAME)) .build(); LatLng location = new LatLng(cursor.getDouble(ActiveTrucksQuery.LATITUDE), cursor.getDouble(ActiveTrucksQuery.LONGITUDE)); markers.add(new TruckCluster(truck, location)); } if (clusterManager != null) { clusterManager.clearItems(); clusterManager.addItems(markers); } }
Source:
public static void sleep(int timeInMillis) { try { if (timeInMillis > 0) { LOG.info("Sleep time set to:" + timeInMillis + " ms"); Thread.sleep(timeInMillis); } } catch (InterruptedException e) { e.printStackTrace(); } }

Target:
public static void sleep(int timeInMillis) { try { if (timeInMillis > 0) { LOG.info("Sleep time set to:" + timeInMillis + " ms"); Thread.sleep(timeInMillis); } } catch (InterruptedException e) { LOG.error("Exception while thread sleep", e); throw new RuntimeException(e); } }