auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>void execute(final Socket sock) throws IOException, ServiceNotEnabledException, ServiceNotAuthorizedException { rawIn = new BufferedInputStream(sock.getInputStream()); rawOut = new BufferedOutputStream(sock.getOutputStream()); if (0 < daemon.getTimeout()) sock.setSoTimeout(daemon.getTimeout() * 1000); String cmd = new PacketLineIn(rawIn).readStringRaw(); Collection<String> extraParameters = null; final int nul = cmd.indexOf('\0'); if (nul >= 0) { cmd = cmd.substring(0, nul); int nulnul = <START> cmd.indexOf("\0\0"); END> if (nulnul != -1) { extraParameters = Arrays.asList(cmd.substring(nulnul + 2).split("\0")); } } final DaemonService srv = getDaemon().matchService(cmd); if (srv == null) return; sock.setSoTimeout(0); srv.execute(this, cmd, extraParameters); }</code><technical_language>start search nul: cmd.indexOf("\0\0", nul)</technical_language>

Target:
void execute(final Socket sock) throws IOException, ServiceNotEnabledException, ServiceNotAuthorizedException { rawIn = new BufferedInputStream(sock.getInputStream()); rawOut = new BufferedOutputStream(sock.getOutputStream()); if (0 < daemon.getTimeout()) sock.setSoTimeout(daemon.getTimeout() * 1000); String cmd = new PacketLineIn(rawIn).readStringRaw(); Collection<String> extraParameters = null; int nulnul = cmd.indexOf("\0\0"); if (nulnul != -1) { extraParameters = Arrays.asList(cmd.substring(nulnul + 2).split("\0")); } final int nul = cmd.indexOf('\0'); if (nul >= 0) { cmd = cmd.substring(0, nul); } final DaemonService srv = getDaemon().matchService(cmd); if (srv == null) return; sock.setSoTimeout(0); srv.execute(this, cmd, extraParameters); }
Source:
<code>public void testEnsureProperCacheState() throws Exception { ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true); EmbeddedCacheManager cacheManager = addClusterEnabledCacheManager(builder); Cache cache = cacheManager.getCache(); cache.stop(); try { MapReduceTask<String, String, String, Integer> task = createMapReduceTask(cache); } catch(IllegalStateException ex) { assertNotNull(ex.getMessage()); assertTrue(ex.getMessage().contains("Cache is in an invalid state:")); throw ex; } finally { TestingUtil.killCacheManagers(cacheManager); <START> cacheManagers.remove(cacheManager); <END> } }</code><technical_language>Instead of do this, line 248 call TCMF.createClusteredCacheManager instead of addClusterEnabledCacheManager? This avoids leak altogether</technical_language>

Target:
public void testEnsureProperCacheState() throws Exception { ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true); withCacheManager(new CacheManagerCallable(TestCacheManagerFactory.createClusteredCacheManager(builder) ) { @Override public void call() { try { Cache cache = cm.getCache(); cache.stop(); MapReduceTask<String, String, String, Integer> task = createMapReduceTask(cache); } catch(IllegalStateException ex) { assertNotNull(ex.getMessage()); assertTrue(ex.getMessage().contains("Cache is in an invalid state:")); throw ex; } } }); }
Source:
<code>synchronized BufferedLogChannel createNewLog() throws IOException { BufferedLogChannel bc; if (!entryLogPreAllocationEnabled || null == preallocation) { bc = allocateNewLog(); } else { try { bc = preallocation.get(0, TimeUnit.MILLISECONDS); } catch (ExecutionException ee) { if (ee.getCause() instanceof IOException) { throw (IOException) (ee.getCause()); } else { throw new IOException("Error to execute entry log allocation.", ee); } } catch (CancellationException ce) { throw new IOException("Task to allocate a new entry log is cancelled.", ce); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); throw new IOException("Intrrupted when waiting a new entry log to be allocated.", ie); } catch (TimeoutException e) { LOG.debug("Received TimeoutException while trying to get preallocation future result," + " which means that Future is waiting for acquiring lock on EntryLoggerAllocator.this"); bc = allocateNewLog(); } } if (entryLogPreAllocationEnabled) { if ((preallocation == null) || preallocation.isDone()) { <START> preallocation = allocatorExecutor.submit(new Callable<BufferedLogChannel>() { <END> @Override public BufferedLogChannel call() throws IOException { return allocateNewLog(); } }); } } LOG.info("Created new entry logger {}.", bc.getLogId()); return bc; }</code><technical_language>written in lambda expression? reason change it</technical_language>

Target:
BufferedLogChannel createNewLog() throws IOException { synchronized (createEntryLogLock) { BufferedLogChannel bc; if (!entryLogPreAllocationEnabled){ bc = allocateNewLog(); return bc; } else { if (null == preallocation){ bc = allocateNewLog(); } else { try { bc = preallocation.get(); } catch (ExecutionException ee) { if (ee.getCause() instanceof IOException) { throw (IOException) (ee.getCause()); } else { throw new IOException("Error to execute entry log allocation.", ee); } } catch (CancellationException ce) { throw new IOException("Task to allocate a new entry log is cancelled.", ce); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); throw new IOException("Intrrupted when waiting a new entry log to be allocated.", ie); } } preallocation = allocatorExecutor.submit(() -> allocateNewLog()); return bc; } } }
Source:
<code>public <R> When.Then<R> then(Supplier<? extends R> supplier) { Objects.requireNonNull(supplier, "supplier is null"); <START> return then(ignored -> {return supplier.get();}); <END> }</code><technical_language>if removed ambiguity, this reverted</technical_language>

Target:
public <R> When.Then<R> then(Supplier<? extends R> supplier) { Objects.requireNonNull(supplier, "supplier is null"); return then(ignored -> supplier.get()); }
Source:
<code>public void serialize(ClaimsHolder holder, JsonGenerator gen, SerializerProvider provider) throws IOException { gen.writeStartObject(); for (Map.Entry<String, Object> e : holder.getClaims().entrySet()) { switch (e.getKey()) { case PublicClaims.AUDIENCE: if (e.getValue() instanceof String) { gen.writeFieldName(e.getKey()); gen.writeString((String)e.getValue()); break; } String[] audArray = (String[]) e.getValue(); if (audArray.length == 1) { gen.writeFieldName(e.getKey()); gen.writeString(audArray[0]); } else if (audArray.length > 1) { gen.writeFieldName(e.getKey()); gen.writeStartArray(); for(String aud : audArray) { gen.writeString(aud); } gen.writeEndArray(); } break; case PublicClaims.EXPIRES_AT: case PublicClaims.ISSUED_AT: case PublicClaims.NOT_BEFORE: gen.writeFieldName(e.getKey()); gen.writeNumber(dateToSeconds((Date) e.getValue())); break; default: gen.writeFieldName(e.getKey()); <START> if (e.getValue() instanceof Date) { <END> gen.writeNumber(dateToSeconds((Date) e.getValue())); } else { gen.writeObject(e.getValue()); } break; } } gen.writeEndObject(); }</code><technical_language>this default case merged 3 claims (which dates well), rephrasing, this deleted: java case PublicClaims.EXPIRES_AT: case PublicClaims.ISSUED_AT: case PublicClaims.NOT_BEFORE: gen.writeFieldName(e.getKey()); gen.writeNumber(dateToSeconds((Date) e.getValue())); break;</technical_language>

