auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void onMessage(Message message) { try { <START> log.infof("onMessage received message: %s '%s'", message, ((TextMessage) message).getText()); <END> final Destination replyTo = message.getJMSReplyTo(); if (replyTo == null) { throw new RuntimeException("ReplyTo info in message was not specified" + " and bean does not know where to reply to"); } TxTestUtil.enlistTestXAResource(tm.getTransaction()); TxTestUtil.addSynchronization(tm.getTransaction()); try ( JMSContext context = factory.createContext() ) { context.createProducer() .setJMSCorrelationID(message.getJMSMessageID()) .send(replyTo, REPLY_PREFIX + ((TextMessage) message).getText()); } } catch (Exception e) { throw new RuntimeException("onMessage method execution failed", e); } }</code><technical_language>log.tracef</technical_language>

Target:
public void onMessage(Message message) { try { log.tracef("onMessage received message: %s '%s'", message, ((TextMessage) message).getText()); final Destination replyTo = message.getJMSReplyTo(); if (replyTo == null) { throw new RuntimeException("ReplyTo info in message was not specified" + " and bean does not know where to reply to"); } TxTestUtil.enlistTestXAResource(tm.getTransaction()); TxTestUtil.addSynchronization(tm.getTransaction()); try ( JMSContext context = factory.createContext() ) { context.createProducer() .setJMSCorrelationID(message.getJMSMessageID()) .send(replyTo, REPLY_PREFIX + ((TextMessage) message).getText()); } } catch (Exception e) { throw new RuntimeException("onMessage method execution failed", e); } }
Source:
<code>protected String[] getCommandArgs() { return new String[]{ "--no-color", <START> "--except=terminating-semicolon", <END> "--", inputFile.getPath() }; }</code><technical_language>Change this "--only=function-whitespace" remove "--" line</technical_language>

Target:
protected String[] getCommandArgs() { return new String[]{ "--only=function-whitespace" }; }
Source:
<code>protected String constructUrlForConnection(String queryString) { return "".equals(queryString) ? getJdbcUrl() <START> : getJdbcUrl() + QUERY_PARAM_SEPARATOR + queryString.substring(1); <END> }</code><technical_language>queryString.substring(1) guarded a check if character is</technical_language>

Target:
protected String constructUrlForConnection(String queryString) { String baseUrl = getJdbcUrl(); if ("".equals(queryString)) { return baseUrl; } if (!queryString.startsWith("?")) { throw new IllegalArgumentException("The '?' character must be included"); } return baseUrl.contains("?") ? baseUrl + QUERY_PARAM_SEPARATOR + queryString.substring(1) : baseUrl + queryString; }
Source:
<code>private boolean modify(String processId, Predicate<Process> checker, Consumer<Process> modifier) { <START> Process process = fetchProcess(processId).orElse(null); <END> if (process == null) { return false; } int retries = 5; while (retries-- > 0) { if (!checker.test(process)) { return false; } modifier.accept(process); try { elastic.tryUpdate(process); process1stLevelCache.put(processId, process); process2ndLevelCache.put(processId, process); return true; } catch (OptimisticLockException e) { Wait.randomMillis(250, 500); } } Log.BACKGROUND.WARN("Failed to update process %s after 5 attempts. Skipping update...", processId); return false; }</code><technical_language>want 2nd level cache a stale instance - 1st lvl cach bypass 1s write delay.</technical_language>

Target:
private boolean modify(String processId, Predicate<Process> checker, Consumer<Process> modifier) { Process process = process1stLevelCache.get(processId); if (process == null) { process = elastic.find(Process.class, processId).orElse(null); } if (process == null) { return false; } int retries = 5; while (retries-- > 0) { if (!checker.test(process)) { return false; } modifier.accept(process); try { elastic.tryUpdate(process); process1stLevelCache.put(processId, process); process2ndLevelCache.put(processId, process); return true; } catch (OptimisticLockException e) { Wait.randomMillis(250, 500); } } Log.BACKGROUND.WARN("Failed to update process %s after 5 attempts. Skipping update...", processId); return false; }
Source:
<code>protected void assertModuleRequest(String moduleName, boolean remove) { Message<?> next = tapChannel.receive(0); assertNotNull(next); String payload = (String) next.getPayload(); <START> assertTrue(payload, payload.contains("\"module\":\"" + moduleName + "\"")); <END> assertTrue(payload, payload.contains("\"remove\":" + (remove ? "true" : "false"))); }</code><technical_language>payload assert failure message confusing more context</technical_language>

