auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void performBoottime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { WildFlyTracerFactory.registerTracer(ENV_TRACER).accept(new JaegerEnvTracerConfiguration()); TracingExtensionLogger.ROOT_LOGGER.activatingSubsystem(); context.addStep(new AbstractDeploymentChainStep() { @Override public void execute(DeploymentProcessorTarget processorTarget) { processorTarget.addDeploymentProcessor( SubsystemExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_MICROPROFILE_OPENTRACING, new TracingDependencyProcessor() ); processorTarget.addDeploymentProcessor(SubsystemExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_MICROPROFILE_OPENTRACING, new TracingDeploymentProcessor() ); } }, OperationContext.Stage.RUNTIME); <START> super.performBoottime(context, operation, model); <END> }</code><technical_language>super implementation is a no-op design</technical_language>

Target:
protected void performBoottime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { WildFlyTracerFactory.registerTracer(ENV_TRACER).accept(new JaegerEnvTracerConfiguration()); TracingExtensionLogger.ROOT_LOGGER.activatingSubsystem();String defaultTracer = DEFAULT_TRACER.resolveModelAttribute(context, operation).asStringOrNull(); if (defaultTracer != null && !defaultTracer.isEmpty()) { CapabilityServiceBuilder<?> builder = context.getCapabilityServiceTarget().addCapability(DEFAULT_TRACER_CAPABILITY); final Supplier<TracerConfiguration> config = builder.requiresCapability(TRACER_CAPABILITY_NAME, TracerConfiguration.class, defaultTracer); final Consumer<TracerConfiguration> injector = builder.provides(DEFAULT_TRACER_CAPABILITY); builder.setInstance(new Service() { @Override public void start(StartContext context) throws StartException { injector.accept(config.get()); WildFlyTracerFactory.registerDefaultTracer().accept(config.get()); } @Override public void stop(StopContext context) { injector.accept(null); WildFlyTracerFactory.registerDefaultTracer().accept(config.get()); } }).setInitialMode(ServiceController.Mode.ACTIVE).install(); } context.addStep(new AbstractDeploymentChainStep() { @Override public void execute(DeploymentProcessorTarget processorTarget) { processorTarget.addDeploymentProcessor( SubsystemExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_MICROPROFILE_OPENTRACING, new TracingDependencyProcessor() ); processorTarget.addDeploymentProcessor(SubsystemExtension.SUBSYSTEM_NAME, Phase.POST_MODULE, Phase.POST_MODULE_MICROPROFILE_OPENTRACING, new TracingDeploymentProcessor() ); } }, OperationContext.Stage.RUNTIME); }
Source:
<code>private void copyArtifactToHistoryFolder(Path historyFolder, String fileName, String planKey, int buildId) throws Exception { URL artifactUrl = new URL(getHistoryArtifactUrl(fileName, planKey, buildId)); URLConnection uc = artifactUrl.openConnection(); <START> InputStream inputStream = uc.getInputStream(); <END> Files.copy(inputStream, historyFolder.resolve(fileName), StandardCopyOption.REPLACE_EXISTING); }</code><technical_language>try-with-resources</technical_language>

Target:
private void copyArtifactToHistoryFolder(Path historyFolder, String fileName, String planKey, int buildId) { try (InputStream inputStream = getArtifactContent(fileName, planKey, buildId)) { Files.createDirectories(historyFolder); Files.copy(inputStream, historyFolder.resolve(fileName), StandardCopyOption.REPLACE_EXISTING); } catch (IOException e) { LOGGER.error("Could not copy file {}", fileName); } }
Source:
<code>void delete() { DownloadBatchStatus.Status status = downloadBatchStatus.status(); if (status == DELETING || status == DELETED) { Logger.v(BATCH + downloadBatchStatus.getDownloadBatchId().rawId() + STATUS + status + " abort delete batch"); return; } downloadBatchStatus.markAsDeleting(); Logger.v("delete request for " + BATCH + downloadBatchStatus.getDownloadBatchId().rawId() + STATUS + status + ", should be deleting"); notifyCallback(callback, downloadBatchStatus); for (DownloadFile downloadFile : downloadFiles) { downloadFile.delete(); } <START> deleteDownloadDirs(); <END> if (status == PAUSED || status == DOWNLOADED || status == WAITING_FOR_NETWORK || status == ERROR) { Logger.v("delete async paused or downloaded " + BATCH + downloadBatchStatus.getDownloadBatchId().rawId()); downloadsBatchPersistence.deleteAsync(downloadBatchStatus, downloadBatchId -> { Logger.v("delete paused or downloaded mark as deleted: " + downloadBatchId.rawId()); downloadBatchStatus.markAsDeleted(); notifyCallback(callback, downloadBatchStatus); }); } Logger.v("delete request for " + BATCH + "end " + downloadBatchStatus.getDownloadBatchId().rawId() + STATUS + status + ", should be deleting"); }</code><technical_language>Deleting files deleting directories is overkill. delete directories grab of files a directory attempt delete them</technical_language>

Target:
void delete() { DownloadBatchStatus.Status status = downloadBatchStatus.status(); if (status == DELETING || status == DELETED) { Logger.v(BATCH + downloadBatchStatus.getDownloadBatchId().rawId() + STATUS + status + " abort delete batch"); return; } downloadBatchStatus.markAsDeleting(); Logger.v("delete request for " + BATCH + downloadBatchStatus.getDownloadBatchId().rawId() + STATUS + status + ", should be deleting"); notifyCallback(callback, downloadBatchStatus); for (DownloadFile downloadFile : downloadFiles) { downloadFile.delete(); } deleteDownloadDirectories(); if (status == PAUSED || status == DOWNLOADED || status == WAITING_FOR_NETWORK || status == ERROR) { Logger.v("delete async paused or downloaded " + BATCH + downloadBatchStatus.getDownloadBatchId().rawId()); downloadsBatchPersistence.deleteAsync(downloadBatchStatus, downloadBatchId -> { Logger.v("delete paused or downloaded mark as deleted: " + downloadBatchId.rawId()); downloadBatchStatus.markAsDeleted(); notifyCallback(callback, downloadBatchStatus); }); } Logger.v("delete request for " + BATCH + "end " + downloadBatchStatus.getDownloadBatchId().rawId() + STATUS + status + ", should be deleting"); }
Source:
<code>private void validateSections(List<StudentAttributes> studentList, String courseId) throws EntityDoesNotExistException, EnrollException { List<StudentAttributes> mergedList = new ArrayList<StudentAttributes>(); List<StudentAttributes> studentsInCourse = getStudentsForCourse(courseId); for(StudentAttributes student : studentList) { mergedList.add(student); } for(StudentAttributes student : studentsInCourse) { if(!isInEnrollList(student, mergedList)){ mergedList.add(student); } } if(mergedList.size() < 2){ return; } Collections.sort(mergedList, new Comparator<StudentAttributes>() { @Override public int compare(StudentAttributes o1, StudentAttributes o2) { return o1.team.compareTo(o2.team); } }); String errorMessage = ""; List<String> invalidTeamList = new ArrayList<String>(); for(int i = 1; i < mergedList.size(); i++){ StudentAttributes currentStudent = mergedList.get(i); StudentAttributes previousStudent = mergedList.get(i-1); if(currentStudent.team.equals(previousStudent.team) && !currentStudent.section.equals(previousStudent.section)){ if(!invalidTeamList.contains(currentStudent.team)){ invalidTeamList.add(currentStudent.team); } } } for(String team : invalidTeamList){ <START> errorMessage += "Cannot put team \"" + team + "\" in 2 different sections<br>"; <END> } if(!errorMessage.equals("")){ throw new EnrollException(errorMessage); } }</code><technical_language>Define this message somewhere</technical_language>

