auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void handleQueryResponse(long sendHsId, long requestId, long lastSeq) { if (m_currentRequestId == requestId && m_mastershipAccepted.get()) { m_es.execute(new Runnable() { @Override public void run() { m_queryResponses.put(sendHsId, new QueryResponse(lastSeq)); Pair<Mailbox, ImmutableList<Long>> p = m_ackMailboxRefs.get(); if (p.getSecond().stream().allMatch(hsid -> m_queryResponses.containsKey(hsid))) { Entry<Long, QueryResponse> bestCandidate = null; try { bestCandidate = m_queryResponses.entrySet().stream() .filter(s -> s.getValue().canCoverGap()) .sorted() .findFirst() .get(); } catch (NoSuchElementException e) { <START> setStatus(StreamStatus.BLOCKED); <END> RealVoltDB voltdb = (RealVoltDB)VoltDB.instance(); if (voltdb.isClusterComplete()) { Pair<Long, Long> gap = m_gapTracker.getFirstGap(); exportLog.warn(ExportDataSource.this.toString() + " is blocked because stream hits a gap from sequence number " + gap.getFirst() + " to " + gap.getSecond()); } } if (bestCandidate != null) { m_newLeaderHostId = CoreUtils.getHostIdFromHSId(bestCandidate.getKey()); exportLog.info("Stream master is going to switch to host " + m_newLeaderHostId + " to jump the gap."); mastershipCheckpoint(m_lastReleasedSeqNo); } } } }); } }</code><technical_language>Question: eds continue polling BLOCKED state</technical_language>

Target:
public void handleQueryResponse(long sendHsId, long requestId, long lastSeq) { if (m_currentRequestId == requestId && m_mastershipAccepted.get()) { m_es.execute(new Runnable() { @Override public void run() { m_queryResponses.put(sendHsId, new QueryResponse(lastSeq)); Pair<Mailbox, ImmutableList<Long>> p = m_ackMailboxRefs.get(); if (p.getSecond().stream().allMatch(hsid -> m_queryResponses.containsKey(hsid))) { List<Entry<Long, QueryResponse>> candidates = m_queryResponses.entrySet().stream() .filter(s -> s.getValue().canCoverGap()) .collect(Collectors.toList()); Entry<Long, QueryResponse> bestCandidate = null; for (Entry<Long, QueryResponse> candidate : candidates) { if (bestCandidate == null) { bestCandidate = candidate; } else if (candidate.getValue().lastSeq > bestCandidate.getValue().lastSeq) { bestCandidate = candidate; } } if (bestCandidate == null) { setStatus(StreamStatus.BLOCKED); RealVoltDB voltdb = (RealVoltDB)VoltDB.instance(); if (voltdb.isClusterComplete()) { if (DISABLE_AUTO_GAP_RELEASE) { Pair<Long, Long> gap = m_gapTracker.getFirstGap(); exportLog.warn(ExportDataSource.this.toString() + " is blocked because stream hits a gap from sequence number " + gap.getFirst() + " to " + gap.getSecond()); } else { Pair<Long, Long> gap = m_gapTracker.getFirstGap(); exportLog.warn(ExportDataSource.this.toString() + " is blocked because stream hits a gap from sequence number " + gap.getFirst() + " to " + gap.getSecond()); } } } else { m_newLeaderHostId = CoreUtils.getHostIdFromHSId(bestCandidate.getKey()); exportLog.info("Stream master is going to switch to host " + m_newLeaderHostId + " to jump the gap."); mastershipCheckpoint(m_lastReleasedSeqNo); } } } }); } }
Source:
<code>public CloudObjectLocation(@JsonProperty("bucket") String bucket, @JsonProperty("path") String path) { this.bucket = Preconditions.checkNotNull(StringUtils.maybeRemoveTrailingSlash(bucket)); this.path = Preconditions.checkNotNull(StringUtils.maybeRemoveLeadingSlash(path)); <START> Preconditions.checkArgument(this.bucket.equals(StringUtils.urlEncode(this.bucket))); <END> }</code><technical_language>This exception get thrown in response user input, please add a nice error message. is, user get IllegalArgumentException message</technical_language>

Target:
public CloudObjectLocation(@JsonProperty("bucket") String bucket, @JsonProperty("path") String path) { this.bucket = Preconditions.checkNotNull(StringUtils.maybeRemoveTrailingSlash(bucket)); this.path = Preconditions.checkNotNull(StringUtils.maybeRemoveLeadingSlash(path)); Preconditions.checkArgument( this.bucket.equals(StringUtils.urlEncode(this.bucket)), "bucket must follow DNS-compliant naming conventions" ); }
Source:
<code>public PageImage fromCursor(Cursor c) { <START> Site site = new Site(c.getString(c.getColumnIndex(COL_TITLE))); <END> PageTitle title = new PageTitle(null, c.getString(c.getColumnIndex(COL_TITLE)), site); String imageName = c.getString(c.getColumnIndex(COL_IMAGE_NAME)); return new PageImage(title, imageName); }</code><technical_language>COL_SITE here</technical_language>

Target:
public PageImage fromCursor(Cursor c) { Site site = new Site(c.getString(c.getColumnIndex(COL_SITE))); PageTitle title = new PageTitle(null, c.getString(c.getColumnIndex(COL_TITLE)), site); String imageName = c.getString(c.getColumnIndex(COL_IMAGE_NAME)); return new PageImage(title, imageName); }
Source:
<code>public Map<Map.Entry<Long, Long>, Map.Entry<Long, Long>> apply(Set<Map.Entry<Long, Long>> request) { if (offHeapTimestampCache.cacheDescriptor.get().currentSize().get() >= offHeapTimestampCache.maxSize) { offHeapTimestampCache.clear(); } CacheDescriptor cacheDescriptor = offHeapTimestampCache.cacheDescriptor.get(); try { Map<Long, Long> response = offHeapTimestampCache.persistentTimestampStore.multiGet( cacheDescriptor.storeNamespace(), request.stream().map(Map.Entry::getKey).collect(Collectors.toList())); Set<Map.Entry<Long, Long>> toWrite = Sets.difference(request, response.entrySet()); offHeapTimestampCache.persistentTimestampStore.multiPut( cacheDescriptor.storeNamespace(), toWrite); cacheDescriptor.currentSize().addAndGet(toWrite.size()); } catch (SafeIllegalArgumentException exception) { <START> log.warn("Clear called concurrently, writing failed"); <END> } finally { offHeapTimestampCache.concurrentHashMap.clear(); } return KeyedStream.of(request.stream()).collectToMap(); }</code><technical_language>worth defensively logging exception is</technical_language>

