auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void executeQueryCommand() { String configuration = getConfigurationFromDb(getParameters().getSnapshotSourceId()); <START> VM result = new VM(); <END> if (configuration != null) { new SnapshotsManager().updateVmFromConfiguration(result,configuration); } getQueryReturnValue().setReturnValue(result); }</code><technical_language>response null? if null return is legit for existing snapshot, move initialize of VM condition</technical_language>

Target:
protected void executeQueryCommand() { String configuration = getConfigurationFromDb(getParameters().getSnapshotSourceId()); VM result = null; if (configuration != null) { result = new VM(); new SnapshotsManager().updateVmFromConfiguration(result,configuration); } getQueryReturnValue().setReturnValue(result); }
Source:
<code>public void waitTimeoutWorks() throws InterruptedException, ExecutionException { assertTimeout(ofMillis(10000), () -> { q.put(100); q.put(200); q.put(300); Callable<Integer> tester = new Callable<Integer>() { @Override public Integer call() throws Exception { <START> q.waitUntilQueueSizeLowerThanThreshold(new DateTime().plusSeconds(3)); <END> return q.size(); } }; Future<Integer> result = newSingleThreadExecutor().submit(tester); sleep(1000); synchronized (q) { q.notifyAll(); } sleep(1000); assertThat(result.isDone(), is(false)); sleep(2000); assertThat(result.isDone(), is(true)); assertThat(result.get(), is(3)); }); }</code><technical_language>suggestion q.waitUntilQueueSizeLowerThanThreshold(DateTime.now().plusSeconds(3));</technical_language>

Target:
public void waitTimeoutWorks() { assertTimeout(ofMillis(10000), () -> { q.put(100); q.put(200); q.put(300); Callable<Integer> tester = new Callable<Integer>() { @Override public Integer call() throws Exception { q.waitUntilQueueSizeLowerThanThreshold(DateTime.now().plusSeconds(3)); return q.size(); } }; Future<Integer> result = newSingleThreadExecutor().submit(tester); sleep(1000); synchronized (q) { q.notifyAll(); } sleep(1000); assertThat(result.isDone(), is(false)); sleep(2000); assertThat(result.isDone(), is(true)); assertThat(result.get(), is(3)); }); }
Source:
<code>public CNLOHCaller(){ rhoThreshold = 0.2; <START> normalNumCopies = 2; <END> }</code><technical_language>HomoSapiensConstants.DEFAULT_PLOIDY</technical_language>

Target:
public CNLOHCaller(){ rhoThreshold = RHO_THRESHOLD_DEFAULT; normalNumCopies = HomoSapiensConstants.DEFAULT_PLOIDY; }
Source:
<code>public Object convertFromMetaDataValue(MetaDataValue value) { switch (value.getDataCase()) { case TEXT_VALUE: return value.getTextValue(); case BYTES_VALUE: return serializer.deserialize(new GrpcSerializedObject(value.getBytesValue())); case DOUBLE_VALUE: return value.getDoubleValue(); case NUMBER_VALUE: return value.getNumberValue(); case BOOLEAN_VALUE: return value.getBooleanValue(); <START> case DATA_NOT_SET: <END> return null; default: return null; } }</code><technical_language>This case is default..</technical_language>

Target:
public Object convertFromMetaDataValue(MetaDataValue value) { switch (value.getDataCase()) { case TEXT_VALUE: return value.getTextValue(); case BYTES_VALUE: return serializer.deserialize(new GrpcSerializedObject(value.getBytesValue())); case DOUBLE_VALUE: return value.getDoubleValue(); case NUMBER_VALUE: return value.getNumberValue(); case BOOLEAN_VALUE: return value.getBooleanValue(); case DATA_NOT_SET: default: return null; } }
Source:
<code>public void init(Context context) { TranslatorContext translatorContext = ((SamzaSqlApplicationContext) context.getApplicationTaskContext()).getTranslatorContexts().get(queryId); this.samzaMsgConverter = translatorContext.getMsgConverter(outputTopic); ContainerContext containerContext = context.getContainerContext(); metricsRegistry = containerContext.getContainerMetricsRegistry(); processingTime = new SamzaHistogram(metricsRegistry, sendToLogicalId, TranslatorConstants.TOTAL_LATENCY_NAME);; <START> inputEvents = metricsRegistry.newCounter(sendToLogicalId, TranslatorConstants.OUTPUT_EVENTS_NAME); <END> inputEvents.clear(); totalLatency = new SamzaHistogram(metricsRegistry, queryLogicalId, TranslatorConstants.TOTAL_LATENCY_NAME);; queryLatency = new SamzaHistogram(metricsRegistry, queryLogicalId, TranslatorConstants.QUERY_LATENCY_NAME); queueingLatency = new SamzaHistogram(metricsRegistry, queryLogicalId, TranslatorConstants.QUEUEING_LATENCY_NAME);; outputEvents = metricsRegistry.newCounter(queryLogicalId, TranslatorConstants.OUTPUT_EVENTS_NAME); outputEvents.clear(); }</code><technical_language>inputEvents sendTo outputEvents right? If remove this one</technical_language>

Target:
public void init(Context context) { TranslatorContext translatorContext = ((SamzaSqlApplicationContext) context.getApplicationTaskContext()).getTranslatorContexts().get(queryId); this.samzaMsgConverter = translatorContext.getMsgConverter(outputTopic); ContainerContext containerContext = context.getContainerContext(); metricsRegistry = containerContext.getContainerMetricsRegistry(); insertProcessingTime = new SamzaHistogram(metricsRegistry, insertLogicalId, TranslatorConstants.TOTAL_LATENCY_NAME);; totalLatency = new SamzaHistogram(metricsRegistry, queryLogicalId, TranslatorConstants.TOTAL_LATENCY_NAME);; queryLatency = new SamzaHistogram(metricsRegistry, queryLogicalId, TranslatorConstants.QUERY_LATENCY_NAME); queueingLatency = new SamzaHistogram(metricsRegistry, queryLogicalId, TranslatorConstants.QUEUEING_LATENCY_NAME);; queryOutputEvents = metricsRegistry.newCounter(queryLogicalId, TranslatorConstants.OUTPUT_EVENTS_NAME); queryOutputEvents.clear(); }
Source:
<code>private void registerSagaBeanDefinitions(Configurer configurer, BeanDefinitionRegistry registry) { String[] sagas = beanFactory.getBeanNamesForAnnotation(Saga.class); for (String saga : sagas) { Saga sagaAnnotation = beanFactory.findAnnotationOnBean(saga, Saga.class); SagaConfiguration<?> sagaConfiguration = SagaConfiguration.subscribingSagaManager(beanFactory.getType(saga)); <START> sagaConfiguration.configureResourceInjector(c -> beanFactory.getBean(ResourceInjector.class)); <END> if (!"".equals(sagaAnnotation.sagaStore())) { sagaConfiguration.configureSagaStore(c -> beanFactory.getBean(sagaAnnotation.sagaStore(), SagaStore.class)); } configurer.registerModule(sagaConfiguration); } }</code><technical_language>This necessary anymore if sagaConfiguration global config injector default</technical_language>