Target:
public void validateSections(List<StudentAttributes> studentList, String courseId) throws EntityDoesNotExistException, EnrollException { List<StudentAttributes> mergedList = new ArrayList<StudentAttributes>(); List<StudentAttributes> studentsInCourse = getStudentsForCourse(courseId); for(StudentAttributes student : studentList) { mergedList.add(student); } for(StudentAttributes student : studentsInCourse) { if(!isInEnrollList(student, mergedList)){ mergedList.add(student); } } if(mergedList.size() < 2){ return; } Collections.sort(mergedList, new Comparator<StudentAttributes>() { @Override public int compare(StudentAttributes o1, StudentAttributes o2) { return o1.team.compareTo(o2.team); } }); String errorMessage = ""; List<String> invalidTeamList = new ArrayList<String>(); for(int i = 1; i < mergedList.size(); i++){ StudentAttributes currentStudent = mergedList.get(i); StudentAttributes previousStudent = mergedList.get(i-1); if(currentStudent.team.equals(previousStudent.team) && !currentStudent.section.equals(previousStudent.section)){ if(!invalidTeamList.contains(currentStudent.team)){ invalidTeamList.add(currentStudent.team); } } } for(String team : invalidTeamList){ errorMessage += String.format(Const.StatusMessages.TEAM_INVALID_SECTION_EDIT, team); } if(!errorMessage.equals("")){ throw new EnrollException(errorMessage); } }
Source:
<code>public Message read() { assert hasNext(); <START> if (nMessages++ % checkMessagesPerSecond == 0) { <END> RateLimitUtil.acquire(checkMessagesPerSecond); } MessageAndMetadata<byte[], byte[]> kafkaMessage = mIterator.next(); Message message = new Message(kafkaMessage.topic(), kafkaMessage.partition(), kafkaMessage.offset(), kafkaMessage.message()); TopicPartition topicPartition = new TopicPartition(message.getTopic(), message.getKafkaPartition()); updateAccessTime(topicPartition); long committedOffsetCount = mOffsetTracker.getTrueCommittedOffsetCount(topicPartition); LOG.debug("read message {}", message); if (nMessages % checkMessagesPerSecond == 0) { exportStats(); } if (message.getOffset() < committedOffsetCount) { LOG.debug("skipping message message " + message + " because its offset precedes " + "committed offset count " + committedOffsetCount); return null; } return message; }</code><technical_language>nMessages = (nMessages + 1) % checkMessagesPerSecond prevent overflow</technical_language>

Target:
public Message read() { assert hasNext(); mNMessages = (mNMessages + 1) % mCheckMessagesPerSecond; if (mNMessages % mCheckMessagesPerSecond == 0) { RateLimitUtil.acquire(mCheckMessagesPerSecond); } MessageAndMetadata<byte[], byte[]> kafkaMessage = mIterator.next(); Message message = new Message(kafkaMessage.topic(), kafkaMessage.partition(), kafkaMessage.offset(), kafkaMessage.message()); TopicPartition topicPartition = new TopicPartition(message.getTopic(), message.getKafkaPartition()); updateAccessTime(topicPartition); long committedOffsetCount = mOffsetTracker.getTrueCommittedOffsetCount(topicPartition); LOG.debug("read message {}", message); if (mNMessages % mCheckMessagesPerSecond == 0) { exportStats(); } if (message.getOffset() < committedOffsetCount) { LOG.debug("skipping message because its offset precedes committed offset count {}", message, committedOffsetCount); return null; } return message; }
Source:
<code>public TaskAdded handle(AddTask cmd, CommandContext ctx) { <START> return Given.EventMessage.taskAddedMsg(cmd.getProjectId()); <END> }</code><technical_language>duplication, too. Rename Given.EventMessage.taskAdded(). approach in class, Event, EventMessage, Command CommandMessage classes</technical_language>

Target:
public TaskAdded handle(AddTask cmd, CommandContext ctx) { return Given.EventMessage.taskAdded(cmd.getProjectId()); }
Source:
<code>public void process(Exchange exchange) throws Exception { final Message in = exchange.getIn(); String binaryUri = (String) in.getHeader(FCREPO_URI); <START> String binaryMimeType = (String) in.getHeader(CdrBinaryMimeType); <END> String binaryPath = (String) in.getHeader(CdrBinaryPath); String derivativePath = binaryPath + fileSuffix; String text = extractText(binaryPath); writeFile(derivativePath, text); InputStream binaryStream = new FileInputStream(derivativePath); BinaryObject binary = repository.getBinary(PIDs.get(binaryUri)); FileObject parent = (FileObject) binary.getParent(); parent.addDerivative(slug, binaryStream, derivativePath, binaryMimeType, PcdmUse.ExtractedText); log.info("Adding derivative for from {}", binaryUri, derivativePath); }</code><technical_language>params defined</technical_language>