Target:
public void serialize(ClaimsHolder holder, JsonGenerator gen, SerializerProvider provider) throws IOException { gen.writeStartObject(); for (Map.Entry<String, Object> e : holder.getClaims().entrySet()) { switch (e.getKey()) { case PublicClaims.AUDIENCE: if (e.getValue() instanceof String) { gen.writeFieldName(e.getKey()); gen.writeString((String)e.getValue()); break; } String[] audArray = (String[]) e.getValue(); if (audArray.length == 1) { gen.writeFieldName(e.getKey()); gen.writeString(audArray[0]); } else if (audArray.length > 1) { gen.writeFieldName(e.getKey()); gen.writeStartArray(); for(String aud : audArray) { gen.writeString(aud); } gen.writeEndArray(); } break; default: gen.writeFieldName(e.getKey()); if (e.getValue() instanceof Date) { gen.writeNumber(dateToSeconds((Date) e.getValue())); } else { gen.writeObject(e.getValue()); } break; } } gen.writeEndObject(); }
Source:
<code>private I_C_Invoice_Detail createI_C_InvoiceDetail(final InvoiceCandidateId invoiceCandidateId, final InvoiceDetailItem invoiceDetailItem) { final I_C_Invoice_Detail invoiceDetailEntity = newInstance(I_C_Invoice_Detail.class); <START> invoiceDetailEntity.setC_Invoice_Candidate_ID(invoiceCandidateId.getRepoId()); <END> invoiceDetailEntity.setSeqNo(NumberUtils.asInt(invoiceDetailItem.getSeqNo(), 0)); invoiceDetailEntity.setDescription(invoiceDetailItem.getDescription()); invoiceDetailEntity.setLabel(invoiceDetailItem.getLabel()); invoiceDetailEntity.setNote(invoiceDetailItem.getNote()); invoiceDetailEntity.setPriceActual(invoiceDetailItem.getPrice()); invoiceDetailEntity.setDate(getDate(invoiceCandidateId, invoiceDetailItem)); return invoiceDetailEntity; }</code><technical_language>please set invoiceDetailEntity.AD_Org_ID</technical_language>

Target:
private I_C_Invoice_Detail createI_C_InvoiceDetail(final InvoiceCandidateId invoiceCandidateId, final InvoiceDetailItem invoiceDetailItem) { final I_C_Invoice_Detail invoiceDetailEntity = newInstance(I_C_Invoice_Detail.class); invoiceDetailEntity.setC_Invoice_Candidate_ID(invoiceCandidateId.getRepoId()); invoiceDetailEntity.setAD_Org_ID(invoiceDetailItem.getOrgId().getRepoId()); invoiceDetailEntity.setSeqNo(NumberUtils.asInt(invoiceDetailItem.getSeqNo(), 0)); invoiceDetailEntity.setDescription(invoiceDetailItem.getDescription()); invoiceDetailEntity.setLabel(invoiceDetailItem.getLabel()); invoiceDetailEntity.setNote(invoiceDetailItem.getNote()); invoiceDetailEntity.setPriceActual(invoiceDetailItem.getPrice()); invoiceDetailEntity.setDate(getDate(invoiceDetailItem)); return invoiceDetailEntity; }
Source:
<code>public static WordUpdateChange updateWordArtifacts(WordUpdateData wud) { WordUpdateChange change = null; OseeClient oseeClient = ServiceUtil.getOseeClient(); WordUpdateEndpoint endpoint = oseeClient.getWordUpdateEndpoint(); try { change = endpoint.updateWordArtifacts(wud); <START> } catch (Exception ex) { <END> throw JaxRsExceptions.asOseeException(ex); } return change; }</code><technical_language>OseeWebApplicationException</technical_language>

Target:
public static WordUpdateChange updateWordArtifacts(WordUpdateData wud) { WordUpdateChange change = null; OseeClient oseeClient = ServiceUtil.getOseeClient(); WordUpdateEndpoint endpoint = oseeClient.getWordUpdateEndpoint(); try { change = endpoint.updateWordArtifacts(wud); } catch (Exception ex) { throw new OseeWebApplicationException(Status.INTERNAL_SERVER_ERROR, "Exception in WordUpdateRequest", ex); } return change; }
Source:
<code>public PBSIMFastqReader(final BufferedReader brRef, final BufferedReader brMAF, final BufferedReader brFastq, final boolean forceFiveBaseEncoding) throws IOException { maf_ = new MafReader(brMAF); fastq_ = new FastqReader(brFastq); index2chrom_ = new ArrayList<String>(5); <START> index2chrom_.add(null); END> for(String buffer = brRef.readLine() ; buffer != null ; buffer = brRef.readLine()) { index2chrom_.add(buffer.substring(1)); } }</code><technical_language>Please abstract index2chrom a class, this is a bit odd</technical_language>

Target:
public PBSIMFastqReader(final BufferedReader brRef, final BufferedReader brMAF, final BufferedReader brFastq, final boolean forceFiveBaseEncoding) throws IOException { maf_ = new MafReader(brMAF); fastq_ = new FastqReader(brFastq); idx2chr_ = new Idx2Chr(brRef); }
Source:
<code>public void onClick(View view) { <START> Log.e("Click", "Button"); <END> switch (view.getId()) { case R.id.take_photo_button: Log.e("Click", "Take Photo"); onTakePhotoButtonPressed(view); break; case R.id.submit_field_report_button: onSubmitFieldReportButtonPressed(view); break; } }</code><technical_language>remove this</technical_language>

Target:
public void onClick(View view) { switch (view.getId()) { case R.id.take_photo_button: onTakePhotoButtonPressed(view); break; case R.id.submit_field_report_button: onSubmitFieldReportButtonPressed(view); break; } }
Source:
<code>public void testTableNotFoundException() throws Exception { <START> ZooKeeperWatcher zkw = HBaseTestingUtility.getZooKeeperWatcher(TEST_UTIL); <END> TableName table = TableName.valueOf("tableNotExists"); try { ZKTableStateClientSideReader.isDisabledTable(zkw, table); fail("Shouldn't be here"); } catch (TableNotFoundException e) { } }</code><technical_language>connection leak, needs closed. Instead non-static version TEST_UTIL.getZookeeperWatcher()... is automatically closed HTU teardown</technical_language>