Target:
private void registerSagaBeanDefinitions(Configurer configurer, BeanDefinitionRegistry registry) { String[] sagas = beanFactory.getBeanNamesForAnnotation(Saga.class); for (String saga : sagas) { Saga sagaAnnotation = beanFactory.findAnnotationOnBean(saga, Saga.class); SagaConfiguration<?> sagaConfiguration = SagaConfiguration.subscribingSagaManager(beanFactory.getType(saga)); if (!"".equals(sagaAnnotation.sagaStore())) { sagaConfiguration.configureSagaStore(c -> beanFactory.getBean(sagaAnnotation.sagaStore(), SagaStore.class)); } configurer.registerModule(sagaConfiguration); } }
Source:
<code>public void run() { try { Iterator<Entry<WatchedCall<?, ?>, Object>> it = openStreams.entrySet().iterator(); int count = 0; while (it.hasNext()) { WatchedCall<?, ?> stream = it.next().getKey(); if (stream.cancelIfStale()) { count++; it.remove(); } } if (count > 0) { LOG.warn("Found %d stale streams and cancelled them", count); } } catch (Throwable t) { <START> LOG.error("Caught throwable in periodic Watchdog run. Continuing.", t); <END> } }</code><technical_language>I cleaner move error handling out of this method, like: run() { try { runUnsafe(); } catch (... } runUnsafe() { while(..) }</technical_language>

Target:
public void run() { try { runUnsafe(); } catch (Throwable t) { LOG.error("Caught throwable in periodic Watchdog run. Continuing.", t); } }
Source:
<code>public void testWebsocketConnectionWithUsernamePassword() throws Exception { MockMqttClient mockClient = new MockMqttClient(); AWSIotMqttManager awsIotMqttManager = new AWSIotMqttManager("test-client", Region.getRegion(Regions.US_EAST_1), TEST_ENDPOINT_PREFIX); awsIotMqttManager.setMqttClient(mockClient); TestClientStatusCallback csb = new TestClientStatusCallback(); <START> awsIotMqttManager.connect("user", "password", csb); <END> Thread.sleep(500); mockClient.mockConnectSuccess(); assertEquals(1, mockClient.connectCalls); assertTrue(mockClient.mostRecentOptions.isCleanSession()); assertEquals(300, mockClient.mostRecentOptions.getKeepAliveInterval()); assertEquals(2, csb.statuses.size()); assertEquals(AWSIotMqttClientStatusCallback.AWSIotMqttClientStatus.Connecting, csb.statuses.get(0)); assertEquals(AWSIotMqttClientStatusCallback.AWSIotMqttClientStatus.Connected, csb.statuses.get(1)); assertEquals(MqttManagerConnectionState.Connected, awsIotMqttManager.getConnectionState()); }</code><technical_language>Instead of waiting arbitrary amount of time, wait for of interest -- callback occurring. Perhaps, like: CountDownLatch latch = new CountDownLatch(1); awsIotMqttManager.connect("user", "password", new TestClientStatusCallback() { @Override public void onSomeStatusEventCallback(StatusInputType type) { super.onSomeStatusEventCallback(type); // behavior far... latch.countDown(); } }); latch.await(500, TimeUnit.MILLISECONDS); ^ In this case, arbitrary is _upper bound_ for result. But, of time, result rendered _before_ 500ms elapsed</technical_language>

Target:
public void testWebsocketConnectionWithUsernamePassword() throws Exception { MockMqttClient mockClient = new MockMqttClient(); AWSIotMqttManager awsIotMqttManager = new AWSIotMqttManager("test-client", Region.getRegion(Regions.US_EAST_1), TEST_ENDPOINT_PREFIX); awsIotMqttManager.setMqttClient(mockClient); TestClientStatusCallback csb = new TestClientStatusCallback(); awsIotMqttManager.connect("user", "pass", csb); csb.latch.await(500, TimeUnit.MILLISECONDS); mockClient.mockConnectSuccess(); assertEquals(1, mockClient.connectCalls); assertTrue(mockClient.mostRecentOptions.isCleanSession()); assertEquals(300, mockClient.mostRecentOptions.getKeepAliveInterval()); assertEquals(2, csb.statuses.size()); assertEquals( Arrays.asList(AWSIotMqttClientStatus.Connecting, AWSIotMqttClientStatus.Connected), csb.statuses ); assertEquals(MqttManagerConnectionState.Connected, awsIotMqttManager.getConnectionState()); }
Source:
<code>public void setLabelClass(String value) { if (!value.startsWith(ChunkContextToolbar.CHUNK_CLASS_PREFIX + CHUNK_OUTPUT_PREFIX)) <START> value = new String(ChunkContextToolbar.CHUNK_CLASS_PREFIX + <END> CHUNK_OUTPUT_PREFIX + value); value = StringUtil.getCssIdentifier(value); if (value != label_) { if (!StringUtil.isNullOrEmpty(label_)) this.removeStyleName(label_); label_ = value; this.addStyleName(label_); } }</code><technical_language>Nit: this needs indent fixed (should 3 spaces)</technical_language>

Target:
public void setLabelClass(String value) { if (!value.startsWith(ChunkContextToolbar.CHUNK_CLASS_PREFIX + CHUNK_OUTPUT_PREFIX)) value = new String(ChunkContextToolbar.CHUNK_CLASS_PREFIX + CHUNK_OUTPUT_PREFIX + value); value = StringUtil.getCssIdentifier(value); if (!StringUtil.equals(value, label_)) { if (!StringUtil.isNullOrEmpty(label_)) this.removeStyleName(label_); label_ = value; this.addStyleName(label_); } }
Source:
<code>public void clearCache() throws SQLException { <START> ((Session)this.getDBConnection().getSession()).clear(); <END> }</code><technical_language>I extend DBConnection interface a clearCache() & hibernate implementation call this clear. in ties context object close hibernate implementation (which I want avoid if want drop hibernate)</technical_language>

Target:
public void clearCache() throws SQLException { this.getDBConnection().clearCache(); }
Source:
<code>public void clearAnswer() { <START> Toast.makeText(getContext(), "URL is readonly", Toast.LENGTH_SHORT).show(); <END> }</code><technical_language>ToastUtils class for displaying toast well</technical_language>

Target:
public void clearAnswer() { ToastUtils.showShortToast("URL is readonly"); }
Source:
<code>private void parseResource(Archive archive, String parent) throws Exception { ResourceBuilder rb = new ResourceBuilder(); Version frameworkVersion = toFrameworkVersion(archive.revision.version.getOSGiVersion()); String bsn = archive.revision.program.toString(); try { File binary = repo.get(archive) .getValue(); if (!rb.addFile(binary, binary.toURI())) { addReserveIdentity(rb, bsn, frameworkVersion); } addInformationCapability(rb, archive.toString(), parent); } catch (Exception e) { <START> Throwable theException = e; <END> if (e instanceof InvocationTargetException) { theException = e.getCause(); } addReserveIdentity(rb, bsn, frameworkVersion); addInformationCapability(rb, archive.toString(), parent, theException); } resources.put(archive, rb.build()); }</code><technical_language>methods for this in Exceptions, provide solid support get original</technical_language>

Target:
private void parseResource(Archive archive, String parent) throws Exception { ResourceBuilder rb = new ResourceBuilder(); Version frameworkVersion = toFrameworkVersion(archive.revision.version.getOSGiVersion()); String bsn = archive.revision.program.toString(); try { File binary = repo.get(archive) .getValue(); if (!rb.addFile(binary, binary.toURI())) { addReserveIdentity(rb, bsn, frameworkVersion); } addInformationCapability(rb, archive.toString(), parent); } catch (Exception e) { Throwable theException = Exceptions.unrollCause(e, InvocationTargetException.class); addReserveIdentity(rb, bsn, frameworkVersion); addInformationCapability(rb, archive.toString(), parent, theException); } resources.put(archive, rb.build()); }
Source:
<code>public List<JiraIssueParameterDefinition.Result> getIssues() throws IOException, TimeoutException { Job<?, ?> context = Stapler.getCurrentRequest().findAncestorObject(Job.class); JiraSite site = JiraSite.get(context); if (site == null) throw new IllegalStateException("Jira site needs to be configured in the project " + context.getFullDisplayName()); <START> JiraSession session = site.getSession(null); <END> if (session == null) throw new IllegalStateException("Remote access for Jira isn't configured in Jenkins"); List<Issue> issues = session.getIssuesFromJqlSearch(jiraIssueFilter); List<Result> issueValues = new ArrayList<>(); for (Issue issue : fixNull(issues)) { issueValues.add(new Result(issue, this.altSummaryFields)); } return issueValues; }</code><technical_language>This needs run-aware</technical_language>

Target:
public List<JiraIssueParameterDefinition.Result> getIssues() throws IOException, TimeoutException { Job<?, ?> job = Stapler.getCurrentRequest().findAncestorObject(Job.class); JiraSite site = JiraSite.get(job); if (site == null) throw new IllegalStateException("Jira site needs to be configured in the project " + job.getFullDisplayName()); JiraSession session = site.getSession(job); if (session == null) throw new IllegalStateException("Remote access for Jira isn't configured in Jenkins"); List<Issue> issues = session.getIssuesFromJqlSearch(jiraIssueFilter); List<Result> issueValues = new ArrayList<>(); for (Issue issue : fixNull(issues)) { issueValues.add(new Result(issue, this.altSummaryFields)); } return issueValues; }
Source:
<code>public int hashCode() { int result = id != null ? id.hashCode() : 0; result = 31 * result + (id != null ? id.hashCode() : 0); result = 31 * result + (confirmed != null ? confirmed.hashCode() : 0); result = 31 * result + (createdAt != null ? createdAt.hashCode() : 0); result = 31 * result + (role != null ? role.hashCode() : 0); result = 31 * result + (status != null ? status.hashCode() : 0); result = 31 * result + (updatedAt != null ? updatedAt.hashCode() : 0); result = 31 * result + (email != null ? email.hashCode() : 0); result = 31 * result + (name != null ? name.hashCode() : 0); result = 31 * result + (deletedAt != null ? deletedAt.hashCode() : 0); result = 31 * result + (reportsTo != null ? reportsTo.hashCode() : 0); result = 31 * result + (timezone != null ? timezone.hashCode() : 0); result = 31 * result + (group != null ? group.hashCode() : 0); <START> result = 31 * result + roles.hashCode(); <END> return result; }</code><technical_language>phoneNumber teamName skipped here</technical_language>

Target:
public int hashCode() { int result = id != null ? id.hashCode() : 0; result = 31 * result + (id != null ? id.hashCode() : 0); result = 31 * result + (confirmed != null ? confirmed.hashCode() : 0); result = 31 * result + (createdAt != null ? createdAt.hashCode() : 0); result = 31 * result + (role != null ? role.hashCode() : 0); result = 31 * result + (status != null ? status.hashCode() : 0); result = 31 * result + (updatedAt != null ? updatedAt.hashCode() : 0); result = 31 * result + (email != null ? email.hashCode() : 0); result = 31 * result + (name != null ? name.hashCode() : 0); result = 31 * result + (deletedAt != null ? deletedAt.hashCode() : 0); result = 31 * result + (reportsTo != null ? reportsTo.hashCode() : 0); result = 31 * result + (timezone != null ? timezone.hashCode() : 0); result = 31 * result + (phoneNumber != null ? phoneNumber.hashCode() : 0); result = 31 * result + (teamName != null ? teamName.hashCode() : 0); result = 31 * result + (group != null ? group.hashCode() : 0); result = 31 * result + roles.hashCode(); return result; }
Source:
<code>private static STRtree buildRTree(LongArrayList addresses, List<List<Block>> channels, int geometryChannel) { STRtree rtree = new STRtree(); for (int position = 0; position < addresses.size(); position++) { long pageAddress = addresses.getLong(position); int blockIndex = decodeSliceIndex(pageAddress); int blockPosition = decodePosition(pageAddress); Block block = channels.get(geometryChannel).get(blockIndex); if (block.isNull(blockPosition)) { <START> continue; <END> } Slice slice = block.getSlice(blockPosition, 0, block.getSliceLength(blockPosition)); OGCGeometry ogcGeometry = deserialize(slice); if (ogcGeometry.isEmpty()) { continue; } rtree.insert(getEnvelope(ogcGeometry), new PagesRTreeIndex.GeometryWithAddress(ogcGeometry, pageAddress)); } if (rtree.isEmpty()) { return null; } rtree.query(ZERO_ENVELOPE); return rtree; }</code><technical_language>This is good, this handled a filter join. Consider adding a TODO here</technical_language>

Target:
private static STRtree buildRTree(LongArrayList addresses, List<List<Block>> channels, int geometryChannel) { STRtree rtree = new STRtree(); for (int position = 0; position < addresses.size(); position++) { long pageAddress = addresses.getLong(position); int blockIndex = decodeSliceIndex(pageAddress); int blockPosition = decodePosition(pageAddress); Block block = channels.get(geometryChannel).get(blockIndex); if (block.isNull(blockPosition)) { continue; } Slice slice = block.getSlice(blockPosition, 0, block.getSliceLength(blockPosition)); OGCGeometry ogcGeometry = deserialize(slice); verify(ogcGeometry != null); if (ogcGeometry.isEmpty()) { continue; } rtree.insert(getEnvelope(ogcGeometry), new GeometryWithAddress(ogcGeometry, pageAddress)); } rtree.build(); return rtree; }
Source:
<code>public PageTitleListCardItemView(Context context) { super(context); int paddingX = (int) getResources().getDimension(R.dimen.list_item_horizontal_padding); int paddingY = (int) getResources().getDimension(R.dimen.list_item_vertical_padding); setPadding(paddingX, paddingY, paddingX, paddingY); setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); setBackgroundResource(ResourceUtil.getThemedAttributeId(context, android.R.attr.selectableItemBackground)); <START> setClickable(true); <END> setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { if (callback != null && title != null) { callback.onSelectPage(title); } } }); }</code><technical_language>done in xml</technical_language>

Target:
public PageTitleListCardItemView(Context context) { super(context); setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { if (callback != null && title != null) { callback.onSelectPage(title); } } }); }
Source:
<code>public void refresh(Detail detail, TreeReference reference, int index, boolean hasDetailCalloutListener) { mEntityDetailPagerAdapter = new EntityDetailPagerAdapter(mContext.getSupportFragmentManager(), detail, index, reference, hasDetailCalloutListener, new DefaultEDVModifier() ); mViewPager.setAdapter(mEntityDetailPagerAdapter); <START> if(!useNewTabStyle) markSelectedTab(0); <END> }</code><technical_language>is this line conditional useNewTabStyle, other places tab is selected default</technical_language>