Target:
public Map<Map.Entry<Long, Long>, Map.Entry<Long, Long>> apply(Set<Map.Entry<Long, Long>> request) { if (offHeapTimestampCache.cacheDescriptor.get().currentSize().get() >= offHeapTimestampCache.maxSize) { offHeapTimestampCache.clear(); } CacheDescriptor cacheDescriptor = offHeapTimestampCache.cacheDescriptor.get(); try { Map<Long, Long> response = offHeapTimestampCache.persistentTimestampStore.multiGet( cacheDescriptor.storeNamespace(), request.stream().map(Map.Entry::getKey).collect(Collectors.toList())); Map<Long, Long> toWrite = ImmutableMap.copyOf(Sets.difference(request, response.entrySet())); offHeapTimestampCache.persistentTimestampStore.multiPut( cacheDescriptor.storeNamespace(), toWrite); cacheDescriptor.currentSize().addAndGet(toWrite.size()); } catch (SafeIllegalArgumentException exception) { log.warn("Clear called concurrently, writing failed", exception); } finally { offHeapTimestampCache.inflightRequests.clear(); } return KeyedStream.of(request.stream()).collectToMap(); }
Source:
<code>public final void canBeRendered() throws Exception { MatcherAssert.assertThat( new MkMarkdown().render( Json.createObjectBuilder() .add("text", "Hello, **world**!") .build() ), <START> Matchers.equalTo("{\"text\":\"Hello, **world**!\"}") <END> ); }</code><technical_language>brr.. this a real implementation. return Hello, **world**!</technical_language>

Target:
public final void canBeRendered() throws Exception { final String text = "Hello, **world**!"; MatcherAssert.assertThat( new MkMarkdown().render( Json.createObjectBuilder() .add("text", text) .build() ), Matchers.equalTo(text) ); }
Source:
<code>public static void renderTokens(CAS aCas, GetDocumentResponse aResponse, AnnotatorState aState) { int winBegin = aState.getWindowBeginOffset(); int winEnd = aState.getWindowEndOffset(); Type tokenType = CasUtil.getType(aCas, Token.class); List<AnnotationFS> tokens = selectCovered(aCas, tokenType, winBegin, winEnd); for (AnnotationFS fs : tokens) { if (fs.getBegin() == fs.getEnd()) { continue; } split(aResponse.getSentenceOffsets(), fs.getCoveredText(), fs.getBegin() - winBegin, fs.getEnd() - winBegin) .forEach(range -> { aResponse.addToken(range.getBegin(), range.getEnd()); if (DEBUG) { aResponse.addEntity(new Entity(new VID(fs), "Token", new Offsets(range.getBegin(), range.getEnd()), fs.getCoveredText(), "#d9d9d9", <START> "[" + fs.getBegin() + "-" + fs.getEnd() + "]", null)); <END> } }); } }</code><technical_language>IMHO "buttons" flag false null</technical_language>

Target:
public static void renderTokens(CAS aCas, GetDocumentResponse aResponse, AnnotatorState aState) { int winBegin = aState.getWindowBeginOffset(); int winEnd = aState.getWindowEndOffset(); Type tokenType = CasUtil.getType(aCas, Token.class); List<AnnotationFS> tokens = selectCovered(aCas, tokenType, winBegin, winEnd); for (AnnotationFS fs : tokens) { if (fs.getBegin() == fs.getEnd()) { continue; } split(aResponse.getSentenceOffsets(), fs.getCoveredText(), fs.getBegin() - winBegin, fs.getEnd() - winBegin).forEach(range -> { aResponse.addToken(range.getBegin(), range.getEnd()); if (DEBUG) { aResponse.addEntity(new Entity(new VID(fs), "Token", new Offsets(range.getBegin(), range.getEnd()), fs.getCoveredText(), "#d9d9d9", "[" + fs.getBegin() + "-" + fs.getEnd() + "]", false)); } }); } }
Source:
<code>public void testAlwaysBlock() throws Exception { final AtomicLong runsStarted = new AtomicLong(0); final List<Thread> taskThreads = Collections.synchronizedList(new ArrayList<>()); final DurableScheduledService service = new DurableScheduledService("testAlwaysBlocks", RUN_FREQUENCY, RUN_TIMEOUT, RUN_TIMEOUT) { @Override protected void startUp() { LOG.info(Thread.currentThread().getName() + " startUp"); } @Override protected void runOneIteration() throws Exception { LOG.info(Thread.currentThread().getName() + " runOneIteration"); runsStarted.incrementAndGet(); synchronized (taskThreads) { if (!taskThreads.contains(Thread.currentThread())) { taskThreads.add(Thread.currentThread()); } } while (true) { Thread.sleep(RUN_FREQUENCY.toMillis()); } } @Override protected void shutDown() { LOG.info(Thread.currentThread().getName() + " shutDown"); } }; service.startAsync().awaitRunning(); long numRuns = 10 * ((RUN_TIMEOUT.toMillis() / RUN_FREQUENCY.toMillis()) + 1); Duration runDuration = RESTART_TIMEOUT.multipliedBy(numRuns); Instant expiration = Instant.now().plus(runDuration); while (runsStarted.get() < numRuns && Instant.now().isBefore(expiration)) { Thread.sleep(RUN_FREQUENCY.toMillis()); } service.stopAsync().awaitTerminated(); Assert.assertTrue(numRuns <= runsStarted.get()); Assert.assertTrue(runsStarted.get() - numRuns <= 1); <START> Assert.assertTrue(taskThreads.stream().noneMatch(Thread::isAlive)); <END> Assert.assertEquals(taskThreads.size(), runsStarted.get()); }</code><technical_language>is runOneIteration considered a failure in this case? do spawned threads get intettupted/stopped</technical_language>