Target:
public void testTableNotFoundException() throws Exception { ZooKeeperWatcher zkw = TEST_UTIL.getZooKeeperWatcher(); TableName table = TableName.valueOf("tableNotExists"); try { ZKTableStateClientSideReader.isDisabledTable(zkw, table); fail("Shouldn't be here"); } catch (TableNotFoundException e) { } }
Source:
<code><START> public void doHeal(EntityRef entity, int healAmount, EntityRef instigator, HealthComponent targetHealthComponent) { <END> HealthComponent health = targetHealthComponent; if (health == null) { health = entity.getComponent(HealthComponent.class); } int healedAmount = Math.min(health.currentHealth + healAmount, health.maxHealth) - health.currentHealth; health.currentHealth += healedAmount; entity.saveComponent(health); entity.send(new OnHealedEvent(healAmount, healedAmount, instigator)); if (health.currentHealth == health.maxHealth) { entity.send(new FullHealthEvent(instigator)); } }</code><technical_language>this public</technical_language>

Target:
private void doHeal(EntityRef entity, int healAmount, EntityRef instigator, HealthComponent targetHealthComponent) { HealthComponent health = targetHealthComponent; if (health == null) { health = entity.getComponent(HealthComponent.class); } int healedAmount = Math.min(health.currentHealth + healAmount, health.maxHealth) - health.currentHealth; health.currentHealth += healedAmount; entity.saveComponent(health); entity.send(new OnHealedEvent(healAmount, healedAmount, instigator)); if (health.currentHealth == health.maxHealth) { entity.send(new FullHealthEvent(instigator)); } }
Source:
<code>protected String getBackupUrl() { String backupUrl = HttpSolrClientFactory.getDefaultHttpsAddress(); if (configurationAdmin != null) { try { Configuration solrConfig = configurationAdmin.getConfiguration( "(service.pid=ddf.catalog.solr.external.SolrHttpCatalogProvider)"); <START> if (solrConfig != null) { <END> if (solrConfig.getProperties() != null && solrConfig.getProperties().get("url") != null) { LOGGER.debug("Found url property in config, setting backup url"); backupUrl = (String) solrConfig.getProperties().get("url"); } else { LOGGER.debug("No Solr config found, checking System settings"); if (System.getProperty("hostContext") != null) { backupUrl = SystemBaseUrl.INTERNAL.constructUrl( SystemBaseUrl.INTERNAL.getProtocol(), System.getProperty("hostContext")); LOGGER.debug("Trying system configured URL instead: {}", backupUrl); } else { LOGGER.info( "No Solr url configured, defaulting to: {}", HttpSolrClientFactory.getDefaultHttpsAddress()); } } } } catch (IOException e) { LOGGER.debug("Unable to get Solr url from bundle config, will check system properties."); } } return backupUrl; }</code><technical_language>pull this string a constant</technical_language>

Target:
protected String getBackupUrl() { return AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty(SOLR_URL_PROP)); }
Source:
<code><START> public JettyHttpClient(HttpClientConfig config, ClientSecurityConfig securityConfig) <END> { this(config, securityConfig, ImmutableList.<HttpRequestFilter>of()); }</code><technical_language>Do need of extra constructors</technical_language>

Target:
public JettyHttpClient(HttpClientConfig config, ClientSecurityConfig securityConfig) { this(config, securityConfig, Optional.<JettyIoPool>absent(), ImmutableList.<HttpRequestFilter>of()); }
Source:
<code>public Builder(ConnectionPolicy connectionPolicy) { this.bufferPageSize = DEFAULT_OPTIONS.bufferPageSize; this.connectionAcquisitionTimeout = DEFAULT_OPTIONS.connectionAcquisitionTimeout; this.connectTimeout = connectionPolicy.getConnectTimeout(); <START> this.idleChannelTimeout = connectionPolicy.getIdleConnectionTimeout(); <END> this.idleEndpointTimeout = DEFAULT_OPTIONS.idleEndpointTimeout; this.maxBufferCapacity = DEFAULT_OPTIONS.maxBufferCapacity; this.maxChannelsPerEndpoint = connectionPolicy.getMaxConnectionsPerEndpoint(); this.maxRequestsPerChannel = connectionPolicy.getMaxRequestsPerConnection(); this.receiveHangDetectionTime = DEFAULT_OPTIONS.receiveHangDetectionTime; this.requestExpiryInterval = DEFAULT_OPTIONS.requestExpiryInterval; this.requestTimeout = connectionPolicy.getRequestTimeout(); this.requestTimerResolution = DEFAULT_OPTIONS.requestTimerResolution; this.sendHangDetectionTime = DEFAULT_OPTIONS.sendHangDetectionTime; this.shutdownTimeout = DEFAULT_OPTIONS.shutdownTimeout; this.threadCount = DEFAULT_OPTIONS.threadCount; this.userAgent = DEFAULT_OPTIONS.userAgent; }</code><technical_language>I this is in-correct. want getIdleTcpConnectionTimeout</technical_language>

Target:
public Builder(ConnectionPolicy connectionPolicy) { this.bufferPageSize = DEFAULT_OPTIONS.bufferPageSize; this.connectionAcquisitionTimeout = DEFAULT_OPTIONS.connectionAcquisitionTimeout; this.connectTimeout = connectionPolicy.getConnectTimeout(); this.idleChannelTimeout = connectionPolicy.getIdleTcpConnectionTimeout(); this.idleEndpointTimeout = DEFAULT_OPTIONS.idleEndpointTimeout; this.maxBufferCapacity = DEFAULT_OPTIONS.maxBufferCapacity; this.maxChannelsPerEndpoint = connectionPolicy.getMaxConnectionsPerEndpoint(); this.maxRequestsPerChannel = connectionPolicy.getMaxRequestsPerConnection(); this.receiveHangDetectionTime = DEFAULT_OPTIONS.receiveHangDetectionTime; this.requestExpiryInterval = DEFAULT_OPTIONS.requestExpiryInterval; this.requestTimeout = connectionPolicy.getRequestTimeout(); this.requestTimerResolution = DEFAULT_OPTIONS.requestTimerResolution; this.sendHangDetectionTime = DEFAULT_OPTIONS.sendHangDetectionTime; this.shutdownTimeout = DEFAULT_OPTIONS.shutdownTimeout; this.threadCount = DEFAULT_OPTIONS.threadCount; this.userAgent = DEFAULT_OPTIONS.userAgent; }
Source:
<code>public String toString() { if(m_highLoadWatermark != null) { <START> return "Load:" + m_load + ", high water-mark:" + m_highLoadWatermark.intValue(); END> } else { return "Load:" + m_load + ", high water-mark: not defined"; } }</code><technical_language>intValue(). remove it</technical_language>