Target:
public void refresh(Detail detail, TreeReference reference, int index, boolean hasDetailCalloutListener) { mEntityDetailPagerAdapter = new EntityDetailPagerAdapter(mContext.getSupportFragmentManager(), detail, index, reference, hasDetailCalloutListener, new DefaultEDVModifier() ); mViewPager.setAdapter(mEntityDetailPagerAdapter); }
Source:
<code>public void activate(ServiceActivatorContext serviceActivatorContext) throws ServiceRegistryException { VirtualFile mountPoint = VFS.getRootVirtualFile().getChild( "ROOT.war" ); try { VFS.mountReal( content, mountPoint ); SelfContainedContentService service = new SelfContainedContentService( mountPoint ); serviceActivatorContext.getServiceTarget().addService( SelfContainedContentService.NAME, service ).install(); } catch (IOException e) { <START> e.printStackTrace(); <END> throw new ServiceRegistryException(e); } }</code><technical_language>Do want print stack trace throw exception</technical_language>

Target:
public void activate(ServiceActivatorContext serviceActivatorContext) throws ServiceRegistryException { VirtualFile mountPoint = VFS.getRootVirtualFile().getChild( "ROOT.war" ); try { VFS.mountReal( content, mountPoint ); SelfContainedContentService service = new SelfContainedContentService( mountPoint ); serviceActivatorContext.getServiceTarget().addService( SelfContainedContentService.NAME, service ).install(); } catch (IOException e) { throw new ServiceRegistryException(e); } }
Source:
<code><START> protected void parseSynchronusly() throws IOException { <END> Optional<RDFFormat> formatByMimeType = getContentType().flatMap(Rio::getParserFormatForMIMEType); String base = getBase().map(IRI::getIRIString).orElse(null); ParserConfig parserConfig = new ParserConfig(); RDFLoader loader = new RDFLoader(parserConfig, rdf4jTermFactory.getValueFactory()); RDFHandler rdfHandler = makeRDFHandler(); if (getSourceFile().isPresent()) { Optional<RDFFormat> formatByFilename = getSourceFile().map(Path::getFileName).map(Path::toString) .flatMap(Rio::getParserFormatForFileName); RDFFormat format = formatByMimeType.orElse(formatByFilename.orElse(null)); try (InputStream in = Files.newInputStream(getSourceFile().get())) { loader.load(in, base, format, rdfHandler); } } else if (getSourceIri().isPresent()) { try { URL url = new URL(getSourceIri().get().getIRIString()); loader.load(url, base, formatByMimeType.orElse(null), makeRDFHandler()); } catch (MalformedURLException ex) { throw new IOException("Can't handle source URL: " + getSourceIri().get(), ex); } } loader.load(getSourceInputStream().get(), base, formatByMimeType.orElse(null), rdfHandler); }</code><technical_language>Note RDF4J internal implementation of parseAsynchronously a Queue takes RDFParser InputStream main inputs, if other implementations async: <LINK_0> Note is currently in http-client module, reliance a InputStream implementation move out of package rio-api if necessary support easily here</technical_language>

