auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Object get(int index) { if (index < 0) { throw new IndexOutOfBoundsException("Index: " + index + " should not be negative"); } int i = 0; <START> for (Iterator it = iterator(); ; i++) { <END> final Object next = it.next(); if (i == index) { return next; } else if (!it.hasNext()) { throw new IndexOutOfBoundsException("Index: " + index + " is too big for range: " + this); } } }</code><technical_language>of synchronization, iterator() returns a slower implementation. raw StepIterator</technical_language>

Target:
public Comparable get(int index) { if (index < 0) { throw new IndexOutOfBoundsException("Index: " + index + " should not be negative"); } int i = 0; for (Iterator<Comparable> iter = new LazySteppingIterator(this, 1); ; i++) { final Comparable next = iter.next(); if (i == index) { return next; } else if (!iter.hasNext()) { throw new IndexOutOfBoundsException("Index: " + index + " is too big for range: " + this); } } }
Source:
<code><START> public void testToString() { <END> DateFormat df = new SimpleDateFormat("HH:mm:ss.SSS"); df.setTimeZone(TimeZone.getTimeZone("UTC")); int timeOffset = TimeZone.getDefault().getOffset(0); Date d0 = new Date(0 + timeOffset); Date d1 = new Date(12345000L + timeOffset); Date d2 = new Date(85166000L + timeOffset); assertEquals("toString", df.format(d0) + " 000 000", ts0.toString()); assertEquals("toString", df.format(d1) + " 000 000", ts1.toString()); assertEquals("toString", df.format(d2) + " 000 000", ts2.toString()); }</code><technical_language>simpler get TmfTimestampFormat.getDefaulTimeFormat() set time zone UTC, in setUp method</technical_language>

Target:
public void testToString() { DateFormat df = new SimpleDateFormat("HH:mm:ss.SSS"); Date d0 = new Date(0); Date d1 = new Date(12345000L); Date d2 = new Date(85166000L); assertEquals("toString", df.format(d0) + " 000 000", ts0.toString()); assertEquals("toString", df.format(d1) + " 000 000", ts1.toString()); assertEquals("toString", df.format(d2) + " 000 000", ts2.toString()); }
Source:
<code>public void stop() { if (this.abortStarted == 0) { this.abortStarted = System.currentTimeMillis(); } if (this.consumer != null && this.consumer.getChannel() != null && this.consumerTags.size() > 0 && !this.cancelled.get()) { try { RabbitUtils.closeMessageConsumer(this.consumer.getChannel(), this.consumerTags.keySet(), this.transactional); } catch (Exception e) { if (logger.isDebugEnabled()) { logger.debug("Error closing consumer " + this, e); } } } if (logger.isDebugEnabled()) { logger.debug("Closing Rabbit Channel: " + this.channel); } RabbitUtils.setPhysicalCloseRequired(true); ConnectionFactoryUtils.releaseResources(this.resourceHolder); if (!(this.channel instanceof ChannelProxy)) { <START> RabbitUtils.isPhysicalCloseRequired(); <END> } this.deliveryTags.clear(); this.consumer = null; this.queue.clear(); }</code><technical_language>consider set TL flag if channel Proxy. a couple lines - RabbitUtils.setPhysicalCloseRequired(true)</technical_language>

Target:
public void stop() { if (this.abortStarted == 0) { this.abortStarted = System.currentTimeMillis(); } if (this.consumer != null && this.consumer.getChannel() != null && this.consumerTags.size() > 0 && !this.cancelled.get()) { try { RabbitUtils.closeMessageConsumer(this.consumer.getChannel(), this.consumerTags.keySet(), this.transactional); } catch (Exception e) { if (logger.isDebugEnabled()) { logger.debug("Error closing consumer " + this, e); } } } if (logger.isDebugEnabled()) { logger.debug("Closing Rabbit Channel: " + this.channel); } RabbitUtils.setPhysicalCloseRequired(this.channel, true); ConnectionFactoryUtils.releaseResources(this.resourceHolder); this.deliveryTags.clear(); this.consumer = null; this.queue.clear(); }
Source:
<code>public List<Index> call(SQLDatabase db) throws Exception { String sqlIndexNames = String.format("SELECT DISTINCT index_name FROM %s", QueryImpl .INDEX_METADATA_TABLE_NAME); Cursor cursorIndexNames = null; ArrayList<Index> indexes = new ArrayList<Index>(); try { cursorIndexNames = db.rawQuery(sqlIndexNames, new String[]{}); while (cursorIndexNames.moveToNext()) { String indexName = cursorIndexNames.getString(0); <START> String sqlIndexes = String.format("SELECT index_type, field_name, index_settings " + <END> "FROM %s " + "WHERE index_name = ?", QueryImpl.INDEX_METADATA_TABLE_NAME); Cursor cursorIndexes = null; try { cursorIndexes = db.rawQuery(sqlIndexes, new String[]{indexName}); IndexType indexType = null; String settings = null; ArrayList<FieldSort> fieldNames = new ArrayList<FieldSort>(); boolean first = true; while (cursorIndexes.moveToNext()) { if (first) { indexType = IndexType.valueOf(cursorIndexes.getString(0).toUpperCase (Locale.ENGLISH)); settings = cursorIndexes.getString(2); first = false; } fieldNames.add(new FieldSort(cursorIndexes.getString(1))); } Tokenizer tokenizer = TokenizerHelper.jsonToTokenizer(settings); if (tokenizer != null) { indexes.add(new Index(fieldNames, indexName, indexType, tokenizer)); } else { indexes.add(new Index(fieldNames, indexName, indexType)); } } finally { DatabaseUtils.closeCursorQuietly(cursorIndexes); } } } finally { DatabaseUtils.closeCursorQuietly(cursorIndexNames); } return indexes; }</code><technical_language>String awkwardly concatenated reformatting</technical_language>