Target:
public void process(Exchange exchange) throws Exception { final Message in = exchange.getIn(); String binaryUri = (String) in.getHeader(FCREPO_URI); String binaryMimeType = (String) in.getHeader(CdrBinaryMimeType); String binaryPath = (String) in.getHeader(CdrBinaryPath); String text = extractText(binaryPath); InputStream binaryStream = new ByteArrayInputStream(text.getBytes(StandardCharsets.UTF_8)); BinaryObject binary = repository.getBinary(PIDs.get(binaryUri)); FileObject parent = (FileObject) binary.getParent(); parent.addDerivative(slug, binaryStream, fileName, binaryMimeType, PcdmUse.ExtractedText); log.info("Adding derivative for from {}", binaryUri, fileName); }
Source:
<code>private void activateDisplayPreferences() { showOwnOffersInOfferBook.setSelected(preferences.isShowOwnOffersInOfferBook()); showOwnOffersInOfferBook.setOnAction(e -> preferences.setShowOwnOffersInOfferBook(showOwnOffersInOfferBook.isSelected())); useAnimations.setSelected(preferences.isUseAnimations()); useAnimations.setOnAction(e -> preferences.setUseAnimations(useAnimations.isSelected())); useDarkMode.setSelected(preferences.getCssTheme() == 1); useDarkMode.setOnAction(e -> preferences.setCssTheme(useDarkMode.isSelected())); sortMarketCurrenciesNumerically.setSelected(preferences.isSortMarketCurrenciesNumerically()); sortMarketCurrenciesNumerically.setOnAction(e -> preferences.setSortMarketCurrenciesNumerically(sortMarketCurrenciesNumerically.isSelected())); resetDontShowAgainButton.setOnAction(e -> preferences.resetDontShowAgain()); if (displayStandbyModeFeature) { avoidStandbyMode.setSelected(!preferences.isUseStandbyMode()); avoidStandbyMode.setOnAction(e -> preferences.setUseStandbyMode(!avoidStandbyMode.isSelected())); <START> } <END> }</code><technical_language>suggestion } else { preferences.setUseStandbyMode(false) } I agree @ripcurlx, thus, change suggestion. I is a good place put it. Instead of attaching a switch, set false</technical_language>

Target:
private void activateDisplayPreferences() { showOwnOffersInOfferBook.setSelected(preferences.isShowOwnOffersInOfferBook()); showOwnOffersInOfferBook.setOnAction(e -> preferences.setShowOwnOffersInOfferBook(showOwnOffersInOfferBook.isSelected())); useAnimations.setSelected(preferences.isUseAnimations()); useAnimations.setOnAction(e -> preferences.setUseAnimations(useAnimations.isSelected())); useDarkMode.setSelected(preferences.getCssTheme() == 1); useDarkMode.setOnAction(e -> preferences.setCssTheme(useDarkMode.isSelected())); sortMarketCurrenciesNumerically.setSelected(preferences.isSortMarketCurrenciesNumerically()); sortMarketCurrenciesNumerically.setOnAction(e -> preferences.setSortMarketCurrenciesNumerically(sortMarketCurrenciesNumerically.isSelected())); resetDontShowAgainButton.setOnAction(e -> preferences.resetDontShowAgain()); if (displayStandbyModeFeature) { avoidStandbyMode.setSelected(!preferences.isUseStandbyMode()); avoidStandbyMode.setOnAction(e -> preferences.setUseStandbyMode(!avoidStandbyMode.isSelected())); } else { preferences.setUseStandbyMode(false); } }
Source:
<code>public void testWriteMultipleStringDataLinesThroughUDP() { String measurement = TestUtils.getRandomMeasurement(); this.influxDB.write(UDP_PORT, Arrays.asList( measurement + ",atag=test1 idle=100,usertime=10,system=1", measurement + ",atag=test2 idle=200,usertime=20,system=2", measurement + ",atag=test3 idle=300,usertime=30,system=3" )); Uninterruptibles.sleepUninterruptibly(2, TimeUnit.SECONDS); Query query = new Query("SELECT * FROM " + measurement + " GROUP BY *", UDP_DATABASE); QueryResult result = this.influxDB.query(query); Assertions.assertEquals(3, result.getResults().get(0).getSeries().size()); <START> Assertions.assertEquals(result.getResults().get(0).getSeries().get(0).getTags().get("atag"), "test1"); <END> Assertions.assertEquals(result.getResults().get(0).getSeries().get(1).getTags().get("atag"), "test2"); Assertions.assertEquals(result.getResults().get(0).getSeries().get(2).getTags().get("atag"), "test3"); }</code><technical_language>(minor adjustment) "expected value" parameter</technical_language>

Target:
public void testWriteMultipleStringDataLinesThroughUDP() { String measurement = TestUtils.getRandomMeasurement(); this.influxDB.write(UDP_PORT, Arrays.asList( measurement + ",atag=test1 idle=100,usertime=10,system=1", measurement + ",atag=test2 idle=200,usertime=20,system=2", measurement + ",atag=test3 idle=300,usertime=30,system=3" )); Uninterruptibles.sleepUninterruptibly(2, TimeUnit.SECONDS); Query query = new Query("SELECT * FROM " + measurement + " GROUP BY *", UDP_DATABASE); QueryResult result = this.influxDB.query(query); Assertions.assertEquals(3, result.getResults().get(0).getSeries().size()); Assertions.assertEquals("test1", result.getResults().get(0).getSeries().get(0).getTags().get("atag")); Assertions.assertEquals("test2", result.getResults().get(0).getSeries().get(1).getTags().get("atag")); Assertions.assertEquals("test3", result.getResults().get(0).getSeries().get(2).getTags().get("atag")); }
Source:
<code>protected void onNewIntent(Intent intent) { super.onNewIntent(intent); Log.d(TAG, "onNewIntent called"); requested = intent.getData(); if (requested == null) { Log.e(TAG, "Got null intent data in onNewIntent()"); return; } if (bound == null) { Log.e(TAG, "We're not bound in onNewIntent()"); return; } TerminalBridge requestedBridge = bound.getConnectedBridge(requested.getFragment()); int requestedIndex = 0; synchronized (pager) { if (requestedBridge == null) { try { Log.d(TAG, String.format("We couldnt find an existing bridge with URI=%s (nickname=%s)," + "so creating one now", requested.toString(), requested.getFragment())); requestedBridge = bound.openConnection(requested); } catch (Exception e) { Log.e(TAG, "Problem while trying to create new requested bridge from URI", e); return; } adapter.notifyDataSetChanged(); requestedIndex = adapter.getCount(); } else { final int flipIndex = bound.getBridges().indexOf(requestedBridge); if (flipIndex > requestedIndex) { requestedIndex = flipIndex; } } <START> pager.setCurrentItem(requestedIndex); <END> } }</code><technical_language>I this is missing updatePromptVisible(), etc., wrapped in a call setDisplayedTerminal( )</technical_language>