Target:
protected void parseSynchronusly() throws IOException { Optional<RDFFormat> formatByMimeType = getContentType().flatMap(Rio::getParserFormatForMIMEType); String base = getBase().map(IRI::getIRIString).orElse(null); ParserConfig parserConfig = getParserConfig(); RDFLoader loader = new RDFLoader(parserConfig, rdf4jTermFactory.getValueFactory()); RDFHandler rdfHandler = makeRDFHandler(); if (getSourceFile().isPresent()) { Optional<RDFFormat> formatByFilename = getSourceFile().map(Path::getFileName).map(Path::toString) .flatMap(Rio::getParserFormatForFileName); RDFFormat format = formatByMimeType.orElse(formatByFilename.orElse(null)); try (InputStream in = Files.newInputStream(getSourceFile().get())) { loader.load(in, base, format, rdfHandler); } } else if (getSourceIri().isPresent()) { try { URL url = new URL(getSourceIri().get().getIRIString()); loader.load(url, base, formatByMimeType.orElse(null), makeRDFHandler()); } catch (MalformedURLException ex) { throw new IOException("Can't handle source URL: " + getSourceIri().get(), ex); } } loader.load(getSourceInputStream().get(), base, formatByMimeType.orElse(null), rdfHandler); }
Source:
<code><START> public void testFieldNameIncrement() throws InterruptedException { <END> assertNotNull(this.sink.input()); Message<String> message = MessageBuilder.withPayload("{\"test\": \"Hi\"}").build(); sink.input().send(message); message = MessageBuilder.withPayload("{\"test\": \"Hello\"}").build(); sink.input().send(message); message = MessageBuilder.withPayload("{\"test\": \"Hi\"}").build(); sink.input().send(message); assertEquals(2, this.fieldValueCounterRepository.findOne("FVCounter").getFieldValueCounts().get("Hi").longValue()); assertEquals(1, this.fieldValueCounterRepository.findOne("FVCounter").getFieldValueCounts().get("Hello").longValue()); }</code><technical_language>test decrement, payload types. Deeply nested payloads</technical_language>