Target:
public String toString() { if(m_highLoadWatermark != null) { return "Load:" + m_load + ", high water-mark:" + m_highLoadWatermark; } else { return "Load:" + m_load + ", high water-mark: not defined"; } }
Source:
<code>public int isApplicable(VElement vElement, ViewModelContext viewModelContext) { if (!VControl.class.isInstance(vElement)) { return NOT_APPLICABLE; } final VControl control = (VControl) vElement; IValueProperty valueProperty; try { valueProperty = Activator.getDefault().getEMFFormsDatabinding() <START> .getValueProperty(control.getDomainModelReference(), viewModelContext.getDomainModel()); <END> } catch (final DatabindingFailedException ex) { Activator.getDefault().getReportService().report(new DatabindingFailedReport(ex)); return NOT_APPLICABLE; } catch (final IllegalArgumentException ex) { Activator.getDefault().getReportService().report(new AbstractReport(ex)); return NOT_APPLICABLE; } final EStructuralFeature feature = (EStructuralFeature) valueProperty.getValueType(); if (feature.isMany()) { return NOT_APPLICABLE; } if (!EAttribute.class.isInstance(feature)) { return NOT_APPLICABLE; } final EAttribute eAttribute = EAttribute.class.cast(feature); if (eAttribute.getEContainingClass().equals(RulePackage.eINSTANCE.getLeafCondition())) { return 3; } return NOT_APPLICABLE; }</code><technical_language>check for null</technical_language>

Target:
public int isApplicable(VElement vElement, ViewModelContext viewModelContext) { if (!VControl.class.isInstance(vElement)) { return NOT_APPLICABLE; } final VControl control = (VControl) vElement; if (control.getDomainModelReference() == null) { return NOT_APPLICABLE; } IValueProperty valueProperty; try { valueProperty = Activator.getDefault().getEMFFormsDatabinding() .getValueProperty(control.getDomainModelReference(), viewModelContext.getDomainModel()); } catch (final DatabindingFailedException ex) { Activator.getDefault().getReportService().report(new DatabindingFailedReport(ex)); return NOT_APPLICABLE; } catch (final IllegalArgumentException ex) { Activator.getDefault().getReportService().report(new AbstractReport(ex)); return NOT_APPLICABLE; } final EStructuralFeature feature = (EStructuralFeature) valueProperty.getValueType(); if (feature.isMany()) { return NOT_APPLICABLE; } if (!EAttribute.class.isInstance(feature)) { return NOT_APPLICABLE; } final EAttribute eAttribute = EAttribute.class.cast(feature); if (eAttribute.getEContainingClass().equals(RulePackage.eINSTANCE.getLeafCondition())) { return 3; } return NOT_APPLICABLE; }
Source:
<code>public void appendData(final String id, final byte[] data) throws IOException { <START> this.rawData.putIfAbsent(id, new ByteArrayOutputStream()); <END> final ByteArrayOutputStream stream = this.rawData.get(id); stream.write(data); }</code><technical_language>do return (which complained QA tools). instantiate a ByteArrayOutputStream time this method is invoked. unsynchronized map implementation synchronize accesses synchronized(..) avoid issues</technical_language>

Target:
public synchronized void appendData(final String id, final byte[] data) throws IOException { ByteArrayOutputStream stream = this.rawData.get(id); if (stream == null) { stream = new ByteArrayOutputStream(); this.rawData.put(id, stream); } stream.write(data); }
Source:
<code>public CharSequence getQuantityText(int id, int quantity) throws NotFoundException { PluralRules rule = getPluralRule(); CharSequence res = mAssets.getResourceBagText(id, attrForQuantityCode(rule.select(quantity))); if (res != null) { return res; } res = mAssets.getResourceBagText(id, ID_OTHER); if (res != null) { return res; } throw new NotFoundException("Plural resource ID #0x" + Integer.toHexString(id) + " quantity=" + quantity + " item=" + <START> stringForQuantityCode(rule.select(quantity))); <END> }</code><technical_language>this " + rules.select(quantity)</technical_language>

Target:
public CharSequence getQuantityText(int id, int quantity) throws NotFoundException { PluralRules rule = getPluralRule(); CharSequence res = mAssets.getResourceBagText(id, attrForQuantityCode(rule.select(quantity))); if (res != null) { return res; } res = mAssets.getResourceBagText(id, ID_OTHER); if (res != null) { return res; } throw new NotFoundException("Plural resource ID #0x" + Integer.toHexString(id) + " quantity=" + quantity + " item=" + rule.select(quantity)); }
Source:
<code>public void initialize(final List<Integer> initBlockLocations) { <START> if (!initialized.compareAndSet(false, true)) { <END> return; } if (initBlockLocations.size() != numTotalBlocks) { throw new RuntimeException("Imperfect routing table"); } for (int blockId = 0; blockId < numTotalBlocks; blockId++) { final int storeId = initBlockLocations.get(blockId); if (storeId == localStoreId) { throw new RuntimeException("Wrong initial routing table"); } this.blockLocations.set(blockId, storeId); } LOG.log(Level.FINE, "Operation router is initialized"); synchronized (this) { this.notifyAll(); } }</code><technical_language>Compared previous of compareAndSet(), I this block is easier understand, is here</technical_language>

Target:
public synchronized void initialize(final List<Integer> initBlockLocations) { if (initialized) { return; } if (initBlockLocations.size() != numTotalBlocks) { throw new RuntimeException("Imperfect routing table"); } for (int blockId = 0; blockId < numTotalBlocks; blockId++) { final int storeId = initBlockLocations.get(blockId); if (storeId == localStoreId) { throw new RuntimeException("Wrong initial routing table"); } this.blockLocations.set(blockId, storeId); } initialized = true; LOG.log(Level.FINE, "Operation router is initialized"); synchronized (this) { this.notifyAll(); } }
Source:
<code>private void writeUserData() { Set<DbUser> dbUsers = fullEntityOvfData.getDbUsers(); if <START> (dbUsers == null || <END> dbUsers.isEmpty()) { return; } _writer.writeStartElement("Section"); _writer.writeAttributeString(XSI_URI, "type", "ovf:UserDomainsSection_Type"); dbUsers.forEach(dbUser -> { _writer.writeStartElement(OvfProperties.USER); _writer.writeElement(OvfProperties.USER_DOMAIN, String.format("%s@%s", dbUser.getName(), dbUser.getDomain())); _writer.writeStartElement(OvfProperties.USER_ROLES); Set<String> roles = fullEntityOvfData.getUserToRoles().getOrDefault(dbUser.getLoginName(), Collections.EMPTY_SET); roles.forEach(role -> _writer.writeElement(OvfProperties.ROLE_NAME, role)); _writer.writeEndElement(); _writer.writeEndElement(); }); _writer.writeEndElement(); }</code><technical_language>Suggestion: I doubt a null Set initialize this new Set FullEntityOvfData. I guess initialized constructor safe side</technical_language>