Target:
protected void onNewIntent(Intent intent) { super.onNewIntent(intent); Log.d(TAG, "onNewIntent called"); requested = intent.getData(); if (requested == null) { Log.e(TAG, "Got null intent data in onNewIntent()"); return; } if (bound == null) { Log.e(TAG, "We're not bound in onNewIntent()"); return; } TerminalBridge requestedBridge = bound.getConnectedBridge(requested.getFragment()); int requestedIndex = 0; synchronized (pager) { if (requestedBridge == null) { try { Log.d(TAG, String.format("We couldnt find an existing bridge with URI=%s (nickname=%s)," + "so creating one now", requested.toString(), requested.getFragment())); requestedBridge = bound.openConnection(requested); } catch (Exception e) { Log.e(TAG, "Problem while trying to create new requested bridge from URI", e); return; } adapter.notifyDataSetChanged(); requestedIndex = adapter.getCount(); } else { final int flipIndex = bound.getBridges().indexOf(requestedBridge); if (flipIndex > requestedIndex) { requestedIndex = flipIndex; } } setDisplayedTerminal(requestedIndex); } }
Source:
<code>public void dispose() { this.h.removeMessages(EVENT_DTMF_DONE); this.h.removeMessages(EVENT_PAUSE_DONE); this.h.removeMessages(EVENT_NEXT_POST_DIAL); this.parent.dispose(); <START> <END> this.h = null; this.owner = null; this.parent = null; }</code><technical_language>this.h.removeCallbacksAndMessages(null) instead. Done in Patch Set 2</technical_language>

Target:
public void dispose() { }
Source:
<code>public void setUp() throws Exception { FileUtils.forceMkdir(taskStoreDir); Mockito.when(jobsClientMock.getJobStatus(Mockito.any())) .thenReturn(JobStatus.STOPPED); Task task = new Task("localHost", "test-task", 0, new ArrayList<>(), ImmutableList.of("test-store")); Mockito.when(jobsClientMock.getTasks(Mockito.any())) .thenReturn(ImmutableList.of(task)); localStoreMonitor = new LocalStoreMonitor(new LocalStoreMonitorConfig(new MapConfig(config)), <START> new LocalStoreMonitorMetrics("TestMonitorName", new NoOpMetricsRegistry()), <END> jobsClientMock); }</code><technical_language>NoOpMetricsRegistry is longer new metrics tested</technical_language>

Target:
public void setUp() throws Exception { FileUtils.forceMkdir(taskStoreDir); taskStoreSize = taskStoreDir.getTotalSpace(); Mockito.when(jobsClientMock.getJobStatus(Mockito.any())) .thenReturn(JobStatus.STOPPED); Task task = new Task("localHost", "test-task", 0, new ArrayList<>(), ImmutableList.of("test-store")); Mockito.when(jobsClientMock.getTasks(Mockito.any())) .thenReturn(ImmutableList.of(task)); localStoreMonitorMetrics = new LocalStoreMonitorMetrics("TestMonitorName", new NoOpMetricsRegistry()); localStoreMonitor = new LocalStoreMonitor(new LocalStoreMonitorConfig(new MapConfig(config)), localStoreMonitorMetrics, jobsClientMock); }
Source:
<code>public static void main(String[] args) { XBeeDevice myDevice = new XBeeDevice(PORT, BAUD_RATE); try { <START> myDevice.connect(); <END> } catch (XBeeException e) { e.printStackTrace(); } catch (InvalidOperatingModeException e) { e.printStackTrace(); } myDevice.startlisteningForSerialData(new MySerialDataReceiveListener()); }</code><technical_language>method is called open(). java myDevice.open();</technical_language>

Target:
public static void main(String[] args) { XBeeDevice myDevice = new XBeeDevice(PORT, BAUD_RATE); try { myDevice.open(); } catch (XBeeException e) { e.printStackTrace(); } catch (InvalidOperatingModeException e) { e.printStackTrace(); } myDevice.startListeningForSerialData(new MySerialDataReceiveListener()); }
Source:
<code>public void checkOffsetsIncludeWeekends() { Map<LocalDate, Double> map = ImmutableMap.<LocalDate, Double>builder() .put(dt(2014, 12, 26), 14d) .put(dt(2014, 12, 29), 13d) .put(dt(2014, 12, 30), 12d) .put(dt(2014, 12, 31), 11d) .put(dt(2015, 1, 2), 11d) .put(dt(2015, 1, 5), 12d) .put(dt(2015, 1, 6), 13d) .put(dt(2015, 1, 7), 14d) .build(); LocalDateDoubleTimeSeries ts = LocalDateDoubleTimeSeries.builder().putAll(map).build(); <START> assertThat(ts.get(dt(2014, 12, 26))).hasValue(14d); <END> assertThat(ts.get(dt(2014, 12, 27))).isEqualTo(OptionalDouble.empty()); assertThat(ts.get(dt(2014, 12, 28))).isEqualTo(OptionalDouble.empty()); assertThat(ts.get(dt(2014, 12, 29))).hasValue(13d); assertThat(ts.get(dt(2014, 12, 30))).hasValue(12d); assertThat(ts.get(dt(2014, 12, 31))).hasValue(11d); assertThat(ts.get(dt(2015, 1, 1))).isEqualTo(OptionalDouble.empty()); assertThat(ts.get(dt(2015, 1, 2))).hasValue(11d); assertThat(ts.get(dt(2015, 1, 3))).isEqualTo(OptionalDouble.empty()); assertThat(ts.get(dt(2015, 1, 4))).isEqualTo(OptionalDouble.empty()); assertThat(ts.get(dt(2015, 1, 5))).hasValue(12d); assertThat(ts.get(dt(2015, 1, 6))).hasValue(13d); assertThat(ts.get(dt(2015, 1, 7))).hasValue(14d); }</code><technical_language>lines isEmpty assert</technical_language>