Target:
public void testFieldNameIncrement() { assertNotNull(this.sink.input()); Message<String> message = MessageBuilder.withPayload("{\"test\": \"Hi\"}").build(); sink.input().send(message); message = MessageBuilder.withPayload("{\"test\": \"Hello\"}").build(); sink.input().send(message); message = MessageBuilder.withPayload("{\"test\": \"Hi\"}").build(); sink.input().send(message); assertEquals(2, this.fieldValueCounterRepository.findOne(FVC_NAME).getFieldValueCounts().get("Hi").longValue()); assertEquals(1, this.fieldValueCounterRepository.findOne(FVC_NAME).getFieldValueCounts().get("Hello").longValue()); }
Source:
<code>public void testParsLong() { <START> Assert.assertTrue(Objects.equals(Long.parseLong("+100"), GuavaUtils.tryParseLong("+100"))); <END> }</code><technical_language>Assert.equals Assert.<Object>equals values get printed out in failure mesasges</technical_language>

Target:
public void testParsLong() { Assert.assertNull(Longs.tryParse("+100")); Assert.assertNull(GuavaUtils.tryParseLong("")); Assert.assertNull(GuavaUtils.tryParseLong(null)); Assert.assertNull(GuavaUtils.tryParseLong("+")); Assert.assertNull(GuavaUtils.tryParseLong("++100")); Assert.assertEquals((Object) Long.parseLong("+100"), GuavaUtils.tryParseLong("+100")); Assert.assertEquals((Object) Long.parseLong("-100"), GuavaUtils.tryParseLong("-100")); Assert.assertNotEquals(new Long(100), GuavaUtils.tryParseLong("+101")); }
Source:
<code>public void no_parents() { FileInput fileInput = parse( "class C: ", " pass"); <START> assertThat(fileInput.globalVariables()).hasSize(1); <END> }</code><technical_language>I understand purpose of this test. assert fileInput.globalVariables() 1 symbol of kind CLASS empty parents property</technical_language>

Target:
public void no_parents() { FileInput fileInput = parse( "class C: ", " pass"); ClassDef classDef = (ClassDef) fileInput.statements().statements().get(0); Symbol symbol = classDef.name().symbol(); assertThat(symbol instanceof ClassSymbol).isTrue(); assertThat(symbol.kind().equals(Symbol.Kind.CLASS)).isTrue(); ClassSymbol classSymbol = (ClassSymbol) symbol; assertThat(classSymbol.parents()).hasSize(0); assertThat(classSymbol.hasUnresolvedParents()).isFalse(); }
Source:
<code>public void rejectsInvalidRelease() throws IOException { final Repo repo = new MkGithub().randomRepo(); final Issue issue = repo.issues().create("", ""); final Agent agent = new CommentsTag(repo.github()); repo.releases().create("1.0"); repo.releases().create("2.0"); repo.releases().create("3.0-b"); <START> final Talk talk = CommentsTagTest.talk(issue, "4.0-alpha"); <END> agent.execute(talk); final Comment.Smart response = new Comment.Smart( repo.issues().get(1).comments().get(1) ); MatcherAssert.assertThat( response.body(), Matchers.containsString("version tag is invalid") ); }</code><technical_language>@gumbelmj talk is a redundant variable here</technical_language>

Target:
public void rejectsInvalidRelease() throws IOException { CommentsTagTest.assertInvalidRelease("4.0-alpha"); CommentsTagTest.assertInvalidRelease(".1"); CommentsTagTest.assertInvalidRelease("a.b.c"); }
Source:
<code>protected String getExcludeSuiteFilter(Class<?> klass) throws Exception { ExcludeSuiteFilter excludeSuiteFilterAnnotation = (ExcludeSuiteFilter)klass.getAnnotation(ExcludeSuiteFilter.class); <START> if (excludeSuiteFilterAnnotation == null) { <END> return null; } else if (!"".equals(excludeSuiteFilterAnnotation.value())) { return excludeSuiteFilterAnnotation.value(); } else if (!"".equals(excludeSuiteFilterAnnotation.systemProperty())) { return System.getProperty(excludeSuiteFilterAnnotation.systemProperty()); } else { throw new InitializationError("In annotation @ExcludeSuiteFilter you have to specify either \'value\' or \'systemProperty\'"); } }</code><technical_language>Currently HsacFitNesseRunner system property fitnesseSuiteToRun 'win' string literal in Suite annotation (even if Java test class code reference system property). This allows developer commit in test class breaking build server's run (which sets system property). approach for (Exclude)SuiteFilter in this version is 'value' (literal in Java code) wins system property. change behavior for (Exclude)SuiteFilter system properties (with names examples) win annotation in code (even filters active is annotation present Java class)? I is extra (first) if-branch, turning current else if, checking system property a if so. Of this override current behavior for SuiteFilter annotation. I agree current code a good improvement for FitNesse project's FitNesseRunner. planning send a pull request it</technical_language>

