auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void canSerialize() throws Exception { DynamoAppConfigElement element = new DynamoAppConfigElement(); element.setKey("studyId:id"); element.setStudyId("studyId"); element.setRevision(1L); element.setId("id"); element.setPublished(true); element.setDeleted(true); element.setData(TestUtils.getClientData()); element.setCreatedOn(CREATED_ON.getMillis()); element.setModifiedOn(MODIFIED_ON.getMillis()); element.setVersion(2L); JsonNode node = BridgeObjectMapper.get().valueToTree(element); assertNull(node.get("key")); assertNull(node.get("studyId")); assertEquals(1L, node.get("revision").longValue()); assertEquals("id", node.get("id").textValue()); assertTrue(node.get("published").booleanValue()); assertTrue(node.get("deleted").booleanValue()); assertEquals(TestUtils.getClientData(), node.get("data")); assertEquals(CREATED_ON.toString(), node.get("createdOn").textValue()); assertEquals(MODIFIED_ON.toString(), node.get("modifiedOn").textValue()); <START> assertEquals(2L, node.get("version").longValue()); <END> AppConfigElement deser = BridgeObjectMapper.get().readValue(node.toString(), AppConfigElement.class); element.setKey(null); element.setStudyId(null); assertEquals(element, deser); }</code><technical_language>Type attribute</technical_language>

Target:
public void canSerialize() throws Exception { DynamoAppConfigElement element = new DynamoAppConfigElement(); element.setStudyId(TestConstants.TEST_STUDY_IDENTIFIER); element.setId(ID); element.setRevision(1L); element.setDeleted(true); element.setData(TestUtils.getClientData()); element.setCreatedOn(CREATED_ON.getMillis()); element.setModifiedOn(MODIFIED_ON.getMillis()); element.setVersion(2L); JsonNode node = BridgeObjectMapper.get().valueToTree(element); assertNull(node.get("key")); assertNull(node.get("studyId")); assertEquals(1L, node.get("revision").longValue()); assertEquals(ID, node.get("id").textValue()); assertTrue(node.get("deleted").booleanValue()); assertEquals(TestUtils.getClientData(), node.get("data")); assertEquals(CREATED_ON.toString(), node.get("createdOn").textValue()); assertEquals(MODIFIED_ON.toString(), node.get("modifiedOn").textValue()); assertEquals(2L, node.get("version").longValue()); assertEquals("AppConfigElement", node.get("type").textValue()); AppConfigElement deser = BridgeObjectMapper.get().readValue(node.toString(), AppConfigElement.class); deser.setStudyId(TestConstants.TEST_STUDY_IDENTIFIER); assertEquals(element, deser); }
Source:
<code>public void testRenameIdNotFoundOnOldName() throws Exception { typeContext = new LabelClientTypeContext(store, LabelType.METRIC, metrics, eventBus, MAX_CACHE_SIZE); ListenableFuture<Void> response = typeContext.rename("oldName", "newName"); <START> Futures.addCallback(response, new FutureCallback<Void>() { <END> @Override public void onSuccess(final Void result) { fail(); } @Override public void onFailure(final Throwable throwable) { } }); }</code><technical_language>This fail if in #rename nested calls moves a thread. tested? JUnit handles this. A simple #get call response a subsequent fail("Rename failed find current name") work otherwise</technical_language>

Target:
public void testRenameIdNotFoundOnOldName() throws Exception { typeContext = new LabelClientTypeContext(store, LabelType.METRIC, metrics, eventBus, MAX_CACHE_SIZE); try { typeContext.rename("oldName", "newName").get(); fail("Rename should have failed when it did not find the current name."); } catch (ExecutionException exception) { assertTrue(exception.getCause() instanceof LabelException); } }
Source:
<code>private boolean isSpecifiedDisksExist(List<DiskImage> disks) { if (disks != null) { List<DiskImage> disksNotExistInDb = ImagesHandler.imagesSubtract(getParameters().getDisks(), getDisksList()); <START> if (!disksNotExistInDb.isEmpty()) { <END> List<String> disksNotExistInDbIds = new ArrayList<>(disksNotExistInDb.size()); for (DiskImage diskImage : disksNotExistInDb) { disksNotExistInDbIds.add(diskImage.getId().toString()); } return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_DISKS_NOT_EXIST, String.format("$%1$s %2$s", "diskIds", StringUtils.join(disksNotExistInDbIds, ","))); } } return true; }</code><technical_language>change if (disksNotExistInDb.isEmpty()) { return true; } lines bit long here, code indentation left</technical_language>