Target:
public void checkOffsetsIncludeWeekends() { Map<LocalDate, Double> map = ImmutableMap.<LocalDate, Double>builder() .put(dt(2014, 12, 26), 14d) .put(dt(2014, 12, 29), 13d) .put(dt(2014, 12, 30), 12d) .put(dt(2014, 12, 31), 11d) .put(dt(2015, 1, 2), 11d) .put(dt(2015, 1, 5), 12d) .put(dt(2015, 1, 6), 13d) .put(dt(2015, 1, 7), 14d) .build(); LocalDateDoubleTimeSeries ts = LocalDateDoubleTimeSeries.builder().putAll(map).build(); assertThat(ts.get(dt(2014, 12, 26))).hasValue(14d); assertThat(ts.get(dt(2014, 12, 27))).isEmpty(); assertThat(ts.get(dt(2014, 12, 28))).isEmpty(); assertThat(ts.get(dt(2014, 12, 29))).hasValue(13d); assertThat(ts.get(dt(2014, 12, 30))).hasValue(12d); assertThat(ts.get(dt(2014, 12, 31))).hasValue(11d); assertThat(ts.get(dt(2015, 1, 1))).isEmpty(); assertThat(ts.get(dt(2015, 1, 2))).hasValue(11d); assertThat(ts.get(dt(2015, 1, 3))).isEmpty(); assertThat(ts.get(dt(2015, 1, 4))).isEmpty(); assertThat(ts.get(dt(2015, 1, 5))).hasValue(12d); assertThat(ts.get(dt(2015, 1, 6))).hasValue(13d); assertThat(ts.get(dt(2015, 1, 7))).hasValue(14d); }
Source:
<code>public Collection<PlannedNode> provision(Label label, int excessWorkload) { List<PlannedNode> list = new ArrayList<PlannedNode>(); <START> final MesosLabel mesosLabel = matchSelectedLabel(mesosLabels, label); <END> try { while (excessWorkload > 0) { final int numExecutors = Math.min(excessWorkload, mesosLabel.getMaxExecutors()); excessWorkload -= numExecutors; LOGGER.info("Provisioning Jenkins Slave on Mesos with " + numExecutors + " executors. Remaining excess workload: " + excessWorkload + " executors)"); list.add(new PlannedNode(this.getDisplayName(), Computer.threadPoolForRemoting .submit(new Callable<Node>() { public Node call() throws Exception { MesosSlave s = doProvision(numExecutors, mesosLabel); return s; } }), numExecutors)); } } catch (Exception e) { LOGGER.log(Level.WARNING, "Failed to create instances on Mesos", e); return Collections.emptyList(); } return list; }</code><technical_language>s/matchSelectedLabel/getSlaveInfo/</technical_language>

Target:
public Collection<PlannedNode> provision(Label label, int excessWorkload) { List<PlannedNode> list = new ArrayList<PlannedNode>(); final MesosSlaveInfo slaveInfo = getSlaveInfo(slaveInfos, label); try { while (excessWorkload > 0) { final int numExecutors = Math.min(excessWorkload, slaveInfo.getMaxExecutors()); excessWorkload -= numExecutors; LOGGER.info("Provisioning Jenkins Slave on Mesos with " + numExecutors + " executors. Remaining excess workload: " + excessWorkload + " executors)"); list.add(new PlannedNode(this.getDisplayName(), Computer.threadPoolForRemoting .submit(new Callable<Node>() { public Node call() throws Exception { MesosSlave s = doProvision(numExecutors, slaveInfo); return s; } }), numExecutors)); } } catch (Exception e) { LOGGER.log(Level.WARNING, "Failed to create instances on Mesos", e); return Collections.emptyList(); } return list; }
Source:
<code>public void testgenearateMappingFile() { <START> bmutils.generateMappingFile("mongodb"); <END> }</code><technical_language>3 test cases assertion output is produced execution of utility method</technical_language>

Target:
public void testgenearateMappingFile() { GoraBenchmarkUtils.generateMappingFile(Constants.MONGODB); GoraBenchmarkUtils.generateMappingFile(Constants.HBASE); GoraBenchmarkUtils.generateMappingFile(Constants.COUCHDB); assertTrue("Failed", fileExists(Constants.DB_MAPPING_PATH + "/" + Constants.MONGO_MAPPING_FILE)); assertTrue("Failed", fileExists(Constants.DB_MAPPING_PATH + "/" + Constants.COUCHDB_MAPPING_FILE)); assertTrue("Failed", fileExists(Constants.DB_MAPPING_PATH + "/" + Constants.HBASE_MAPPING_FILE)); }
Source:
<code>public ClassLoader getExternalAuthenticatorsClassLoader(ClassLoader parent) { Path authenticatorsDirectory; try { authenticatorsDirectory = Paths.get( configurationResourceResolver.getConfigurationResource("strongbox.authentication.lib", "webapp/WEB-INF/lib").getURI()); } catch (FileNotFoundException e) { logger.debug(e.getMessage()); return parent; } catch (IOException e) { throw new UndeclaredThrowableException(e); } if (!Files.exists(authenticatorsDirectory)) { logger.debug("{} does not exist.", authenticatorsDirectory); return parent; } if (!Files.isDirectory(authenticatorsDirectory)) { logger.error("{} is not a directory.", authenticatorsDirectory); return parent; } final Set<Path> authenticatorsJarPaths = getAuthenticatorJarPaths(authenticatorsDirectory); if (CollectionUtils.isEmpty(authenticatorsJarPaths)) { <START> logger.debug("{} contains 0 authenticators jar files.", authenticatorsDirectory); <END> return parent; } return ClassLoaderFactory.urlClassLoaderFromPaths(parent, authenticatorsJarPaths); }</code><technical_language>a typo here, authenticator jar files</technical_language>

Target:
public ClassLoader getExternalAuthenticatorsClassLoader(ClassLoader parent) { Path authenticatorsDirectory; try { authenticatorsDirectory = Paths.get( configurationResourceResolver.getConfigurationResource("strongbox.authentication.lib", "webapp/WEB-INF/lib").getURI()); } catch (FileNotFoundException e) { logger.debug(e.getMessage()); return parent; } catch (IOException e) { throw new UndeclaredThrowableException(e); } if (!Files.exists(authenticatorsDirectory)) { logger.debug("{} does not exist.", authenticatorsDirectory); return parent; } if (!Files.isDirectory(authenticatorsDirectory)) { logger.error("{} is not a directory.", authenticatorsDirectory); return parent; } final Set<Path> authenticatorsJarPaths = getAuthenticatorJarPaths(authenticatorsDirectory); if (CollectionUtils.isEmpty(authenticatorsJarPaths)) { logger.debug("{} does not contain any authenticator jar files.", authenticatorsDirectory); return parent; } return ClassLoaderFactory.urlClassLoaderFromPaths(parent, authenticatorsJarPaths); }
Source:
<code>private ProcessDTO convertRelatedJSONObjects(JsonObject jsonObject, ProcessDTO processDTO) throws DataException { Integer project = jsonObject.getInt("project.id"); <START> if (project > 0) { <END> processDTO.setProject(serviceManager.getProjectService().findById(project)); } processDTO.setBatches(convertRelatedJSONObjectToDTO(jsonObject, "batches", serviceManager.getBatchService())); processDTO.setBatchID(getBatchID(processDTO)); processDTO.setTasks(convertRelatedJSONObjectToDTO(jsonObject, "tasks", serviceManager.getTaskService())); processDTO.setImageFolderInUse(isImageFolderInUse(processDTO)); processDTO.setProgressClosed(getProgressClosed(null, processDTO)); processDTO.setProgressInProcessing(getProgressInProcessing(null, processDTO)); processDTO.setProgressOpen(getProgressOpen(null, processDTO)); processDTO.setProgressLocked(getProgressLocked(null, processDTO)); processDTO.setBlockedUser(getBlockedUser(processDTO)); processDTO.setContainsUnreachableSteps(getContainsUnreachableSteps(processDTO)); return processDTO; }</code><technical_language>a check if of property project is null comparing null 0 trouble</technical_language>