Target:
public List<Index> call(SQLDatabase db) throws Exception { String sqlIndexNames = String.format("SELECT DISTINCT index_name FROM %s", QueryImpl .INDEX_METADATA_TABLE_NAME); Cursor cursorIndexNames = null; ArrayList<Index> indexes = new ArrayList<Index>(); try { cursorIndexNames = db.rawQuery(sqlIndexNames, new String[]{}); while (cursorIndexNames.moveToNext()) { String indexName = cursorIndexNames.getString(0); String sqlIndexes = String.format("SELECT index_type, field_name, index_settings " + "FROM %s WHERE index_name = ?", QueryImpl.INDEX_METADATA_TABLE_NAME); Cursor cursorIndexes = null; try { cursorIndexes = db.rawQuery(sqlIndexes, new String[]{indexName}); IndexType indexType = null; String settings = null; ArrayList<FieldSort> fieldNames = new ArrayList<FieldSort>(); boolean first = true; while (cursorIndexes.moveToNext()) { if (first) { indexType = IndexType.valueOf(cursorIndexes.getString(0).toUpperCase (Locale.ENGLISH)); settings = cursorIndexes.getString(2); first = false; } fieldNames.add(new FieldSort(cursorIndexes.getString(1))); } Tokenizer tokenizer = TokenizerHelper.jsonToTokenizer(settings); if (tokenizer != null) { indexes.add(new Index(fieldNames, indexName, indexType, tokenizer)); } else { indexes.add(new Index(fieldNames, indexName, indexType)); } } finally { DatabaseUtils.closeCursorQuietly(cursorIndexes); } } } finally { DatabaseUtils.closeCursorQuietly(cursorIndexNames); } return indexes; }
Source:
<code>public boolean postData(JSONArray data, String sessionID) throws IOException, JSONException { if(sessionID == null || sessionID.isEmpty() || data == null || data.length() == 0) throw new IOException("invalid input of data or sessionID"); JSONObject postData = new JSONObject(); postData.put("sensors",data); String url = makeUrlFor(URLE_UPLOAD_MULTIPLE_SENSORS,null); Map<String, String> response = request(url, postData, sessionID,"POST"); int code = checkResponseCode(response.get(RESPONSE_CODE), "postData"); if(code != -2) <START> throw new IOException("Incorrect response of postData from CommonSense: " + response.get(RESPONSE_CODE)); <END> return (code == -2); }</code><technical_language>@excaliburnan a more exception</technical_language>

Target:
public boolean postData(JSONArray data, String sessionID) throws RuntimeException, IOException { if(sessionID == null || sessionID.isEmpty() || data == null || data.length() == 0) throw new IllegalArgumentException("invalid input of data or sessionID"); JSONObject postData = new JSONObject(); try { postData.put("sensors", data); }catch(JSONException js){ throw new RuntimeException("postData failed to create the content for the request"); } String url = makeUrlFor(URLE_UPLOAD_MULTIPLE_SENSORS,null); Map<String, String> response = request(url, postData, sessionID,"POST"); int code = checkResponseCode(response.get(RESPONSE_CODE), "postData"); return (code == 1); }
Source:
<code>private void updateBrokers() { <START> if (StringUtils.isEmpty(kafkaSettings.getBootstrapServers()) && kafkaProperties != null) { <END> final List<Broker> brokers = fetchBrokers(); if (!brokers.isEmpty()) { kafkaProperties.setProperty(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, buildBootstrapServers(brokers)); } } }</code><technical_language>means run a thread 30 seconds condition fulfilled ever. change a scheduled action if need it</technical_language>

Target:
private void updateBrokers() { final List<Broker> brokers = fetchBrokers(); if (!brokers.isEmpty()) { kafkaProperties.setProperty(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG, buildBootstrapServers(brokers)); } }
Source:
<code>public void testKJarNotAvailable() { boolean caughtException = false; ScoreKJarReleaseIdConfig config = new ScoreKJarReleaseIdConfig(); config.setGroupId(groupId); config.setArtifactId(artifactId); config.setVersion("1.0.1"); try { DroolsScoreDirectorFactory scoreDirectorFactory = config.build(); } catch (RuntimeException re) { caughtException = true; } <START> assertEquals("Expected exception when trying to load a KJAR which doesn't exist.", true, caughtException); <END> }</code><technical_language>@Test annotation attribute accepting expected Exception type, this exception handling for you</technical_language>

Target:
public void testKJarNotAvailable() { ScoreKJarReleaseIdConfig config = new ScoreKJarReleaseIdConfig(); config.setGroupId(groupId); config.setArtifactId(artifactId); config.setVersion("1.0.1"); DroolsScoreDirectorFactory scoreDirectorFactory = config.build(); }
Source:
<code>private static <T> String getMismatchDescriptionString(T actual, Matcher<T> matcher) { Description mismatchDescription = new StringDescription(); matcher.describeMismatch(actual, mismatchDescription); String mismatchDescriptionString = mismatchDescription.toString(); <START> mismatchDescriptionString = mismatchDescriptionString == null ? "" : mismatchDescriptionString.trim(); <END> return mismatchDescriptionString.isEmpty() ? actual.toString() : mismatchDescriptionString; }</code><technical_language>mismatchDescriptionString null StringDescription a StringBuilder</technical_language>

Target:
private static <T> String getMismatchDescriptionString(T actual, Matcher<T> matcher) { Description mismatchDescription = new StringDescription(); matcher.describeMismatch(actual, mismatchDescription); String mismatchDescriptionString = mismatchDescription.toString().trim(); return mismatchDescriptionString.isEmpty() ? actual.toString() : mismatchDescriptionString; }
Source:
<code>public void run() throws OperationException { Map<String, Object> vars = isolate ? new HashMap<String, Object>(ctx.getVars()) : ctx.getVars(); Collection<?> list = null; if (ctx.get(listName) instanceof Object[]) { list = Arrays.asList((Object[]) ctx.get(listName)); } else if (ctx.get(listName) instanceof Collection<?>) { list = (Collection<?>) ctx.get(listName); } else { throw new UnsupportedOperationException(ctx.get(listName).getClass() + " is not a Collection"); } TransactionHelper.commitOrRollbackTransaction(); for (Object value : list) { <START> TransactionHelper.startTransaction(); <END> boolean completedAbruptly = true; try { OperationContext subctx = ctx.getSubContext(isolate, ctx.getInput()); subctx.push(itemName, value); try { service.run(subctx, chainId); } finally { subctx.pop(itemName); } completedAbruptly = false; } finally { if (completedAbruptly) { TransactionHelper.setTransactionRollbackOnly(); } TransactionHelper.commitOrRollbackTransaction(); } } TransactionHelper.startTransaction(); if (!isolate) { for (String varName : vars.keySet()) { if (!ctx.getVars().containsKey(varName)) { ctx.put(varName, vars.get(varName)); } else { Object value = vars.get(varName); if (session != null && value != null && value instanceof DocumentModel) { ctx.getVars().put(varName, session.getDocument(((DocumentModel) value).getRef())); } else { ctx.getVars().put(varName, value); } } } } }</code><technical_language>This updated TransactionHelper.runInNewTransaction I suppose, for RunInNewTransaction.java</technical_language>