Target:
private boolean isSpecifiedDisksExist(List<DiskImage> disks) { if (disks == null || disks.isEmpty()) { return true; } DiskImagesValidator diskImagesValidator = createDiskImageValidator(disks); if (!validate(diskImagesValidator.diskImagesNotExist())) { return false; } return true; }
Source:
<code>public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_webview, container, false); webView = (WebView) view.findViewById(R.id.webview); mLayout = (ViewGroup) view; WebSettings webViewSettings = webView.getSettings(); webViewSettings.setSupportZoom(true); webViewSettings.setBuiltInZoomControls(false); webViewSettings.setJavaScriptEnabled(true); webViewSettings.setGeolocationEnabled(true); webView.setWebChromeClient(new GeoWebChromeClient()); <START> Bundle arguments = getArguments(); <END> if (!TextUtils.isEmpty(arguments.getString(MapboxWebMapType.ARG_MAPBOX_ACCESS_TOKEN)) && !TextUtils.isEmpty(arguments.getString(MapboxWebMapType.ARG_MAPBOX_MAPID))) { MapboxWebMapType mapType = MapboxWebMapType.fromBundle(arguments); webView.loadDataWithBaseURL(mapType.getDomain(), mapType.getMapData(getResources()), "text/html", "base64", null); } else { AirMapType mapType = AirMapType.fromBundle(arguments); webView.loadDataWithBaseURL(mapType.getDomain(), mapType.getMapData(getResources()), "text/html", "base64", null); } webView.addJavascriptInterface(new MapsJavaScriptInterface(), "AirMapView"); return view; }</code><technical_language>this initialization happen in MapboxWebViewMapFragment</technical_language>

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_webview, container, false); webView = (WebView) view.findViewById(R.id.webview); mLayout = (ViewGroup) view; WebSettings webViewSettings = webView.getSettings(); webViewSettings.setSupportZoom(true); webViewSettings.setBuiltInZoomControls(false); webViewSettings.setJavaScriptEnabled(true); webViewSettings.setGeolocationEnabled(true); webView.setWebChromeClient(new GeoWebChromeClient()); AirMapType mapType = AirMapType.fromBundle(getArguments()); webView.loadDataWithBaseURL(mapType.getDomain(), mapType.getMapData(getResources()), "text/html", "base64", null); webView.addJavascriptInterface(new MapsJavaScriptInterface(), "AirMapView"); return view; }
Source:
<code>public PayableDocument copyAsPayableDocument() { final InvoiceRow invoiceRow = this; final InvoiceId invoiceId; final OrderId prepayOrderId; final boolean creditMemo; if (invoiceRow.getC_Invoice_ID() > 0) { invoiceId = InvoiceId.ofRepoId(invoiceRow.getC_Invoice_ID()); prepayOrderId = null; creditMemo = invoiceRow.isCreditMemo(); } else if (invoiceRow.getC_Order_ID() > 0) { invoiceId = null; prepayOrderId = OrderId.ofRepoId(invoiceRow.getC_Order_ID()); creditMemo = false; } else { throw new AdempiereException("No document reference: " + invoiceRow); } final ICurrencyDAO currenciesRepo = Services.get(ICurrencyDAO.class); final CurrencyId currencyId = currenciesRepo.getByCurrencyCode(invoiceRow.getCurrencyISOCode()).getId(); return PayableDocument.builder() <START> .clientAndOrgId(ClientAndOrgId.ofClientAndOrg(ClientId.METASFRESH, invoiceRow.getOrgId())) <END> .invoiceId(invoiceId) .prepayOrderId(prepayOrderId) .bpartnerId(BPartnerId.ofRepoIdOrNull(invoiceRow.getC_BPartner_ID())) .soTrx(SOTrx.ofBoolean(invoiceRow.isCustomerDocument())) .creditMemo(creditMemo) .documentNo(invoiceRow.getDocumentNo()) .openAmt(Money.of(invoiceRow.getOpenAmtConv_APAdjusted(), currencyId)) .amountsToAllocate(AllocationAmounts.builder() .payAmt(Money.of(invoiceRow.getAppliedAmt_APAdjusted(), currencyId)) .discountAmt(Money.of(invoiceRow.getDiscount_APAdjusted(), currencyId)) .writeOffAmt(Money.of(invoiceRow.getWriteOffAmt_APAdjusted(), currencyId)) .build()) .build(); }</code><technical_language>avoid avoid hardcoding ClientId</technical_language>

Target:
public PayableDocument copyAsPayableDocument() { final InvoiceRow invoiceRow = this; final InvoiceId invoiceId; final OrderId prepayOrderId; final boolean creditMemo; if (invoiceRow.getC_Invoice_ID() > 0) { invoiceId = InvoiceId.ofRepoId(invoiceRow.getC_Invoice_ID()); prepayOrderId = null; creditMemo = invoiceRow.isCreditMemo(); } else if (invoiceRow.getC_Order_ID() > 0) { invoiceId = null; prepayOrderId = OrderId.ofRepoId(invoiceRow.getC_Order_ID()); creditMemo = false; } else { throw new AdempiereException("No document reference: " + invoiceRow); } final ICurrencyDAO currenciesRepo = Services.get(ICurrencyDAO.class); final CurrencyId currencyId = currenciesRepo.getByCurrencyCode(invoiceRow.getCurrencyISOCode()).getId(); return PayableDocument.builder() .clientAndOrgId(ClientAndOrgId.ofClientAndOrg(Env.getClientId(), invoiceRow.getOrgId())) .invoiceId(invoiceId) .prepayOrderId(prepayOrderId) .bpartnerId(BPartnerId.ofRepoIdOrNull(invoiceRow.getC_BPartner_ID())) .soTrx(SOTrx.ofBoolean(invoiceRow.isCustomerDocument())) .creditMemo(creditMemo) .documentNo(invoiceRow.getDocumentNo()) .openAmt(Money.of(invoiceRow.getOpenAmtConv_APAdjusted(), currencyId)) .amountsToAllocate(AllocationAmounts.builder() .payAmt(Money.of(invoiceRow.getAppliedAmt_APAdjusted(), currencyId)) .discountAmt(Money.of(invoiceRow.getDiscount_APAdjusted(), currencyId)) .writeOffAmt(Money.of(invoiceRow.getWriteOffAmt_APAdjusted(), currencyId)) .build()) .build(); }
Source:
<code><START> public void testInitProducerIdRequest() throws Exception { <END> final long producerId = 343434L; TransactionManager transactionManager = createTransactionManager(); setupWithTransactionState(transactionManager); prepareAndReceiveInitProducerId(producerId, Errors.NONE); assertTrue(transactionManager.hasProducerId()); assertEquals(producerId, transactionManager.producerIdAndEpoch().producerId); assertEquals((short) 0, transactionManager.producerIdAndEpoch().epoch); }</code><technical_language>nit: exception is longer thrown</technical_language>

Target:
public void testInitProducerIdRequest() { final long producerId = 343434L; TransactionManager transactionManager = createTransactionManager(); setupWithTransactionState(transactionManager); prepareAndReceiveInitProducerId(producerId, Errors.NONE); assertTrue(transactionManager.hasProducerId()); assertEquals(producerId, transactionManager.producerIdAndEpoch().producerId); assertEquals((short) 0, transactionManager.producerIdAndEpoch().epoch); }
Source:
<code>public void testFtpOutboundFlowWithChmod() { IntegrationFlow flow = f -> f .handle(Ftp.outboundAdapter(sessionFactory(), FileExistsMode.FAIL) .useTemporaryFileName(false) .fileNameExpression("headers['" + FileHeaders.FILENAME + "']") <START> .chmod(644) <END> .remoteDirectory("ftpTarget")); IntegrationFlowRegistration registration = this.flowContext.registration(flow).register(); String fileName = "foo.file"; Message<ByteArrayInputStream> message = MessageBuilder .withPayload(new ByteArrayInputStream("foo".getBytes(StandardCharsets.UTF_8))) .setHeader(FileHeaders.FILENAME, fileName) .build(); registration.getInputChannel().send(message); RemoteFileTemplate<FTPFile> template = new RemoteFileTemplate<>(sessionFactory()); FTPFile[] files = template.execute(session -> session.list(getTargetRemoteDirectory().getName() + "/" + fileName)); assertThat(files.length).isEqualTo(1); assertThat(files[0].getSize()).isEqualTo(3); assertThat(files[0].hasPermission(FTPFile.USER_ACCESS, FTPFile.READ_PERMISSION)).isTrue(); assertThat(files[0].hasPermission(FTPFile.USER_ACCESS, FTPFile.WRITE_PERMISSION)).isTrue(); assertThat(files[0].hasPermission(FTPFile.GROUP_ACCESS, FTPFile.READ_PERMISSION)).isTrue(); assertThat(files[0].hasPermission(FTPFile.GROUP_ACCESS, FTPFile.WRITE_PERMISSION)).isFalse(); assertThat(files[0].hasPermission(FTPFile.WORLD_ACCESS, FTPFile.READ_PERMISSION)).isTrue(); assertThat(files[0].hasPermission(FTPFile.WORLD_ACCESS, FTPFile.WRITE_PERMISSION)).isFalse(); registration.destroy(); }</code><technical_language>missed fact octal number start 0: <LINK_0></technical_language>