Target:
private ProcessDTO convertRelatedJSONObjects(JsonObject jsonObject, ProcessDTO processDTO) throws DataException { Integer project = jsonObject.getInt("project.id"); if (project > 0) { processDTO.setProject(serviceManager.getProjectService().findById(project)); } processDTO.setBatchID(getBatchID(processDTO)); processDTO.setTasks(convertRelatedJSONObjectToDTO(jsonObject, "tasks", serviceManager.getTaskService())); processDTO.setImageFolderInUse(isImageFolderInUse(processDTO)); processDTO.setProgressClosed(getProgressClosed(null, processDTO)); processDTO.setProgressInProcessing(getProgressInProcessing(null, processDTO)); processDTO.setProgressOpen(getProgressOpen(null, processDTO)); processDTO.setProgressLocked(getProgressLocked(null, processDTO)); processDTO.setBlockedUser(getBlockedUser(processDTO)); processDTO.setContainsUnreachableSteps(getContainsUnreachableSteps(processDTO)); return processDTO; }
Source:
<code>public static BingTile decode(long tile) { int version = (int) (tile >>> VERSION_OFFSET) & BITS_5; if (version == 0) { return decodeV0(tile); } else { <START> throw new IllegalArgumentException(format("Unknown Bing Tile encoding version: {}", version)); <END> } }</code><technical_language>"Unknown Bing Tile encoding version: %s"</technical_language>

Target:
public static BingTile decode(long tile) { int version = (int) (tile >>> VERSION_OFFSET) & BITS_5; if (version == 0) { return decodeV0(tile); } else { throw new IllegalArgumentException(format("Unknown Bing Tile encoding version: %s", version)); } }
Source:
<code>protected ReplicationUser(AuthConfig authConfig, @Assisted Set<AccountGroup.Id> authGroups) { super(AccessPath.REPLICATION, authConfig); <START> this.effectiveGroups = authGroups; <END> if (effectiveGroups.isEmpty()) { effectiveGroups.addAll(authConfig.getRegisteredGroups()); } }</code><technical_language>I suggest creating a copy of input collection, adding registered groups it, making unmodifiable storing instance member. Basically life of collection passed, a caller mutate a thread break this class's thread-safety getEffectiveGroups. code defensively copy</technical_language>

Target:
protected ReplicationUser(AuthConfig authConfig, @Assisted Set<AccountGroup.Id> authGroups) { super(AccessPath.REPLICATION, authConfig); effectiveGroups = new HashSet<AccountGroup.Id>(authGroups); if (effectiveGroups.isEmpty()) { effectiveGroups.addAll(authConfig.getRegisteredGroups()); } effectiveGroups = Collections.unmodifiableSet(effectiveGroups); }
Source:
<code>public List<Guid> runFilters(List<String> filterNames, List<Guid> hostIDs, Guid vmID, Map<String, String> propertiesMap) { try { <START> if (filterNames.isEmpty()) return hostIDs; <END> XmlRpcClient client = new XmlRpcClient(); client.setConfig(config); Object result = client.execute(FILTER, createFilterArgs(filterNames, hostIDs, vmID, propertiesMap)); return parseFilterResults(result); } catch (XmlRpcException e) { log.error("Could not communicate with the external scheduler while filtering", e); AuditLogableBase loggable = new AuditLogableBase(); AuditLogDirector.log(loggable, AuditLogType.FAILED_TO_CONNECT_TO_SCHEDULER_PROXY); return hostIDs; } }</code><technical_language>please add parentheses spit lines</technical_language>

Target:
public List<Guid> runFilters(List<String> filterNames, List<Guid> hostIDs, Guid vmID, Map<String, String> propertiesMap) { try { if (filterNames.isEmpty()) { return hostIDs; } XmlRpcClient client = new XmlRpcClient(); client.setConfig(config); Object result = client.execute(FILTER, createFilterArgs(filterNames, hostIDs, vmID, propertiesMap)); return parseFilterResults(result); } catch (XmlRpcException e) { log.error("Could not communicate with the external scheduler while filtering", e); auditLogFailedToConnect(); return hostIDs; } }
Source:
<code>private QueryParameters parseQuery(String query) throws Exception{ QueryParameters q = new QueryParameters(); versions = new ArrayList<String>(); if (query == null || query.equals("")) { return q; } query = query.replaceAll(" and ", "|"); query = query.replaceAll(", ", ","); query = query.replaceAll(": ", ":"); String[] tokens = query.split("\\|", -1); System.out.print(tokens.length); for (int i = 0; i < tokens.length; i++) { String[] pair = tokens[i].split(":", -1); if (pair.length != 2) { throw new Exception("Invalid format"); } String[] values = pair[1].split(",", -1); String label = pair[0]; if (label.equals("version")) { for (int j = 0; j < values.length; j++) { versions.add(values[j].replace(".", "-")); } } else if (label.equals("from")) { SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yy HH:mm"); Date d = sdf.parse(values[0] + " 00:00"); Calendar cal = Calendar.getInstance(); cal.setTime(d); <START> cal = TimeHelper.convertToUserTimeZone(cal, - Const.SystemParams.ADMIN_TIMZE_ZONE_DOUBLE); <END> fromDateValue = cal.getTime().getTime(); } else if (label.equals("to")) { SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yy HH:mm"); Date d = sdf.parse(values[0] + " 23:59"); Calendar cal = Calendar.getInstance(); cal.setTime(d); cal = TimeHelper.convertToUserTimeZone(cal, - Const.SystemParams.ADMIN_TIMZE_ZONE_DOUBLE); toDateValue = cal.getTime().getTime(); } else { q.add(label, values); } } return q; }</code><technical_language>PR is this constant a typo</technical_language>