Target:
public void run() throws OperationException { Map<String, Object> vars = isolate ? new HashMap<String, Object>(ctx.getVars()) : ctx.getVars(); Collection<?> list = null; if (ctx.get(listName) instanceof Object[]) { list = Arrays.asList((Object[]) ctx.get(listName)); } else if (ctx.get(listName) instanceof Collection<?>) { list = (Collection<?>) ctx.get(listName); } else { throw new UnsupportedOperationException(ctx.get(listName).getClass() + " is not a Collection"); } TransactionHelper.commitOrRollbackTransaction(); for (Object value : list) { try { TransactionHelper.runInNewTransaction(() -> { try (OperationContext subctx = ctx.getSubContext(isolate, ctx.getInput())) { subctx.push(itemName, value); try { service.run(subctx, chainId); } finally { subctx.pop(itemName); } } catch (OperationException e) { throw new NuxeoException(e); } }); } catch (NuxeoException e) { if (e.getCause() instanceof OperationException) { throw (OperationException) e.getCause(); } throw e; } } TransactionHelper.startTransaction(); if (!isolate) { for (String varName : vars.keySet()) { if (!ctx.getVars().containsKey(varName)) { ctx.put(varName, vars.get(varName)); } else { Object value = vars.get(varName); if (session != null && value != null && value instanceof DocumentModel) { ctx.getVars().put(varName, session.getDocument(((DocumentModel) value).getRef())); } else { ctx.getVars().put(varName, value); } } } } }
Source:
<code>private boolean updateJMXPort(DebuggingContext debugContext, Set<IPort> ports) { IPort existing = ports.stream().filter(p->p.getName().equals("remotingjmx")).findFirst().orElse(null); <START> PortSpecAdapter newPort = new PortSpecAdapter("remotingjmx", "TCP", 9999); <END> if (existing == null) { ports.add(newPort); return true; } else { if (existing.equals(newPort)) { return false; } ports.remove(existing); ports.add(newPort); return true; } }</code><technical_language>pelase define reuse a constant for this port? (see above)</technical_language>

Target:
private boolean updateJMXPort(DebuggingContext debugContext, Set<IPort> ports) { IPort existing = ports.stream().filter(p->p.getName().equals("remotingjmx")).findFirst().orElse(null); PortSpecAdapter newPort = new PortSpecAdapter("remotingjmx", "TCP", NATIVE_MANAGMENT_PORT); if (existing == null) { ports.add(newPort); return true; } else { if (existing.equals(newPort)) { return false; } ports.remove(existing); ports.add(newPort); return true; } }
Source:
<code>public void onVertexStateUpdated(VertexStateUpdate stateUpdate) { <START> Preconditions.checkArgument(VertexState.CONFIGURED.equals(stateUpdate.getVertexState()), <END> "Received incorrect state notification : " + stateUpdate.getVertexState() + " for vertex: " + stateUpdate.getVertexName() + " in vertex: " + this.vertexName); Preconditions.checkArgument(srcVerticesConfigured.containsKey(stateUpdate.getVertexName()), "Received incorrect vertex notification : " + stateUpdate.getVertexState() + " for vertex: " + stateUpdate.getVertexName() + " in vertex: " + this.vertexName); LOG.info("Received configured notification: " + stateUpdate.getVertexState() + " for vertex: " + stateUpdate.getVertexName() + " in vertex: " + this.vertexName); srcVerticesConfigured.put(stateUpdate.getVertexName(), true); boolean checkAllSrcVerticesConfigured = true; for (Map.Entry<String, Boolean> entry : srcVerticesConfigured.entrySet()) { if (!entry.getValue()) { LOG.info("Waiting for vertex in vertex ", entry.getKey(), this.vertexName); checkAllSrcVerticesConfigured = false; break; } } allSrcVerticesConfigured = checkAllSrcVerticesConfigured; scheduleTasks(); }</code><technical_language>Precondition performance a consideration message is string is composed of boolean condition. replace 3 argument Precondition evaluate condition throw IllegalArgumentExcteption manually, constructing message in condition block. for other precondition checks. <LINK_0>,%20java.lang.String,%20java.lang.Object...)</technical_language>

Target:
public synchronized void onVertexStateUpdated(VertexStateUpdate stateUpdate) { VertexState state = stateUpdate.getVertexState(); String fromVertex = stateUpdate.getVertexName(); if (!srcVerticesConfigured.containsKey(fromVertex)) { throw new IllegalArgumentException("Not expecting state update from vertex:" + fromVertex + " in vertex: " + this.vertexName); } if (!VertexState.CONFIGURED.equals(state)) { throw new IllegalArgumentException("Received incorrect state notification : " + state + " from vertex: " + fromVertex + " in vertex: " + this.vertexName); } LOG.info("Received configured notification: " + state + " for vertex: " + fromVertex + " in vertex: " + this.vertexName); srcVerticesConfigured.put(fromVertex, true); boolean checkAllSrcVerticesConfigured = true; for (Map.Entry<String, Boolean> entry : srcVerticesConfigured.entrySet()) { if (!entry.getValue()) { LOG.info("Waiting for vertex in vertex ", entry.getKey(), this.vertexName); checkAllSrcVerticesConfigured = false; break; } } allSrcVerticesConfigured = checkAllSrcVerticesConfigured; scheduleTasks(); }
Source:
<code>private Page getSelectedRows() { checkState(selectedRowPageBuilder.isPresent()); int rowNumberChannel = types.size() - 1; <START> PageBuilder pageBuilder = selectedRowPageBuilder.get(); <END> for (int currentPosition = 0; currentPosition < inputPage.getPositionCount(); currentPosition++) { long partitionId = getPartitionId(currentPosition); long rowCount = partitionRowCount.get(partitionId); if (rowCount == maxRowsPerPartition.get()) { continue; } pageBuilder.declarePosition(); for (int i = 0; i < outputChannels.length; i++) { int channel = outputChannels[i]; Type type = types.get(i); type.appendTo(inputPage.getBlock(channel), currentPosition, pageBuilder.getBlockBuilder(i)); } BIGINT.writeLong(pageBuilder.getBlockBuilder(rowNumberChannel), rowCount + 1); partitionRowCount.set(partitionId, rowCount + 1); } if (pageBuilder.isEmpty()) { return null; } Page page = pageBuilder.build(); pageBuilder.reset(); return page; }</code><technical_language>assert is empty</technical_language>