Target:
public void testFtpOutboundFlowWithChmod() { IntegrationFlow flow = f -> f .handle(Ftp.outboundAdapter(sessionFactory(), FileExistsMode.FAIL) .useTemporaryFileName(false) .fileNameExpression("headers['" + FileHeaders.FILENAME + "']") .chmod(0644) .remoteDirectory("ftpTarget")); IntegrationFlowRegistration registration = this.flowContext.registration(flow).register(); String fileName = "foo.file"; Message<ByteArrayInputStream> message = MessageBuilder .withPayload(new ByteArrayInputStream("foo".getBytes(StandardCharsets.UTF_8))) .setHeader(FileHeaders.FILENAME, fileName) .build(); registration.getInputChannel().send(message); RemoteFileTemplate<FTPFile> template = new RemoteFileTemplate<>(sessionFactory()); FTPFile[] files = template.execute(session -> session.list(getTargetRemoteDirectory().getName() + "/" + fileName)); assertThat(files.length).isEqualTo(1); assertThat(files[0].getSize()).isEqualTo(3); registration.destroy(); }
Source:
<code>public void onEvent(Event event, Object o, Object o1) { try { org.xwiki.eventstream.Event eventStreamEvent = (org.xwiki.eventstream.Event) o; List<RecordableEventDescriptor> descriptorList = this.recordableEventDescriptorManager.getRecordableEventDescriptors(true); for (RecordableEventDescriptor descriptor : descriptorList) { if (descriptor.getEventType().equals(eventStreamEvent.getType()) <START> && this.notificationConfiguration.isEnabled() <END> && this.notificationConfiguration.areEmailsEnabled()) { this.liveNotificationEmailManager.addEvent(eventStreamEvent); this.startNotificationThread(); } } } catch (EventStreamException e) { logger.warn("Unable to retrieve a full list of RecordableEventDescriptor.", e); } }</code><technical_language>Do this check for(), if this.notificationConfiguration.isEnabled() this.notificationConfiguration.areEmailsEnabled() false, event need load descriptors on..</technical_language>

Target:
public void onEvent(Event event, Object o, Object o1) { if (this.notificationConfiguration.isEnabled() && this.notificationConfiguration.areEmailsEnabled()) { try { org.xwiki.eventstream.Event eventStreamEvent = (org.xwiki.eventstream.Event) o; List<RecordableEventDescriptor> descriptorList = this.recordableEventDescriptorManager.getRecordableEventDescriptors(true); for (RecordableEventDescriptor descriptor : descriptorList) { if (descriptor.getEventType().equals(eventStreamEvent.getType())) { this.liveNotificationEmailManager.addEvent(eventStreamEvent); this.startNotificationThread(); } } } catch (EventStreamException e) { logger.warn("Unable to retrieve a full list of RecordableEventDescriptor.", e); } } }
Source:
<code>public static String getDisplay(DrugOrder delegate) { StringBuilder ret = new StringBuilder(); if (delegate.getDrug() != null) { ret.append(delegate.getDrug().getName()); } else { ret.append(delegate.getConcept().getDisplayString()); } ret.append(": "); <START> if(delegate.getDosingType() != null && delegate.getDosingInstructionsInstance() != null) { <END> ret.append(delegate.getDosingInstructionsInstance().getDosingInstructionsAsString(Context.getLocale())); } else if (delegate.getDose() != null) { ret.append(delegate.getDose()); if (delegate.getDoseUnits() != null && delegate.getDoseUnits().getName() != null) { ret.append(delegate.getDoseUnits().getName().getName()); } else { ret.append("[no units]"); } } else { ret.append("[no dose]"); } return ret.toString(); }</code><technical_language>DrugOrderValidator.java:96 (in openmrs-core) dosingType null active order. I _can_ null a discontinue order. I guess do need this check. Thought this reminds if order.action is discontinue, put "Discontinue " start of string return</technical_language>

Target:
public static String getDisplay(DrugOrder delegate) { StringBuilder ret = new StringBuilder(); if (delegate.getDrug() != null) { ret.append(delegate.getDrug().getName()); } else { ret.append(delegate.getConcept().getDisplayString()); } if(delegate.getDosingType() != null && delegate.getDosingInstructionsInstance() != null) { String dosingInstructionsAsString = delegate.getDosingInstructionsInstance().getDosingInstructionsAsString(Context.getLocale()); ret.append(": "); ret.append(dosingInstructionsAsString); } return ret.toString(); }
Source:
<code>public ColorPickerLifecycleManager(EEFCustomWidgetDescription description, IVariableManager variableManager, IInterpreter interpreter, TransactionalEditingDomain editingDomain) { <START> super(description, variableManager, <END> interpreter, editingDomain); this.description = description; }</code><technical_language>done</technical_language>

Target:
public ColorPickerLifecycleManager(EEFCustomWidgetDescription description, IVariableManager variableManager, IInterpreter interpreter, TransactionalEditingDomain editingDomain) { super(variableManager, interpreter, editingDomain); this.description = description; }
Source:
<code>public boolean next() throws IOException { for (;;) { LogQueueEntry t = queue.poll(); if (t == null) { return false; } refName = t.lc.getRefName(); updateIndex = t.lc.getUpdateIndex(); entry = t.lc.getReflogEntry(); boolean include = includeDeletes || entry != null; skipShadowed(refName, updateIndex); add(t); <START> if (include) { return true; } return true; <END> } }</code><technical_language>This right</technical_language>