Target:
public void testAlwaysBlock() throws Exception { final AtomicLong runsStarted = new AtomicLong(0); final List<Thread> taskThreads = Collections.synchronizedList(new ArrayList<>()); final DurableScheduledService service = new DurableScheduledService("testAlwaysBlocks", RUN_FREQUENCY, RUN_TIMEOUT, RUN_TIMEOUT) { @Override protected void startUp() { LOG.info(Thread.currentThread().getName() + " startUp"); } @Override protected void runOneIteration() throws Exception { LOG.info(Thread.currentThread().getName() + " runOneIteration"); runsStarted.incrementAndGet(); synchronized (taskThreads) { if (!taskThreads.contains(Thread.currentThread())) { taskThreads.add(Thread.currentThread()); } } while (true) { Thread.sleep(RUN_FREQUENCY.toMillis()); } } @Override protected void shutDown() { LOG.info(Thread.currentThread().getName() + " shutDown"); } }; service.startAsync().awaitRunning(); long numRuns = 2 * ((RUN_TIMEOUT.toMillis() / RUN_FREQUENCY.toMillis()) + 1); Duration runDuration = RESTART_TIMEOUT.multipliedBy(numRuns); Instant expiration = Instant.now().plus(runDuration); while (runsStarted.get() < numRuns && Instant.now().isBefore(expiration)) { Thread.sleep(RUN_FREQUENCY.toMillis()); } service.stopAsync().awaitTerminated(); Assert.assertTrue(numRuns <= runsStarted.get()); Assert.assertTrue(taskThreads.stream().noneMatch(Thread::isAlive)); Assert.assertEquals(taskThreads.size(), runsStarted.get()); }
Source:
<code>public Type getMinecartType() { <START> return null; <END> }</code><technical_language>Pretty this is a Nonnull field. a Chest Empty</technical_language>

Target:
public Type getMinecartType() { return Type.CHEST; }
Source:
<code>private void appendMethodWrapper( StringBuilder code, Class<?> subjectType, Class<?> targetType, Method method) { int modifiers = method.getModifiers(); <START> Object o = method.getDeclaringClass(); <END> boolean shouldWrap = !method.getDeclaringClass().equals(Subject.class) && !method.getDeclaringClass().equals(Object.class) && !(isFinal(modifiers) || isPrivate(modifiers) || isStatic(modifiers)); if (shouldWrap) { code.append(String.format( WRAPPER_METHOD_TEMPLATE, stringVisibility(modifiers), method.getReturnType().getCanonicalName(), method.getName(), methodSignature( method.getParameterTypes(), method.getParameterAnnotations()).toString(), targetType.getCanonicalName(), subjectType.getCanonicalName(), methodParameterList(method.getParameterTypes().length) )); } }</code><technical_language>personally I avoid names o, i, l etc... obj is better. ... is</technical_language>

Target:
private void appendMethodWrapper( StringBuilder code, Class<?> subjectType, Class<?> targetType, Method method) { int modifiers = method.getModifiers(); boolean shouldWrap = !method.getDeclaringClass().equals(Subject.class) && !method.getDeclaringClass().equals(Object.class) && !(isFinal(modifiers) || isPrivate(modifiers) || isStatic(modifiers)); if (shouldWrap) { code.append(String.format( WRAPPER_METHOD_TEMPLATE, stringVisibility(modifiers), method.getReturnType().getCanonicalName(), method.getName(), methodSignature( method.getParameterTypes(), method.getParameterAnnotations()).toString(), targetType.getCanonicalName(), subjectType.getCanonicalName(), methodParameterList(method.getParameterTypes().length) )); } }
Source:
<code>public int hashCode() { int result = origin != null ? origin.hashCode() : 0; <START> result = 31 * result + (test != null ? test.hashCode() : 0); <END> return result; }</code><technical_language>delete metricName (metric id) hashCode</technical_language>

Target:
public int hashCode() { int result = origin != null ? origin.hashCode() : 0; result = 31 * result + (test != null ? test.hashCode() : 0); result = 31 * result + (metricName != null ? metricName.hashCode() : 0); return result; }
Source:
<code>public String toString() { <START> StringBuilder sb = new StringBuilder("ColumnMetadata{"); <END> sb.append("name='").append(name).append('\''); sb.append(", type=").append(type); if (comment != null) { sb.append(", comment='").append(comment).append('\''); } if (hidden) { sb.append(", hidden"); } sb.append('}'); return sb.toString(); }</code><technical_language>toStringHelper</technical_language>

Target:
public String toString() { return toStringHelper(this) .add("name", name) .add("type", type) .add("comment", comment) .add("isHidden", isHidden) .toString(); }
Source:
<code>public void edit(final ImportTemplatesModel model) { templatesTable.edit( model.getExternalTemplatesModels(), model.getImportedTemplatesModels(), model.getAddImportCommand(), model.getCancelImportCommand()); <START> driver.edit(model); <END> model.getProblemDescription().getEntityChangedEvent().addListener((ev, object, args) -> updateErrorAndWarning(model)); updateErrorAndWarning(model); updatePanelsVisibility(model); model.getImportSources().getSelectedItemChangedEvent().addListener((ev, sender, args) -> updatePanelsVisibility(model)); loadVmsFromExportDomainButton.addClickHandler(event -> model.loadTemplatesFromExportDomain()); loadOvaButton.addClickHandler(event -> model.loadVmFromOva()); }</code><technical_language>call first, for consistency.</technical_language>

Target:
public void edit(final ImportTemplatesModel model) { driver.edit(model); templatesTable.edit( model.getExternalTemplatesModels(), model.getImportedTemplatesModels(), model.getAddImportCommand(), model.getCancelImportCommand()); model.getProblemDescription().getEntityChangedEvent().addListener((ev, object, args) -> updateErrorAndWarning(model)); updateErrorAndWarning(model); updatePanelsVisibility(model); model.getImportSources().getSelectedItemChangedEvent().addListener((ev, sender, args) -> updatePanelsVisibility(model)); loadVmsFromExportDomainButton.addClickHandler(event -> model.loadTemplatesFromExportDomain()); loadOvaButton.addClickHandler(event -> model.loadVmFromOva()); }
Source:
<code>public static CompletableFuture<Process> onExit(@NotNull Process process) { <START> return CompletableFuture.supplyAsync(() -> { <END> try { Thread.sleep(15000); process.waitFor(); if (process.exitValue() != 0) { throw new IOException(toString(process.getErrorStream())); } return process; } catch (Throwable e) { throw new CompletionException(e); } }); }</code><technical_language>nit: a Executors.newSingleThreadScheduledExecutor() .scheduleWithFixedDelay(...) instead? Feel free ignore, idiomatic achieve this</technical_language>

Target:
public static CompletableFuture<Process> onExit(@NotNull Process process) { return CompletableFuture.supplyAsync(() -> { try { process.waitFor(); if (process.exitValue() != 0) { throw new IOException(toString(process.getErrorStream())); } return process; } catch (Throwable e) { throw new CompletionException(e); } }); }
Source:
<code>private static boolean isFormatChange(AttributeChange input) { <START> for (EAttribute attribute : NotationPackage.Literals.FONT_STYLE.getEAllAttributes()) { <END> if (input.getAttribute() == attribute) { return true; } } return false; }</code><technical_language>handle font changes here. name 'FormatChange' is a bit misleading think? deal more fonts (FILL_STYLE for example?) rename 'FormatChange' 'FontChange'. I requirements here, I want point out try clearest names :-)</technical_language>