Target:
private Page getSelectedRows() { verify(selectedRowPageBuilder.isPresent()); int rowNumberChannel = types.size() - 1; PageBuilder pageBuilder = selectedRowPageBuilder.get(); verify(pageBuilder.isEmpty()); for (int currentPosition = 0; currentPosition < inputPage.getPositionCount(); currentPosition++) { long partitionId = getPartitionId(currentPosition); long rowCount = partitionRowCount.get(partitionId); if (rowCount == maxRowsPerPartition.get()) { continue; } pageBuilder.declarePosition(); for (int i = 0; i < outputChannels.length; i++) { int channel = outputChannels[i]; Type type = types.get(i); type.appendTo(inputPage.getBlock(channel), currentPosition, pageBuilder.getBlockBuilder(i)); } BIGINT.writeLong(pageBuilder.getBlockBuilder(rowNumberChannel), rowCount + 1); partitionRowCount.set(partitionId, rowCount + 1); } if (pageBuilder.isEmpty()) { return null; } Page page = pageBuilder.build(); pageBuilder.reset(); return page; }
Source:
<code>private DarkClusterStrategy createStrategy(String darkClusterName, DarkClusterConfig darkClusterConfig) { if (darkClusterConfig.hasMultiplierStrategyList()) { MultiplierStrategyTypeArray strategyList = darkClusterConfig.getMultiplierStrategyList(); for (com.linkedin.d2.multiplierStrategyType multiplierStrategyType : strategyList) { if (RELATIVE_TRAFFIC.equals(multiplierStrategyType) && darkClusterConfig.getMultiplier() > 0) { <START> if (darkClusterConfig.getMultiplier() <= 0) <END> { return new NoOpDarkClusterStrategy(); } BaseDarkClusterDispatcher baseDarkClusterDispatcher = new BaseDarkClusterDispatcherImpl(darkClusterName, _darkClusterDispatcher, _notifier, _verifierManager); return new RelativeTrafficMultiplierDarkClusterStrategy(_sourceClusterName, darkClusterName, darkClusterConfig.getMultiplier(), baseDarkClusterDispatcher, _notifier, _facilities.getClusterInfoProvider(), _random); } else if (CONSTANT_QPS.equals(multiplierStrategyType)) { } else { return new NoOpDarkClusterStrategy(); } } } return new NoOpDarkClusterStrategy(); }</code><technical_language>this reached of previous "darkClusterConfig.getMultiplier() > 0"</technical_language>

Target:
private DarkClusterStrategy createStrategy(String darkClusterName, DarkClusterConfig darkClusterConfig) { if (darkClusterConfig.hasDarkClusterStrategyPrioritizedList()) { DarkClusterStrategyNameArray strategyList = darkClusterConfig.getDarkClusterStrategyPrioritizedList(); for (com.linkedin.d2.DarkClusterStrategyName darkClusterStrategyName : strategyList) { switch(darkClusterStrategyName) { case RELATIVE_TRAFFIC: if (RelativeTrafficMultiplierDarkClusterStrategy.isValidConfig(darkClusterConfig)) { BaseDarkClusterDispatcher baseDarkClusterDispatcher = new BaseDarkClusterDispatcherImpl(darkClusterName, _darkClusterDispatcher, _notifier, _verifierManager); return new RelativeTrafficMultiplierDarkClusterStrategy(_sourceClusterName, darkClusterName, darkClusterConfig.getMultiplier(), baseDarkClusterDispatcher, _notifier, _facilities.getClusterInfoProvider(), _random); } break; case CONSTANT_QPS: break; default: break; } } } return new NoOpDarkClusterStrategy(); }
Source:
<code>public List<InputAnchor> getAllInputs() { <START> return Arrays.asList(r,g,b); <END> }</code><technical_language>ImmutableList.of(r,g,b)</technical_language>

Target:
public List<InputAnchor> getAllInputs() { return ImmutableList.of(r,g,b); }
Source:
<code>public void schedule(I id) { Duration timeout = this.expiration.getTimeout(); if (expirationTracker != null) { expirationTracker.trackExpiration(id); if (expireTask == null) { InfinispanEjbLogger.ROOT_LOGGER.tracef("Scheduling stateful session bean %s to expire in %s", id, timeout); Runnable task = new ExpirationTask(); synchronized (this) { <START> expireTask = this.expiration.getExecutor().schedule(task, timeout.toMillis(), TimeUnit.MILLISECONDS); <END> } } } }</code><technical_language>I want additional null check - multiple concurrent threads reach this synchronized block resulting in multiple expire task creation. e.g. java synchronized (this) { if (expireTask == null) { expireTask = ...; } }</technical_language>

Target:
public void schedule(I id) { BeanEntry<I> entry = this.factory.findValue(id); if (entry != null) { this.schedule(id, entry); } }
Source:
<code>private ItemStack getCooked(final ItemStack is) { ItemStack cooked = new ItemStack(Material.AIR); final Material material = is.getType(); switch (material) { case BEEF: cooked = new ItemStack(Material.COOKED_BEEF); break; case COD: cooked = new ItemStack(Material.COOKED_COD); break; case CHICKEN: cooked = new ItemStack(Material.COOKED_CHICKEN); break; case PORKCHOP: cooked = new ItemStack(Material.COOKED_PORKCHOP); break; case POTATO: cooked = new ItemStack(Material.BAKED_POTATO); break; case MUTTON: cooked = new ItemStack(Material.COOKED_MUTTON); break; case RABBIT: cooked = new ItemStack(Material.COOKED_RABBIT); break; case SALMON: cooked = new ItemStack(Material.COOKED_SALMON); break; case KELP: cooked = new ItemStack(Material.DRIED_KELP); break; case CHORUS_FRUIT: cooked = new ItemStack(Material.POPPED_CHORUS_FRUIT); break; <START> case WHEAT: cooked = new ItemStack(Material.BREAD); break; <END> case WET_SPONGE: cooked = new ItemStack(Material.SPONGE); break; case STICK: cooked = bPlayer.canUseSubElement(SubElement.BLUE_FIRE) ? new ItemStack(Material.SOUL_TORCH) : new ItemStack(Material.TORCH); default: break; } return cooked; }</code><technical_language>do this, considering takes 3 wheat bread. wheat in list of cookables above</technical_language>