Target:
public boolean next() throws IOException { for (;;) { LogQueueEntry t = queue.poll(); if (t == null) { return false; } refName = t.lc.getRefName(); updateIndex = t.lc.getUpdateIndex(); entry = t.lc.getReflogEntry(); boolean include = includeDeletes || entry != null; skipShadowed(refName, updateIndex); add(t); if (include) { return true; } } }
Source:
<code>public static String relativeTime(final OffsetDateTime offsetDateTime) { <START> return relativeTime(fromUTC(offsetDateTime)); <END> }</code><technical_language>~~The tests covering bug fixed. I change this line tests pass successfully~~ nvm, i realised mistake</technical_language>

Target:
public static String relativeTime(final OffsetDateTime offsetDateTime) { return relativeTime(OffsetDateTimeKt.toCalendar(offsetDateTime)); }
Source:
<code>public void shouldGetBahmniProgramEnrollmentByPatientUuid() throws Exception { ProgramEnrollment programEnrollment = prepareBahmniProgramEnrollment(); URI url = config.toInstancePathWithParams("/bahmniprogramenrollment?patient={uuid}&v=full", programEnrollment.getPatient().getUuid()); when(restOperations.exchange(eq(url), eq(HttpMethod.GET), any(HttpEntity.class), eq(String.class))) .thenReturn(getResponseFromFile(BAHMNI_PROGRAM_ENROLLMENT_TABLE)); List<ProgramEnrollment> fetched = programEnrollmentResource.getBahmniProgramEnrollmentByPatientUuid(config, programEnrollment.getPatient().getUuid()); verify(restOperations).exchange(eq(url), eq(HttpMethod.GET), requestCaptor.capture(), eq(String.class)); assertThat(fetched, hasItem(programEnrollment)); assertThat(fetched.size(), equalTo(1)); assertThat(requestCaptor.getValue().getHeaders(), equalTo(getHeadersForGet(config))); <START> assertThat(JsonUtils.readJson(requestCaptor.getValue().getBody(), JsonObject.class), nullValue()); <END> }</code><technical_language>this is redundant</technical_language>

Target:
public void shouldGetBahmniProgramEnrollmentByPatientUuid() throws Exception { ProgramEnrollment programEnrollment = prepareBahmniProgramEnrollment(); URI url = config.toInstancePathWithParams("/bahmniprogramenrollment?patient={uuid}&v=full", programEnrollment.getPatient().getUuid()); when(restOperations.exchange(eq(url), eq(HttpMethod.GET), any(HttpEntity.class), eq(String.class))) .thenReturn(getResponseFromFile(BAHMNI_PROGRAM_ENROLLMENT_TABLE)); List<ProgramEnrollment> fetched = programEnrollmentResource.getBahmniProgramEnrollmentByPatientUuid(config, programEnrollment.getPatient().getUuid()); verify(restOperations).exchange(eq(url), eq(HttpMethod.GET), requestCaptor.capture(), eq(String.class)); assertThat(fetched, hasItem(programEnrollment)); assertThat(fetched.size(), equalTo(1)); assertThat(requestCaptor.getValue().getHeaders(), equalTo(getHeadersForGet(config))); }
Source:
<code>public void parseAndValidate() throws JsonParseException { ReferencedCourtCasesTagValueItem[] referencedCourtCasesTagValueItems = jsonStringParser.parseAndValidate(jsonTagValue); <START> assertNotNull(referencedCourtCasesTagValueItems); <END> }</code><technical_language>Is this test finished? assert exact values of ReferencedCourtCasesTagValueItem</technical_language>

Target:
public void parseAndValidate() throws JsonParseException { ReferencedCourtCasesTagValueItem[] referencedCourtCasesTagValueItems = jsonStringParser.parseAndValidate(jsonTagValue); assertNotNull(referencedCourtCasesTagValueItems); List<ReferencedCourtCasesTagValueItem> tagValueItems = Lists.newArrayList(referencedCourtCasesTagValueItems); assertEquals(1, tagValueItems.stream().filter(item->item.getCaseNumber().equals("XVI1 Ko 439/96") && item.getJudgmentIds().isEmpty()).count()); assertEquals(1, tagValueItems.stream().filter(item->item.getCaseNumber().equals("II AKa 115/99") && item.getJudgmentIds().size()==1 && item.getJudgmentIds().contains(83218l)).count()); }
Source:
<code>public PortableInfoboxObject isNotHeroImageSquare() { wait.forElementVisible(mainImage); Assertion.assertNotEquals(mainImage.getSize().getHeight(), mainImage.getSize().getWidth()); <START> PageObjectLogging.log("Hero image", "is square", true); <END> return this; }</code><technical_language>is this log message correct? message is in method</technical_language>

Target:
public PortableInfoboxObject isNotHeroImageSquare() { wait.forElementVisible(mainImage); Assertion.assertNotEquals(mainImage.getSize().getHeight(), mainImage.getSize().getWidth()); PageObjectLogging.log("Hero image", "is not square", true); return this; }
Source:
<code>public void testToOneInitializedByQuery() throws Exception { em.getTransaction().begin(); String nativeQuery = "MATCH ( n:" + TABLE_NAME + " { name:'Portia', author:'Oscar Wilde' } ) RETURN n"; OscarWildePoem poem = (OscarWildePoem) em.createNativeQuery( nativeQuery, OscarWildePoem.class ).getSingleResult(); <START> assertThat( poem.getCritic() ).isNotNull(); <END> em.getTransaction().commit(); }</code><technical_language>add assertion of props? sure..</technical_language>