Target:
protected String getExcludeSuiteFilter(Class<?> klass) throws Exception { String excludeSuiteFilter = System.getProperty(EXCLUDE_SUITE_FILTER_OVERRIDE_VARIABLE_NAME); if (StringUtils.isEmpty(excludeSuiteFilter)) { return super.getExcludeSuiteFilter(klass); } return excludeSuiteFilter; }
Source:
<code>public ArrayList<LunModel> getLunsToRefresh() { ArrayList<LunModel> luns = <START> new ArrayList<>(); <END> if (!getIsGrouppedByTarget()) { List<LunModel> items = (List<LunModel>) getItems(); luns.addAll(items.stream() .filter(LunModel::getIsIncluded) .filter(LunModel::isAdditionalAvailableSizeSelected) .distinct() .collect(Collectors.toList())); } else { List<SanTargetModel> sanTargetModels = (List<SanTargetModel>) getItems(); for (SanTargetModel sanTargetModel : sanTargetModels) { luns.addAll(sanTargetModel.getLuns().stream() .filter(LunModel::getIsIncluded) .filter(LunModel::isAdditionalAvailableSizeSelected) .distinct() .collect(Collectors.toList())); } } return luns; }</code><technical_language>This removed avoid creation of ArrayList, set Collections.emptyList() is iteration return of this method, want null</technical_language>

Target:
public List<LunModel> getLunsToRefresh() { List<LunModel> luns = Collections.emptyList(); if (!getIsGrouppedByTarget()) { List<LunModel> items = (List<LunModel>) getItems(); luns.addAll(items.stream() .filter(LunModel::getIsIncluded) .filter(LunModel::isAdditionalAvailableSizeSelected) .distinct() .collect(Collectors.toList())); } else { List<SanTargetModel> sanTargetModels = (List<SanTargetModel>) getItems(); for (SanTargetModel sanTargetModel : sanTargetModels) { luns = sanTargetModel.getLuns().stream() .filter(LunModel::getIsIncluded) .filter(LunModel::isAdditionalAvailableSizeSelected) .distinct() .collect(Collectors.toList()); } } return luns; }
Source:
<code>public void testWasitUntilElementPipedLocator() { Grid.driver().get(url); try { WebDriverWaitUtils.waitUntilElementIsPresent(pipedLocator); assertTrue(true); <START> } catch (WaitTimedOutException e) { <END> fail(e.getMessage()); } }</code><technical_language>@azaytsev I TestNG default fails a test method if Test method generates exception. do need wrap this a try..catch block</technical_language>

Target:
public void testWasitUntilElementPipedLocator() { Grid.driver().get(url); WebDriverWaitUtils.waitUntilElementIsPresent(pipedLocator); }
Source:
<code>public void testLocalBroadcast() { String action = "TEST_ACTION"; IntentFilter intentFilter = new IntentFilter(action); Application application = Robolectric.application; Observable<Intent> observable = AndroidObservable.fromLocalBroadcast(application, intentFilter); final Observer<Intent> observer = mock(Observer.class); final Subscription subscription = observable.subscribe(new TestObserver<Intent>(observer)); final InOrder inOrder = inOrder(observer); <START> inOrder.verify(observer, never()).onNext(any(Intent.class)); <END> Intent intent = new Intent(action); LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(application); localBroadcastManager.sendBroadcast(intent); inOrder.verify(observer, times(1)).onNext(intent); localBroadcastManager.sendBroadcast(intent); inOrder.verify(observer, times(1)).onNext(intent); subscription.unsubscribe(); inOrder.verify(observer, never()).onNext(any(Intent.class)); inOrder.verify(observer, never()).onError(any(Throwable.class)); inOrder.verify(observer, never()).onCompleted(); }</code><technical_language>this assertion is pointless, created inOrder object this fail</technical_language>

Target:
public void testLocalBroadcast() { String action = "TEST_ACTION"; IntentFilter intentFilter = new IntentFilter(action); Application application = Robolectric.application; Observable<Intent> observable = AndroidObservable.fromLocalBroadcast(application, intentFilter); final Observer<Intent> observer = mock(Observer.class); final Subscription subscription = observable.subscribe(new TestObserver<Intent>(observer)); final InOrder inOrder = inOrder(observer); inOrder.verify(observer, never()).onNext(any(Intent.class)); Intent intent = new Intent(action); LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(application); localBroadcastManager.sendBroadcast(intent); inOrder.verify(observer, times(1)).onNext(intent); localBroadcastManager.sendBroadcast(intent); inOrder.verify(observer, times(1)).onNext(intent); subscription.unsubscribe(); localBroadcastManager.sendBroadcast(intent); inOrder.verify(observer, never()).onNext(any(Intent.class)); inOrder.verify(observer, never()).onError(any(Throwable.class)); inOrder.verify(observer, never()).onCompleted(); }
Source:
<code>public void update() { IDebuggerConsole[] consoles = getDebuggerConsoleManager().getConsoles(); <START> setEnabled(consoles.length > 1); <END> }</code><technical_language>In typical use-case, a single session / console, this disabled. user this button is there. I if confusing enable widget if is a single console? "display selected console" shed more light situation, appears select, in single session case :)</technical_language>

Target:
public void update() { IDebuggerConsole[] consoles = getDebuggerConsoleManager().getConsoles(); setEnabled(consoles.length > 0); }
Source:
<code>private void checkQuestionableHashingAlgorithm(SubscriptionContext ctx) { PyNameTree name = (PyNameTree) ctx.syntaxNode(); if (isWithinImport(name)) { return; <START> } <END> String fullyQualifiedName = name.symbol() != null ? name.symbol().fullyQualifiedName() : ""; if (questionableHashlibAlgorithm.contains(fullyQualifiedName) || questionablePasslibAlgorithm.contains(fullyQualifiedName)) { ctx.addIssue(name, MESSAGE); } }</code><technical_language>I this condition is replaced</technical_language>