Target:
private void writeUserData() { Set<DbUser> dbUsers = fullEntityOvfData.getDbUsers(); if (dbUsers == null || dbUsers.isEmpty()) { return; } _writer.writeStartElement("Section"); _writer.writeAttributeString(XSI_URI, "type", "ovf:UserDomainsSection_Type"); dbUsers.forEach(dbUser -> { _writer.writeStartElement(OvfProperties.USER); _writer.writeElement(OvfProperties.USER_DOMAIN, String.format("%s@%s", dbUser.getName(), dbUser.getDomain())); _writer.writeStartElement(OvfProperties.USER_ROLES); Set<String> roles = fullEntityOvfData.getUserToRoles().getOrDefault(dbUser.getLoginName(), Collections.emptySet()); roles.forEach(role -> _writer.writeElement(OvfProperties.ROLE_NAME, role)); _writer.writeEndElement(); _writer.writeEndElement(); }); _writer.writeEndElement(); }
Source:
<code>public void compile() { Nullability nullability = new Nullability(this); List<State> allStates = new ArrayList<>(); <START> for (NonTerminal nonTerminal : getAllNonTerminals()) { <END> allStates.addAll(nonTerminal.getReachableStates()); } Map<State, Integer> inverseAllStates = new HashMap<>(); for (int i = 0; i < allStates.size(); i++) { inverseAllStates.put(allStates.get(i), i); } @SuppressWarnings("unchecked") List<Integer>[] predecessors = new List[allStates.size()]; for (int i = 0; i < predecessors.length; i++) { predecessors[i] = new ArrayList<>(); } for (State s : allStates) { if (s instanceof NextableState) { NextableState ns = (NextableState) s; for (State nextState : ns.next) { if (nullability.isNullable(nextState)) { predecessors[inverseAllStates.get(nextState)].add(inverseAllStates.get(s)); } if (nextState instanceof NonTerminalState) { EntryState es = ((NonTerminalState) nextState).child.entryState; predecessors[inverseAllStates.get(es)].add(inverseAllStates.get(s)); } } if (ns instanceof NonTerminalState) { ExitState es = ((NonTerminalState) ns).child.exitState; predecessors[inverseAllStates.get(es)].add(inverseAllStates.get(s)); } } } List<List<Integer>> components = new SCCTarjan().scc(predecessors); for (int i = 0; i < components.size(); i++) { for (int j : components.get(i)) { State state = allStates.get(j); state.orderingInfo = new OrderingInfo(i); } } }</code><technical_language>I making this pattern places in code loop states. inefficient me. Is a reason this information precomputed somewhere</technical_language>

Target:
public void compile() { Nullability nullability = new Nullability(this); List<State> allStates = new ArrayList<>(); for (NonTerminal nonTerminal : getAllNonTerminals()) { allStates.addAll(nonTerminal.getReachableStates()); } Map<State, Integer> inverseAllStates = new HashMap<>(); for (int i = 0; i < allStates.size(); i++) { inverseAllStates.put(allStates.get(i), i); } @SuppressWarnings("unchecked") List<Integer>[] predecessors = new List[allStates.size()]; for (int i = 0; i < predecessors.length; i++) { predecessors[i] = new ArrayList<>(); } for (State s : allStates) { if (s instanceof NextableState) { NextableState ns = (NextableState) s; for (State nextState : ns.next) { if (nullability.isNullable(nextState)) { predecessors[inverseAllStates.get(nextState)].add(inverseAllStates.get(s)); } if (nextState instanceof NonTerminalState) { EntryState es = ((NonTerminalState) nextState).child.entryState; predecessors[inverseAllStates.get(es)].add(inverseAllStates.get(s)); } } if (ns instanceof NonTerminalState) { ExitState es = ((NonTerminalState) ns).child.exitState; predecessors[inverseAllStates.get(es)].add(inverseAllStates.get(s)); } } } List<List<Integer>> components = new SCCTarjan().scc(predecessors); for (int i = 0; i < components.size(); i++) { for (int j : components.get(i)) { State state = allStates.get(j); state.orderingInfo = new State.OrderingInfo(i); } } }
Source:
<code>public AttributeValueSearch(IAttributeType attributeType, String attributeValue) { this.attributeType = attributeType; this.attributeValue = attributeValue; <START> Conditions.checkNotNull(attributeType, "attributeType"); Conditions.checkNotNullOrEmpty(attributeValue, "attributeValue"); <END> }</code><technical_language>want conditions check prior assignments</technical_language>

Target:
public AttributeValueSearch(IAttributeType attributeType, String attributeValue) { Conditions.checkNotNull(attributeType, "attributeType"); Conditions.checkNotNullOrEmpty(attributeValue, "attributeValue"); this.attributeType = attributeType; this.attributeValue = attributeValue; }
Source:
<code>private void updateLinkProperties(NetworkAgentInfo networkAgent, LinkProperties newLp, LinkProperties oldLp) { int netId = networkAgent.network.netId; networkAgent.clatd.fixupLinkProperties(oldLp, newLp); updateInterfaces(newLp, oldLp, netId, networkAgent.networkCapabilities); updateMtu(newLp, oldLp); if (isDefaultNetwork(networkAgent)) { updateTcpBufferSizes(newLp.getTcpBufferSizes()); } updateRoutes(newLp, oldLp, netId); updateDnses(newLp, oldLp, netId); mDnsManager.updatePrivateDnsStatus(netId, newLp); if (isDefaultNetwork(networkAgent)) { handleApplyDefaultProxy(newLp.getHttpProxy()); } else { updateProxy(newLp, oldLp); } if (!Objects.equals(newLp, oldLp)) { synchronized (networkAgent) { networkAgent.linkProperties = newLp; } networkAgent.clatd.update(); notifyIfacesChangedForNetworkStats(); if (networkAgent.everConnected) { try { <START> networkAgent.networkMonitor().notifyLinkPropertiesChanged( networkAgent.linkProperties); <END> } catch (RemoteException e) { e.rethrowFromSystemServer(); } notifyNetworkCallbacks(networkAgent, ConnectivityManager.CALLBACK_IP_CHANGED); } } mKeepaliveTracker.handleCheckKeepalivesStillValid(networkAgent); }</code><technical_language>Nit: is necessary do this if networkagent connected? do time</technical_language>