Target:
private QueryParameters parseQuery(String query) throws Exception{ QueryParameters q = new QueryParameters(); versions = new ArrayList<String>(); if (query == null || query.equals("")) { return q; } query = query.replaceAll(" and ", "|"); query = query.replaceAll(", ", ","); query = query.replaceAll(": ", ":"); String[] tokens = query.split("\\|", -1); System.out.print(tokens.length); for (int i = 0; i < tokens.length; i++) { String[] pair = tokens[i].split(":", -1); if (pair.length != 2) { throw new Exception("Invalid format"); } String[] values = pair[1].split(",", -1); String label = pair[0]; if (label.equals("version")) { for (int j = 0; j < values.length; j++) { versions.add(values[j].replace(".", "-")); } } else if (label.equals("from")) { SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yy HH:mm"); sdf.setTimeZone(TimeZone.getTimeZone(Const.SystemParams.ADMIN_TIME_ZONE)); Date d = sdf.parse(values[0] + " 00:00"); Calendar cal = TimeHelper.now(0.0); cal.setTime(d); fromDateValue = cal.getTime().getTime(); } else if (label.equals("to")) { SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yy HH:mm"); sdf.setTimeZone(TimeZone.getTimeZone(Const.SystemParams.ADMIN_TIME_ZONE)); Date d = sdf.parse(values[0] + " 23:59"); Calendar cal = TimeHelper.now(0.0); cal.setTime(d); toDateValue = cal.getTime().getTime(); } else { q.add(label, values); } } return q; }
Source:
<code>public void putObject() throws IOException, SignatureException, URISyntaxException { final String jobIdString = "a4a586a1-cb80-4441-84e2-48974e982d51"; final Map<String, String> queryParams = new HashMap<>(); queryParams.put("job", jobIdString); queryParams.put("offset", Long.toString(0)); <START> final Path resourceFile = ResourceUtils.loadFileResource("LoremIpsumTwice.txt"); <END> final byte[] fileBytes = Files.readAllBytes(resourceFile); final String output = new String(fileBytes, Charset.forName("UTF-8")); final FileChannel channel = FileChannel.open(resourceFile, StandardOpenOption.READ); MockNetwork .expecting(HttpVerb.PUT, "/bucketName/objectName", queryParams, output) .returning(200, "") .asClient() .putObject(new PutObjectRequest("bucketName", "objectName", UUID.fromString(jobIdString), fileBytes.length, 0, channel)); }</code><technical_language>Path object named resourceFile</technical_language>