Target:
public void testToOneInitializedByQuery() throws Exception { em.getTransaction().begin(); String nativeQuery = "MATCH ( n:" + TABLE_NAME + " { name:'Portia', author:'Oscar Wilde' } ) RETURN n"; OscarWildePoem poem = (OscarWildePoem) em.createNativeQuery( nativeQuery, OscarWildePoem.class ).getSingleResult(); assertThat( poem.getCritic() ).isNotNull(); assertThat( poem.getCritic().getName() ).as( "Wrong critic name" ).isEqualTo( "Roger" ); em.getTransaction().commit(); }
Source:
<code>protected void onResume() { super.onResume(); if (!freshRegFlag && !isUnregisterBtnClicked) { if (CommonUtils.isNetworkAvailable(context)) { JSONObject requestParams = new JSONObject(); try { requestParams.put(resources.getString(R.string.shared_pref_regId), regId); } catch (JSONException e) { <START> if (Constants.DEBUG_MODE_ENABLED) { <END> Log.d(TAG, "Invalid JSON." + e); } } CommonUtils.callSecuredAPI(AlreadyRegisteredActivity.this, Constants.IS_REGISTERED_ENDPOINT, Constants.POST_METHOD, requestParams, AlreadyRegisteredActivity.this, Constants.IS_REGISTERED_REQUEST_CODE); } else { CommonDialogUtils.showNetworkUnavailableMessage(AlreadyRegisteredActivity.this); } } }</code><technical_language>error message logged in place of debug messages</technical_language>

Target:
protected void onResume() { super.onResume(); if (!freshRegFlag && !isUnregisterBtnClicked) { if (CommonUtils.isNetworkAvailable(context)) { JSONObject requestParams = new JSONObject(); try { requestParams.put(resources.getString(R.string.shared_pref_regId), regId); } catch (JSONException e) { Log.e(TAG, "Invalid JSON." + e); } CommonUtils.callSecuredAPI(AlreadyRegisteredActivity.this, Constants.IS_REGISTERED_ENDPOINT, HTTP_METHODS.POST, requestParams, AlreadyRegisteredActivity.this, Constants.IS_REGISTERED_REQUEST_CODE); } else { CommonDialogUtils.showNetworkUnavailableMessage(AlreadyRegisteredActivity.this); } } }
Source:
<code>private Expression getExpression(String expression) { if (isTemplate(expression)) { <START> logger.warn("Template expressions are deprecated in favor of literal expressions"); <END> return new SpelExpressionParser().parseExpression(expression, PARSER_CONTEXT); } return new SpelExpressionParser().parseExpression(expression); }</code><technical_language>I Template expressions deprecated for ExpressionRetryPolicy . *literal expressions* is confuse users is a LiteralExpresion return plain string time. So, bring end-users in situation decide this is trealy simple strings</technical_language>

Target:
private Expression getExpression(String expression) { if (isTemplate(expression)) { logger.warn("#{...} syntax is not required for this run-time expression and is deprecated in favor of a simple expression string"); return new SpelExpressionParser().parseExpression(expression, PARSER_CONTEXT); } return new SpelExpressionParser().parseExpression(expression); }
Source:
<code>private void terminateContainer(DockerCloud dc, DockerClient client, Container container) { boolean gracefulFailed = false; try { terminateContainerGracefully(dc, container); } catch (TerminationException e) { <START> LOGGER.warn("Graceful termination of container failed with TerminationException", container.getId(), e); <END> gracefulFailed = true; } catch (ContainerIsTaintedException e) { LOGGER.warn("Container has been tempered with; skipping cleanup", container.getId(), e); return; } if (gracefulFailed) { try { client.removeContainerCmd(container.getId()).withForce(true).exec(); } catch (RuntimeException e) { LOGGER.warn("Forced termination of container failed with RuntimeException", container.getId(), e); } } }</code><technical_language>Unnecessary logging - enough logging call stopAndRemoveContainer need log extra (also, a full stracktrace TerminationException useful)</technical_language>

Target:
private void terminateContainer(DockerCloud dc, DockerClient client, Container container) { boolean gracefulFailed = false; try { terminateContainerGracefully(dc, container); } catch (TerminationException e) { gracefulFailed = true; } catch (ContainerIsTaintedException e) { LOGGER.warn("Container has been tampered with; skipping cleanup", container.getId(), e); return; } if (gracefulFailed) { try { Instant start = clock.instant(); client.removeContainerCmd(container.getId()).withForce(true).exec(); Instant stop = clock.instant(); executionStatistics.addContainerRemovalForce(Duration.between(start, stop).toMillis()); } catch (RuntimeException e) { LOGGER.warn("Forced termination of container failed with RuntimeException", container.getId(), e); executionStatistics.addContainerRemovalFailed(); } } }
Source:
<code>private void renderConstants(ParameterHolder<?> criteriaBuilder) { for (Map.Entry<Object, String> entry : constantToLabel.entrySet()) { try { criteriaBuilder.setParameter(entry.getValue(), entry.getKey()); } catch (Exception e) { <START> throw e; <END> } } }</code><technical_language>This compile do need a try catch anyway</technical_language>

Target:
private void renderConstants(ParameterHolder<?> criteriaBuilder) { for (Map.Entry<Object, String> entry : constantToLabel.entrySet()) { criteriaBuilder.setParameter(entry.getValue(), entry.getKey()); } }
Source:
<code>protected String checkJavaVersion(final PrintStream logger, String javaCommand, final BufferedReader r, final StringWriter output) throws IOException { String line; while (null != (line = r.readLine())) { output.write(line); output.write("\n"); line = line.toLowerCase(Locale.ENGLISH); if (line.startsWith("java version \"") || line.startsWith("openjdk version \"")) { final String versionStr = line.substring( line.indexOf('\"') + 1, line.lastIndexOf('\"')); logger.println(Messages.SSHLauncher_JavaVersionResult( getTimestamp(), javaCommand, versionStr)); final VersionNumber minJavaLevel = JavaProvider.getMinJavaLevel(); try { final Number version = NumberFormat.getNumberInstance(Locale.US).parse(versionStr); if(version.doubleValue() < Double.parseDouble("1."+minJavaLevel)) { throw new IOException(Messages <START> .SSHLauncher_NoJavaFound(line, minJavaLevel.toString())); <END> } } catch(final ParseException e) { throw new IOException(Messages.SSHLauncher_NoJavaFound(line, minJavaLevel)); } return javaCommand; } } return null; }</code><technical_language>toString() gratuitous</technical_language>