Target:
private static boolean isFormatChange(AttributeChange input) { for (EAttribute attribute : NotationPackage.Literals.FONT_STYLE.getEAllAttributes()) { if (input.getAttribute() == attribute) { return true; } } for (EAttribute attribute : NotationPackage.Literals.FILL_STYLE.getEAllAttributes()) { if (input.getAttribute() == attribute) { return true; } } for (EAttribute attribute : NotationPackage.Literals.LINE_STYLE.getEAllAttributes()) { if (input.getAttribute() == attribute) { return true; } } return false; }
Source:
<code>public RestRule appToRest(Rule app, User user) { <START> RestRule restRule = toRest.apply(app); <END> if(restRule == null){ try{ APILocator.getRulesAPI().disableRule(app, user); } catch (DotDataException|DotSecurityException e){ Logger.error(this, "Error trying to disable Rule: " + app.getId(), e); } } return restRule; }</code><technical_language>need get out of habit of returning null bad happen. a SUPER bad practice. leads this kind of defensive null checking clutters code is distracting</technical_language>

Target:
public RestRule appToRest(Rule app, User user) { try{ Map<String, RestConditionGroup> groups = new HashMap<>(); Map<String, Boolean> ruleActions = new HashMap<>(); for (ConditionGroup conditionGroup : app.getGroups()) { groups.put(conditionGroup.getId(), groupTransform.appToRest(conditionGroup)); } for (RuleAction ruleAction : app.getRuleActions()) { ruleActions.put(ruleAction.getId(), true); } return new RestRule.Builder() .key(app.getId()) .name(app.getName()) .fireOn(app.getFireOn().toString()) .shortCircuit(app.isShortCircuit()) .priority(app.getPriority()) .enabled(app.isEnabled()) .conditionGroups(groups) .ruleActions(ruleActions) .build(); } catch (Exception e) { try{ APILocator.getRulesAPI().disableRule(app, user); } catch (DotDataException|DotSecurityException dse){ Logger.error(this, "Error trying to disable Rule: " + app.getId(), dse); } throw new InternalServerException(e, "Could not create ReST Rule from Server, Rule id '%s'", app.getId()); } }
Source:
<code>public void query() { StubMappingScope scope = indexManager.createScope(); SearchQuery<DocumentReference> genericQuery = scope.query() .predicate( f -> f.matchAll() ) .toQuery(); ElasticsearchSearchQuery<DocumentReference> query = genericQuery.extension( ElasticsearchExtension.get() ); ElasticsearchSearchResult<DocumentReference> result = query.fetchAll(); assertThat( result ).fromQuery( query ) .hasDocRefHitsAnyOrder( INDEX_NAME, FIRST_ID, SECOND_ID, THIRD_ID, FOURTH_ID, FIFTH_ID, EMPTY_ID ) .hasTotalHitCount( 6 ); Assertions.assertThat( result.getResponseBody() ) .isNotNull() <START> .extracting( body -> body.get( "_shards" ) ).isInstanceOf( JsonObject.class ); <END> SubTest.expectException( () -> query.extension( (SearchQuery<DocumentReference> original, LoadingContext<?, ?> loadingContext) -> Optional.empty() ) ) .assertThrown() .isInstanceOf( SearchException.class ); }</code><technical_language>I miss something, test in method query_gsonResponseBody</technical_language>

Target:
public void query() { StubMappingScope scope = indexManager.createScope(); SearchQuery<DocumentReference> genericQuery = scope.query() .predicate( f -> f.matchAll() ) .toQuery(); ElasticsearchSearchQuery<DocumentReference> query = genericQuery.extension( ElasticsearchExtension.get() ); ElasticsearchSearchResult<DocumentReference> result = query.fetchAll(); assertThat( result ).fromQuery( query ) .hasDocRefHitsAnyOrder( INDEX_NAME, FIRST_ID, SECOND_ID, THIRD_ID, FOURTH_ID, FIFTH_ID, EMPTY_ID ) .hasTotalHitCount( 6 ); SubTest.expectException( () -> query.extension( (SearchQuery<DocumentReference> original, LoadingContext<?, ?> loadingContext) -> Optional.empty() ) ) .assertThrown() .isInstanceOf( SearchException.class ); }
Source:
<code>public AdminBlobStorageServiceFactory(VerifiableProperties verifiableProperties, MetricRegistry metricRegistry, ClusterMap clusterMap) throws InstantiationException { if (verifiableProperties != null && metricRegistry != null && clusterMap != null) { adminConfig = new AdminConfig(verifiableProperties); adminMetrics = new AdminMetrics(metricRegistry); this.clusterMap = clusterMap; } else { logger <START> .error("While trying to instantiate AdminBlobStorageServiceFactory: Some of the arguments received are null"); <END> throw new InstantiationException("One of the received arguments is null"); } }</code><technical_language>is logs statements flipped? "While instantiate, some error" instead of "Error while instantiate"</technical_language>

Target:
public AdminBlobStorageServiceFactory(VerifiableProperties verifiableProperties, MetricRegistry metricRegistry, ClusterMap clusterMap) { if (verifiableProperties != null && metricRegistry != null && clusterMap != null) { adminConfig = new AdminConfig(verifiableProperties); adminMetrics = new AdminMetrics(metricRegistry); this.clusterMap = clusterMap; } else { StringBuilder errorMessage = new StringBuilder("Null arg(s) received during instantiation of AdminBlobStorageServiceFactory -"); if (verifiableProperties == null) { errorMessage.append(" [VerifiableProperties] "); } if (metricRegistry == null) { errorMessage.append(" [MetricRegistry] "); } if (clusterMap == null) { errorMessage.append(" [ClusterMap] "); } throw new IllegalArgumentException(errorMessage.toString()); } logger.trace("Instantiated AdminBlobStorageServiceFactory"); }
Source:
<code>private static Archive<?> createDeploymentWithoutSpringMvcDispatcherOrListener() { WebArchive archive = TestUtil.prepareArchive(deploymentWithoutSpringMvcDispatcherOrListenerSpringIncluded); archive.addAsWebInfResource(AddSpringResteasyAsResourceRootTest.class.getPackage(), "web-no-mvc-no-listener.xml", "web.xml") .addAsWebInfResource(AddSpringResteasyAsResourceRootTest.class.getPackage(), "applicationContext.xml", "applicationContext.xml"); archive.addAsManifestResource(PermissionUtil.createPermissionsXmlAsset( new PropertyPermission("arquillian.*", "read"), new ReflectPermission("suppressAccessChecks"), new RuntimePermission("accessDeclaredMembers"), new RuntimePermission("getClassLoader"), <START> new FilePermission("<<ALL FILES>>", "read"), <END> new LoggingPermission("control", "") ), "permissions.xml"); TestUtilSpring.addSpringLibraries(archive); archive.as(ZipExporter.class).exportTo(new File("target", deploymentWithoutSpringMvcDispatcherOrListenerSpringIncluded + ".war"), true); return TestUtil.finishContainerPrepare(archive, null, TestResource.class); }</code><technical_language>permissions needed test pass</technical_language>