Target:
private void updateLinkProperties(NetworkAgentInfo networkAgent, LinkProperties newLp, LinkProperties oldLp) { int netId = networkAgent.network.netId; networkAgent.clatd.fixupLinkProperties(oldLp, newLp); updateInterfaces(newLp, oldLp, netId, networkAgent.networkCapabilities); updateMtu(newLp, oldLp); if (isDefaultNetwork(networkAgent)) { updateTcpBufferSizes(newLp.getTcpBufferSizes()); } updateRoutes(newLp, oldLp, netId); updateDnses(newLp, oldLp, netId); mDnsManager.updatePrivateDnsStatus(netId, newLp); if (isDefaultNetwork(networkAgent)) { handleApplyDefaultProxy(newLp.getHttpProxy()); } else { updateProxy(newLp, oldLp); } if (!Objects.equals(newLp, oldLp)) { synchronized (networkAgent) { networkAgent.linkProperties = newLp; } networkAgent.clatd.update(); notifyIfacesChangedForNetworkStats(); try { networkAgent.networkMonitor().notifyLinkPropertiesChanged(newLp); } catch (RemoteException e) { e.rethrowFromSystemServer(); } if (networkAgent.everConnected) { notifyNetworkCallbacks(networkAgent, ConnectivityManager.CALLBACK_IP_CHANGED); } } mKeepaliveTracker.handleCheckKeepalivesStillValid(networkAgent); }
Source:
<code>public long maxSizeBytes() { String str = attributes.attribute(MAX_SIZE).get(); <START> if(str == null) return -1; <END> return ByteQuantity.parse(str); }</code><technical_language>Nitpick: space</technical_language>

Target:
public long maxSizeBytes() { return maxSizeBytes; }
Source:
<code>public void resolved(final Pair<Series, FetchData> result) throws Exception { final FetchData f = result.getRight(); boolean failed = false; for (final MetricCollection g : f.getGroups()) { failed = failed || <START> failOnLimits && aggregationLimit.isGreater(session::getRetainedMetricsCount); <END> if (!failed) { g.updateAggregation(session, result.getLeft().getTags(), ImmutableSet.of(result.getLeft())); } dataInMemoryReporter.reportDataNoLongerNeeded(g.size()); } }</code><technical_language>This approach scan aggregations sum retained count time fed data. alternative, a system similar QuotaWatcher works. aggregation session initialized AtomicLong (wrapped interface) responsible for incrementing this time "stored" data. Querying a matter of reading here. want consider tying systems together, if aggregation system "runs out of quota" is need continue reading data backend longer</technical_language>

Target:
public void resolved(final Pair<Series, FetchData> result) throws Exception { final FetchData f = result.getRight(); requestErrors.addAll(f.getErrors()); try { for (final MetricCollection g : f.getGroups()) { g.updateAggregation(session, result.getLeft().getTags(), ImmutableSet.of(result.getLeft())); dataInMemoryReporter.reportDataNoLongerNeeded(g.size()); } } catch (QuotaViolationException e) { log.debug("Aggregation quota violated", e); } }
Source:
<code>public void updateMinimap(int editorTopIndex, int editorBottomIndex) { if (editorTopIndex != fEditorTopIndex || editorBottomIndex != fEditorBottomIndex) { fEditorTopIndex = editorTopIndex; fEditorBottomIndex = editorBottomIndex; fMinimapTextWidget.setRedraw(false); int newMinimapTopIndex = editorTopIndex; if (editorTopIndex != 0 && editorBottomIndex != fMinimapTextWidget.getLineAtOffset(fMinimapTextWidget.getCharCount())) { int minimapTopIndex = JFaceTextUtil.getPartialTopIndex(fMinimapTextWidget); int minimapBottomIndex = JFaceTextUtil.getPartialBottomIndex(fMinimapTextWidget); int minimapVisibleLineCount = minimapBottomIndex - minimapTopIndex; int editorVisibleLineCount = editorBottomIndex - editorTopIndex; newMinimapTopIndex = Math.max(0, editorTopIndex + editorVisibleLineCount - minimapVisibleLineCount / 2); } fMinimapTextWidget.setTopIndex(newMinimapTopIndex); fTopIndexY = fMinimapTextWidget.getLinePixel(fEditorTopIndex); fBottomIndexY = <START> fMinimapTextWidget.getLinePixel(fEditorBottomIndex); <END> fMinimapTextWidget.setRedraw(true); } }</code><technical_language>mac a retina display, line is included in rectangle. this is reason: this is top of line? rectangle bottom. fEditorBottomIndex+1 subtract 1 pixel</technical_language>

Target:
public void updateMinimap(int editorTopIndex, int editorBottomIndex) { if (editorTopIndex != fEditorTopIndex || editorBottomIndex != fEditorBottomIndex) { fEditorTopIndex = editorTopIndex; fEditorBottomIndex = editorBottomIndex; fMinimapTextWidget.setRedraw(false); int newMinimapTopIndex = editorTopIndex; if (editorTopIndex != 0 && editorBottomIndex != fMinimapTextWidget.getLineAtOffset(fMinimapTextWidget.getCharCount())) { int minimapTopIndex = JFaceTextUtil.getPartialTopIndex(fMinimapTextWidget); int minimapBottomIndex = JFaceTextUtil.getPartialBottomIndex(fMinimapTextWidget); int minimapVisibleLineCount = minimapBottomIndex - minimapTopIndex; int editorVisibleLineCount = editorBottomIndex - editorTopIndex; newMinimapTopIndex = Math.max(0, editorTopIndex + editorVisibleLineCount - minimapVisibleLineCount / 2); } fMinimapTextWidget.setTopIndex(newMinimapTopIndex); fTopIndexY = fMinimapTextWidget.getLinePixel(fEditorTopIndex); fBottomIndexY = fMinimapTextWidget.getLinePixel(fEditorBottomIndex + 1); fMinimapTextWidget.setRedraw(true); } }
Source:
<code>private void removeDetachedServers(List<VDS> existingServers, Set<GlusterServerInfo> fetchedServers) { for (VDS server : existingServers) { if (isRemovableStatus(server.getstatus()) && serverDetached(server, fetchedServers)) { <START> RemoveVdsStatisticsFromDb(server); <END> RemoveVdsDynamicFromDb(server); RemoveVdsStaticFromDb(server); runVdsCommand(VDSCommandType.RemoveVds, new RemoveVdsVDSCommandParameters(server.getId())); log.debugFormat("Server {0} has been removed directly using the gluster CLI. Removing it from engine as well.", server.getvds_name()); logServerMessage(server, AuditLogType.GLUSTER_SERVER_REMOVED_FROM_CLI); } } }</code><technical_language>3 removeXXX in transaction</technical_language>