Target:
protected String checkJavaVersion(final PrintStream logger, String javaCommand, final BufferedReader r, final StringWriter output) throws IOException { String line; while (null != (line = r.readLine())) { output.write(line); output.write("\n"); line = line.toLowerCase(Locale.ENGLISH); if (line.startsWith("java version \"") || line.startsWith("openjdk version \"")) { final String versionStr = line.substring( line.indexOf('\"') + 1, line.lastIndexOf('\"')); logger.println(Messages.SSHLauncher_JavaVersionResult( getTimestamp(), javaCommand, versionStr)); final VersionNumber minJavaLevel = JavaProvider.getMinJavaLevel(); try { final Number version = NumberFormat.getNumberInstance(Locale.US).parse(versionStr); if(version.doubleValue() < Double.parseDouble("1."+minJavaLevel)) { throw new IOException(Messages .SSHLauncher_NoJavaFound2(line, minJavaLevel.toString())); } } catch(final ParseException e) { throw new IOException(Messages.SSHLauncher_NoJavaFound2(line, minJavaLevel)); } return javaCommand; } } return null; }
Source:
<code>public ValidationError(String msg) { <START> super("ValidationError: " + msg); <END> }</code><technical_language>override toString append ValidationError get org.voltdb.exception.ValidationError: ValidationError: MESSAGE toString is called stack trace is printed</technical_language>

Target:
public ValidationError(String msg) { super(msg); }
Source:
<code>private List<ErrorReporter> sinkTaskReporters(ConnectorTaskId id, SinkConnectorConfig connConfig, ErrorHandlingMetrics errorHandlingMetrics, Class<? extends Connector> connectorClass) { ArrayList<ErrorReporter> reporters = new ArrayList<>(); LogReporter logReporter = new LogReporter(id, connConfig, errorHandlingMetrics); reporters.add(logReporter); String topic = connConfig.dlqTopicName(); if (topic != null && !topic.isEmpty()) { Map<String, Object> producerProps = producerConfigs(id, "connector-dlq-producer-" + id, config, connConfig, connectorClass, connectorClientConfigOverridePolicy); Map<String, Object> adminProps = adminConfigs(id, "", config, connConfig, connectorClass, connectorClientConfigOverridePolicy); DeadLetterQueueReporter reporter = DeadLetterQueueReporter.createAndSetup(adminProps, id, connConfig, producerProps, errorHandlingMetrics); <START> reporters.add(reporter); <END> } return reporters; }</code><technical_language>keeping this blank for compatibility</technical_language>

Target:
private List<ErrorReporter> sinkTaskReporters(ConnectorTaskId id, SinkConnectorConfig connConfig, ErrorHandlingMetrics errorHandlingMetrics, Class<? extends Connector> connectorClass) { ArrayList<ErrorReporter> reporters = new ArrayList<>(); LogReporter logReporter = new LogReporter(id, connConfig, errorHandlingMetrics); reporters.add(logReporter); String topic = connConfig.dlqTopicName(); if (topic != null && !topic.isEmpty()) { Map<String, Object> producerProps = producerConfigs(id, "connector-dlq-producer-" + id, config, connConfig, connectorClass, connectorClientConfigOverridePolicy); Map<String, Object> adminProps = adminConfigs(id, "connector-dlq-adminclient-", config, connConfig, connectorClass, connectorClientConfigOverridePolicy); DeadLetterQueueReporter reporter = DeadLetterQueueReporter.createAndSetup(adminProps, id, connConfig, producerProps, errorHandlingMetrics); reporters.add(reporter); } return reporters; }
Source:
<code>public CollectionResource createCollection(String newName) throws DotRuntimeException { User user=(User)HttpManager.request().getAuthorization().getTag(); if(dotDavHelper.isTempResource(newName)){ File f = dotDavHelper.createTempFolder(File.separator + host.getHostname() + File.separator + newName); TempFolderResourceImpl tr = new TempFolderResourceImpl(f.getPath(),f ,isAutoPub); return tr; } if(!path.endsWith("/")){ path = path + "/"; } try { Folder f = dotDavHelper.createFolder(path + newName, user); FolderResourceImpl fr = new FolderResourceImpl(f, path + newName + "/"); return fr; } catch (Exception e) { <START> if(e instanceof InvalidFolderNameException) { <END> Logger.warnAndDebug(HostResourceImpl.class, e.getMessage(), e); throw new DotRuntimeException(e.getMessage()); } else { Logger.error(this, e.getMessage(), e); throw new DotRuntimeException(e.getMessage(), e); } } }</code><technical_language>suggestion } catch (InvalidFolderNameException e) { .... } catch (Exception e) { ... }</technical_language>

Target:
public CollectionResource createCollection(String newName) throws DotRuntimeException { User user=(User)HttpManager.request().getAuthorization().getTag(); if(dotDavHelper.isTempResource(newName)){ File f = dotDavHelper.createTempFolder(File.separator + host.getHostname() + File.separator + newName); TempFolderResourceImpl tr = new TempFolderResourceImpl(f.getPath(),f ,isAutoPub); return tr; } if(!path.endsWith("/")){ path = path + "/"; } try { Folder f = dotDavHelper.createFolder(path + newName, user); FolderResourceImpl fr = new FolderResourceImpl(f, path + newName + "/"); return fr; } catch(InvalidFolderNameException e) { Logger.warnAndDebug(HostResourceImpl.class, e.getMessage(), e); throw new DotRuntimeException(e.getMessage()); } catch (Exception e) { Logger.error(this, e.getMessage(), e); throw new DotRuntimeException(e.getMessage(), e); } }
Source:
<code>protected void performLiveSnapshot(Guid createdSnapshotId) { try { TransactionSupport.executeInScope(TransactionScopeOption.Suppress, new TransactionMethod<Void>() { @Override public Void runInTransaction() { <START> List<Disk> pluggedDisks = new VmRunHandler().getPluggedDisks(getVm(), DbFacade.getInstance() <END> .getDiskDao() .getAllForVm(getVm().getId())); runVdsCommand(VDSCommandType.Snapshot, new SnapshotVDSCommandParameters(getVm().getrun_on_vds().getValue(), getVm().getId(), ImagesHandler.filterImageDisks(pluggedDisks, false, true))); return null; } }); } catch (VdcBLLException e) { if (e.getErrorCode() == VdcBllErrors.SNAPSHOT_FAILED) { getParameters().setTaskGroupSuccess(false); log.errorFormat("Wasn't able to live snpashot due to error: {0}, rolling back.", ExceptionUtils.getMessage(e)); revertToActiveSnapshot(createdSnapshotId); } else { throw e; } } }</code><technical_language>VmRunHandler.getInstance()</technical_language>