Target:
private static Archive<?> createDeploymentWithoutSpringMvcDispatcherOrListener() { WebArchive archive = TestUtil.prepareArchive(deploymentWithoutSpringMvcDispatcherOrListenerSpringIncluded); archive.addAsWebInfResource(AddSpringResteasyAsResourceRootTest.class.getPackage(), "web-no-mvc-no-listener.xml", "web.xml") .addAsWebInfResource(AddSpringResteasyAsResourceRootTest.class.getPackage(), "applicationContext.xml", "applicationContext.xml"); TestUtilSpring.addSpringLibraries(archive); archive.as(ZipExporter.class).exportTo(new File("target", deploymentWithoutSpringMvcDispatcherOrListenerSpringIncluded + ".war"), true); return TestUtil.finishContainerPrepare(archive, null, TestResource.class); }
Source:
<code>public void testSetRoutingData() throws InvalidRoutingDataException, IOException { Map<String, List<String>> routingData = new HashMap<>(); routingData.put(TEST_REALM_1, TEST_SHARDING_KEYS_2); routingData.put(TEST_REALM_2, TEST_SHARDING_KEYS_1); <START> String routingDataString = new ObjectMapper().writeValueAsString(routingData); Map<String, String> badFormatRoutingData = new HashMap<>(); badFormatRoutingData.put(TEST_REALM_1, TEST_REALM_2); badFormatRoutingData.put(TEST_REALM_2, TEST_REALM_1); String badFormatRoutingDataString = new ObjectMapper().writeValueAsString(badFormatRoutingData); <END> put("/namespaces/non-existing-namespace" + MetadataStoreRoutingConstants.MSDS_GET_ALL_ROUTING_DATA_ENDPOINT, null, Entity.entity(routingDataString, MediaType.APPLICATION_JSON_TYPE), Response.Status.NOT_FOUND.getStatusCode()); put(TEST_NAMESPACE_URI_PREFIX + MetadataStoreRoutingConstants.MSDS_GET_ALL_ROUTING_DATA_ENDPOINT, null, Entity.entity("?", MediaType.APPLICATION_JSON_TYPE), Response.Status.BAD_REQUEST.getStatusCode()); put(TEST_NAMESPACE_URI_PREFIX + MetadataStoreRoutingConstants.MSDS_GET_ALL_ROUTING_DATA_ENDPOINT, null, Entity.entity(badFormatRoutingDataString, MediaType.APPLICATION_JSON_TYPE), Response.Status.BAD_REQUEST.getStatusCode()); put(TEST_NAMESPACE_URI_PREFIX + MetadataStoreRoutingConstants.MSDS_GET_ALL_ROUTING_DATA_ENDPOINT, null, Entity.entity(routingDataString, MediaType.APPLICATION_JSON_TYPE), Response.Status.CREATED.getStatusCode()); Assert.assertEquals(getRawRoutingData(), routingData); }</code><technical_language>Please create a constant OBJECT_MAPPER throughout</technical_language>

Target:
public void testSetRoutingData() throws InvalidRoutingDataException, IOException { Map<String, List<String>> routingData = new HashMap<>(); routingData.put(TEST_REALM_1, TEST_SHARDING_KEYS_2); routingData.put(TEST_REALM_2, TEST_SHARDING_KEYS_1); String routingDataString = OBJECT_MAPPER.writeValueAsString(routingData); Map<String, String> badFormatRoutingData = new HashMap<>(); badFormatRoutingData.put(TEST_REALM_1, TEST_REALM_2); badFormatRoutingData.put(TEST_REALM_2, TEST_REALM_1); String badFormatRoutingDataString = OBJECT_MAPPER.writeValueAsString(badFormatRoutingData); put("/namespaces/non-existing-namespace" + MetadataStoreRoutingConstants.MSDS_GET_ALL_ROUTING_DATA_ENDPOINT, null, Entity.entity(routingDataString, MediaType.APPLICATION_JSON_TYPE), Response.Status.NOT_FOUND.getStatusCode()); put(TEST_NAMESPACE_URI_PREFIX + MetadataStoreRoutingConstants.MSDS_GET_ALL_ROUTING_DATA_ENDPOINT, null, Entity.entity("?", MediaType.APPLICATION_JSON_TYPE), Response.Status.BAD_REQUEST.getStatusCode()); put(TEST_NAMESPACE_URI_PREFIX + MetadataStoreRoutingConstants.MSDS_GET_ALL_ROUTING_DATA_ENDPOINT, null, Entity.entity(badFormatRoutingDataString, MediaType.APPLICATION_JSON_TYPE), Response.Status.BAD_REQUEST.getStatusCode()); put(TEST_NAMESPACE_URI_PREFIX + MetadataStoreRoutingConstants.MSDS_GET_ALL_ROUTING_DATA_ENDPOINT, null, Entity.entity(routingDataString, MediaType.APPLICATION_JSON_TYPE), Response.Status.CREATED.getStatusCode()); Assert.assertEquals(getRawRoutingData(), routingData); }
Source:
<code><START> protected static void closeClientConnection() { <END> if (isConnectionActive) { LOG.debug("Request for stopping grill cli received"); client.closeConnection(); isConnectionActive = false; } }</code><technical_language>synchronized</technical_language>

Target:
protected static synchronized void closeClientConnection() { if (isConnectionActive) { LOG.debug("Request for stopping grill cli received"); client.closeConnection(); isConnectionActive = false; } }
Source:
<code>public static void cleanUpLdapFiles() throws Exception { File workingDirLDIF = new File(LDAP_DIRECTORY_LOCATION); if (workingDirLDIF.exists() == false) { <START> workingDirLDIF.mkdirs(); <END> } Files.copy(Paths.get(workingDirLDIF + LDIF_LOCATION + ".bak"), Paths.get(workingDirLDIF + LDIF_LOCATION), StandardCopyOption.REPLACE_EXISTING); }</code><technical_language>If directory exist, .bak file exist this if statement removed replaced a check directory exist</technical_language>