Target:
private void removeDetachedServers(List<VDS> existingServers, Set<GlusterServerInfo> fetchedServers) { for (VDS server : existingServers) { if (isRemovableStatus(server.getstatus()) && serverDetached(server, fetchedServers)) { log.debugFormat("Server {0} has been removed directly using the gluster CLI. Removing it from engine as well.", server.getvds_name()); logServerMessage(server, AuditLogType.GLUSTER_SERVER_REMOVED_FROM_CLI); try { removeServerFromDb(server); } catch (Exception e) { log.errorFormat("Error while removing server {0} from database!", server.getvds_name(), e); continue; } runVdsCommand(VDSCommandType.RemoveVds, new RemoveVdsVDSCommandParameters(server.getId())); } } }
Source:
<code>public static Map<String, List<String>> getQueryParametersFromState(String state) { Map<String, List<String>> params = new HashMap<>(); if (isNullOrEmpty(state)) { return params; } <START> String decodedState; <END> try { decodedState = URLDecoder.decode(state, "UTF-8"); for (String pair : decodedState.split("&")) { if (!pair.isEmpty()) { String name; String value; int eq = pair.indexOf('='); if (eq < 0) { name = pair; value = ""; } else { name = pair.substring(0, eq); value = pair.substring(eq + 1); } List<String> paramValues = params.computeIfAbsent(name, values -> new ArrayList<>()); paramValues.add(value); } } } catch (UnsupportedEncodingException ignored) { } return params; }</code><technical_language>do need declaration of this variable here</technical_language>

Target:
public static Map<String, List<String>> getQueryParametersFromState(String state) { Map<String, List<String>> params = new HashMap<>(); if (isNullOrEmpty(state)) { return params; } try { for (String pair : URLDecoder.decode(state, "UTF-8").split("&")) { if (pair.isEmpty()) { continue; } String name; String value; int eq = pair.indexOf('='); if (eq < 0) { name = pair; value = ""; } else { name = pair.substring(0, eq); value = pair.substring(eq + 1); } List<String> paramValues = params.computeIfAbsent(name, values -> new ArrayList<>()); paramValues.add(value); } } catch (UnsupportedEncodingException ignored) { } return params; }
Source:
<code>protected Response performRemove(String id) { Fault fault = new Fault(); fault.setReason("Unsupported Operation"); fault.setDetail("Remove is not supported"); <START> throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST).entity(fault).build()); <END> }</code><technical_language>"remove" method is part of interface, client able invoke it, is need prepare a nice response for user. throw exception: throw new UnsupportedOperationException();</technical_language>