Target:
protected void assertModuleRequest(String moduleName, boolean remove) { Message<?> next = tapChannel.receive(0); assertNotNull(next); String payload = (String) next.getPayload(); assertTrue(String.format("payload %s does not contain the expected module name %s", payload, moduleName), payload.contains("\"module\":\"" + moduleName + "\"")); assertTrue(String.format("payload %s does not contain the expected remove: value", payload), payload.contains("\"remove\":" + (remove ? "true" : "false"))); }
Source:
<code>public IngressServerExposer( ExternalServiceExposureStrategy serviceExposureStrategy, @Named("infra.kubernetes.ingress.annotations") Map<String, String> annotations, @Nullable @Named("che.infra.kubernetes.ingress.labels") String labelsProperty, @Nullable @Named("che.infra.kubernetes.ingress.path_transform") String pathTransformFmt) { this.serviceExposureStrategy = serviceExposureStrategy; this.ingressAnnotations = annotations; this.pathTransformFmt = pathTransformFmt == null ? PATH_TRANSFORM_PATH_CATCH : pathTransformFmt; this.labels = labelsProperty != null ? Splitter.on(",").withKeyValueSeparator("=").split(labelsProperty) <START> : new HashMap<>(); <END> }</code><technical_language>Collections.emptyMap(</technical_language>

Target:
public IngressServerExposer( ExternalServiceExposureStrategy serviceExposureStrategy, @Named("infra.kubernetes.ingress.annotations") Map<String, String> annotations, @Nullable @Named("che.infra.kubernetes.ingress.labels") String labelsProperty, @Nullable @Named("che.infra.kubernetes.ingress.path_transform") String pathTransformFmt) { this.serviceExposureStrategy = serviceExposureStrategy; this.ingressAnnotations = annotations; this.pathTransformFmt = pathTransformFmt == null ? PATH_TRANSFORM_PATH_CATCH : pathTransformFmt; this.labels = labelsProperty != null ? Splitter.on(",").withKeyValueSeparator("=").split(labelsProperty) : emptyMap(); }
Source:
<code>public void testEndOfStreamWithMultipleTasks() throws Exception { CountDownLatch task0ProcessedMessagesLatch = new CountDownLatch(1); CountDownLatch task1ProcessedMessagesLatch = new CountDownLatch(1); SystemConsumers consumerMultiplexer = mock(SystemConsumers.class); when(consumerMultiplexer.pollIntervalMs()).thenReturn(10); OffsetManager offsetManager = mock(OffsetManager.class); TestTask task0 = spy(createTestTask(true, true, false, task0ProcessedMessagesLatch, 0, taskName0, ssp0, offsetManager)); TestTask task1 = spy(createTestTask(true, true, false, task1ProcessedMessagesLatch, 0, taskName1, ssp1, offsetManager)); Map<TaskName, RunLoopTask> tasks = new HashMap<>(); tasks.put(taskName0, task0); tasks.put(taskName1, task1); int maxMessagesInFlight = 1; RunLoop runLoop = new RunLoop(tasks, executor, consumerMultiplexer, maxMessagesInFlight, windowMs, commitMs, callbackTimeoutMs, maxThrottlingDelayMs, maxIdleMs, containerMetrics, () -> 0L, false); when(consumerMultiplexer.choose(false)) .thenReturn(envelope0) .thenReturn(envelope1) .thenReturn(ssp0EndOfStream) .thenReturn(ssp1EndOfStream) .thenReturn(null); runLoop.run(); task0ProcessedMessagesLatch.await(); task1ProcessedMessagesLatch.await(); <START> verify(task0, times(1)).endOfStream(any()); <END> verify(task1, times(1)).endOfStream(any()); assertEquals(1, task0.processed); assertEquals(1, task0.completed.get()); assertEquals(1, task1.processed); assertEquals(1, task1.completed.get()); assertEquals(4L, containerMetrics.envelopes().getCount()); assertEquals(2L, containerMetrics.processes().getCount()); }</code><technical_language>times(1) is default for verify, need pass argument</technical_language>

Target:
public void testEndOfStreamWithMultipleTasks() { SystemConsumers consumerMultiplexer = mock(SystemConsumers.class); RunLoopTask task0 = getMockRunLoopTask(taskName0, ssp0); RunLoopTask task1 = getMockRunLoopTask(taskName1, ssp1); Map<TaskName, RunLoopTask> tasks = new HashMap<>(); tasks.put(taskName0, task0); tasks.put(taskName1, task1); int maxMessagesInFlight = 1; RunLoop runLoop = new RunLoop(tasks, executor, consumerMultiplexer, maxMessagesInFlight, windowMs, commitMs, callbackTimeoutMs, maxThrottlingDelayMs, maxIdleMs, containerMetrics, () -> 0L, false); when(consumerMultiplexer.choose(false)) .thenReturn(envelope00) .thenReturn(envelope11) .thenReturn(ssp0EndOfStream) .thenReturn(ssp1EndOfStream) .thenReturn(null); runLoop.run(); verify(task0).process(eq(envelope00), any(), any()); verify(task0).endOfStream(any()); verify(task1).process(eq(envelope11), any(), any()); verify(task1).endOfStream(any()); assertEquals(4L, containerMetrics.envelopes().getCount()); }
Source:
<code><START> public ArrayInterface setArray(int index, Array value) { <END> return setObject(index, value); }</code><technical_language>I return Array here</technical_language>

Target:
public Array setArray(int index, Array value) { return setObject(index, value); }
Source:
<code><START> private groovy.lang.Script getParsedScript() { <END> if (groovyShell == null) { groovyShell = new GroovyShell(); } if (parsedScript == null) { parsedScript = new ThreadLocal<>(); } groovy.lang.Script script = parsedScript.get(); if (script == null) { script = groovyShell.parse(expression); parsedScript.set(script); } return script; }</code><technical_language>@HeartSaVioR If multiple threads invoke concurrently getParsedScript(), create instances of groovyShell parsedScript do give thread safe instances. instance of GroovyShell parsedScript shared threads. do want create in constructor avoid serialization issues. want synchronize while creating instances for thread safety. IMO this synchronization penalty avoided created in constructor. components creating GroovyScript instance create is required. This kind of stuff is typically done in org.apache.storm.task.IBolt#prepare instead of in IBolt constructors avoid serialization issues. file a separate JIRA address that</technical_language>

Target:
private groovy.lang.Script getParsedScript() { if (parsedScript == null) { synchronized (this) { parsedScript = new ThreadLocal<groovy.lang.Script>() { @Override protected groovy.lang.Script initialValue() { return new GroovyShell().parse(expression); } }; } } return parsedScript.get(); }
Source:
<code>private Event.Type getEventType(Class<? extends Annotation> annotation) { <START> if (annotation == CacheEntryActivated.class) return Event.Type.CACHE_ENTRY_ACTIVATED; <END> if (annotation == CacheEntryCreated.class) return Event.Type.CACHE_ENTRY_CREATED; if (annotation == CacheEntryInvalidated.class) return Event.Type.CACHE_ENTRY_INVALIDATED; if (annotation == CacheEntryLoaded.class) return Event.Type.CACHE_ENTRY_LOADED; if (annotation == CacheEntryModified.class) return Event.Type.CACHE_ENTRY_MODIFIED; if (annotation == CacheEntryPassivated.class) return Event.Type.CACHE_ENTRY_PASSIVATED; if (annotation == CacheEntryRemoved.class) return Event.Type.CACHE_ENTRY_REMOVED; if (annotation == CacheEntryVisited.class) return Event.Type.CACHE_ENTRY_VISITED; if (annotation == CacheEntryEvicted.class) return Event.Type.CACHE_ENTRY_EVICTED; return null; }</code><technical_language>store in a hash map? CacheNotiferImpl similar, for actual Event class instead</technical_language>

Target:
private Event.Type getEventType(Class<? extends Annotation> annotation) { if (annotation == CacheEntryCreated.class) return Event.Type.CACHE_ENTRY_CREATED; if (annotation == CacheEntryModified.class) return Event.Type.CACHE_ENTRY_MODIFIED; if (annotation == CacheEntryRemoved.class) return Event.Type.CACHE_ENTRY_REMOVED; if (annotation == CacheEntryActivated.class) return Event.Type.CACHE_ENTRY_ACTIVATED; if (annotation == CacheEntryInvalidated.class) return Event.Type.CACHE_ENTRY_INVALIDATED; if (annotation == CacheEntryLoaded.class) return Event.Type.CACHE_ENTRY_LOADED; if (annotation == CacheEntryPassivated.class) return Event.Type.CACHE_ENTRY_PASSIVATED; if (annotation == CacheEntryVisited.class) return Event.Type.CACHE_ENTRY_VISITED; if (annotation == CacheEntriesEvicted.class) return Event.Type.CACHE_ENTRY_EVICTED; if (annotation == CacheEntryEvicted.class) return Event.Type.CACHE_ENTRY_EVICTED; return null; }
Source:
<code>private Response createErrorResponse(String errorId, LockEntry lockEntry) { String message = String.format("Error %s: Check and set failed. ", errorId) <START> + (lockEntry == null ? "" : "Lock was already open. "); <END> return Response .status(Response.Status.CONFLICT) .type(MediaType.APPLICATION_JSON_TYPE) .entity(ImmutableMap.of( "exceptionClass", CheckAndSetException.class.getName(), "message", message, "code", Response.Status.CONFLICT.getStatusCode())) .build(); }</code><technical_language>prefer including state of lockEntry if null, and/or checking if open open indicating - CheckAndSetException occur if else locked lock well, necessary lock's open</technical_language>

Target:
private Response createErrorResponse(String errorId, LockEntry lockEntry) { String message = String.format("Error %s: Check and set failed. ", errorId) + (lockEntry == null ? "Please contact the AtlasDB team. " : lockEntry); return Response .status(Response.Status.CONFLICT) .type(MediaType.APPLICATION_JSON_TYPE) .entity(ImmutableMap.of( "exceptionClass", CheckAndSetException.class.getName(), "message", message, "code", Response.Status.CONFLICT.getStatusCode())) .build(); }
Source:
<code>public void testLabelSelector() { LabelSelector selector = repo.getKieServerCMLabelSelector(client); assertNotNull(selector); boolean foundAppNameLabel = false; for (LabelSelectorRequirement selReq : selector.getMatchExpressions()) { if (selReq.getKey() == KieServerStateCloudRepository.CFG_MAP_LABEL_APP_NAME) { foundAppNameLabel = true; assertEquals("In", selReq.getOperator()); assertTrue(selReq.getValues().contains(TEST_APP_NAME)); } if (selReq.getKey() == KieServerStateCloudRepository.CFG_MAP_LABEL_NAME) { assertEquals("In", selReq.getOperator()); assertTrue(selReq.getValues().contains(KieServerStateCloudRepository.CFG_MAP_LABEL_VALUE_USED)); assertTrue(selReq.getValues().contains(KieServerStateCloudRepository.CFG_MAP_LABEL_VALUE_IMMUTABLE)); } } assertTrue(foundAppNameLabel); System.setProperty(KieServerStateCloudRepository.CFG_KIE_CONTROLLER_OCP_GLOBAL_DISCOVERY_ENABLED, "true"); assertTrue(repo.getKieServerCMLabelSelector(client).getMatchExpressions().stream().noneMatch( selReq -> selReq.getKey() == KieServerStateCloudRepository.CFG_MAP_LABEL_APP_NAME)); <START> System.clearProperty(KieServerStateCloudRepository.CFG_KIE_CONTROLLER_OCP_GLOBAL_DISCOVERY_ENABLED); <END> }</code><technical_language>Please put this final statement of try clause previous line move @After method, property is cleared in case of assertion failure</technical_language>

Target:
public void testLabelSelector() { LabelSelector selector = repo.getKieServerCMLabelSelector(client); assertNotNull(selector); boolean foundAppNameLabel = false; for (LabelSelectorRequirement selReq : selector.getMatchExpressions()) { if (selReq.getKey() == KieServerStateCloudRepository.CFG_MAP_LABEL_APP_NAME) { foundAppNameLabel = true; assertEquals("In", selReq.getOperator()); assertTrue(selReq.getValues().contains(TEST_APP_NAME)); } if (selReq.getKey() == KieServerStateCloudRepository.CFG_MAP_LABEL_NAME) { assertEquals("In", selReq.getOperator()); assertTrue(selReq.getValues().contains(KieServerStateCloudRepository.CFG_MAP_LABEL_VALUE_USED)); assertTrue(selReq.getValues().contains(KieServerStateCloudRepository.CFG_MAP_LABEL_VALUE_IMMUTABLE)); } } assertTrue(foundAppNameLabel); System.setProperty(KieServerControllerConstants.KIE_CONTROLLER_OCP_GLOBAL_DISCOVERY_ENABLED, "true"); assertTrue(repo.getKieServerCMLabelSelector(client).getMatchExpressions().stream().noneMatch( selReq -> selReq.getKey() == KieServerStateCloudRepository.CFG_MAP_LABEL_APP_NAME)); }
Source:
<code>protected void activate(ComponentContext context) { if (log.isDebugEnabled()) { log.debug("Activating GoogleConnectorServiceComponent"); } try { GoogleProvisioningConnectorFactory googleProvisioningConnectorFactory = new GoogleProvisioningConnectorFactory(); context.getBundleContext().registerService(AbstractProvisioningConnectorFactory.class.getName(), googleProvisioningConnectorFactory, null); if (log.isDebugEnabled()) { log.debug("Google Identity Provisioning Connector bundle is activated"); } } catch (Exception e) { <START> log.error(" Error while activating Google Identity Provisioning Connector ", e); <END> } }</code><technical_language>remove unnecessary space, catch throwable</technical_language>

Target:
protected void activate(ComponentContext context) { if (log.isDebugEnabled()) { log.debug("Activating GoogleConnectorServiceComponent"); } try { GoogleProvisioningConnectorFactory googleProvisioningConnectorFactory = new GoogleProvisioningConnectorFactory(); context.getBundleContext().registerService(AbstractProvisioningConnectorFactory.class.getName(), googleProvisioningConnectorFactory, null); if (log.isDebugEnabled()) { log.debug("Google Identity Provisioning Connector bundle is activated"); } } catch (Throwable e) { log.error("Error while activating Google Identity Provisioning Connector", e); } }
Source:
<code>private void sendResultsEmail(PaymentWorksEmailableReportData reportData, File reportFile) { LOG.info("sendResultsEmail: entered"); String body = readReportFileToString(reportData, reportFile); String subject = buildEmailSubject(reportData); <START> if (StringUtils.isNotBlank(getToAddress()) && StringUtils.isNotBlank(getFromAddress()) && StringUtils.isNotBlank(body) && StringUtils.isNotBlank(subject)) { <END> getPaymentWorksReportEmailService().sendEmail(getToAddress(), getFromAddress(), subject, body); LOG.info("sendResultsEmail: Email was sent for batch job results report. toAddress = " + getToAddress() + " fromAddress = " + getFromAddress() + " subject = '" + subject + "'"); } else { LOG.error("sendResultsEmail: Could not email batch job results report " + reportData.retrieveReportName() + " because " + ((StringUtils.isBlank(getToAddress())) ? "toAddress is blank. " : "") + ((StringUtils.isBlank(getFromAddress())) ? "fromAddress is blank. " : "") + ((StringUtils.isBlank(subject)) ? "subject is blank. " : "") + ((StringUtils.isBlank(body)) ? "body is blank. " : "")); } }</code><technical_language>do checks logging sendEmail method</technical_language>

Target:
private void sendResultsEmail(PaymentWorksEmailableReportData reportData, File reportFile) { LOG.info("sendResultsEmail: Preparing to send email for batch job results report " + reportData.retrieveReportName()); String body = readReportFileToString(reportData, reportFile); String subject = buildEmailSubject(reportData); getPaymentWorksReportEmailService().sendEmail(getToAddress(), getFromAddress(), subject, body); LOG.info("sendResultsEmail: Email was sent for batch job results report. toAddress = " + getToAddress() + " fromAddress = " + getFromAddress() + " subject = '" + subject + "'."); }
Source:
<code>public void testProcessScheduledMessageSuccess() { final ResponseMessageResultType result = ResponseMessageResultType.OK; final ProtocolResponseMessage message = new ProtocolResponseMessage.Builder() <START> .deviceMessageMetadata(DEVICE_MESSAGE_DATA).domain(DOMAIN).domainVersion(DOMAIN_VERSION).result(result) <END> .dataObject(DATA_OBJECT).scheduled(true).build(); final ScheduledTask scheduledTask = new ScheduledTask(DEVICE_MESSAGE_DATA, DOMAIN, DOMAIN, DATA_OBJECT, SCHEDULED_TIME); scheduledTask.setPending(); when(this.scheduledTaskRepository.findByCorrelationUid(anyString())).thenReturn(scheduledTask); this.deviceResponseMessageService.processMessage(message); verify(this.domainResponseMessageSender, times(1)).send(message); verify(this.scheduledTaskRepository, times(1)).delete(scheduledTask); }</code><technical_language>add ResponseMessageResultType.OK in steadof 'result'</technical_language>

Target:
public void testProcessScheduledMessageSuccess() { final ProtocolResponseMessage message = new ProtocolResponseMessage.Builder() .deviceMessageMetadata(DEVICE_MESSAGE_DATA).domain(DOMAIN).domainVersion(DOMAIN_VERSION) .result(ResponseMessageResultType.OK).dataObject(DATA_OBJECT).scheduled(true).build(); final ScheduledTask scheduledTask = new ScheduledTask(DEVICE_MESSAGE_DATA, DOMAIN, DOMAIN, DATA_OBJECT, SCHEDULED_TIME); scheduledTask.setPending(); when(this.scheduledTaskRepository.findByCorrelationUid(anyString())).thenReturn(scheduledTask); this.deviceResponseMessageService.processMessage(message); verify(this.domainResponseMessageSender).send(message); verify(this.scheduledTaskRepository).delete(scheduledTask); }
Source:
<code>public void testConfigureClientBuilder() { configurator.configureDefaults(props); configurator.configureClientBuilder(config, builder); <START> List<Object> actual = captor.getAllValues(); <END> assertTrue(actual.size() > 8); Iterator<Object> iterator = actual.iterator(); assertEquals(GenericResponseExceptionMapper.class, iterator.next().getClass()); assertEquals(JacksonJaxbJsonProvider.class, iterator.next().getClass()); assertEquals(JsonParseExceptionMapper.class, iterator.next()); assertEquals(JsonMappingExceptionMapper.class, iterator.next()); assertEquals(OAuthJSONProvider.class, iterator.next().getClass()); assertEquals(OAuthContextProvider.class, iterator.next().getClass()); assertEquals(LoggingFeature.class, iterator.next().getClass()); assertEquals(GZIPFeature.class, iterator.next().getClass()); verify(builder).property("a", "1"); verify(builder).property("b", "2"); verify(builder).property("c", "3"); }</code><technical_language>out verify statement eliminate captor.capture, causing a null return - noticed build failure</technical_language>

Target:
public void testConfigureClientBuilder() { configurator.configureDefaults(props); configurator.configureClientBuilder(config, builder); verify(builder, times(10)).register(captor.capture()); List<Object> actual = captor.getAllValues(); assertTrue(actual.size() > 10); Iterator<Object> iterator = actual.iterator(); assertEquals(GenericResponseExceptionMapper.class, iterator.next().getClass()); assertEquals(JacksonJaxbJsonProvider.class, iterator.next().getClass()); assertEquals(JsonParseExceptionMapper.class, iterator.next()); assertEquals(JsonMappingExceptionMapper.class, iterator.next()); assertEquals(OAuthJSONProvider.class, iterator.next().getClass()); assertEquals(OAuthContextProvider.class, iterator.next().getClass()); assertEquals(LoggingFeature.class, iterator.next().getClass()); assertEquals(GZIPFeature.class, iterator.next().getClass()); verify(builder).property("a", "1"); verify(builder).property("b", "2"); verify(builder).property("c", "3"); }
Source:
<code>public boolean handleSelection() { <START> try { <END> if (FoundInVersionColumnUI.promptFoundInVersion((TeamWorkFlowArtifact) getArtifact(), VersionReleaseType.UnReleased, VersionLockedType.UnLocked, getRelation())) { notifyXModifiedListeners(); refresh(); return true; } return false; } catch (Exception ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } return false; }</code><technical_language>want UnLocked UnReleased. want able select version</technical_language>

Target:
public boolean handleSelection() { try { if (FoundInVersionColumnUI.promptFoundInVersion((TeamWorkFlowArtifact) getArtifact(), getRelation())) { notifyXModifiedListeners(); refresh(); return true; } return false; } catch (Exception ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } return false; }
Source:
<code>public boolean isLargeAttribute(PerunSession sess, AttributeDefinition attribute) { return (attribute.getType().equals(LinkedHashMap.class.getName()) || attribute.getType().equals("java.lang.LargeString") || <START> attribute.getType().equals("java.util.LargeArrayList")); <END> }</code><technical_language>I prefer constant there</technical_language>

Target:
public boolean isLargeAttribute(PerunSession sess, AttributeDefinition attribute) { return (attribute.getType().equals(LinkedHashMap.class.getName()) || attribute.getType().equals(BeansUtils.largeStringClassName) || attribute.getType().equals(BeansUtils.largeArrayListClassName)); }
Source:
<code>public Block copyRegion(int positionOffset, int length) { int positionCount = getPositionCount(); if (positionOffset < 0 || length < 0 || positionOffset + length > positionCount) { throw new IndexOutOfBoundsException("Invalid position " + positionOffset + " in block with " + positionCount + " positions"); } int[] newOffsets = Arrays.copyOfRange(offsets, positionOffset, positionOffset + length + 1); for (int i = 0; i < newOffsets.length; i++) { newOffsets[i] -= offsets[positionOffset]; <START> } <END> boolean[] newValueIsNull = Arrays.copyOfRange(valueIsNull, positionOffset, positionOffset + length); Slice slice = sliceOutput.slice().slice(offsets[positionOffset], newOffsets[length]); if (!slice.isCompact()) { slice = Slices.copyOf(slice); } return new VariableWidthBlock(length, slice, newOffsets, newValueIsNull); }</code><technical_language>I int[] newOffsets = new int[...] instead of Arrays.copyOfRange</technical_language>

Target:
public Block copyRegion(int positionOffset, int length) { int positionCount = getPositionCount(); if (positionOffset < 0 || length < 0 || positionOffset + length > positionCount) { throw new IndexOutOfBoundsException("Invalid position " + positionOffset + " in block with " + positionCount + " positions"); } int[] newOffsets = compactOffsets(offsets, positionOffset, length); boolean[] newValueIsNull = compactArray(valueIsNull, positionOffset, length); Slice slice = compactSlice(sliceOutput.getUnderlyingSlice(), offsets[positionOffset], newOffsets[length]); return new VariableWidthBlock(length, slice, newOffsets, newValueIsNull); }
Source:
<code>public void testServiceLoadBalancerWithNoIP() throws Exception { final String hostName = "test-host-name"; mockRestServiceWithLB(hostName, ""); final Optional<Endpoint> resultEndpoint = flinkKubeClient.getRestEndpoint(CLUSTER_ID).get(); <START> assertTrue(resultEndpoint.isPresent()); <END> assertEquals(hostName, resultEndpoint.get().getAddress()); assertEquals(REST_PORT, resultEndpoint.get().getPort()); }</code><technical_language>suggestion assertThat(resultEndpoint.isPresent(), is(true)); assertThat .. is pattern for readability</technical_language>

Target:
public void testServiceLoadBalancerWithNoIP() { final String hostName = "test-host-name"; mockExpectedServiceFromServerSide(buildExternalServiceWithLoadBalancer(hostName, "")); final Optional<Endpoint> resultEndpoint = flinkKubeClient.getRestEndpoint(CLUSTER_ID); assertThat(resultEndpoint.isPresent(), is(true)); assertThat(resultEndpoint.get().getAddress(), is(hostName)); assertThat(resultEndpoint.get().getPort(), is(REST_PORT)); }
Source:
<code>public static String artToString(Art art) { <START> switch (art) { <END> case KEBAB: return "Kebab"; case AZTEC: return "Aztec"; case ALBAN: return "Alban"; case AZTEC2: return "Aztec2"; case BOMB: return "Bomb"; case PLANT: return "Plant"; case WASTELAND: return "Wasteland"; case WANDERER: return "Wanderer"; case GRAHAM: return "Graham"; case POOL: return "Pool"; case COURBET: return "Courbet"; case SUNSET: return "Sunset"; case SEA: return "Sea"; case CREEBET: return "Creebet"; case MATCH: return "Match"; case BUST: return "Bust"; case STAGE: return "Stage"; case VOID: return "Void"; case SKULL_AND_ROSES: return "SkullAndRoses"; case WITHER: return "Wither"; case FIGHTERS: return "Fighters"; case SKELETON: return "Skeleton"; case DONKEYKONG: return "DonkeyKong"; case POINTER: return "Pointer"; case PIGSCENE: return "Pigscene"; case BURNINGSKULL: return "BurningSkull"; default: return "Kebab"; } }</code><technical_language>in the... Please no. do <3</technical_language>

Target:
public static String artToString(Art art) { switch (art) { case SKULL_AND_ROSES: return "SkullAndRoses"; case DONKEYKONG: return "DonkeyKong"; case BURNINGSKULL: return "BurningSkull"; default: return CapitalizeEnum.capitalizeEnum(art); } }
Source:
<code>public static TopologyInfo getTopologyInfo(String name, String asUser, Map<String, Object> topoConf) { try (NimbusClient client = NimbusClient.getConfiguredClientAs(topoConf, asUser)) { <START> return client.getClient().getTopologyInfoByName(name); <END> } catch (Exception e) { throw new RuntimeException(e); } }</code><technical_language>catch NotAliveException return null if This is syntax consistent original implementation</technical_language>

Target:
public static TopologyInfo getTopologyInfo(String name, String asUser, Map<String, Object> topoConf) { try (NimbusClient client = NimbusClient.getConfiguredClientAs(topoConf, asUser)) { return client.getClient().getTopologyInfoByName(name); } catch (NotAliveException notAliveException) { return null; } catch (Exception e) { throw new RuntimeException(e); } }
Source:
<code>protected Election createElectionAlgorithm(int electionAlgorithm){ Election le=null; switch (electionAlgorithm) { case 0: <START> assert false : "Leader election algorithm type 0 is not supported anymore."; <END> break; case 1: le = new AuthFastLeaderElection(this); break; case 2: le = new AuthFastLeaderElection(this, true); break; case 3: qcm = new QuorumCnxManager(this); QuorumCnxManager.Listener listener = qcm.listener; if(listener != null){ listener.start(); FastLeaderElection fle = new FastLeaderElection(this, qcm); fle.start(); le = fle; } else { LOG.error("Null listener when initializing cnx manager"); } break; default: assert false; } return le; }</code><technical_language>I log error server jvm exit in this case</technical_language>

Target:
protected Election createElectionAlgorithm(int electionAlgorithm){ Election le=null; switch (electionAlgorithm) { case 1: le = new AuthFastLeaderElection(this); break; case 2: le = new AuthFastLeaderElection(this, true); break; case 3: qcm = new QuorumCnxManager(this); QuorumCnxManager.Listener listener = qcm.listener; if(listener != null){ listener.start(); FastLeaderElection fle = new FastLeaderElection(this, qcm); fle.start(); le = fle; } else { LOG.error("Null listener when initializing cnx manager"); } break; default: assert false; } return le; }
Source:
<code>private boolean isChildOfOrEqualToAnyFolder(IResource resource) { for (IPackageFragmentRoot <START> fPackageFragmentRoot : <END> fPackageFragmentRoots) { IResource fragmentRootResource= fPackageFragmentRoot.getResource(); if (fragmentRootResource.equals(resource) || ParentChecker.isDescendantOf(resource, fragmentRootResource)) return true; } return false; }</code><technical_language>rename root</technical_language>

Target:
private boolean isChildOfOrEqualToAnyFolder(IResource resource) { for (IPackageFragmentRoot root : fPackageFragmentRoots) { IResource fragmentRootResource= root.getResource(); if (fragmentRootResource.equals(resource) || ParentChecker.isDescendantOf(resource, fragmentRootResource)) return true; } return false; }
Source:
<code>public boolean isForNewerJava() { try { return minimumJavaVersion != null && new VersionNumber(minimumJavaVersion).isNewerThan( new VersionNumber(System.getProperty("java.specification.version"))); } catch (NumberFormatException nfe) { <START> logBadMinJavaVersion("'minimumJavaVersion' was specified for plugin ''{0}'' but unparseable (received {1})", this.name, <END> minimumJavaVersion); return false; } }</code><technical_language>set message method avoiding passing argument?</technical_language>

Target:
public boolean isForNewerJava() { try { final VersionNumber currentRuntimeJavaVersion = JavaUtils.getCurrentJavaRuntimeVersionNumber(); return minimumJavaVersion != null && new VersionNumber(minimumJavaVersion).isNewerThan( currentRuntimeJavaVersion); } catch (NumberFormatException nfe) { logBadMinJavaVersion(); return false; } }
Source:
<code>public static SphereClient createObjectTestDouble(final Function<HttpRequestIntent, Object> function) { return new SphereClient() { @Override public <T> CompletionStage<T> execute(final SphereRequest<T> sphereRequest) { final T result = (T) function.apply(sphereRequest.httpRequestIntent()); return successful(result); } @Override public void close() { } @Override public String toString() { return "SphereClientObjectTestDouble"; } @Override public SphereApiConfig getConfig() { <START> return null; <END> } }; }</code><technical_language>I feel right in a class delivered library a method signalled @Nullable returns a null. Of meaningful return a fake client... checking code I in of methods is SphereApiConfig fake data. line provide a dummy config a project key API URL leaves doubt this is a fake config. @katmatt a idea</technical_language>

Target:
public static SphereClient createObjectTestDouble(final Function<HttpRequestIntent, Object> function) { return new SphereClient() { @Override public <T> CompletionStage<T> execute(final SphereRequest<T> sphereRequest) { final T result = (T) function.apply(sphereRequest.httpRequestIntent()); return successful(result); } @Override public void close() { } @Override public String toString() { return "SphereClientObjectTestDouble"; } @Override public SphereApiConfig getConfig() { return sphereApiConfig; } }; }
Source:
<code>private String getTagId(Document document, String tagName) throws DocumentParserException { Node node = document.getElementsByTagName(tagName).item(0); if (node == null) { return null; } NamedNodeMap nodeAttributeMap = node.getAttributes(); Node idNode = nodeAttributeMap.getNamedItem("id"); if(idNode == null) { <START> throw new DocumentParserException("Please provide a " + tagName + " id as a part of the XML"); <END> } return idNode.getNodeValue(); }</code><technical_language>"Please provide id attribute for tag: tagname"</technical_language>

Target:
private String getTagId(Document document, String tagName) throws DocumentParserException { Node node = document.getElementsByTagName(tagName).item(0); if (node == null) { return null; } NamedNodeMap nodeAttributeMap = node.getAttributes(); Node idNode = nodeAttributeMap.getNamedItem("id"); if(idNode == null) { throw new DocumentParserException("Please provide an id attribute for tag: " + tagName); } return idNode.getNodeValue(); }
Source:
<code>public void apply(InternalEnvironment internalEnvironment, Collection<CheService> cheServices) throws InfrastructureException { <START> KubernetesEnvironment kubernetesEnvironment = (KubernetesEnvironment) internalEnvironment; <END> if (cheServices.isEmpty()) { return; } Map<String, Pod> pods = ((KubernetesEnvironment) internalEnvironment).getPods(); if (pods.size() != 1) { throw new InfrastructureException( "Can't apply Workspace.Next configuration to a workspace with multiple pods"); } Pod pod = pods.values().iterator().next(); for (CheService cheService : cheServices) { for (Container container : cheService.getSpec().getContainers()) { io.fabric8.kubernetes.api.model.Container k8sContainer = addContainer( pod, container.getImage(), container.getEnv(), container.getResources()); String machineName = Names.machineName(pod, k8sContainer); InternalMachineConfig machineConfig = addMachine(kubernetesEnvironment, machineName, container.getServers(), container.getVolumes()); normalizeMemory(k8sContainer, machineConfig); } } }</code><technical_language>sense move this line is needed cast environment if Che services list is empty</technical_language>

Target:
public void apply(InternalEnvironment internalEnvironment, Collection<CheService> cheServices) throws InfrastructureException { if (cheServices.isEmpty()) { return; } KubernetesEnvironment kubernetesEnvironment = (KubernetesEnvironment) internalEnvironment; Map<String, Pod> pods = kubernetesEnvironment.getPods(); if (pods.size() != 1) { throw new InfrastructureException( "Workspace.Next configuration can be applied to a workspace with one pod only"); } Pod pod = pods.values().iterator().next(); for (CheService cheService : cheServices) { for (Container container : cheService.getSpec().getContainers()) { io.fabric8.kubernetes.api.model.Container k8sContainer = addContainer(pod, container.getImage(), container.getEnv(), container.getResources()); String machineName = Names.machineName(pod, k8sContainer); InternalMachineConfig machineConfig = addMachine( kubernetesEnvironment, machineName, container.getServers(), container.getVolumes()); normalizeMemory(k8sContainer, machineConfig); } } }
Source:
<code>private static void validateExtraHosts(final List<String> extraHosts) { if (extraHosts != null) { for (final String extraHost : extraHosts) { checkArgument(extraHost.contains(":"), <START> String.format("extra host arg '%s' must contain a ':'", extraHost)); <END> } } }</code><technical_language>need call String.format yourself, is overload of checkArgument does: public static void checkArgument(boolean expression, @Nullable String errorMessageTemplate, @Nullable Object... errorMessageArgs)</technical_language>

Target:
private static void validateExtraHosts(final List<String> extraHosts) { if (extraHosts != null) { for (final String extraHost : extraHosts) { checkArgument(extraHost.contains(":"), "extra host arg '%s' must contain a ':'", extraHost); } } }
Source:
<code>private static UUID setUuidOnProperties(Path savesRoot, WorldProperties properties) { checkNotNull(properties); UUID uuid; if (properties.getUniqueId() == null || properties.getUniqueId().equals <START> (UUID.fromString("00000000-0000-0000-0000-000000000000"))) { <END> final Path uidPath = savesRoot.resolve(properties.getWorldName()).resolve("uid.dat"); if (!Files.exists(uidPath)) { uuid = UUID.randomUUID(); } else { DataInputStream dis; try { dis = new DataInputStream(Files.newInputStream(uidPath)); uuid = new UUID(dis.readLong(), dis.readLong()); } catch (IOException e) { SpongeImpl.getLogger().error("World folder has an existing Bukkit unique identifier for it but we encountered issues " + "parsing the file. We will have to use a new unique id. Please report this to Sponge ASAP.", properties.getWorldName(), e); uuid = UUID.randomUUID(); } } } else { uuid = properties.getUniqueId(); } ((IMixinWorldInfo) properties).setUUID(uuid); return uuid; }</code><technical_language>a good idea store this in a constant (like EMPTY_UUID). Also, is this new UUID(0, 0)</technical_language>

Target:
private static UUID setUuidOnProperties(Path savesRoot, WorldProperties properties) { checkNotNull(properties); UUID uuid; if (properties.getUniqueId() == null || properties.getUniqueId().equals (UUID.fromString("00000000-0000-0000-0000-000000000000"))) { final Path uidPath = savesRoot.resolve(properties.getWorldName()).resolve("uid.dat"); if (!Files.exists(uidPath)) { uuid = UUID.randomUUID(); } else { try(final DataInputStream dis = new DataInputStream(Files.newInputStream(uidPath))) { uuid = new UUID(dis.readLong(), dis.readLong()); } catch (IOException e) { SpongeImpl.getLogger().error("World folder has an existing Bukkit unique identifier for it but we encountered issues parsing " + "the file. We will have to use a new unique id. Please report this to Sponge ASAP.", properties.getWorldName(), e); uuid = UUID.randomUUID(); } } } else { uuid = properties.getUniqueId(); } ((IMixinWorldInfo) properties).setUUID(uuid); return uuid; }
Source:
<code>public String toString() { StringBuilder sb = new StringBuilder("ColumnMetadata{"); sb.append("name='").append(name).append('\''); sb.append(", type=").append(type); if (comment != null) { sb.append(", comment='").append(comment).append('\''); } if (extraInfo != null) { sb.append(", extraInfo='").append(extraInfo).append('\''); } if (hidden) { sb.append(", hidden"); } if (!properties.isEmpty()) { sb.append(", properties=").append(properties); } <START> sb.append(", nullable=").append(nullable); <END> sb.append('}'); return sb.toString(); }</code><technical_language>this java sb.append(nullable ? ", nullable" : ", nonnull");</technical_language>

Target:
public String toString() { StringBuilder sb = new StringBuilder("ColumnMetadata{"); sb.append("name='").append(name).append('\''); sb.append(", type=").append(type); sb.append(", ").append(nullable ? "nullable" : "nonnull"); if (comment != null) { sb.append(", comment='").append(comment).append('\''); } if (extraInfo != null) { sb.append(", extraInfo='").append(extraInfo).append('\''); } if (hidden) { sb.append(", hidden"); } if (!properties.isEmpty()) { sb.append(", properties=").append(properties); } sb.append('}'); return sb.toString(); }
Source:
<code>public void testTransformXDRToCheckPolicy() throws Exception { XDREventType eventA = new XDREventType(); assertionType.setMessageId(MESSAGE_ID); slotType1.setName("$XDSDocumentEntryPatientId"); valueListType.getValue().add("1111.4444^^^&amp;26.489.22&amp;ISO"); slotType1.setValueList(valueListType); pnt.setFullName("Minh"); <START> assertionType.setPersonName(pnt); <END> rsl.getSlot().add(slotType1); sor.setId("100"); sor.setRequestSlotList(rsl); ProvideAndRegisterDocumentSetRequestType prdsrt = new ProvideAndRegisterDocumentSetRequestType(); Document doc = new Document(); doc.setId("223"); prdsrt.getDocument().add(doc); prdsrt.setSubmitObjectsRequest(sor); sor.setRegistryObjectList(rolt); XDRMessageType xmt = new XDRMessageType(); eventA.setMessage(xmt); xmt.setAssertion(assertionType); xmt.setProvideAndRegisterDocumentSetRequest(prdsrt); RequestType request = new RequestType(); SubjectHelper subjHelp = new SubjectHelper(); SubjectType subject = subjHelp.subjectFactory(hct, assertionType); request.getSubject().add(subject); assertionType.setHomeCommunity(hct); assertionType.setSSN("170112756"); eventA.setSendingHomeCommunity(hct); String direction = "inbound"; eventA.setDirection(direction); eventA.getMessage().setAssertion(assertionType); CheckPolicyRequestType result = xdrTransformHelper.transformXDRToCheckPolicy(eventA); verifycheckPolicy_Request(result, direction); }</code><technical_language>creation of assertionType is duplicated in testTransformXDRResponseToCheckPolicy testTransformXDRToCheckPolicy. Try do in place</technical_language>

Target:
public void testTransformXDRToCheckPolicy() throws Exception { XDREventType eventA = new XDREventType(); assertionType.setMessageId(MESSAGE_ID); pnt.setFullName("Minh"); assertionType.setPersonName(pnt); rsl.getSlot().add(slotType1); sor.setId("100"); sor.setRequestSlotList(rsl); ProvideAndRegisterDocumentSetRequestType prdsrt = new ProvideAndRegisterDocumentSetRequestType(); Document doc = new Document(); doc.setId("223"); prdsrt.getDocument().add(doc); prdsrt.setSubmitObjectsRequest(sor); sor.setRegistryObjectList(rolt); XDRMessageType xmt = new XDRMessageType(); eventA.setMessage(xmt); xmt.setAssertion(assertionType); xmt.setProvideAndRegisterDocumentSetRequest(prdsrt); RequestType request = new RequestType(); SubjectHelper subjHelp = new SubjectHelper(); SubjectType subject = subjHelp.subjectFactory(hct, assertionType); request.getSubject().add(subject); assertionType.setHomeCommunity(hct); assertionType.setSSN("170112756"); eventA.setSendingHomeCommunity(hct); String direction = "inbound"; eventA.setDirection(direction); eventA.getMessage().setAssertion(assertionType); CheckPolicyRequestType result = xdrTransformHelper.transformXDRToCheckPolicy(eventA); verifycheckPolicy_Request(result); }
Source:
<code>public <T, V> Set<Argument<T>> createArguments(ArgumentHolder<? extends ArgumentType<T>> type, V value) { Set<Argument<T>> set = Sets.newLinkedHashSet(); if (type instanceof SpongeArgumentHolder.SpongeVector3) { Set<Function<V, T>> extractors = ((SpongeArgumentHolder.SpongeVector3<V, T>) (Object) type).extractFunctions(); Set<? extends ArgumentType<T>> types = type.getTypes(); Iterator<Function<V, T>> extIter = extractors.iterator(); Iterator<? extends ArgumentType<T>> typeIter = types.iterator(); <START> for (; extIter.hasNext() && typeIter.hasNext();) { <END> Function<V, T> extractor = extIter.next(); ArgumentType<T> subtype = typeIter.next(); set.add(createArgument(subtype, extractor.apply(value))); } } return set; }</code><technical_language>This is called a while loop. bizarre of for</technical_language>

Target:
public <T, V> Set<Argument<T>> createArguments(ArgumentHolder<? extends ArgumentType<T>> type, V value) { Set<Argument<T>> set = Sets.newLinkedHashSet(); if (type instanceof SpongeArgumentHolder.SpongeVector3) { Set<Function<V, T>> extractors = ((SpongeArgumentHolder.SpongeVector3<V, T>) (Object) type).extractFunctions(); Set<? extends ArgumentType<T>> types = type.getTypes(); Iterator<Function<V, T>> extIter = extractors.iterator(); Iterator<? extends ArgumentType<T>> typeIter = types.iterator(); while (extIter.hasNext() && typeIter.hasNext()) { Function<V, T> extractor = extIter.next(); ArgumentType<T> subtype = typeIter.next(); set.add(createArgument(subtype, extractor.apply(value))); } } return set; }
Source:
<code>private void fillLocalPullDown(IMenuManager manager) { for (ASTView.ASTLevelToggle <START> fASTVersionToggleAction : <END> fASTVersionToggleActions) { manager.add(fASTVersionToggleAction); } manager.add(new Separator()); manager.add(fCreateBindingsAction); manager.add(fStatementsRecoveryAction); manager.add(fBindingsRecoveryAction); manager.add(fIgnoreMethodBodiesAction); manager.add(new Separator()); for (ASTView.ASTInputKindAction fASTInputKindAction : fASTInputKindActions) { manager.add(fASTInputKindAction); } manager.add(new Separator()); manager.add(fFindDeclaringNodeAction); manager.add(fParseBindingFromKeyAction); manager.add(fParseBindingFromElementAction); manager.add(new Separator()); manager.add(fFilterNonRelevantAction); manager.add(fLinkWithEditor); }</code><technical_language>rename action</technical_language>

Target:
private void fillLocalPullDown(IMenuManager manager) { for (ASTView.ASTLevelToggle action : fASTVersionToggleActions) { manager.add(action); } manager.add(new Separator()); manager.add(fCreateBindingsAction); manager.add(fStatementsRecoveryAction); manager.add(fBindingsRecoveryAction); manager.add(fIgnoreMethodBodiesAction); manager.add(new Separator()); for (ASTView.ASTInputKindAction action : fASTInputKindActions) { manager.add(action); } manager.add(new Separator()); manager.add(fFindDeclaringNodeAction); manager.add(fParseBindingFromKeyAction); manager.add(fParseBindingFromElementAction); manager.add(new Separator()); manager.add(fFilterNonRelevantAction); manager.add(fLinkWithEditor); }