Target:
private ItemStack getCooked(final ItemStack is) { ItemStack cooked = new ItemStack(Material.AIR); final Material material = is.getType(); switch (material) { case BEEF: cooked = new ItemStack(Material.COOKED_BEEF); break; case COD: cooked = new ItemStack(Material.COOKED_COD); break; case CHICKEN: cooked = new ItemStack(Material.COOKED_CHICKEN); break; case PORKCHOP: cooked = new ItemStack(Material.COOKED_PORKCHOP); break; case POTATO: cooked = new ItemStack(Material.BAKED_POTATO); break; case MUTTON: cooked = new ItemStack(Material.COOKED_MUTTON); break; case RABBIT: cooked = new ItemStack(Material.COOKED_RABBIT); break; case SALMON: cooked = new ItemStack(Material.COOKED_SALMON); break; case KELP: cooked = new ItemStack(Material.DRIED_KELP); break; case CHORUS_FRUIT: cooked = new ItemStack(Material.POPPED_CHORUS_FRUIT); break; case WET_SPONGE: cooked = new ItemStack(Material.SPONGE); break; case STICK: cooked = bPlayer.canUseSubElement(SubElement.BLUE_FIRE) ? new ItemStack(Material.SOUL_TORCH) : new ItemStack(Material.TORCH); default: break; } return cooked; }
Source:
<code>public static Guid getGuidValue(Guid id) { <START> return id == null ? null : id; <END> }</code><technical_language>return id;</technical_language>

Target:
public static Guid getGuidValue(Guid id) { return id; }
Source:
<code>public void registered_device_with_x509cert_to_server_with_x509cert() throws NonUniqueSecurityInfoException { helper.createServerWithX509Cert(helper.trustedCertificates); helper.server.start(); helper.createX509CertClient(helper.clientPrivateKeyFromCert, helper.trustedCertificates); helper.server.getSecurityRegistry().add(SecurityInfo.newX509CertInfo(helper.getCurrentEndpoint())); helper.client.start(); helper.waitForRegistration(1); <START> assertEquals(1, helper.server.getRegService().getAllRegistrations().size()); <END> assertNotNull(helper.getCurrentRegistration()); }</code><technical_language>I if try consistent here, time "Reg" another time "Registrations"</technical_language>

Target:
public void registered_device_with_x509cert_to_server_with_x509cert() throws NonUniqueSecurityInfoException { helper.createServerWithX509Cert(helper.trustedCertificates); helper.server.start(); helper.createX509CertClient(helper.clientPrivateKeyFromCert, helper.trustedCertificates); helper.server.getSecurityRegistry().add(SecurityInfo.newX509CertInfo(helper.getCurrentEndpoint())); helper.client.start(); helper.waitForRegistration(1); assertEquals(1, helper.server.getRegistrationService().getAllRegistrations().size()); assertNotNull(helper.getCurrentRegistration()); }
Source:
<code>public void addHeaders(HttpURLConnection connection) { if (this.headers == null) { return; } boolean hasAcceptHeader = false; for (KeyValuePair pair : this.headers) { String key = pair.key.toString(); connection.addRequestProperty(key, pair.value.toString()); <START> if (key.toLowerCase().contentEquals("Accept-Encoding")) { <END> hasAcceptHeader = true; } } if (!hasAcceptHeader) { connection.addRequestProperty("Accept-Encoding", "gzip"); } }</code><technical_language>@NathanaelA if (key.toLowerCase().contentEquals("accept-encoding"))</technical_language>

Target:
public void addHeaders(HttpURLConnection connection) { if (this.headers == null) { return; } boolean hasAcceptHeader = false; for (KeyValuePair pair : this.headers) { String key = pair.key.toString(); connection.addRequestProperty(key, pair.value.toString()); if (key.toLowerCase().contentEquals("accept-encoding")) { hasAcceptHeader = true; } } if (!hasAcceptHeader) { connection.addRequestProperty("Accept-Encoding", "gzip"); } }
Source:
<code>public byte[] decrypt(byte[] cipherTextBytes, String algorithm, String internalCryptoProviderType) throws CryptoException { failIfEncryptDecryptInputsAreInvalid(cipherTextBytes,algorithm,internalCryptoProviderType); byte[] decryptedValue; try { CryptoService cryptoService = CarbonCoreDataHolder.getInstance().getCryptoService(); if (cryptoService == null) { throw new CryptoException("A crypto service implementation has not been registered."); } CipherMetaDataHolder cipherMetaDataHolder = cipherTextToCipherMetaDataHolder(cipherTextBytes); if (cipherMetaDataHolder != null) { if (log.isDebugEnabled()) { log.debug( String.format("Cipher text is in self contained format. Retrieve the actual cipher from " + "the self contained cipher text.")); } cipherTextBytes = cipherMetaDataHolder.getCipherBase64Decoded(); } if (cipherTextBytes.length == 0) { decryptedValue = StringUtils.EMPTY.getBytes(); if (log.isDebugEnabled()) { log.debug("Ciphertext is empty. An empty array will be used as the plaintext bytes."); } } else { decryptedValue = cryptoService.decrypt(cipherTextBytes, algorithm, CRYPTO_API_PROVIDER_BC, internalCryptoProviderType); } return decryptedValue; <START> } catch (Exception e) { <END> throw new CryptoException("An error occurred while decrypting data.", e); } }</code><technical_language>catch specific exception here</technical_language>

Target:
public byte[] decrypt(byte[] cipherTextBytes, String algorithm, String internalCryptoProviderType) throws CryptoException { failIfEncryptDecryptInputsAreInvalid(cipherTextBytes, algorithm, internalCryptoProviderType); byte[] decryptedValue; try { CryptoService cryptoService = CarbonCoreDataHolder.getInstance().getCryptoService(); if (cryptoService == null) { throw new CryptoException("A crypto service implementation has not been registered."); } CipherMetaDataHolder cipherMetaDataHolder = cipherTextToCipherMetaDataHolder(cipherTextBytes); if (cipherMetaDataHolder != null) { if (log.isDebugEnabled()) { log.debug( String.format("Cipher text is in self contained format. Retrieve the actual cipher from " + "the self contained cipher text.")); } cipherTextBytes = cipherMetaDataHolder.getCipherBase64Decoded(); algorithm = cipherMetaDataHolder.getTransformation(); } if (cipherTextBytes.length == 0) { decryptedValue = StringUtils.EMPTY.getBytes(); if (log.isDebugEnabled()) { log.debug("Ciphertext is empty. An empty array will be used as the plaintext bytes."); } } else { decryptedValue = cryptoService.decrypt(cipherTextBytes, algorithm, CRYPTO_API_PROVIDER_BC, internalCryptoProviderType); } return decryptedValue; } catch (org.wso2.carbon.crypto.api.CryptoException e) { throw new CryptoException("An error occurred while decrypting data.", e); } }
Source:
<code>public Number apply(List<Expr> args, Expr.ObjectBinding bindings) { if (args.size() != 2) { <START> throw new RuntimeException("function '" + name() + "' needs 2 argument"); <END> } Expr expr1 = args.get(0); Expr expr2 = args.get(1); return eval(expr1.eval(bindings), expr2.eval(bindings)); }</code><technical_language>needs 2 _arguments_, plural</technical_language>