Target:
protected Response performRemove(String id) { throw new UnsupportedOperationException(); }
Source:
<code>private static void updateNumOfMonitorsInVmDevice(VmBase oldVmBase, VmBase newStatic) { int prevNumOfMonitors=0; if (oldVmBase != null) { prevNumOfMonitors = oldVmBase.getnum_of_monitors(); } if (newStatic.getnum_of_monitors() > prevNumOfMonitors) { for (int i = prevNumOfMonitors; i < newStatic .getnum_of_monitors(); i++) { Guid newId = Guid.NewGuid(); VmDeviceUtils.addManagedDevice(new VmDeviceId(newId, newStatic.getId()), VmDeviceType.VIDEO, VmDeviceType.QXL, getMemExpr(newStatic.getnum_of_monitors()), true, false, <START> ""); <END> } } else { List<VmDevice> list = DbFacade .getInstance() .getVmDeviceDAO() .getVmDeviceByVmIdAndType(newStatic.getId(), VmDeviceType.VIDEO.getName()); removeNumberOfDevices(list, prevNumOfMonitors - newStatic.getnum_of_monitors()); } }</code><technical_language>please remove alias setting (should encapsulated in addManagedDevice</technical_language>

Target:
private static void updateNumOfMonitorsInVmDevice(VmBase oldVmBase, VmBase newStatic) { int prevNumOfMonitors=0; if (oldVmBase != null) { prevNumOfMonitors = oldVmBase.getnum_of_monitors(); } if (newStatic.getnum_of_monitors() > prevNumOfMonitors) { for (int i = prevNumOfMonitors; i < newStatic .getnum_of_monitors(); i++) { Guid newId = Guid.NewGuid(); VmDeviceUtils.addManagedDevice(new VmDeviceId(newId, newStatic.getId()), VmDeviceType.VIDEO, VmDeviceType.QXL, getMemExpr(newStatic.getnum_of_monitors()), true, false); } } else { List<VmDevice> list = DbFacade .getInstance() .getVmDeviceDAO() .getVmDeviceByVmIdAndType(newStatic.getId(), VmDeviceType.VIDEO.getName()); removeNumberOfDevices(list, prevNumOfMonitors - newStatic.getnum_of_monitors()); } }
Source:
<code>public static int getHeaderSize() { return Version_Field_Size_In_Bytes + Total_Size_Field_Size_In_Bytes + <START> (3 * Relative_Offset_Field_Sizes_In_Bytes) + <END> Crc_Size; }</code><technical_language>3 is a magic number. I assume is due following: <<< outputBuffer.putInt(systemMetadataRelativeOffset); outputBuffer.putInt(userMetadataRelativeOffset); outputBuffer.putInt(dataRelativeOffset); Ideally 3 is iether a method call a constant</technical_language>

Target:
public static int getHeaderSize() { return Version_Field_Size_In_Bytes + Total_Size_Field_Size_In_Bytes + (Number_Of_Relative_Offset_Fields * Relative_Offset_Field_Sizes_In_Bytes) + Crc_Size; }
Source:
<code>public AS7ManagementDetails(IServer server) { <START> this(server, new HashMap<String,Object>()); <END> }</code><technical_language>new HashMap<String,Object>(0) Collections.<String, Object>emptyMap() if immutable</technical_language>

Target:
public AS7ManagementDetails(IServer server) { this(server, new HashMap<String,Object>(0)); }
Source:
<code>public void process(String sessionId, String taskId, NodeId agentId, NodeContext nodeContext, SystemInfo systemInfo) { String serviceId = getKey(sessionId, taskId); if (!metricServiceMap.containsKey(serviceId)){ metricServiceMap.put(serviceId, new DefaultMetricService(sessionId, taskId, nodeContext)); } saveMonitoringValues(serviceId, agentId.getIdentifier(), systemInfo.getSysInfo()); if (systemInfo.getSysUnderTest() == null){ <START> return; <END> } for (Map.Entry<String, SystemUnderTestInfo> entry : systemInfo.getSysUnderTest().entrySet()){ saveMonitoringValues(serviceId, entry.getKey(), entry.getValue().getSysUTInfo()); } log.trace("System info received from agent and has been written to FileStorage", systemInfo, agentId); }</code><technical_language>propose put for (Map ...) if clause in current implementation log.trace executed</technical_language>

Target:
public void process(String sessionId, String taskId, NodeId agentId, NodeContext nodeContext, SystemInfo systemInfo) { String serviceId = getKey(sessionId, taskId); if (!metricServiceMap.containsKey(serviceId)){ metricServiceMap.put(serviceId, new DefaultMetricService(sessionId, taskId, nodeContext)); } saveMonitoringValues(serviceId, agentId.getIdentifier(), systemInfo.getSysInfo()); if (systemInfo.getSysUnderTest() != null){ for (Map.Entry<String, SystemUnderTestInfo> entry : systemInfo.getSysUnderTest().entrySet()){ saveMonitoringValues(serviceId, entry.getKey(), entry.getValue().getSysUTInfo()); } } log.trace("System info received from agent and has been written to FileStorage", systemInfo, agentId); }
Source:
<code>public boolean shouldSync(UdbTable udbTable) { if (!Objects.equals(mName, udbTable.getName()) || !Objects.equals(mSchema, udbTable.getSchema()) || !Objects.equals(mOwner, udbTable.getOwner()) || !Objects.equals(mStatistics, udbTable.getStatistics()) || !Objects.equals(mParameters, udbTable.getParameters())) { return true; } Map<String, Partition> existingPartitions = mPartitionScheme.getPartitions().stream() .collect(Collectors.toMap(Partition::getSpec, Function.identity())); if (existingPartitions.size() != udbTable.getPartitions().size()) { return true; } for (UdbPartition udbPartition : udbTable.getPartitions()) { Partition newPartition = existingPartitions.get(udbPartition.getSpec()); <START> if (newPartition == null || !newPartition.getLayout() <END> .equals(udbPartition.getLayout())) { return true; } } return false; }</code><technical_language>similar above, this layout comparison fail if is transformation. want getBaseLayout</technical_language>

Target:
public boolean shouldSync(UdbTable udbTable) { if (!Objects.equals(mName, udbTable.getName()) || !Objects.equals(mSchema, udbTable.getSchema()) || !Objects.equals(mOwner, udbTable.getOwner()) || !Objects.equals(mStatistics, udbTable.getStatistics()) || !Objects.equals(mParameters, udbTable.getParameters())) { return true; } Map<String, Partition> existingPartitions = mPartitionScheme.getPartitions().stream() .collect(Collectors.toMap(Partition::getSpec, Function.identity())); if (existingPartitions.size() != udbTable.getPartitions().size()) { return true; } for (UdbPartition udbPartition : udbTable.getPartitions()) { Partition newPartition = existingPartitions.get(udbPartition.getSpec()); if (newPartition == null || !newPartition.getBaseLayout().equals(udbPartition.getLayout())) { return true; } } return false; }
Source:
<code>public int getVmlist(){ log.debug("about to print collection"); Host host = getActiveHost(); List statusList = new ArrayList(); for (VM vm : host.getRunningVMs().values()) { statusList.add(vm.getName()); } log.debug("printing <START> collection {}", <END> statusList.size()); return statusList.size(); }</code><technical_language>Is a good enough debug print? printing VMs</technical_language>

Target:
public int getVmlist(){ Host host = getActiveHost(); List statusList = new ArrayList(); for (VM vm : host.getRunningVMs().values()) { statusList.add(vm.getName()); } return statusList.size(); }
Source:
<code>public void widgetDisposed(DisposeEvent e) { if (fImages != null) { for (Image <START> fImage : <END> fImages) { fImage.dispose(); } } }</code><technical_language>rename image</technical_language>

Target:
public void widgetDisposed(DisposeEvent e) { if (fImages != null) { for (Image image : fImages) { image.dispose(); } } }
Source:
<code>protected Set<Value.Immutable<?>> api$getVanillaValues() { final Set<Value.Immutable<?>> vanillaValues = super.api$getVanillaValues(); vanillaValues.add(this.primed().asImmutable()); vanillaValues.add(this.fuseDuration().asImmutable()); <START> if (this.tntPlacedBy != null) { END> this.detonator().map(Value::asImmutable).ifPresent(vanillaValues::add); } return vanillaValues; }</code><technical_language>need if check</technical_language>

Target:
protected Set<Value.Immutable<?>> api$getVanillaValues() { final Set<Value.Immutable<?>> values = super.api$getVanillaValues(); values.add(this.primed().asImmutable()); values.add(this.fuseDuration().asImmutable()); this.detonator().map(Value::asImmutable).ifPresent(values::add); return values; }
Source:
<code>public void refreshItems() { if (dataManager != null) { try { Collection<? extends BaseModel> databaseItems = dataManager.getObjects(baseClass); if (items == null) { items = new ConcurrentHashMap<>(databaseItems.size()); } Set<Long> databaseItemIds = new HashSet<>(); for (BaseModel item : databaseItems) { databaseItemIds.add(item.getId()); if (items.containsKey(item.getId())) { updateCachedItem(item); } else { addNewItem(item); } } for (Long cachedItemId : items.keySet()) { if (!databaseItemIds.contains(cachedItemId)) { <START> items.remove(cachedItemId); <END> } } } catch (SQLException error) { Log.warning(error); } } refreshUserItems(); }</code><technical_language>removeCachedItem here</technical_language>

Target:
public void refreshItems() { if (dataManager != null) { try { Collection<? extends BaseModel> databaseItems = dataManager.getObjects(baseClass); if (items == null) { items = new ConcurrentHashMap<>(databaseItems.size()); } Set<Long> databaseItemIds = new HashSet<>(); for (BaseModel item : databaseItems) { databaseItemIds.add(item.getId()); if (items.containsKey(item.getId())) { updateCachedItem(item); } else { addNewItem(item); } } for (Long cachedItemId : items.keySet()) { if (!databaseItemIds.contains(cachedItemId)) { removeCachedItem(cachedItemId); } } } catch (SQLException error) { Log.warning(error); } } refreshUserItems(); }