Target:
public void cleanUpLdapFiles() throws Exception { File workingDirLDIF = new File(LDAP_DIRECTORY_LOCATION); if (workingDirLDIF.exists()) { Files.copy(Paths.get(workingDirLDIF + LDIF_LOCATION + ".bak"), Paths.get(workingDirLDIF + LDIF_LOCATION), StandardCopyOption.REPLACE_EXISTING); } }
Source:
<code>public void getsMultipleSingleSelection() throws Exception { bot.radio("SWT.MULTI").click(); bot.checkBox("Listen").select(); bot.button("Clear").click(); table = bot.tableInGroup("Table"); table.select(new int[] { 5, 10 }); TableCollection selection = table.selection(); assertEquals("Index:5", selection.get(0, 0)); assertEquals("images", selection.get(0, 1)); assertEquals("91571", selection.get(0, 2)); assertEquals("yesterday", selection.get(0, 3)); assertEquals(new TableRow(new String[] { "Index:10", "databases", "2556", "tomorrow" }), selection.get(1)); SWTBotText text = bot.textInGroup("Listeners"); <START> assertEventMatches(text, "Selection [13]: SelectionEvent{Table time=-550222256 data=null item=TableItem {Index:5} detail=0 x=0 y=0 width=0 height=0 stateMask=0x80000 text=null doit=true}"); <END> assertEventMatches(text, "MouseDown [3]: MouseEvent{Table time=-550222259 data=null button=1 stateMask=0x0 x=0 y=0 count=1}"); assertEventMatches(text, "MouseUp [4]: MouseEvent{Table time=-550222255 data=null button=1 stateMask=0x80000 x=0 y=0 count=1}"); assertEventMatches(text, "Selection [13]: SelectionEvent{Table time=-550222256 data=null item=TableItem {Index:10} detail=0 x=0 y=0 width=0 height=0 stateMask=0xc0000 text=null doit=true}"); assertEventMatches(text, "MouseDown [3]: MouseEvent{Table time=-550222259 data=null button=1 stateMask=0x40000 x=0 y=0 count=1}"); assertEventMatches(text, "MouseUp [4]: MouseEvent{Table time=-550222255 data=null button=1 stateMask=0xc0000 x=0 y=0 count=1}"); }</code><technical_language>Selection MouseDown</technical_language>

Target:
public void getsMultipleSingleSelection() throws Exception { bot.radio("SWT.MULTI").click(); bot.checkBox("Listen").select(); bot.button("Clear").click(); table = bot.tableInGroup("Table"); table.select(new int[] { 5, 10 }); TableCollection selection = table.selection(); assertEquals("Index:5", selection.get(0, 0)); assertEquals("images", selection.get(0, 1)); assertEquals("91571", selection.get(0, 2)); assertEquals("yesterday", selection.get(0, 3)); assertEquals(new TableRow(new String[] { "Index:10", "databases", "2556", "tomorrow" }), selection.get(1)); SWTBotText text = bot.textInGroup("Listeners"); assertEventMatches(text, "MouseDown [3]: MouseEvent{Table time=-550222259 data=null button=1 stateMask=0x0 x=0 y=0 count=1}"); assertEventMatches(text, "Selection [13]: SelectionEvent{Table time=-550222256 data=null item=TableItem {Index:5} detail=0 x=0 y=0 width=0 height=0 stateMask=0x80000 text=null doit=true}"); assertEventMatches(text, "MouseUp [4]: MouseEvent{Table time=-550222255 data=null button=1 stateMask=0x80000 x=0 y=0 count=1}"); assertEventMatches(text, "MouseDown [3]: MouseEvent{Table time=-550222259 data=null button=1 stateMask=0x40000 x=0 y=0 count=1}"); assertEventMatches(text, "Selection [13]: SelectionEvent{Table time=-550222256 data=null item=TableItem {Index:10} detail=0 x=0 y=0 width=0 height=0 stateMask=0xc0000 text=null doit=true}"); assertEventMatches(text, "MouseUp [4]: MouseEvent{Table time=-550222255 data=null button=1 stateMask=0xc0000 x=0 y=0 count=1}"); }
Source:
<code>private CheckBox createCheckBoxView(Option option, LayoutParams layoutParams) { CheckBox checkBoxView = new CheckBox(getContext()); checkBoxView.setLayoutParams(layoutParams); checkBoxView.setText(option.label); checkBoxView.setTag(option); checkBoxView.setOnCheckedChangeListener(this); checkBoxView.setTypeface(getTypeface()); checkBoxView.setSaveEnabled(true); <START> if (this.field.isInline()) { <END> checkBoxView.setGravity(Gravity.TOP); } return checkBoxView; }</code><technical_language>this</technical_language>

Target:
private CheckBox createCheckBoxView(Option option, LayoutParams layoutParams) { CheckBox checkBoxView = new CheckBox(getContext()); checkBoxView.setLayoutParams(layoutParams); checkBoxView.setText(option.label); checkBoxView.setTag(option); checkBoxView.setOnCheckedChangeListener(this); checkBoxView.setTypeface(getTypeface()); checkBoxView.setSaveEnabled(true); if (field.isInline()) { checkBoxView.setGravity(Gravity.TOP); } return checkBoxView; }
Source:
<code>private void updateStack(AmazonCloudFormation cfn) throws IOException { String stackName = getStackName(); String cfnTemplateUrl = getCfnTemplateUrl(); File cfnTemplateFile = getCfnTemplateFile(); List<Parameter> cfnStackParams = getCfnStackParams(); List<Tag> cfnStackTags = getCfnStackTags(); String cfnStackPolicyUrl = getCfnStackPolicyUrl(); File cfnStackPolicyFile = getCfnStackPolicyFile(); getLogger().info("Update stack: {}", stackName); UpdateStackRequest req = new UpdateStackRequest() .withStackName(stackName) .withParameters(cfnStackParams) .withTags(cfnStackTags); if (Strings.isNullOrEmpty(cfnTemplateUrl) == false) { req.setTemplateURL(cfnTemplateUrl); getLogger().info("Using template url: {}", cfnTemplateUrl); } else { req.setTemplateBody(FileUtils.readFileToString(cfnTemplateFile)); getLogger().info("Using template file: {}", "$cfnTemplateFile.canonicalPath"); } if (isCapabilityIam()) { Capability selectedCapability = (useCapabilityIam == null) ? Capability.CAPABILITY_IAM : useCapabilityIam; getLogger().info("Using policy: " + selectedCapability); req.setCapabilities(Arrays.asList(selectedCapability.toString())); } <START> if (!Strings.isNullOrEmpty(cfnStackPolicyUrl)) { <END> req.setStackPolicyURL(cfnStackPolicyUrl); } else if (cfnStackPolicyFile != null) { req.setStackPolicyBody( FileUtils.readFileToString(cfnStackPolicyFile)); } UpdateStackResult updateStackResult = cfn.updateStack(req); getLogger().info("Update requested: {}", updateStackResult.getStackId()); }</code><technical_language>project ! operator this is easy overlook. Please leave == false</technical_language>