Target:
public ExprEval apply(List<Expr> args, Expr.ObjectBinding bindings) { if (args.size() != 2) { throw new IAE("function '%s' needs 2 arguments", name()); } Expr expr1 = args.get(0); Expr expr2 = args.get(1); return eval(expr1.eval(bindings), expr2.eval(bindings)); }
Source:
<code>public static Guid GetEntityGuid(Object entity) { if (entity instanceof VM) { return ((VM) entity).getId(); } else if (entity instanceof storage_pool) { return ((storage_pool) entity).getId(); } else if (entity instanceof VDSGroup) { return ((VDSGroup) entity).getId(); } else if (entity instanceof VDS) { return ((VDS) entity).getId(); } else if (entity instanceof storage_domains) { return ((storage_domains) entity).getId(); } else if (entity instanceof VmTemplate) { return ((VmTemplate) entity).getId(); } else if (entity instanceof vm_pools) { return ((vm_pools) entity).getvm_pool_id(); } else if (entity instanceof DbUser) { return ((DbUser) entity).getuser_id(); } else if (entity instanceof Quota) { return ((Quota) entity).getId(); } else if (entity instanceof DiskImage) { return ((DiskImage) entity).getId(); } else if (entity instanceof GlusterVolumeEntity) { return ((GlusterVolumeEntity) entity).getId(); } <START> else if (entity instanceof NetworkView) <END> { return ((NetworkView) entity).getNetwork().getId(); } return new Guid(); }</code><technical_language>Please remove Network, add another "else if" for NetworkView. This procedure useful get id of a Network entity in a generic way</technical_language>

Target:
public static Guid GetEntityGuid(Object entity) { if (entity instanceof VM) { return ((VM) entity).getId(); } else if (entity instanceof storage_pool) { return ((storage_pool) entity).getId(); } else if (entity instanceof VDSGroup) { return ((VDSGroup) entity).getId(); } else if (entity instanceof VDS) { return ((VDS) entity).getId(); } else if (entity instanceof storage_domains) { return ((storage_domains) entity).getId(); } else if (entity instanceof VmTemplate) { return ((VmTemplate) entity).getId(); } else if (entity instanceof vm_pools) { return ((vm_pools) entity).getvm_pool_id(); } else if (entity instanceof DbUser) { return ((DbUser) entity).getuser_id(); } else if (entity instanceof Quota) { return ((Quota) entity).getId(); } else if (entity instanceof DiskImage) { return ((DiskImage) entity).getId(); } else if (entity instanceof GlusterVolumeEntity) { return ((GlusterVolumeEntity) entity).getId(); } else if (entity instanceof Network) { return ((Network) entity).getId(); } else if (entity instanceof NetworkView) { return ((NetworkView) entity).getNetwork().getId(); } return new Guid(); }
Source:
<code>protected void doExecute() { DslCommonPlugin.PROFILER.startWork(SiriusTasksKey.CLEANING_REMOVEDANGLING_KEY); for (EObject eObject : toRemoveXRefFrom) { modelAccessor.eDelete(eObject, xReferencer, isReferenceToIgnorePredicate); TreeIterator<EObject> eAllContents = eObject.eAllContents(); <START> while (eAllContents.hasNext()) { <END> EObject child = eAllContents.next(); modelAccessor.eRemoveCrossReferences(child, xReferencer, isReferenceToIgnorePredicate); } } DslCommonPlugin.PROFILER.stopWork(SiriusTasksKey.CLEANING_REMOVEDANGLING_KEY); toRemoveXRefFrom.clear(); modelAccessor = null; xReferencer = null; }</code><technical_language>I continue previous detect detached objects. if want decrease number of Remove notifcation (after checkings effects manuel refresh, red cross decorators, ...) call eDelete eRemoveCrossReferences of eContainer() execution time</technical_language>

Target:
protected void doExecute() { DslCommonPlugin.PROFILER.startWork(SiriusTasksKey.CLEANING_REMOVEDANGLING_KEY); for (EObject eObject : toRemoveXRefFrom) { modelAccessor.eDelete(eObject, xReferencer, isReferenceToIgnorePredicate); } DslCommonPlugin.PROFILER.stopWork(SiriusTasksKey.CLEANING_REMOVEDANGLING_KEY); toRemoveXRefFrom.clear(); modelAccessor = null; xReferencer = null; }
Source:
<code><START> public URLClassLoader getClassLoader(ObjectId rulesId) { <END> String filePath = ""; File cacheFolder = site.resolve( config.getString("cache", null, "directory")); if (cacheFolder != null) { filePath = cacheFolder.getPath(); } File jarFile = null; if (rulesId != null) { jarFile = new File(filePath + "/rules/rules-" + rulesId.getName() + ".jar"); } ClassLoader defaultLoader = getClass().getClassLoader(); if(cacheFolder != null && jarFile != null && jarFile.exists()) { URL url; try { url = jarFile.toURI().toURL(); } catch (MalformedURLException e) { return null; } URL[] urls = new URL[]{url}; return new URLClassLoader(urls, defaultLoader); } else { return null; } }</code><technical_language>Declare return type ClassLoader. Try stay generic possible</technical_language>

Target:
public ClassLoader getClassLoader(ObjectId rulesId) { Reference<? extends ClassLoader> ref = referMap.get(rulesId); if (ref != null) { ClassLoader cl = ref.get(); if (cl != null) { return cl; } synchronized(lock) { referMap.remove(rulesId); } ref.enqueue(); } cleanMap(); if (rulesId == null || rulesDir == null) { return null; } File jarFile = new File(rulesDir, "rules-" + rulesId.getName() + ".jar"); if (!jarFile.isFile()) { return null; } ClassLoader defaultLoader = getClass().getClassLoader(); URL url; try { url = jarFile.toURI().toURL(); } catch (MalformedURLException e) { return null; } URL[] urls = new URL[]{url}; ClassLoader urlLoader = new URLClassLoader(urls, defaultLoader); LoaderRef lRef = new LoaderRef(rulesId, urlLoader); synchronized(lock) { referMap.put(rulesId, lRef); } return urlLoader; }
Source:
<code><START> public ThingStatusInfoBuilder withStatusDetail(ThingStatusDetail statusDetail) throws IllegalArgumentException { <END> this.statusDetail = statusDetail; return this; }</code><technical_language>related changes, do happen is a throws IllegalArgumentException</technical_language>