Target:
private static void checkQuestionableHashingAlgorithm(SubscriptionContext ctx) { PyNameTree name = (PyNameTree) ctx.syntaxNode(); if (isWithinImport(name)) { return; } String fullyQualifiedName = name.symbol() != null ? name.symbol().fullyQualifiedName() : ""; if (questionableHashlibAlgorithm.contains(fullyQualifiedName) || questionablePasslibAlgorithm.contains(fullyQualifiedName)) { ctx.addIssue(name, MESSAGE); } }
Source:
<code>public long getLong(int length, boolean signed) { if (length > BIT_LONG) { <START> throw new IllegalArgumentException("Cannot read a long longer than 64 bits. Rquested: " + length); END> } if (length == BIT_LONG) { long a = getInt(); long b = getInt(); a &= 0xFFFFFFFFL; b &= 0xFFFFFFFFL; if (this.byteOrder == ByteOrder.BIG_ENDIAN) { return (a << 32) | b; } return (b << 32) | a; } long a = getInt() & 0x00000000FFFFFFFFL; long b = getInt(length - BIT_INT, false); long retVal; a &= 0xFFFFFFFFL; b &= ((1 << (length - BIT_INT)) - 1); retVal = (this.byteOrder == ByteOrder.BIG_ENDIAN) ? ((a << length) | b) : ((b << BIT_INT) | a); if (signed && ((retVal & (1L << (length - 1))) != 0L)) { retVal |= ~((1L << length) - 1L); } return retVal; }</code><technical_language>user's "fault" for giving a 65+ bits integer, trace. Instead of a throwing a hard-to-catch runtime exception, a CtfReaderException? This prevent "malicious" traces crashing program</technical_language>

Target:
public long getLong(int length, boolean signed) throws CTFReaderException { if (length > BIT_LONG) { throw new CTFReaderException("Cannot read a long longer than 64 bits. Rquested: " + length); } if (length > BIT_INT) { final int highShift = length-BIT_INT; long a = getInt() & 0x00000000FFFFFFFFL; long b = getInt(highShift, false); long retVal; a &= 0xFFFFFFFFL; b &= ((1L << highShift) - 1L); retVal = (this.byteOrder == ByteOrder.BIG_ENDIAN) ? ((a << highShift) | b) : ((b << BIT_INT) | a); if (signed && ((retVal & (1L << (length - 1))) != 0L)) { int signExtendBits = BIT_LONG - length; long l = retVal << signExtendBits; long m = l >> signExtendBits; retVal = m; } return retVal; } return getInt(length, signed); }
Source:
<code>public void bind(UserFeed feed, String avatarUrl) { if (avatarUrl == null) { client.profile(feed.getLogin()) .compose(bindToLifecycle()) <START> .observeOn(AndroidSchedulers.mainThread()) <END> .subscribe(user -> setAvatar(user.getAvatarUrl())); } else { setAvatar(avatarUrl); } name.setText(feed.getLogin()); switch (feed.getAction()) { case WATCH: setWatchAction(feed); break; case NEW: setNewAction(feed); break; } }</code><technical_language>redundant</technical_language>

Target:
public void bind(UserFeed feed, String avatarUrl) { setAvatar(avatarUrl); name.setText(feed.getLogin()); switch (feed.getAction()) { case WATCH: setWatchAction(feed); break; case NEW: setNewAction(feed); break; } }
Source:
<code>public void setCatchKey(int keycode, boolean catchKey) { <START> <END> }</code><technical_language>For consistency's sake change this java input.setCatchKey(keycode, catchKey); other methods in GwtTestWrapper same</technical_language>

Target:
public void setCatchKey(int keycode, boolean catchKey) { input.setCatchKey(keycode, catchKey); }
Source:
<code>private void sendMagicLinkRequest() { if (!NetworkUtils.isNetworkAvailable(getActivity())) { ToastUtils.showToast(getActivity(), R.string.no_network_message, ToastUtils.Duration.LONG); return; } disableRequestEmailButtonAndShowProgressDialog(); Map<String, String> params = new HashMap<>(); params.put(EMAIL_KEY, mEmail); params.put(CLIENT_ID_KEY, BuildConfig.OAUTH_APP_ID); params.put(CLIENT_SECRET_KEY, BuildConfig.OAUTH_APP_SECRET); WordPress.getRestClientUtilsV1_1().sendLoginEmail(params, new RestRequest.Listener() { @Override public void onResponse(JSONObject response) { mProgressDialog.cancel(); AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_MAGIC_LINK_REQUESTED); if (mListener != null) { mListener.onMagicLinkSent(); } } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { HashMap<String, String> errorProperties = new HashMap<>(); errorProperties.put(ERROR_KEY, error.getMessage()); AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_MAGIC_LINK_FAILED, errorProperties); mProgressDialog.cancel(); <START> ToastUtils.showToast(getActivity(), R.string.magic_link_unavailable_error_message, ToastUtils.Duration.LONG); <END> if (mListener != null) { mListener.onEnterPasswordRequested(); } } }); }</code><technical_language>isAdded() check getActivity() in case fragment is longer valid (the getView() != null check previously this)</technical_language>

Target:
private void sendMagicLinkRequest() { if (!NetworkUtils.isNetworkAvailable(getActivity())) { ToastUtils.showToast(getActivity(), R.string.no_network_message, ToastUtils.Duration.LONG); return; } disableRequestEmailButtonAndShowProgressDialog(); Map<String, String> params = new HashMap<>(); params.put(EMAIL_KEY, mEmail); params.put(CLIENT_ID_KEY, BuildConfig.OAUTH_APP_ID); params.put(CLIENT_SECRET_KEY, BuildConfig.OAUTH_APP_SECRET); WordPress.getRestClientUtilsV1_1().sendLoginEmail(params, new RestRequest.Listener() { @Override public void onResponse(JSONObject response) { mProgressDialog.cancel(); AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_MAGIC_LINK_REQUESTED); if (mListener != null) { mListener.onMagicLinkSent(); } } }, new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { HashMap<String, String> errorProperties = new HashMap<>(); errorProperties.put(ERROR_KEY, error.getMessage()); AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_MAGIC_LINK_FAILED, errorProperties); mProgressDialog.cancel(); if (isAdded()) { ToastUtils.showToast(getActivity(), R.string.magic_link_unavailable_error_message, ToastUtils.Duration.LONG); } if (mListener != null) { mListener.onEnterPasswordRequested(); } } }); }
Source:
<code>public void testNullPropertyWillNotRemoveOldValue() { try { <START> ServerConfiguration configuration = ConfigurationFileLoader.loadConfiguration(); <END> configuration.setProperty("test-key", "a"); configuration.setProperty("test-key", null); assertEquals(configuration.getProperty("test-key", null), "a"); assertEquals(configuration.getProperty("test-key", "b"), "a"); assertTrue(configuration.getPropertyKeys().contains("test-key")); } catch (Exception e) { fail("Error in test", e); } }</code><technical_language>Add final keyword</technical_language>