Target:
private void updateStack(AmazonCloudFormation cfn) throws IOException { String stackName = getStackName(); String cfnTemplateUrl = getCfnTemplateUrl(); File cfnTemplateFile = getCfnTemplateFile(); List<Parameter> cfnStackParams = getCfnStackParams(); List<Tag> cfnStackTags = getCfnStackTags(); String cfnStackPolicyUrl = getCfnStackPolicyUrl(); File cfnStackPolicyFile = getCfnStackPolicyFile(); getLogger().info("Update stack: {}", stackName); UpdateStackRequest req = new UpdateStackRequest() .withStackName(stackName) .withParameters(cfnStackParams) .withTags(cfnStackTags); if (Strings.isNullOrEmpty(cfnTemplateUrl) == false) { req.setTemplateURL(cfnTemplateUrl); getLogger().info("Using template url: {}", cfnTemplateUrl); } else { req.setTemplateBody(FileUtils.readFileToString(cfnTemplateFile)); getLogger().info("Using template file: {}", "$cfnTemplateFile.canonicalPath"); } if (isCapabilityIam()) { Capability selectedCapability = (useCapabilityIam == null) ? Capability.CAPABILITY_IAM : useCapabilityIam; getLogger().info("Using policy: " + selectedCapability); req.setCapabilities(Arrays.asList(selectedCapability.toString())); } if (Strings.isNullOrEmpty(cfnStackPolicyUrl) == false) { req.setStackPolicyURL(cfnStackPolicyUrl); } else if (cfnStackPolicyFile != null) { req.setStackPolicyBody( FileUtils.readFileToString(cfnStackPolicyFile)); } UpdateStackResult updateStackResult = cfn.updateStack(req); getLogger().info("Update requested: {}", updateStackResult.getStackId()); }
Source:
<code>Iv2InFlight removeHandle(long ciHandle) { assert(!shouldCheckThreadIdAssertion() || m_expectedThreadId == Thread.currentThread().getId()); final boolean readOnly = getReadBit(ciHandle); ciHandle = unsetReadBit(ciHandle); Iv2InFlight inflight = m_shortCircuitReads.remove(ciHandle); if (inflight != null) { m_acg.reduceBackpressure(inflight.m_messageSize); m_outstandingTxns--; return inflight; } <START> else if (isShortCircuitReadHandle(ciHandle)) { <END> return null; } int partitionId = getPartIdFromHandle(ciHandle); PartitionData partitionStuff = m_partitionStuff.get(partitionId); if (partitionStuff == null) { tmLog.error("Unable to find handle list for removal for partition: " + partitionId + ", client interface handle: " + ciHandle); return null; } final Deque<Iv2InFlight> perPartDeque = readOnly ? partitionStuff.m_reads : partitionStuff.m_writes; Iterator<Iv2InFlight> iter = perPartDeque.iterator(); while (iter.hasNext()) { Iv2InFlight inFlight = iter.next(); if (inFlight.m_ciHandle > ciHandle) { tmLog.error("CI clientData lookup for remove missing handle: " + ciHandle + ". Next expected client data handle is: " + inFlight.m_ciHandle); break; } else if (inFlight.m_ciHandle == ciHandle) { m_acg.reduceBackpressure(inFlight.m_messageSize); m_outstandingTxns--; iter.remove(); return inFlight; } } tmLog.error("Unable to find Client data to remove client interface handle: " + ciHandle); return null; }</code><technical_language>Similar IF simply</technical_language>

Target:
Iv2InFlight removeHandle(long ciHandle) { assert(!shouldCheckThreadIdAssertion() || m_expectedThreadId == Thread.currentThread().getId()); final boolean readOnly = getReadBit(ciHandle); ciHandle = unsetReadBit(ciHandle); Iv2InFlight inflight = m_shortCircuitReads.remove(ciHandle); if (inflight != null) { m_acg.reduceBackpressure(inflight.m_messageSize); m_outstandingTxns--; return inflight; } if (isShortCircuitReadHandle(ciHandle)) { return null; } int partitionId = getPartIdFromHandle(ciHandle); PartitionData partitionStuff = m_partitionStuff.get(partitionId); if (partitionStuff == null) { tmLog.error("Unable to find handle list for removal for partition: " + partitionId + ", client interface handle: " + ciHandle); return null; } final Deque<Iv2InFlight> perPartDeque = readOnly ? partitionStuff.m_reads : partitionStuff.m_writes; Iterator<Iv2InFlight> iter = perPartDeque.iterator(); while (iter.hasNext()) { Iv2InFlight inFlight = iter.next(); if (inFlight.m_ciHandle > ciHandle) { tmLog.error("CI clientData lookup for remove missing handle: " + ciHandle + ". Next expected client data handle is: " + inFlight.m_ciHandle); break; } else if (inFlight.m_ciHandle == ciHandle) { m_acg.reduceBackpressure(inFlight.m_messageSize); m_outstandingTxns--; iter.remove(); return inFlight; } } tmLog.error("Unable to find Client data to remove client interface handle: " + ciHandle); return null; }
Source:
<code>private void showBiometricPrompt() { BiometricPrompt.PromptInfo promptInfo = new BiometricPrompt.PromptInfo.Builder() .setTitle(getString(R.string.biometric_prompt_title)) .setSubtitle(getString(R.string.biometric_prompt_subtitle)) .setNegativeButtonText(getString(android.R.string.cancel)) .setConfirmationRequired(true) .setDeviceCredentialAllowed(false) .build(); BiometricPrompt biometricPrompt = new BiometricPrompt(BiometricActivity.this, executor, new BiometricPrompt.AuthenticationCallback() { @Override <START> public void onAuthenticationError(int errorCode, @NonNull CharSequence errString) { <END> super.onAuthenticationError(errorCode, errString); Log_OC.e(TAG, "onAuthenticationError (" + errorCode + "): " + errString); authError(); } @Override public void onAuthenticationSucceeded( @NonNull BiometricPrompt.AuthenticationResult result) { super.onAuthenticationSucceeded(result); mActivity.finish(); } @Override public void onAuthenticationFailed() { super.onAuthenticationFailed(); Log_OC.e(TAG, "onAuthenticationFailed"); } }); biometricPrompt.authenticate(promptInfo, mCryptoObject); }</code><technical_language>write this in line</technical_language>