Target:
public ThingStatusInfoBuilder withStatusDetail(ThingStatusDetail statusDetail) { this.statusDetail = statusDetail; return this; }
Source:
<code>public Response act(final Request req) throws IOException { final Inbox inbox = new RqAlias(this.base, req).alias().inbox(); final long number = inbox.start(); final Bout bout = inbox.bout(number); final StringBuilder msg = new StringBuilder( String.format("new bout #%d started", number) ); final Href href = new RqHref.Base(req).href(); final Iterator<String> invite = href.param("invite").iterator(); while (invite.hasNext()) { final String friend = invite.next(); try { bout.friends().invite(friend); } catch (final Friends.UnknownAliasException ex) { <START> throw new RsFailure(ex); <END> } msg.append(String.format(", \"%s\" invited", friend)); } final Iterator<String> post = href.param("post").iterator(); if (post.hasNext()) { try { bout.messages().post(post.next()); } catch (final Messages.BrokenPostException ex) { throw new RsFailure(ex); } msg.append(", message posted"); } throw new RsForward( new RsFlash(msg.toString()), new RqHref.Smart(new RqHref.Base(req)).home().path("b").path( Long.toString(number) ) ); }</code><technical_language>@komaz this point bout created, right? do it</technical_language>

Target:
public Response act(final Request req) throws IOException { final Inbox inbox = new RqAlias(this.base, req).alias().inbox(); final long number = inbox.start(); final Bout bout = inbox.bout(number); final StringBuilder msg = new StringBuilder( String.format("new bout #%d started", number) ); final Href href = new RqHref.Base(req).href(); final Iterator<String> invite = href.param("invite").iterator(); while (invite.hasNext()) { final String friend = invite.next(); try { bout.friends().invite(friend); } catch (final Friends.UnknownAliasException ex) { this.discard(bout); throw new RsFailure(ex); } msg.append(String.format(", \"%s\" invited", friend)); } final Iterator<String> post = href.param("post").iterator(); if (post.hasNext()) { try { bout.messages().post(post.next()); } catch (final Messages.BrokenPostException ex) { this.discard(bout); throw new RsFailure(ex); } msg.append(", message posted"); } throw new RsForward( new RsFlash(msg.toString()), new RqHref.Smart(new RqHref.Base(req)).home().path("b").path( Long.toString(number) ) ); }
Source:
<code>public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { switch (viewType) { case VIEW_TYPE_HEADER: return new HeaderViewHolder(LayoutInflater.from(parent.getContext()) <START> .inflate(R.layout.new_site_creation_domain_header, parent, <END> false)); case VIEW_TYPE_INPUT: return new InputViewHolder(LayoutInflater.from(parent.getContext()) .inflate(R.layout.new_site_creation_domain_input, parent, false)); case VIEW_TYPE_ITEM: return new DomainViewHolder(LayoutInflater.from(parent.getContext()) .inflate(R.layout.new_site_creation_domain_item, parent, false)); default: throw new RuntimeException("Unknown view type " + viewType); } }</code><technical_language>I this file unchanged, right</technical_language>

Target:
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { switch (viewType) { case VIEW_TYPE_HEADER: return new HeaderViewHolder(LayoutInflater.from(parent.getContext()) .inflate(R.layout.site_creation_domain_header, parent, false)); case VIEW_TYPE_INPUT: return new InputViewHolder(LayoutInflater.from(parent.getContext()) .inflate(R.layout.site_creation_domain_input, parent, false)); case VIEW_TYPE_ITEM: return new DomainViewHolder(LayoutInflater.from(parent.getContext()) .inflate(R.layout.site_creation_domain_item, parent, false)); default: throw new RuntimeException("Unknown view type " + viewType); } }
Source:
<code>public void unlockDiskStore(String diskStoreName) { <START> if (diskStoreLatches.get(diskStoreName) != null) { diskStoreLatches.get(diskStoreName).countDown(); } <END> }</code><technical_language>I is a small possibility of a race condition causing NPE if latch diskStoreName is removed get() call. change this method get() call</technical_language>

Target:
public void unlockDiskStore(String diskStoreName) { doUnlockDiskStore(diskStoreName); }
Source:
<code>private void updateReceivedHUs( final IHUContext huContext, final Collection<I_M_HU> hus) { ppOrderProductAttributeBL.updateHUAttributes(hus, getPpOrderId()); if (lotNumber != null || bestBeforeDate != null) { final IAttributeStorageFactory huAttributeStorageFactory = huContext.getHUAttributeStorageFactory(); for (final I_M_HU hu : hus) { final IAttributeStorage huAttributes = huAttributeStorageFactory.getAttributeStorage(hu); setLotNumberAttribute(hu, huAttributes); <START> setBestBeforeDateAttribute(huAttributes); <END> huAttributes.saveChangesIfNeeded(); } } setAssignedHUs(hus); }</code><technical_language>introduce a new method, e.g. updateAttributes(hu...) calls methods</technical_language>