Target:
public void testNullPropertyWillNotRemoveOldValue() { try { final ServerConfiguration configuration = ConfigurationFileLoader.loadConfiguration(); configuration.setProperty("test-key", "a"); configuration.setProperty("test-key", null); assertEquals(configuration.getProperty("test-key", null), "a"); assertEquals(configuration.getProperty("test-key", "b"), "a"); assertTrue(configuration.getPropertyKeys().contains("test-key")); } catch (Exception e) { fail("Error in test", e); } }
Source:
<code>public void treatNullGuestListsAsEmptyGuestLists() throws Exception { Owner owner = new Owner("admin"); Map<String, List<GuestId>> hostGuestMap = new HashMap<String, List<GuestId>>(); hostGuestMap.put("HYPERVISOR_A", null); when(ownerCurator.lookupByKey(eq(owner.getKey()))).thenReturn(owner); when(consumerCurator.getHostConsumersMap(any(Owner.class), any(Set.class))) .thenReturn(new VirtConsumerMap()); when(consumerCurator.getGuestConsumersMap(any(Owner.class), any(Set.class))) .thenReturn(new VirtConsumerMap()); when(consumerCurator.getGuestsHostMap(any(Owner.class), any(Set.class))). thenReturn(new VirtConsumerMap()); when(ownerCurator.lookupByKey(eq(owner.getKey()))).thenReturn(owner); when(principal.canAccess(eq(owner), eq(SubResource.CONSUMERS), eq(Access.CREATE))) .thenReturn(true); when(consumerTypeCurator.lookupByLabel(eq(ConsumerTypeEnum.HYPERVISOR.getLabel()))) .thenReturn(hypervisorType); when(idCertService.generateIdentityCert(any(Consumer.class))) .thenReturn(new IdentityCertificate()); HypervisorCheckInResult result = hypervisorResource.hypervisorCheckIn( hostGuestMap, principal, owner.getKey(), true); assertNotNull(result); assertNotNull(result.getCreated()); <START> System.out.println(result); <END> List<Consumer> created = new ArrayList<Consumer>(result.getCreated()); assertEquals(1, created.size()); List<GuestId> gids = created.get(0).getGuestIds(); assertEquals(0, gids.size()); }</code><technical_language>point_up_2:</technical_language>

Target:
public void treatNullGuestListsAsEmptyGuestLists() throws Exception { Owner owner = new Owner("admin"); Map<String, List<GuestId>> hostGuestMap = new HashMap<String, List<GuestId>>(); hostGuestMap.put("HYPERVISOR_A", null); when(ownerCurator.lookupByKey(eq(owner.getKey()))).thenReturn(owner); when(consumerCurator.getHostConsumersMap(any(Owner.class), any(Set.class))) .thenReturn(new VirtConsumerMap()); when(consumerCurator.getGuestConsumersMap(any(Owner.class), any(Set.class))) .thenReturn(new VirtConsumerMap()); when(consumerCurator.getGuestsHostMap(any(Owner.class), any(Set.class))). thenReturn(new VirtConsumerMap()); when(ownerCurator.lookupByKey(eq(owner.getKey()))).thenReturn(owner); when(principal.canAccess(eq(owner), eq(SubResource.CONSUMERS), eq(Access.CREATE))) .thenReturn(true); when(consumerTypeCurator.lookupByLabel(eq(ConsumerTypeEnum.HYPERVISOR.getLabel()))) .thenReturn(hypervisorType); when(idCertService.generateIdentityCert(any(Consumer.class))) .thenReturn(new IdentityCertificate()); HypervisorCheckInResult result = hypervisorResource.hypervisorCheckIn( hostGuestMap, principal, owner.getKey(), true); assertNotNull(result); assertNotNull(result.getCreated()); List<Consumer> created = new ArrayList<Consumer>(result.getCreated()); assertEquals(1, created.size()); List<GuestId> gids = created.get(0).getGuestIds(); assertEquals(0, gids.size()); }
Source:
<code>public String getProperties(String key) { <START> return properties.get(key).toString(); <END> }</code><technical_language>cast string instead of toString()</technical_language>

Target:
public String getProperties(String key) { return (String)properties.get(key); }
Source:
<code>public void testLinearIndex(String testName, String filepath, int problemReference, int problemWindowStart, int problemWindowEnd, int expectedCount) { <START> final SamReader sfr = SamReaderFactory.makeDefault().open(new File(filepath)); <END> for (int problemWindow = problemWindowStart; problemWindow <= problemWindowEnd; problemWindow++) { int count = countAlignmentsInWindow(problemReference, problemWindow, sfr, expectedCount); if (expectedCount != -1) assertEquals(expectedCount, count); } }</code><technical_language>is this reader closed somewhere</technical_language>

Target:
public void testLinearIndex(String testName, String filepath, int problemReference, int problemWindowStart, int problemWindowEnd, int expectedCount) { final SamReader sfr = SamReaderFactory.makeDefault().open(new File(filepath)); for (int problemWindow = problemWindowStart; problemWindow <= problemWindowEnd; problemWindow++) { int count = countAlignmentsInWindow(problemReference, problemWindow, sfr, expectedCount); if (expectedCount != -1) assertEquals(expectedCount, count); } CloserUtil.close(sfr); }
Source:
<code>public ProxyConfig convert(ProxyRequest source) { ProxyConfig proxyConfig = new ProxyConfig(); proxyConfig.setName(source.getName()); proxyConfig.setDescription(source.getDescription()); proxyConfig.setProtocol(source.getProtocol()); proxyConfig.setServerHost(source.getHost()); proxyConfig.setServerPort(source.getPort()); <START> if (StringUtils.isNoneBlank(source.getUserName())) { proxyConfig.setUserName(source.getUserName()); } if (StringUtils.isNoneBlank(source.getPassword())) { <END> proxyConfig.setPassword(source.getPassword()); } return proxyConfig; }</code><technical_language>is reason set if other is blank? if like: if (StringUtils.isNoneBlank(source.getUserName(), source.getPassword())) { proxyConfig.setUserName(source.getUserName()); proxyConfig.setPassword(source.getPassword()); } if yes, StringUtils.isNotBlank</technical_language>

Target:
public ProxyConfig convert(ProxyRequest source) { ProxyConfig proxyConfig = new ProxyConfig(); proxyConfig.setName(source.getName()); proxyConfig.setDescription(source.getDescription()); proxyConfig.setProtocol(source.getProtocol()); proxyConfig.setServerHost(source.getHost()); proxyConfig.setServerPort(source.getPort()); if (StringUtils.isNoneBlank(source.getUserName(), source.getPassword())) { proxyConfig.setUserName(source.getUserName()); proxyConfig.setPassword(source.getPassword()); } return proxyConfig; }