Target:
private void showBiometricPrompt() { BiometricPrompt.PromptInfo promptInfo = new BiometricPrompt.PromptInfo.Builder() .setTitle(getString(R.string.biometric_prompt_title)) .setSubtitle(getString(R.string.biometric_prompt_subtitle)) .setNegativeButtonText(getString(android.R.string.cancel)) .setConfirmationRequired(true) .setDeviceCredentialAllowed(false) .build(); BiometricPrompt biometricPrompt = new BiometricPrompt(BiometricActivity.this, executor, new BiometricPrompt.AuthenticationCallback() { @Override public void onAuthenticationError(int errorCode, @NonNull CharSequence errString) { super.onAuthenticationError(errorCode, errString); Timber.e("onAuthenticationError (" + errorCode + "): " + errString); authError(); } @Override public void onAuthenticationSucceeded(@NonNull BiometricPrompt.AuthenticationResult result) { super.onAuthenticationSucceeded(result); mActivity.finish(); } @Override public void onAuthenticationFailed() { super.onAuthenticationFailed(); Timber.e("onAuthenticationFailed"); } }); biometricPrompt.authenticate(promptInfo, mCryptoObject); }
Source:
<code>public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } MethodYield other = (MethodYield) obj; return new EqualsBuilder() <START> .append(parametersConstraints.stream().flatMap(MethodYield::pmapToStream).collect(Collectors.toList()), <END> other.parametersConstraints.stream().flatMap(MethodYield::pmapToStream).collect(Collectors.toList())) .isEquals(); }</code><technical_language>work. For a method following: Object foo(Object a, Object b, Object c) { if (a == null && (b == null || c == null)) { return null; } return new Object(); } generate yields (only focusing parameters): [[NULL], [NULL], [ ]] [[NULL], [ ], [NULL]] equality tests yields equals, absolutely not, based flatMap producing a new list. I it, yields produce lists [NULL, NULL]</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } MethodYield other = (MethodYield) obj; return new EqualsBuilder() .append(parametersConstraints, other.parametersConstraints) .isEquals(); }
Source:
<code>private void createBranch(final String textForBranch, boolean doCheckout, RevCommit commit, IProgressMonitor monitor) throws CoreException { SubMonitor progress = SubMonitor.convert(monitor, UIText.FetchGerritChangePage_CreatingBranchTaskName, <START> 10); <END> CreateLocalBranchOperation bop = new CreateLocalBranchOperation( repository, textForBranch, commit); bop.execute(progress.newChild(2)); if (doCheckout) { checkout(textForBranch, progress.newChild(8)); } monitor.worked(1); }</code><technical_language>doCheckout ? 2 : 10</technical_language>

Target:
private void createBranch(final String textForBranch, boolean doCheckout, RevCommit commit, IProgressMonitor monitor) throws CoreException { SubMonitor progress = SubMonitor.convert(monitor, UIText.FetchGerritChangePage_CreatingBranchTaskName, doCheckout ? 10 : 2); CreateLocalBranchOperation bop = new CreateLocalBranchOperation( repository, textForBranch, commit); bop.execute(progress.newChild(2)); if (doCheckout) { checkout(textForBranch, progress.newChild(8)); } }
Source:
<code>public boolean equals(final Object other){ if (other == null){ return false; } if (getClass() != other.getClass()){ return false; } <START> final AlarmExpansion sound = (AlarmExpansion) other; <END> return Objects.equal(sound.id, this.id); }</code><technical_language>sound</technical_language>

Target:
public boolean equals(final Object other){ if (other == null){ return false; } if (getClass() != other.getClass()){ return false; } final AlarmExpansion expansion = (AlarmExpansion) other; return Objects.equal(expansion.id, this.id) && Objects.equal(expansion.enabled, this.enabled) && Objects.equal(expansion.category, this.category) && Objects.equal(expansion.targetValue, this.targetValue); }
Source:
<code>public void onNetworkUpdate(boolean isOnline) { <START> String state_msg = context.getString((isOnline? R.string.status_connectivity_change_online : R.string.status_connectivity_change_offline )); <END> StatusActivity.addMessage(String.format("%s: %s", context.getString(R.string.status_connectivity_change), state_msg)); if (!this.isOnline && isOnline) { read(); } this.isOnline = isOnline; }</code><technical_language>multiple formatting naming convention issues here</technical_language>

Target:
public void onNetworkUpdate(boolean isOnline) { int message = isOnline ? R.string.status_network_online : R.string.status_network_offline; StatusActivity.addMessage(context.getString(message)); if (!this.isOnline && isOnline) { read(); } this.isOnline = isOnline; }
Source:
<code>private void remove() { if (getWindow() != null) { return; } List<VmNetworkInterface> nicList = new ArrayList<>(1); <START> nicList.add(getSelectedItem()); <END> RemoveVmInterfaceModel model = new RemoveVmInterfaceModel(this, nicList, false); setWindow(model); }</code><technical_language>I do this: new RemoveVmInterfaceModel(this, new ArrayList<>(Arrays.asList(getSelectedItem()), false);</technical_language>

Target:
private void remove() { if (getWindow() != null) { return; } RemoveVmInterfaceModel model = new RemoveVmInterfaceModel(this, Arrays.asList(getSelectedItem()), false); setWindow(model); }
Source:
<code>public void save(PartitionQC qc) throws IOException { PartitionQC managedQc = get(qc.getRun(), qc.getPartition()); if (managedQc == null) { qc.setRun(runService.get(qc.getRun().getId())); qc.setPartition(containerService.getPartition(qc.getPartition().getId())); qc.setType(getType(qc.getType().getId())); partitionQcDao.create(qc); } else { managedQc.setType(getType(qc.getType().getId())); managedQc.setNotes(qc.getNotes()); partitionQcDao.update(managedQc); <START> } <END> }</code><technical_language>Missing auth check</technical_language>

Target:
public void save(PartitionQC qc) throws IOException { PartitionQC managedQc = get(qc.getRun(), qc.getPartition()); Run managedRun = runService.get(qc.getRun().getId()); authorizationManager.throwIfNotWritable(managedRun); if (managedQc == null) { qc.setRun(managedRun); qc.setPartition(containerService.getPartition(qc.getPartition().getId())); qc.setType(getType(qc.getType().getId())); partitionQcDao.create(qc); } else { managedQc.setType(getType(qc.getType().getId())); managedQc.setNotes(qc.getNotes()); partitionQcDao.update(managedQc); } }