Target:
private void updateReceivedHUs( final IHUContext huContext, final Collection<I_M_HU> hus) { ppOrderProductAttributeBL.updateHUAttributes(hus, getPpOrderId()); if (lotNumber != null || bestBeforeDate != null) { final IAttributeStorageFactory huAttributeStorageFactory = huContext.getHUAttributeStorageFactory(); for (final I_M_HU hu : hus) { final IAttributeStorage huAttributes = huAttributeStorageFactory.getAttributeStorage(hu); setAttributes(hu, huAttributes); } } setAssignedHUs(hus); }
Source:
<code><START> private Map<QName, String> collectUnknownAttributesFrom(StartElement element) { <END> Map<QName, String> otherAttributes = new HashMap<>(); Iterator<?> attributes = element.getAttributes(); while (attributes.hasNext()) { Attribute currentAttribute = (Attribute) attributes.next(); QName attributeQName = currentAttribute.getName(); if (attributeQName == null || DEFAULT_KNOWN_LOCAL_ATTRIBUTE_NAMES.contains(attributeQName.getLocalPart())) { continue; } String attributeValue = currentAttribute.getValue(); otherAttributes.put(attributeQName, attributeValue); if (LOGGER.isTraceEnabled()) { LOGGER.trace("Adding attribute " + attributeQName + " with value " + attributeValue); } } return otherAttributes; }</code><technical_language>suggestion private static Map<QName, String> collectUnknownAttributesFrom(StartElement element) {</technical_language>

Target:
private static Map<QName, String> collectUnknownAttributesFrom(StartElement element) { Map<QName, String> otherAttributes = new HashMap<>(); Iterator<?> attributes = element.getAttributes(); while (attributes.hasNext()) { Attribute currentAttribute = (Attribute) attributes.next(); QName attributeQName = currentAttribute.getName(); if (attributeQName == null || DEFAULT_KNOWN_ATTRIBUTE_NAMES.contains(attributeQName)) { continue; } String attributeValue = currentAttribute.getValue(); otherAttributes.put(attributeQName, attributeValue); if (LOGGER.isTraceEnabled()) { LOGGER.trace(String.format("Adding attribute %s with value %s", attributeQName, attributeValue)); } } return otherAttributes; }
Source:
<code><START> public Pair<String, String[]> next(ITmfEvent event, Map<String, TmfXmlTest> tests, TmfXmlScenarioInfo scenarioInfo) { <END> boolean matched = false; TmfXmlStateTransition stateTransition = null; TmfXmlState state = NonNullUtils.checkNotNull(fStatesMap.get(scenarioInfo.getActiveState())); for (int i = 0; i < state.getTransitionList().size() && !matched; i++) { stateTransition = state.getTransitionList().get(i); matched = stateTransition.validate(event, scenarioInfo, tests); } return getNextStep(stateTransition, matched, scenarioInfo.getActiveState()); }</code><technical_language>This return @Nullable if is match this event, do a fast return calling this method</technical_language>

Target:
public @Nullable Pair<String, List<String>> next(ITmfEvent event, Map<String, TmfXmlTest> tests, TmfXmlScenarioInfo scenarioInfo) { boolean matched = false; TmfXmlStateTransition stateTransition = null; TmfXmlState state = NonNullUtils.checkNotNull(fStatesMap.get(scenarioInfo.getActiveState())); for (int i = 0; i < state.getTransitionList().size() && !matched; i++) { stateTransition = state.getTransitionList().get(i); matched = stateTransition.validate(event, scenarioInfo, tests); } return matched ? getNextStep(stateTransition, scenarioInfo.getActiveState()) : null; }
Source:
<code>protected Set<TokenRangeDiagnostic> generateTokenRangeDiagnostics(TokenMap tokenMap) { <START> Set<TokenRangeDiagnostic> reports = new HashSet<>(); <END> for (TokenRange range : tokenMap.getTokenRanges()) { Set<Node> allReplicas = tokenMap.getReplicas(keyspace.getName(), range); Set<Node> aliveReplicas = allReplicas.stream().filter(this::isAlive).collect(Collectors.toSet()); TokenRangeDiagnostic report = generateTokenRangeDiagnostic(range, aliveReplicas); reports.add(report); } return reports; }</code><technical_language>nit: this presized</technical_language>

Target:
protected Set<TokenRangeDiagnostic> generateTokenRangeDiagnostics(TokenMap tokenMap) { Set<TokenRange> tokenRanges = tokenMap.getTokenRanges(); Set<TokenRangeDiagnostic> reports = Sets.newHashSetWithExpectedSize(tokenRanges.size()); for (TokenRange range : tokenRanges) { Set<Node> allReplicas = tokenMap.getReplicas(keyspace.getName(), range); TokenRangeDiagnostic report = generateTokenRangeDiagnostic(range, allReplicas); reports.add(report); } return reports; }
Source:
<code>public String getCreationSQL() { final StringBuilder sbSQL = new StringBuilder(100); sbSQL.append("ALTER TABLE "); sbSQL.append(PgDiffUtils.getQuotedName(getTableName())); sbSQL.append(System.getProperty("line.separator")); sbSQL.append("\tADD CONSTRAINT "); <START> sbSQL.append(PgDiffUtils.getQuotedName(getName())); <END> sbSQL.append(' '); sbSQL.append(getDefinition()); sbSQL.append(';'); if (comment != null && !comment.isEmpty()) { sbSQL.append(System.getProperty("line.separator")); sbSQL.append(System.getProperty("line.separator")); sbSQL.append("COMMENT ON CONSTRAINT "); sbSQL.append(PgDiffUtils.getQuotedName(name)); sbSQL.append(" ON "); sbSQL.append(PgDiffUtils.getQuotedName(tableName)); sbSQL.append(" IS "); sbSQL.append(comment); sbSQL.append(';'); } return sbSQL.toString(); }</code><technical_language>remove this line</technical_language>

Target:
public String getCreationSQL() { final StringBuilder sbSQL = new StringBuilder(100); sbSQL.append("ALTER TABLE "); sbSQL.append(PgDiffUtils.getQuotedName(getTableName())); sbSQL.append(System.getProperty("line.separator")); sbSQL.append("\tADD CONSTRAINT "); sbSQL.append(PgDiffUtils.getCreateIfNotExists()); sbSQL.append(PgDiffUtils.getQuotedName(getName())); sbSQL.append(' '); sbSQL.append(getDefinition()); sbSQL.append(';'); if (comment != null && !comment.isEmpty()) { sbSQL.append(System.getProperty("line.separator")); sbSQL.append(System.getProperty("line.separator")); sbSQL.append("COMMENT ON CONSTRAINT "); sbSQL.append(PgDiffUtils.getQuotedName(name)); sbSQL.append(" ON "); sbSQL.append(PgDiffUtils.getQuotedName(tableName)); sbSQL.append(" IS "); sbSQL.append(comment); sbSQL.append(';'); } return sbSQL.toString(); }
Source:
<code>private String getLsRegisterOutput() throws Exception { if <START> (lsRegisterOutput != <END> null) { return lsRegisterOutput; } long beforeCallLsRegister = System.currentTimeMillis(); lsRegisterOutput = processExecutor.execute(LSREGISTER, DUMP); long afterCallLsRegister = System.currentTimeMillis(); System.out.println("Call to lsregister took :" + (afterCallLsRegister - beforeCallLsRegister)); return lsRegisterOutput; }</code><technical_language>this.lsRegisterOutput</technical_language>

Target:
private String getLsRegisterOutput() throws Exception { if (this.lsRegisterOutput != null) { return this.lsRegisterOutput; } this.lsRegisterOutput = processExecutor.execute(LSREGISTER, DUMP); return this.lsRegisterOutput; }
Source:
<code>public void verifySingleValue() { final PortValue portValue = new PortValue("5"); <START> assertThat(portValue.getPorts(), Matchers.hasItems(5)); <END> assertThat(portValue.matches(5), Matchers.is(true)); assertThat(portValue.matches(1), Matchers.is(false)); }</code><technical_language>read Matchers. prefix</technical_language>

Target:
public void verifySingleValue() { final PortValue portValue = new PortValue("5"); assertThat(portValue.getPorts(), hasItems(5)); assertThat(portValue.matches(5), is(true)); assertThat(portValue.matches(1), is(false)); }