Target:
protected void performLiveSnapshot(Guid createdSnapshotId) { try { TransactionSupport.executeInScope(TransactionScopeOption.Suppress, new TransactionMethod<Void>() { @Override public Void runInTransaction() { List<Disk> pluggedDisks = VmRunHandler.getInstance().getPluggedDisks(getVm()); runVdsCommand(VDSCommandType.Snapshot, new SnapshotVDSCommandParameters(getVm().getrun_on_vds().getValue(), getVm().getId(), ImagesHandler.filterImageDisks(pluggedDisks, false, true))); return null; } }); } catch (VdcBLLException e) { if (e.getErrorCode() == VdcBllErrors.SNAPSHOT_FAILED) { getParameters().setTaskGroupSuccess(false); log.errorFormat("Wasn't able to live snpashot due to error: {0}, rolling back.", ExceptionUtils.getMessage(e)); revertToActiveSnapshot(createdSnapshotId); } else { throw e; } } }
Source:
<code>public void onNewIntent(Intent intent) { super.onNewIntent(intent); if(intent.getAction().equals(ACTION_VIEW) && <START> intent.getData().getHost().equals("android.owncloud.com")) { <END> getOAuth2AccessTokenFromCapturedRedirection(intent.getData()); } }</code><technical_language>a get "android.owncloud.com" instead of a hardcoded string</technical_language>

Target:
public void onNewIntent(Intent intent) { super.onNewIntent(intent); if(intent.getAction().equals(ACTION_VIEW)) { getOAuth2AccessTokenFromCapturedRedirection(intent.getData()); } }
Source:
<code>public void testGetUndefined() { String result = DlmsUnitTypeDto.getUnit(0); Assert.assertTrue("UNDEFINED".equals(result)); result = DlmsUnitTypeDto.getUnit(100); <START> Assert.assertTrue("UNDEFINED".equals(result)); <END> }</code><technical_language>assertEquals</technical_language>

Target:
public void testGetUndefined() { String result = DlmsUnitTypeDto.getUnit(0); assertEquals("UNDEFINED", result); result = DlmsUnitTypeDto.getUnit(100); }
Source:
<code>protected boolean setAndValidateDiskProfiles() { if (getDiskImageInfo() != null <START> && DiskStorageType.IMAGE == getDiskImageInfo().getDiskStorageType()) { <END> Map<DiskImage, Guid> map = new HashMap<>(); map.put(getDiskImageInfo(), getStorageDomainId()); return validate(DiskProfileHelper.setAndValidateDiskProfiles(map)); } return true; }</code><technical_language>if clause removed, this method is called</technical_language>

Target:
protected boolean setAndValidateDiskProfiles() { return validate(DiskProfileHelper.setAndValidateDiskProfiles(Collections.singletonMap(getDiskImageInfo(), getStorageDomainId()))); }
Source:
<code>public WorkspaceImpl createWorkspace( WorkspaceConfig config, String namespace, @Nullable Map<String, String> attributes) throws ServerException, NotFoundException, ConflictException, ValidationException { <START> TracingTags.USER_ID.set(() -> EnvironmentContext.getCurrent().getSubject().getUserId()); <END> requireNonNull(config, "Required non-null config"); requireNonNull(namespace, "Required non-null namespace"); validator.validateConfig(config); if (attributes != null) { validator.validateAttributes(attributes); } WorkspaceImpl workspace = doCreateWorkspace(config, accountManager.getByName(namespace), attributes, false); TracingTags.WORKSPACE_ID.set(workspace.getId()); return workspace; }</code><technical_language>do in EnvironementInitializationFilter avoid adding this top sites</technical_language>

Target:
public WorkspaceImpl createWorkspace( WorkspaceConfig config, String namespace, @Nullable Map<String, String> attributes) throws ServerException, NotFoundException, ConflictException, ValidationException { TracingTags.STACK_ID.set(() -> attributes.getOrDefault("stackId", "no stack")); requireNonNull(config, "Required non-null config"); requireNonNull(namespace, "Required non-null namespace"); validator.validateConfig(config); if (attributes != null) { validator.validateAttributes(attributes); } WorkspaceImpl workspace = doCreateWorkspace(config, accountManager.getByName(namespace), attributes, false); TracingTags.WORKSPACE_ID.set(workspace.getId()); return workspace; }
Source:
<code>abstract void connect(InetSocketAddress addr) throws IOException; abstract SocketAddress getRemoteSocketAddress(); abstract SocketAddress getLocalSocketAddress(); abstract void cleanup(); abstract void packetAdded(); abstract void onClosing(); abstract void saslCompleted(); abstract void connectionPrimed(); abstract void doTransport(int waitTimeOut, List<Packet> pendingQueue, ClientCnxn cnxn) throws IOException, InterruptedException; abstract void testableCloseSocket() throws IOException; abstract void close(); abstract void sendPacket(Packet p) throws IOException; <START> public ZKClientConfig getClientConfig() { <END> return clientConfig; }</code><technical_language>public</technical_language>

Target:
abstract void connect(InetSocketAddress addr) throws IOException; abstract SocketAddress getRemoteSocketAddress(); abstract SocketAddress getLocalSocketAddress(); abstract void cleanup(); abstract void packetAdded(); abstract void onClosing(); abstract void saslCompleted(); abstract void connectionPrimed(); abstract void doTransport(int waitTimeOut, List<Packet> pendingQueue, ClientCnxn cnxn) throws IOException, InterruptedException; abstract void testableCloseSocket() throws IOException; abstract void close(); abstract void sendPacket(Packet p) throws IOException; protected void initProperties() { packetLen = Integer.getInteger( clientConfig.getProperty(ZKConfig.JUTE_MAXBUFFER), ZKClientConfig.CLIENT_MAX_PACKET_LENGTH_DEFAULT); if (LOG.isDebugEnabled()) { LOG.debug("{} is {}", ZKConfig.JUTE_MAXBUFFER, packetLen); } }
Source:
<code>protected Builder() { super(EtcdApi.class); <START> id("etcd").name("Etcd API").identityName("Optional Username").defaultIdentity("Optional Username and Password") <END> .documentation(URI.create("<LINK_0>")) .version(API_VERSION).buildVersion(BUILD_VERSION).defaultEndpoint("<LINK_1>") .defaultProperties(EtcdApiMetadata.defaultProperties()) .defaultModules(ImmutableSet.<Class<? extends Module>> of(EtcdHttpApiModule.class)); }</code><technical_language>authentication in this API. api metadata define defaultCredential then? add credentialName</technical_language>