Target:
public void putObject() throws IOException, SignatureException, URISyntaxException { final String jobIdString = "a4a586a1-cb80-4441-84e2-48974e982d51"; final Map<String, String> queryParams = new HashMap<>(); queryParams.put("job", jobIdString); queryParams.put("offset", Long.toString(0)); final Path resourcePath = ResourceUtils.loadFileResource("LoremIpsumTwice.txt"); final byte[] fileBytes = Files.readAllBytes(resourcePath); final String output = new String(fileBytes, Charset.forName("UTF-8")); final FileChannel channel = FileChannel.open(resourcePath, StandardOpenOption.READ); MockNetwork .expecting(HttpVerb.PUT, "/bucketName/objectName", queryParams, output) .returning(200, "") .asClient() .putObject(new PutObjectRequest("bucketName", "objectName", UUID.fromString(jobIdString), fileBytes.length, 0, channel)); }
Source:
<code>public ByteBuffer message(ByteBuffer messagesBuf) { if (messagesBuf.limit() == messagesBuf.position()) { return null; } if (m_partialMessageLength.position() != 0) { if (!startMessage(messagesBuf)) { return null; } <START> } else if (m_currentMessageLength == -1) { <END> if (!startMessage(messagesBuf)) { return null; } } int remainingInMessage = m_currentMessageLength - (messagesBuf.position() - m_currentMessageStart); if (messagesBuf.remaining() >= remainingInMessage) { int oldLimit = messagesBuf.limit(); messagesBuf.position(m_currentMessageStart); messagesBuf.limit(messagesBuf.position() + m_currentMessageLength); ByteBuffer message = ByteBuffer.allocate(m_currentMessageLength); message.put(messagesBuf); message.flip(); messagesBuf.limit(oldLimit); int remainingMessageLength = messagesBuf.remaining(); messagesBuf.compact(); messagesBuf.flip(); m_currentMessageLength = -1; return message; } else { messagesBuf.position(messagesBuf.limit()); return null; } }</code><technical_language>wrong java else if (m_currentMessageLength == -1 && !startMessage(messagesBuf)) { java short circuit conditional evaluation</technical_language>

Target:
public ByteBuffer message(ByteBuffer messagesBuf) { if (messagesBuf.limit() == messagesBuf.position()) { return null; } if (m_partialMessageLength.position() != 0 || m_currentMessage == null) { if (!startMessage(messagesBuf)) { return null; } } if (messagesBuf.remaining() >= m_currentMessage.remaining()) { int oldLimit = messagesBuf.limit(); messagesBuf.limit(messagesBuf.position() + m_currentMessage.remaining()); m_currentMessage.put(messagesBuf); m_currentMessage.flip(); messagesBuf.limit(oldLimit); ByteBuffer message = m_currentMessage; m_currentMessage = null; return message; } else { m_currentMessage.put(messagesBuf); return null; } }
Source:
<code>protected boolean matchesSafely(T item) { if (condition.matches(itemToMatchCondition)) { return matcher.matches(item); <START> } else { <END> Description conditionDescription = new StringDescription() .appendValue(itemToMatchCondition) .appendDescriptionOf(condition); throw new AssumptionViolatedException( String.format("Condition is not satisfied: %s", conditionDescription)); } }</code><technical_language>need define else explicitly</technical_language>

Target:
protected boolean matchesSafely(T item) { if (condition.matches(itemToMatchCondition)) { return matcher.matches(item); } Description conditionDescription = new StringDescription() .appendValue(itemToMatchCondition) .appendDescriptionOf(condition); throw new AssumptionViolatedException( String.format("Condition is not satisfied: %s", conditionDescription)); }
Source:
<code>public void setupGatewayAccount() { DatabaseFixtures databaseFixtures = DatabaseFixtures.withDatabaseTestHelper(app.getDatabaseTestHelper()); DatabaseFixtures.TestCardType mastercard = databaseFixtures.aMastercardDebitCardType().insert(); DatabaseFixtures.TestCardType visa = databaseFixtures.aVisaCreditCardType().insert(); <START> app.getDatabaseTestHelper().addGatewayAccount(accountId, paymentProvider, description, analyticsId, 200L, 50L); <END> app.getDatabaseTestHelper().addAcceptedCardType(Long.valueOf(accountId), mastercard.getId()); app.getDatabaseTestHelper().addAcceptedCardType(Long.valueOf(accountId), visa.getId()); }</code><technical_language>put in fields please (like do for accountId friends)? a bit magic numberish right</technical_language>

Target:
public void setupGatewayAccount() { DatabaseFixtures databaseFixtures = DatabaseFixtures.withDatabaseTestHelper(app.getDatabaseTestHelper()); DatabaseFixtures.TestCardType mastercard = databaseFixtures.aMastercardDebitCardType().insert(); DatabaseFixtures.TestCardType visa = databaseFixtures.aVisaCreditCardType().insert(); app.getDatabaseTestHelper().addGatewayAccount(accountId, paymentProvider, description, analyticsId, corporateCreditCardSurchargeAmount, corporateDebitCardSurchargeAmount); app.getDatabaseTestHelper().addAcceptedCardType(Long.valueOf(accountId), mastercard.getId()); app.getDatabaseTestHelper().addAcceptedCardType(Long.valueOf(accountId), visa.getId()); }
Source:
<code>private void promptInvalid() { jumpTo.clear(); jumpTo.setPromptText(ERROR); <START> jumpTo.setStyle("-fx-prompt-text-fill: red;"); <END> }</code><technical_language>want move this css</technical_language>

Target:
private void promptInvalid() { jumpTo.clear(); jumpTo.setPromptText(ERROR); jumpTo.getStyleClass().add(INVALIDPROMPT); }
Source:
<code><START> public synchronized static LightblueFactory getFactory( <END> final PluginConfiguration pluginConfiguration) { if (factory == null) { appendToThreadClassLoader(pluginConfiguration); return getFactory(loadDefaultDatasources()); } return factory; }</code><technical_language>Inefficient. Instead: 1) Declare factory volatile 2) remove synchronized 3) getFactory() { LightblueFactory f=factory; if(f==null) { synchronized(this) { if(factory==null) initialize factory f=factory; } return f; }</technical_language>

Target:
public static LightblueFactory getFactory( final PluginConfiguration pluginConfiguration) { LightblueFactory f = factory; if (f == null) { synchronized (RestConfiguration.class) { f = factory; if (f == null) { appendToThreadClassLoader(pluginConfiguration); return getFactory(loadDefaultDatasources()); } } } return f; }
Source:
<code>public void testExecute() { initMocks(this); doReturn(null).when(diagram).getGraph(); <START> final PerformAutomaticLayoutCommand command = mock(PerformAutomaticLayoutCommand.class); <END> doCallRealMethod().when(command).execute(callback); doReturn(diagram).when(command).getDiagram(); command.execute(callback); verify(command).getExecutor(); verify(callback).onSuccess(); }</code><technical_language>IMO a concrete instance of PerformAutomaticLayoutCommand passing mock objects constructor is nicer mocking class test doCallRealMethod(...)... opinion</technical_language>

Target:
public void testExecute() { doReturn(diagram).when(command).getDiagram(); doReturn(executor).when(command).makeExecutor(); command.execute(callback); verify(layoutHelper).applyLayout(diagram, executor, true); verify(callback).onSuccess(); verify(command).executeLock(); }
Source:
<code>private void reportMetrics() { System.out.println("\n"); <START> metricRegistry.getCounters().entrySet().forEach(e -> System.out.printf(e.getKey() + ": " + e.getValue().getCount() + "\n")); <END> }</code><technical_language>If logger append benchmark results a file for instance..</technical_language>

Target:
private void reportMetrics() { metricRegistry.getCounters().entrySet().forEach(e -> logger.info(e.getKey() + ": " + e.getValue().getCount())); }
Source:
<code>protected void executeCommand() { boolean success = true; <START> StorageServerConnections connection = getConnection(); <END> if (!Guid.isNullOrEmpty(getParameters().getVdsId())) { Pair<Boolean, Integer> result = connectHostToStorage(); boolean isValidConnection = result.getFirst(); if (!isValidConnection) { VdcFault fault = new VdcFault(); fault.setError(VdcBllErrors.forValue(result.getSecond())); getReturnValue().setFault(fault); success = false; } } if (success) { connection.setid(Guid.newGuid().toString()); saveConnection(connection); getReturnValue().setActionReturnValue(getConnection().getid()); } setSucceeded(success); }</code><technical_language>please put connection decleration in if success condition (At line 51) , related process</technical_language>

Target:
protected void executeCommand() { boolean success = true; if (!Guid.isNullOrEmpty(getParameters().getVdsId())) { Pair<Boolean, Integer> result = connectHostToStorage(); boolean isValidConnection = result.getFirst(); if (!isValidConnection) { VdcFault fault = new VdcFault(); fault.setError(VdcBllErrors.forValue(result.getSecond())); getReturnValue().setFault(fault); success = false; } } if (success) { StorageServerConnections connection = getConnection(); connection.setid(Guid.newGuid().toString()); saveConnection(connection); getReturnValue().setActionReturnValue(connection.getid()); } setSucceeded(success); }
Source:
<code>public void testWindowsNode() throws RunNodesException { final String groupName = String.format("win%s", System.getProperty("user.name").substring(0, 3)); final TemplateBuilder templateBuilder = view.getComputeService().templateBuilder(); templateBuilder.imageId("westus/MicrosoftWindowsServer/WindowsServer/2016-Technical-Preview-with-Containers"); templateBuilder.hardwareId("Standard_A0"); templateBuilder.locationId("westus"); final Template template = templateBuilder.build(); final TemplateOptions options = template.getOptions().as(TemplateOptions.class); <START> options.inboundPorts(5985); <END> try { Set<? extends NodeMetadata> nodes = view.getComputeService().createNodesInGroup(groupName, 1, template); assertThat(nodes).hasSize(1); } finally { view.getComputeService().destroyNodesMatching(inGroup(groupName)); } }</code><technical_language>here, is this relevant for this test</technical_language>

Target:
public void testWindowsNode() throws RunNodesException { final String groupName = this.azureGroup; final TemplateBuilder templateBuilder = view.getComputeService().templateBuilder(); templateBuilder.imageId("global/MicrosoftWindowsServer/WindowsServer/Windows-Server-Technical-Preview"); templateBuilder.hardwareId("Standard_A0"); templateBuilder.locationId("westus"); final Template template = templateBuilder.build(); try { Set<? extends NodeMetadata> nodes = view.getComputeService().createNodesInGroup(groupName, 1, template); assertThat(nodes).hasSize(1); } finally { view.getComputeService().destroyNodesMatching(inGroup(groupName)); } }
Source:
<code><START> public boolean add(Entity entity){ <END> return entities.add(entity); }</code><technical_language>I impassable entity allowed a Square. Exception otherwise</technical_language>

Target:
public boolean add(Entity entity){ if (entity == null){ throw new IllegalArgumentException("Cannot add null entity"); } if (!entity.isPassable()){ if (!isPassable()) return false; impassableEntity = entity; return true; } return passableEntities.add(entity); }