Target:
protected Builder() { super(EtcdApi.class); id("etcd"). name("Etcd API"). identityName("Optional Username"). credentialName("Optional Password"). defaultIdentity("N/A"). defaultCredential("N/A"). documentation(URI.create("<LINK_0>")). version(API_VERSION). buildVersion(BUILD_VERSION). defaultEndpoint("<LINK_1>"). defaultProperties(EtcdApiMetadata.defaultProperties()). defaultModules(ImmutableSet.<Class<? extends Module>> of(EtcdHttpApiModule.class)); }
Source:
<code>public void startStripe(InputStreamSources dictionaryStreamSources, List<ColumnEncoding> encoding) throws IOException { ColumnEncodingKind kind = encoding.get(streamDescriptor.getStreamId()) .getColumnEncodingForSequence(streamDescriptor.getSequence()) .getColumnEncodingKind(); <START> if (kind == DIRECT || kind == DIRECT_V2 || kind == DWRF_DIRECT) { <END> currentReader = directReader; } else if (kind == DWRF_MAP_FLAT) { currentReader = flattenedReader; } else { throw new IllegalArgumentException("Unsupported encoding " + kind); } currentReader.startStripe(dictionaryStreamSources, encoding); }</code><technical_language>curious: a DWRF file direct map flat map encoded stripes present</technical_language>

Target:
public void startStripe(InputStreamSources dictionaryStreamSources, List<ColumnEncoding> encoding) throws IOException { ColumnEncodingKind kind = encoding.get(streamDescriptor.getStreamId()) .getColumnEncoding(streamDescriptor.getSequence()) .getColumnEncodingKind(); if (kind == DIRECT || kind == DIRECT_V2 || kind == DWRF_DIRECT) { currentReader = directReader; } else if (kind == DWRF_MAP_FLAT) { currentReader = flatReader; } else { throw new IllegalArgumentException("Unsupported encoding " + kind); } currentReader.startStripe(dictionaryStreamSources, encoding); }
Source:
<code>public void deleteStory(String storyId) { <START> m_db.deleteStory(storyId); <END> }</code><technical_language>Remove local cache. Publish</technical_language>

Target:
public void deleteStory(String storyId) { m_db.deleteStory(storyId); m_storyList.remove(storyId); PublishStoryListChanged(); }
Source:
<code>public void populate(ICube cube) { tryInit(vanilla, world); <START> Random rand = getChunkSpecificRandom(cube.getX(), cube.getZ()); <END> CubeGeneratorsRegistry.populateVanillaCubic(world, rand, cube); if (cube.getY() < 0 || cube.getY() >= worldHeightCubes) { return; } if (cube.getY() >= 0 && cube.getY() < worldHeightCubes) { for (int y = worldHeightCubes - 1; y >= 0; y--) { ((ICubicWorldInternal) world).getCubeFromCubeCoords(cube.getX(), y, cube.getZ()).setPopulated(true); } try { vanilla.populate(cube.getX(), cube.getZ()); } catch (IllegalArgumentException ex) { StackTraceElement[] stack = ex.getStackTrace(); if (stack == null || stack.length < 1 || !stack[0].getClassName().equals(Random.class.getName()) || !stack[0].getMethodName().equals("nextInt")) { throw ex; } else { CubicChunks.LOGGER.error("Error while populating. Likely known mod issue, ignoring...", ex); } } GameRegistry.generateWorld(cube.getX(), cube.getZ(), world, vanilla, world.getChunkProvider()); } }</code><technical_language>seed change cube Y too? sense do for actual vanilla generator, sense for CC</technical_language>

Target:
public void populate(ICube cube) { tryInit(vanilla, world); Random rand = getCubeSpecificRandom(cube.getX(), cube.getY(), cube.getZ()); CubeGeneratorsRegistry.populateVanillaCubic(world, rand, cube); if (cube.getY() < 0 || cube.getY() >= worldHeightCubes) { return; } if (cube.getY() >= 0 && cube.getY() < worldHeightCubes) { for (int y = worldHeightCubes - 1; y >= 0; y--) { ((ICubicWorldInternal) world).getCubeFromCubeCoords(cube.getX(), y, cube.getZ()).setPopulated(true); } try { vanilla.populate(cube.getX(), cube.getZ()); } catch (IllegalArgumentException ex) { StackTraceElement[] stack = ex.getStackTrace(); if (stack == null || stack.length < 1 || !stack[0].getClassName().equals(Random.class.getName()) || !stack[0].getMethodName().equals("nextInt")) { throw ex; } else { CubicChunks.LOGGER.error("Error while populating. Likely known mod issue, ignoring...", ex); } } GameRegistry.generateWorld(cube.getX(), cube.getZ(), world, vanilla, world.getChunkProvider()); } }
Source:
<code>public void testCloseWithCancellation() throws Exception { cnt = 0; boolean failed = false; startGrids(3); <START> Ignite g4 = grid(2); <END> IgniteDataStreamer<Object, Object> dataLdr = g4.dataStreamer(DEFAULT_CACHE_NAME); dataLdr.perNodeBufferSize(32); List<IgniteFuture> futures = new ArrayList<>(501); for (int i = 0; i < 500; i++) futures.add(dataLdr.addData(i, i)); try { dataLdr.close(true); } catch (CacheException ignored) { failed = true; } finally { assertTrue(failed); for (IgniteFuture fut : futures) assertTrue(fut.isDone()); } }</code><technical_language>Rename g4 g2</technical_language>

Target:
public void testCloseWithCancellation() throws Exception { cnt = 0; startGrids(2); Ignite g1 = grid(1); List<IgniteFuture> futures = new ArrayList<>(); IgniteDataStreamer<Object, Object> dataLdr = g1.dataStreamer(DEFAULT_CACHE_NAME); for (int i = 0; i < 100; i++) futures.add(dataLdr.addData(i, i)); try { dataLdr.close(true); } catch (CacheException e) { } for (IgniteFuture fut : futures) assertTrue(fut.isDone()); }