auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public long putFile(File sourceFile, ContentReference targetContentReference) throws ContentIOException { try { <START> FileInputStream fis = new FileInputStream(sourceFile); <END> try { return putInputStream(fis, targetContentReference); } finally { if (fis != null) { fis.close(); } } } catch (IOException e) { logger.error(e.getMessage(), e); throw new ContentIOException("Failed to write content: " + e.getMessage(), e); } }</code><technical_language>this check isContentReferenceSupported</technical_language>

Target:
public long putFile(File sourceFile, ContentReference targetContentReference) throws ContentIOException { if (!isContentReferenceSupported(targetContentReference)) { throw new ContentIOException("ContentReference not supported"); } try { FileInputStream fis = new FileInputStream(sourceFile); try { return putInputStream(fis, targetContentReference); } finally { if (fis != null) { fis.close(); } } } catch (IOException e) { logger.error(e.getMessage(), e); throw new ContentIOException("Failed to write content: " + e.getMessage(), e); } }
Source:
<code>protected void _onResume() { Log.i(LOG_TAG, "onResume"); startCampaignsAndResourcesTimer(true); disableAutoShowAfterDelay(); queueDeviceInfoNow(false); long currentTime = getSessionTime(); if (currentTime > lastSessionTick) { sessionStart(); } else { if (config.isSendQueuedEventsOnResume()) { sendQueuedEvents(); } } generateNewSessionInterval(); <START> if (getActivityContext() != null && getActivityContext().getIntent() != null && getActivityContext().getIntent().getData() != null) { <END> Uri uri = getActivityContext().getIntent().getData(); String referrer = uri.getQueryParameter(REFERRER); if (!SwrveHelper.isNullOrEmpty(referrer)) { Map<String, String> attributes = new HashMap<String, String>(); attributes.put(SWRVE_REFERRER_ID, referrer); Log.i(LOG_TAG, "Received referrer, so sending userUpdate:" + attributes); userUpdate(attributes); } } }</code><technical_language>Get a hold of Activity temporarily a variable</technical_language>

Target:
protected void _onResume() { Log.i(LOG_TAG, "onResume"); startCampaignsAndResourcesTimer(true); disableAutoShowAfterDelay(); queueDeviceInfoNow(false); long currentTime = getSessionTime(); if (currentTime > lastSessionTick) { sessionStart(); } else { if (config.isSendQueuedEventsOnResume()) { sendQueuedEvents(); } } generateNewSessionInterval(); Activity activity = getActivityContext(); if (activity != null && activity.getIntent() != null && activity.getIntent().getData() != null) { Uri uri = activity.getIntent().getData(); String referrer = uri.getQueryParameter(REFERRER); if (!SwrveHelper.isNullOrEmpty(referrer)) { Map<String, String> attributes = new HashMap<String, String>(); attributes.put(SWRVE_REFERRER_ID, referrer); Log.i(LOG_TAG, "Received referrer, so sending userUpdate:" + attributes); userUpdate(attributes); } } }
Source:
<code>public List<Map<ActionParameter, String>> getParameterValues(String filePath, String scriptDefinitionFilePath) throws ScriptDefinitionNotMatched, UnsupportedOperationException { <START> List<Map<ActionParameter, String>> newMappedParameterToValues = null; <END> try { this.currentlyLoadedJSONFileContent = convertJSONtoObject(filePath); String scriptDefStoredInJson = currentlyLoadedJSONFileContent.getScriptDefinitionContent(); String actualScriptDefcontent = new String( Files.readAllBytes(Paths.get(scriptDefinitionFilePath))); if (scriptDefStoredInJson.equals(actualScriptDefcontent)) { List<Map<String, String>> mappedParamToValue = currentlyLoadedJSONFileContent.getParameterValues(); newMappedParameterToValues = getMappedParamToValue(mappedParamToValue); } else { throw new ScriptDefinitionNotMatched("Current script definition does not match with the " + "script definition that was used to generate the selected data file"); } } catch(JsonSyntaxException | JsonIOException | IOException e) { LOG.error(e); } return newMappedParameterToValues; }</code><technical_language>This means if is error in converting JSON for example this return a null lead null pointer exceptions. return empty list</technical_language>

Target:
public List<Map<ActionParameter, String>> getParameterValues(String filePath, String scriptDefinitionFilePath) throws ScriptDefinitionNotMatched, UnsupportedOperationException { List<Map<ActionParameter, String>> newMappedParameterToValues = Collections.emptyList(); try { Optional<ParametersConverter> currentlyLoadedJSONFileContent = convertJSONtoObject(readFileContent(filePath)); if (currentlyLoadedJSONFileContent.isPresent()) { String scriptDefStoredInJson = currentlyLoadedJSONFileContent.get().getScriptDefinitionContent(); String currentlyLoadedScriptDef = readFileContent(scriptDefinitionFilePath); if (scriptDefStoredInJson.equals(currentlyLoadedScriptDef)) { List<Map<String, String>> mappedParamToValue = currentlyLoadedJSONFileContent.get().getParameterValues("default"); newMappedParameterToValues = getMappedParamToValue(mappedParamToValue); } else { throw new ScriptDefinitionNotMatched("Current script definition does not match with the " + "script definition that was used to generate the selected data file"); } } } catch(JsonSyntaxException | JsonIOException | IOException e) { LOG.error(e); } return newMappedParameterToValues; }
Source:
<code>public static Group getNameAndDataTypeText(final NameAndDataTypeHeaderMetaData headerMetaData, final GridHeaderColumnRenderContext context, final double blockWidth, final double rowHeight) { final Group headerGroup = GWT.create(Group.class); final Text name = context.getRenderer().getTheme().getHeaderText(); name.setText(headerMetaData.getTitle()); name.setListening(false); name.setX(blockWidth / 2); name.setY(rowHeight / 2 - SPACING); final Text typeRef = context.getRenderer().getTheme().getHeaderText(); typeRef.setFontStyle(FONT_STYLE_TYPE_REF); typeRef.setFontSize(BaseExpressionGridTheme.FONT_SIZE - 2.0); <START> typeRef.setText("(" + headerMetaData.getTypeRef().toString() + ")"); <END> typeRef.setListening(false); typeRef.setX(blockWidth / 2); typeRef.setY(rowHeight / 2 + SPACING); headerGroup.add(name); headerGroup.add(typeRef); return headerGroup; }</code><technical_language>I this shortened to: java typeRef.setText("(" + headerMetaData.getTypeRef() + ")");</technical_language>

Target:
public static Group getNameAndDataTypeText(final NameAndDataTypeHeaderMetaData headerMetaData, final GridHeaderColumnRenderContext context, final double blockWidth, final double rowHeight) { final Group headerGroup = GWT.create(Group.class); final Text name = context.getRenderer().getTheme().getHeaderText(); name.setText(headerMetaData.getTitle()); name.setListening(false); name.setX(blockWidth / 2); name.setY(rowHeight / 2 - SPACING); final Text typeRef = context.getRenderer().getTheme().getHeaderText(); typeRef.setFontStyle(FONT_STYLE_TYPE_REF); typeRef.setFontSize(BaseExpressionGridTheme.FONT_SIZE - 2.0); typeRef.setText("(" + headerMetaData.getTypeRef() + ")"); typeRef.setListening(false); typeRef.setX(blockWidth / 2); typeRef.setY(rowHeight / 2 + SPACING); headerGroup.add(name); headerGroup.add(typeRef); return headerGroup; }
Source:
<code>private static Peer createLocalPeer( int port ) throws UnknownHostException { var networkParameters = new MainNetParams(); <START> <END> var context = new Context(networkParameters); var ourVersionMessage = new VersionMessage(networkParameters, 0); var localPeerAddress = new PeerAddress(InetAddress.getLocalHost(), port); AbstractBlockChain blockchain = null; var peer = new Peer(networkParameters, ourVersionMessage, localPeerAddress, blockchain); return peer; }</code><technical_language>space in this method..</technical_language>

Target:
private Peer createLocalPeer(int port) throws UnknownHostException { var networkParameters = config.baseCurrencyNetwork.getParameters(); new Context(networkParameters); var ourVersionMessage = new VersionMessage(networkParameters, 0); var localPeerAddress = new PeerAddress(InetAddress.getLocalHost(), port); return new Peer(networkParameters, ourVersionMessage, localPeerAddress, null); }
Source:
<code>public void setResponseType(final String responseType) { responseTypeException = null; try { this.responseType = ResponseType.parse(responseType); } catch (ParseException e) { <START> responseTypeException = new TechnicalException("Unrecognised responseType: " + responseType, e); <END> } }</code><technical_language>more simple: throw TechnicalException here</technical_language>

Target:
public void setResponseType(final String responseType) { try { this.responseType = ResponseType.parse(responseType); } catch (ParseException e) { throw new TechnicalException("Unrecognised responseType: " + responseType, e); } }
Source:
<code>public void executeSetFridgeTemperature(int rangeValue, Config params) { boolean executed = executeCommand("set fridge temperature", params); if (executed) { <START> fridgeTemperature.setValue(rangeValue); <END> setChanged(true); } }</code><technical_language>good move in a "setFridgeTemperature(int value)" method called this if. for freezer temperature</technical_language>

Target:
public void executeSetFridgeTemperature(int rangeValue, Config params) { boolean executed = executeCommand("set fridge temperature", params); if (executed) { setFridgeTemperature(rangeValue); } }
Source:
<code>protected void setupBookieClientAddEntry() { doAnswer((Answer) (InvocationOnMock invokation) -> { Object[] args = invokation.getArguments(); BookkeeperInternalCallbacks.WriteCallback callback = (BookkeeperInternalCallbacks.WriteCallback) args[5]; BookieSocketAddress bookieSocketAddress = (BookieSocketAddress) args[0]; <START> long _ledgerId = (Long) args[1]; <END> long _entryId = (Long) args[3]; Object ctx = args[6]; submit(() -> { boolean fenced = fencedLedgers.contains(_ledgerId); LOG.error("addEntry {}@{} fenced {}", _ledgerId, _entryId, fenced); if (fenced) { callback.writeComplete(BKException.Code.LedgerFencedException, _ledgerId, _entryId, bookieSocketAddress, ctx); } else { callback.writeComplete(BKException.Code.OK, _ledgerId, _entryId, bookieSocketAddress, ctx); } }); return null; }).when(bookieClient).addEntry(any(BookieSocketAddress.class), anyLong(), any(byte[].class), anyLong(), any(ByteBuf.class), any(BookkeeperInternalCallbacks.WriteCallback.class), any(), anyInt()); }</code><technical_language>I "_xyz" for variables. I stick "ledgerId" consistent. I this pattern in multiple places in this class</technical_language>

Target:
protected void setupBookieClientAddEntry() { doAnswer((Answer) (InvocationOnMock invokation) -> { Object[] args = invokation.getArguments(); BookkeeperInternalCallbacks.WriteCallback callback = (BookkeeperInternalCallbacks.WriteCallback) args[5]; BookieSocketAddress bookieSocketAddress = (BookieSocketAddress) args[0]; long ledgerId = (Long) args[1]; long entryId = (Long) args[3]; Object ctx = args[6]; submit(() -> { boolean fenced = fencedLedgers.contains(ledgerId); if (fenced) { callback.writeComplete(BKException.Code.LedgerFencedException, ledgerId, entryId, bookieSocketAddress, ctx); } else { callback.writeComplete(BKException.Code.OK, ledgerId, entryId, bookieSocketAddress, ctx); } }); return null; }).when(bookieClient).addEntry(any(BookieSocketAddress.class), anyLong(), any(byte[].class), anyLong(), any(ByteBuf.class), any(BookkeeperInternalCallbacks.WriteCallback.class), any(), anyInt()); }
Source:
<code>public void checkPool() throws Exception { AbstractPool pool = getPool(); assertEquals(pool.getManagedConnectionPools().size(), 0); SimpleConnection[] simpleConnections = fillPoolToSize(5); String[] mcHashes = new String[5]; for (int i = 0; i < 5; i++) { SimpleConnection sc = simpleConnections[i]; SimpleConnectionImpl sci = (SimpleConnectionImpl) sc; mcHashes[i] = sci.getManagedConnection().toString(); } assertEquals(pool.getManagedConnectionPools().size(), 1); PoolStatistics ps = pool.getStatistics(); checkStatistics(ps, 5, 0, 5); ManagedConnectionPool mcp = pool.getManagedConnectionPools().values().iterator().next(); callRemoveIdleConnections(mcp); checkStatistics(ps, 5, 0, 4, 1); callRemoveIdleConnections(mcp); checkStatistics(ps, 5, 0, 3, 2); simpleConnections = fillPoolToSize(5); String[] mcHashesAfterIdleConnectionCleanup = new String[5]; for (int i = 0; i < 5; i++) { SimpleConnection sc = simpleConnections[i]; SimpleConnectionImpl sci = (SimpleConnectionImpl) sc; <START> mcHashesAfterIdleConnectionCleanup[i] = sci.getManagedConnection().toString(); <END> } assertEquals(mcHashes[2], mcHashesAfterIdleConnectionCleanup[0]); assertEquals(mcHashes[3], mcHashesAfterIdleConnectionCleanup[1]); assertEquals(mcHashes[4], mcHashesAfterIdleConnectionCleanup[2]); }</code><technical_language>adove</technical_language>

Target:
public void checkPool() throws Exception { AbstractPool pool = getPool(); assertEquals(pool.getManagedConnectionPools().size(), 0); String[] mcsIds = fillPoolToSize(5); assertEquals(pool.getManagedConnectionPools().size(), 1); PoolStatistics ps = pool.getStatistics(); checkStatistics(ps, 5, 0, 5); ManagedConnectionPool mcp = pool.getManagedConnectionPools().values().iterator().next(); callRemoveIdleConnections(mcp); checkStatistics(ps, 5, 0, 4, 1); callRemoveIdleConnections(mcp); checkStatistics(ps, 5, 0, 3, 2); String[] mcsIdsAfterIdleConnectionCleanup = fillPoolToSize(5); assertEquals(mcsIds[2], mcsIdsAfterIdleConnectionCleanup[0]); assertEquals(mcsIds[3], mcsIdsAfterIdleConnectionCleanup[1]); assertEquals(mcsIds[4], mcsIdsAfterIdleConnectionCleanup[2]); assertEquals("SimpleManagedConnection #5", mcsIdsAfterIdleConnectionCleanup[3]); assertEquals("SimpleManagedConnection #6", mcsIdsAfterIdleConnectionCleanup[4]); }
Source:
<code>public void batchUpdateMergingLarge() { <START> Change change2 = new Change("Q2", 1, Instant.EPOCH, 1); List<Statement> statements2 = new StatementBuilder("Q2") .withPredicateObject(RDFS.LABEL, new LiteralImpl(randomizer.randomAsciiOfLength(300 * 1024))) .build(); change2.setStatements(statements2); Change change3 = new Change("Q3", 1, Instant.EPOCH, 1); List<Statement> statements3 = new StatementBuilder("Q3") .withPredicateObject(RDFS.LABEL, new LiteralImpl("third item")) .build(); change3.setStatements(statements3); List<Change> changes = ImmutableList.of(change2, change3); <END> int count = mergingRepo.syncFromChanges(changes, false); assertThat(count).isEqualTo(2); verify(mergingMockClient, times(2)).mergingUpdate( any(Collection.class), any(Collection.class), any(Collection.class) ); }</code><technical_language>of fixtures in tests similar enough factorize construction. extract common fixtures a StatementFixtures class reuse them</technical_language>

Target:
public void batchUpdateMergingLarge() { List<Change> changes = ImmutableList.of(change2, change3); int count = mergingRepo.syncFromChanges(changes, false); assertThat(count).isEqualTo(2); verify(mergingMockClient, times(2)).mergingUpdate( any(Collection.class), any(Collection.class), any(Collection.class) ); }
Source:
<code>public boolean saveConversationWallpaper(Bitmap bitmap, String filename) { File file; if (isConversationWallpaperCached(filename)) { return true; } else { String filepath = getConversationWallpaperPath(filename); file = new File(filepath); file.getParentFile().mkdirs(); OutputStream os = null; try { file.createNewFile(); os = new FileOutputStream(file); bitmap.compress(Bitmap.CompressFormat.JPEG, 90, os); os.close(); <START> return os != null; <END> } catch (IOException e) { return false; } finally { close(os); } } }</code><technical_language>This condition is true, os.close() throw NPE</technical_language>

Target:
public boolean saveConversationWallpaper(Bitmap bitmap, String filename) { File file; boolean isWallpaperCached = false; if (isConversationWallpaperCached(filename + ".jpg")) { isWallpaperCached = true; file = new File(getConversationWallpaperPath(filename + "_tempWallpaper.jpg")); } else { file = new File(getConversationWallpaperPath(filename + ".jpg")); } file.getParentFile().mkdirs(); OutputStream outputStream = null; try { file.createNewFile(); outputStream = new FileOutputStream(file); bitmap.compress(Bitmap.CompressFormat.JPEG, 90, outputStream); outputStream.flush(); outputStream.close(); if (outputStream != null) { if (isWallpaperCached) { File oldFile = new File(getConversationWallpaperPath(filename + ".jpg")); if (oldFile.delete()) { file.renameTo(oldFile); return true; } file.delete(); return false; } } else { file.delete(); } return outputStream != null; } catch (IOException e) { file.delete(); return false; } finally { close(outputStream); } }
Source:
<code>public void byteArrayToInputStreamTransformationIsSuccessful() { <START> PollingProber.check(240000, 1000, () -> EventRecorder.countCapturedEvents() == 1); <END> }</code><technical_language>constants for pollingprober params</technical_language>

Target:
public void byteArrayToInputStreamTransformationIsSuccessful() { check(POLL_TIMEOUT_MILLIS, POLL_DELAY_MILLIS, () -> EventRecorder.countCapturedEvents() == EXPECTED_EVENT_COUNT); }
Source:
<code>public Object get(DataFetchingEnvironment env) { User user = MutationHelpers.getUser(env); String combinedId = env.getArgument("dataSetId"); String authString = env.getArgument("authorization"); Tuple<String, String> userAndDataSet = DataSetMetaData.splitCombinedId(combinedId); Optional<DataSet> dataSet; ResourceSyncImport.ResourceSyncReport resourceSyncReport; try { dataSet = dataSetRepository.getDataSet(user, userAndDataSet.getLeft(), userAndDataSet.getRight()); if (!dataSet.isPresent()) { LOG.error("DataSet does not exist."); throw new RuntimeException("DataSet does not exist."); } ResourceSyncImport resourceSyncImport = new ResourceSyncImport( resourceSyncFileLoader, dataSet.get(), false); String capabilityListUri = dataSet.get().getMetadata().getImportSource(); resourceSyncReport = resourceSyncImport.filterAndImport(capabilityListUri, null, true, authString); <START> } catch (IOException | CantRetrieveFileException | CantDetermineDataSetException e) { <END> LOG.error("Failed to do a resource sync import. ", e); throw new RuntimeException(e); } return resourceSyncReport; }</code><technical_language>For resourcesync want authorization token for remote resourcesync</technical_language>

Target:
public Object get(DataFetchingEnvironment env) { User user = MutationHelpers.getUser(env); String combinedId = env.getArgument("dataSetId"); String authString = env.getArgument("authorization"); Tuple<String, String> userAndDataSet = DataSetMetaData.splitCombinedId(combinedId); Optional<DataSet> dataSet; ResourceSyncImport.ResourceSyncReport resourceSyncReport; try { dataSet = dataSetRepository.getDataSet(user, userAndDataSet.getLeft(), userAndDataSet.getRight()); if (!dataSet.isPresent()) { LOG.error("DataSet does not exist."); throw new RuntimeException("DataSet does not exist."); } ResourceSyncImport resourceSyncImport = new ResourceSyncImport( resourceSyncFileLoader, dataSet.get(), false); String capabilityListUri = dataSet.get().getMetadata().getImportInfo().get(0).getImportSource(); resourceSyncReport = resourceSyncImport.filterAndImport(capabilityListUri, null, true, authString); } catch (IOException | CantRetrieveFileException | CantDetermineDataSetException e) { LOG.error("Failed to do a resource sync import. ", e); throw new RuntimeException(e); } return resourceSyncReport; }
Source:
<code><START> public int compare(Identifiable object1, Identifiable object2) { <END> Integer val1 = value.get(object1.getGuid()); Integer val2 = value.get(object2.getGuid()); if (val1 == null) { val1 = Integer.MAX_VALUE - 1; } if (val2 == null) { val2 = Integer.MAX_VALUE; } return val1 - val2; }</code><technical_language>if null? this return 0 if this happens</technical_language>

Target:
public int compare(Identifiable object1, Identifiable object2) { Integer val1 = getIndex(object1); Integer val2 = getIndex(object2); if (val1 == null) { val1 = Integer.MAX_VALUE - 1; } if (val2 == null) { val2 = Integer.MAX_VALUE; } return val1 - val2; }
Source:
<code>private static Uri addMessageToUri(ContentResolver resolver, Uri uri, String address, String body, String subject, Long date) { final int statusPending = 32; final int subId = SubscriptionManager.getDefaultSmsSubscriptionId(); ContentValues values = new ContentValues(7); Log.v(TAG, "Telephony addMessageToUri sub id: " + subId); <START> values.put("sub_id", subId); <END> values.put("address", address); if (date != null) { values.put("date", date); } values.put("read", Integer.valueOf(0)); values.put("subject", subject); values.put("body", body); values.put("status", statusPending); return resolver.insert(uri, values); }</code><technical_language>@system @public constants exposed in Telephony.java for of these. want that. reach out tomtaylor@ if want Messages app this</technical_language>

Target:
private static Uri addMessageToUri(ContentResolver resolver, Uri uri, String address, String body, String subject, Long date) { ContentValues values = new ContentValues(7); final int statusPending = 32; final int subId = SubscriptionManager.getDefaultSmsSubscriptionId(); Log.v(TAG, "Telephony addMessageToUri sub id: " + subId); values.put(Telephony.Sms.SUBSCRIPTION_ID, subId); values.put(Telephony.Sms.ADDRESS, address); if (date != null) { values.put(Telephony.Sms.DATE, date); } values.put(Telephony.Sms.READ, 0); values.put(Telephony.Sms.SUBJECT, subject); values.put(Telephony.Sms.BODY, body); values.put(Telephony.Sms.STATUS, statusPending); return resolver.insert(uri, values); }
Source:
<code>public boolean hasMinimumSize() { <START> return splitBrainProtectionState == SplitBrainProtectionState.MIN_CLUSTER_SIZE_SATISFIED; <END> }</code><technical_language>minor: This SplitBrainProtectionState.MIN_CLUSTER_SIZE_SATISFIED renamed</technical_language>

Target:
public boolean hasMinimumSize() { return splitBrainProtectionState == SplitBrainProtectionState.HAS_MIN_CLUSTER_SIZE; }
Source:
<code>public double getTotalCurrent(){ double totalCurrent = 0; <START> for(int i = 0; i <= 15; i++){ <END> totalCurrent += Math.abs(getCurrent(i)); } return totalCurrent; }</code><technical_language>Is another get number of channels? This sketchy</technical_language>

Target:
public double getTotalCurrent(){ return pdp.getTotalCurrent(); }
Source:
<code>public State makeState(Map<String, Object> conf, IMetricsContext metrics, int partitionIndex, int numPartitions) { LOG.info("makeState(partitonIndex={}, numpartitions={}", partitionIndex, numPartitions); <START> TridentKafkaState<K, V> state = new TridentKafkaState<K, V>() <END> .withKafkaTopicSelector(this.topicSelector) .withTridentTupleToKafkaMapper(this.mapper); state.prepare(producerProperties); return state; }</code><technical_language><> right hand side</technical_language>

Target:
public State makeState(Map<String, Object> conf, IMetricsContext metrics, int partitionIndex, int numPartitions) { LOG.info("makeState(partitonIndex={}, numpartitions={}", partitionIndex, numPartitions); TridentKafkaState<K, V> state = new TridentKafkaState<>(); state.withKafkaTopicSelector(this.topicSelector) .withTridentTupleToKafkaMapper(this.mapper); state.prepare(producerProperties); return state; }
Source:
<code>private SendRequest createSendRequest(PaymentIntent paymentIntent, boolean signInputs, boolean forceEnsureMinRequiredFee) { final Wallet wallet = viewModel.wallet; boolean llmqInstantSendActive = wallet.getContext().sporkManager.isSporkActive(SporkManager.SPORK_20_INSTANTSEND_LLMQ_BASED); paymentIntent.setInstantX(false); final SendRequest sendRequest = paymentIntent.toSendRequest(); <START> sendRequest.coinSelector = llmqInstantSendActive ? ZeroConfCoinSelector.get() : InstantXCoinSelector.get(); <END> sendRequest.useInstantSend = false; sendRequest.feePerKb = ECONOMIC_FEE; sendRequest.ensureMinRequiredFee = forceEnsureMinRequiredFee; sendRequest.signInputs = signInputs; Coin walletBalance = wallet.getBalance(BalanceType.ESTIMATED); sendRequest.emptyWallet = viewModel.paymentIntent.mayEditAmount() && walletBalance.equals(paymentIntent.getAmount()); return sendRequest; }</code><technical_language>if llmqInstantSendActive is false, ZeroConfCoinSelector used. InstantXCoinSelector anymore</technical_language>

Target:
private SendRequest createSendRequest(PaymentIntent paymentIntent, boolean signInputs, boolean forceEnsureMinRequiredFee) { paymentIntent.setInstantX(false); final SendRequest sendRequest = paymentIntent.toSendRequest(); sendRequest.coinSelector = ZeroConfCoinSelector.get(); sendRequest.useInstantSend = false; sendRequest.feePerKb = ECONOMIC_FEE; sendRequest.ensureMinRequiredFee = forceEnsureMinRequiredFee; sendRequest.signInputs = signInputs; Coin walletBalance = viewModel.wallet.getBalance(BalanceType.ESTIMATED); sendRequest.emptyWallet = viewModel.paymentIntent.mayEditAmount() && walletBalance.equals(paymentIntent.getAmount()); return sendRequest; }
Source:
<code>private void updateRowsOnHosts(MemoryTableHandle table, Collection<Slice> fragments) { <START> Map<HostAddress, Long> rowsOnHosts = hostsPerTable.computeIfAbsent( <END> table.getTableId(), key -> new ConcurrentHashMap<>()); for (Slice fragment : fragments) { WriteInfo writeInfo = WriteInfo.fromSlice(fragment); rowsOnHosts.compute( writeInfo.getHostAndPort(), (hostAddress, rows) -> (rows == null ? 0 : rows) + writeInfo.getRows()); } }</code><technical_language>this initialized beginCreateTable</technical_language>

Target:
private void updateRowsOnHosts(MemoryTableHandle table, Collection<Slice> fragments) { checkState( tableDataFragments.containsKey(table.getTableId()), "Uninitialized table [%s.%s]", table.getSchemaName(), table.getTableName()); Map<HostAddress, MemoryDataFragment> dataFragments = tableDataFragments.get(table.getTableId()); for (Slice fragment : fragments) { MemoryDataFragment memoryDataFragment = MemoryDataFragment.fromSlice(fragment); dataFragments.merge(memoryDataFragment.getHostAddress(), memoryDataFragment, MemoryDataFragment::merge); } }
Source:
<code>protected static void setSliderFunction(final Slider slider, final SType type) { slider.setOnMouseReleased(event -> { if (type == SType.VOLUME_SOUNDTRACK) { State.setSoundtrackVolume(soundtrackVolumeSlider. getValue() / VOLUME_CONVERTER); MainMenuScene.getAudioPlayer(). setVolume(State.getSoundtrackVolume()); } else { State.setSoundEffectVolume(soundEffectVolumeSlider. getValue() / VOLUME_CONVERTER); AbstractMenuScene.getButtonSoundEffectPlayer(). setVolume(State.getSoundEffectVolume()); AbstractInfoPopup.getButtonSoundEffectPlayer(). <START> setVolume(State.getSoundEffectVolume()); <END> } }); }</code><technical_language>I nice hear buttonsound releasing slider, hear volume, hear volume soundtrack is sliding :) <feature, review</technical_language>

Target:
protected static void setSliderFunction(final Slider slider, final SType type) { slider.setOnMouseReleased(event -> { if (type == SType.VOLUME_SOUNDTRACK) { State.setSoundtrackVolume(soundtrackVolumeSlider. getValue() / VOLUME_CONVERTER); MainMenuScene.getAudioPlayer(). setVolume(State.getSoundtrackVolume()); } else { State.setSoundEffectVolume(soundEffectVolumeSlider. getValue() / VOLUME_CONVERTER); } playButtonSound(); }); }
Source:
<code>public void copyAllRightToLeft(Iterable<? extends Diff> differences, Monitor monitor) { long start = 0; if (LOGGER.isDebugEnabled()) { start = System.currentTimeMillis(); LOGGER.debug("copyAllRightToLeft(differences, monitor) - Start"); } ComputeDiffsToMerge computer = new <START> ComputeDiffsToMerge(true, registry, null); <END> for (Diff diff : Iterables.filter(differences, filter)) { if (!AbstractMerger.isInTerminalState(diff)) { Set<Diff> diffsToMerge = computer.getAllDiffsToMergeFor(diff); for (Diff toMerge : diffsToMerge) { if (!AbstractMerger.isInTerminalState(toMerge)) { final IMerger merger = registry.getHighestRankingMerger(toMerge); if (LOGGER.isDebugEnabled()) { LOGGER.debug("copyAllLeftToRight - Selected merger: " + merger.getClass().getSimpleName()); } merger.copyRightToLeft(toMerge, monitor); } } } } if (LOGGER.isDebugEnabled()) { long duration = System.currentTimeMillis() - start; LOGGER.debug("copyAllRightToLeft(differences, monitor) - Stop - Time spent: " + duration + "ms"); } }</code><technical_language>nicer provide alternative constructor of ComputeDiffsToMerge criterion this constructor create default criterion (which is null moment). in favor of null default prefer instance of a default class</technical_language>

Target:
public void copyAllRightToLeft(Iterable<? extends Diff> differences, Monitor monitor) { long start = 0; if (LOGGER.isDebugEnabled()) { start = System.currentTimeMillis(); LOGGER.debug("copyAllRightToLeft(differences, monitor) - Start"); } ComputeDiffsToMerge computer = new ComputeDiffsToMerge(true, registry); for (Diff diff : Iterables.filter(differences, filter)) { if (!AbstractMerger.isInTerminalState(diff)) { Set<Diff> diffsToMerge = computer.getAllDiffsToMerge(diff); for (Diff toMerge : diffsToMerge) { if (!AbstractMerger.isInTerminalState(toMerge)) { final IMerger merger = registry.getHighestRankingMerger(toMerge); if (LOGGER.isDebugEnabled()) { LOGGER.debug("copyAllLeftToRight - Selected merger: " + merger.getClass().getSimpleName()); } merger.copyRightToLeft(toMerge, monitor); } } } } if (LOGGER.isDebugEnabled()) { long duration = System.currentTimeMillis() - start; LOGGER.debug("copyAllRightToLeft(differences, monitor) - Stop - Time spent: " + duration + "ms"); } }
Source:
<code>public void testFinishButtonDisabledInLauncherApplicationProjectWizard() { log.step("Import project start"); NewLauncherProjectWizard wizard = new NewLauncherProjectWizard(); NewLauncherProjectWizardPage wizardPage = new NewLauncherProjectWizardPage(wizard); wizard.openWizardFromShellMenu(); <START> assertFalse(wizardPage.isFinishButtonEnabled()); <END> wizardPage.setProjectName("project_2_customized_settings"); String defaultLocationBackup = ""; wizardPage.toggleUseDefaultLocationCheckBox(false); defaultLocationBackup = wizardPage.getProjectLocation(); wizardPage.setCustomProjectLocation(""); assertFalse(wizardPage.isFinishButtonEnabled()); wizardPage.setCustomProjectLocation(defaultLocationBackup); wizardPage.toggleUseDefaultLocationCheckBox(true); String defaultArtifactIdBackup = ""; defaultArtifactIdBackup = wizardPage.getArtifactId(); wizardPage.setArtifactId(""); assertFalse(wizardPage.isFinishButtonEnabled()); wizardPage.setArtifactId(defaultArtifactIdBackup); String defaultGroupIdBackup = ""; defaultGroupIdBackup = wizardPage.getGroupId(); wizardPage.setGroupId(""); assertFalse(wizardPage.isFinishButtonEnabled()); wizardPage.setGroupId(defaultGroupIdBackup); String defaultVersionBackup = ""; defaultVersionBackup = wizardPage.getVersion(); wizardPage.setVersion(""); assertFalse(wizardPage.isFinishButtonEnabled()); wizardPage.setVersion(defaultVersionBackup); new DefaultShell("New Launcher project").close(); log.step("Window closed"); new WaitWhile(new JobIsRunning(), TimePeriod.VERY_LONG); checkForErrors(); }</code><technical_language>Also, please move isFinishButtonEnabled page wizard dialog class impl. of finish methods. Thanks</technical_language>

Target:
public void testFinishButtonDisabledInLauncherApplicationProjectWizard() { log.step("Import project start"); NewLauncherProjectWizard wizard = new NewLauncherProjectWizard(); NewLauncherProjectWizardPage wizardPage = new NewLauncherProjectWizardPage(wizard); wizard.openWizardFromShellMenu(); assertFalse(wizard.isFinishEnabled()); wizardPage.setProjectName("project_2_customized_settings"); String defaultLocationBackup = ""; wizardPage.toggleUseDefaultLocationCheckBox(false); defaultLocationBackup = wizardPage.getProjectLocation(); wizardPage.setCustomProjectLocation(""); assertFalse(wizard.isFinishEnabled()); wizardPage.setCustomProjectLocation(defaultLocationBackup); wizardPage.toggleUseDefaultLocationCheckBox(true); String defaultArtifactIdBackup = ""; defaultArtifactIdBackup = wizardPage.getArtifactId(); wizardPage.setArtifactId(""); assertFalse(wizard.isFinishEnabled()); wizardPage.setArtifactId(defaultArtifactIdBackup); String defaultGroupIdBackup = ""; defaultGroupIdBackup = wizardPage.getGroupId(); wizardPage.setGroupId(""); assertFalse(wizard.isFinishEnabled()); wizardPage.setGroupId(defaultGroupIdBackup); String defaultVersionBackup = ""; defaultVersionBackup = wizardPage.getVersion(); wizardPage.setVersion(""); assertFalse(wizard.isFinishEnabled()); wizardPage.setVersion(defaultVersionBackup); new DefaultShell("New Launcher project").close(); log.step("Window closed"); new WaitWhile(new JobIsRunning(), TimePeriod.VERY_LONG); checkForErrors(); }
Source:
<code>public final void testExecuteLogOutput() throws Exception { final CheckstyleAntTaskLogStub antTask = new CheckstyleAntTaskLogStub(); final URL url = new File(getPath(CONFIG_FILE)).toURI().toURL(); antTask.setProject(new Project()); antTask.setConfigURL(url); antTask.setFile(new File(getPath(FLAWLESS_INPUT))); mockStatic(System.class); when(System.currentTimeMillis()).thenReturn(1L); antTask.execute(); final List<MessageLevelPair> expectedList = Arrays.asList( <START> new MessageLevelPair("checkstyle version ", 3), <END> new MessageLevelPair("compiled on ", 3), new MessageLevelPair("Adding standalone file for audit", 3), new MessageLevelPair("To locate the files took 0 ms.", 3), new MessageLevelPair("Running Checkstyle ", 2), new MessageLevelPair("Using configuration ", 3), new MessageLevelPair("Starting audit", 4), new MessageLevelPair("Audit done.", 4), new MessageLevelPair("To process the files took 0 ms.", 3), new MessageLevelPair("Total execution took 0 ms.", 3) ); final List<MessageLevelPair> loggedMessages = antTask.getLoggedMessages(); assertEquals(expectedList.size(), loggedMessages.size()); for (int i = 0; i < expectedList.size(); i++) { final MessageLevelPair expected = expectedList.get(i); final MessageLevelPair actual = loggedMessages.get(i); assertTrue(actual.getMsg().startsWith(expected.getMsg())); assertEquals(expected.getLevel(), actual.getLevel()); } }</code><technical_language>I numbers replaced Project.XXXX more human friendly</technical_language>

Target:
public final void testExecuteLogOutput() throws Exception { final CheckstyleAntTaskLogStub antTask = new CheckstyleAntTaskLogStub(); final URL url = new File(getPath(CONFIG_FILE)).toURI().toURL(); antTask.setProject(new Project()); antTask.setConfigURL(url); antTask.setFile(new File(getPath(FLAWLESS_INPUT))); mockStatic(System.class); when(System.currentTimeMillis()).thenReturn(1L); antTask.execute(); final List<MessageLevelPair> expectedList = Arrays.asList( new MessageLevelPair("checkstyle version ", Project.MSG_VERBOSE), new MessageLevelPair("compiled on ", Project.MSG_VERBOSE), new MessageLevelPair("Adding standalone file for audit", Project.MSG_VERBOSE), new MessageLevelPair("To locate the files took 0 ms.", Project.MSG_VERBOSE), new MessageLevelPair("Running Checkstyle ", Project.MSG_INFO), new MessageLevelPair("Using configuration ", Project.MSG_VERBOSE), new MessageLevelPair("Starting audit", Project.MSG_DEBUG), new MessageLevelPair("Audit done.", Project.MSG_DEBUG), new MessageLevelPair("To process the files took 0 ms.", Project.MSG_VERBOSE), new MessageLevelPair("Total execution took 0 ms.", Project.MSG_VERBOSE) ); final List<MessageLevelPair> loggedMessages = antTask.getLoggedMessages(); assertEquals(expectedList.size(), loggedMessages.size()); for (int i = 0; i < expectedList.size(); i++) { final MessageLevelPair expected = expectedList.get(i); final MessageLevelPair actual = loggedMessages.get(i); assertTrue(actual.getMsg().startsWith(expected.getMsg())); assertEquals(expected.getLevel(), actual.getLevel()); } }
Source:
<code>public WikipediaBenchmark(WorkloadConfiguration workConf) { <START> super("wikipedia", workConf, true); <END> this.commentLength = new FlatHistogram<Integer>(this.rng(), RevisionHistograms.COMMENT_LENGTH); this.minorEdit = new FlatHistogram<Integer>(this.rng(), RevisionHistograms.MINOR_EDIT); this.revisionDeltas = (FlatHistogram<Integer>[])new FlatHistogram[RevisionHistograms.REVISION_DELTA_SIZES.length]; for (int i = 0; i < this.revisionDeltas.length; i++) { this.revisionDeltas[i] = new FlatHistogram<Integer>(this.rng(), RevisionHistograms.REVISION_DELTAS[i]); } }</code><technical_language>Formatter</technical_language>

Target:
public WikipediaBenchmark(WorkloadConfiguration workConf) { super("wikipedia", workConf, true); this.commentLength = new FlatHistogram<Integer>(this.rng(), RevisionHistograms.COMMENT_LENGTH); this.minorEdit = new FlatHistogram<Integer>(this.rng(), RevisionHistograms.MINOR_EDIT); this.revisionDeltas = new FlatHistogram[RevisionHistograms.REVISION_DELTA_SIZES.length]; for (int i = 0; i < this.revisionDeltas.length; i++) { this.revisionDeltas[i] = new FlatHistogram<Integer>(this.rng(), RevisionHistograms.REVISION_DELTAS[i]); } }
Source:
<code>private Map<String, Collection<UpstreamInfo>> fetchServiceToUpstreamInfoMap(Collection<String> services) throws Exception { Map<String, Collection<String>> serviceToUpstreams = zkFetcher.fetchChildrenInParallel(services); Map<String, UpstreamInfo> upstreamToInfo = zkFetcher.fetchDataInParallel(upstreamPaths(serviceToUpstreams), new UpstreamInfoDeserializer()); Map<String, Collection<UpstreamInfo>> serviceToUpstreamInfo = new HashMap<>(services.size()); for (Entry<String, Collection<String>> entry : serviceToUpstreams.entrySet()) { for (String upstream : entry.getValue()) { if (serviceToUpstreamInfo.containsKey(entry.getKey())) { serviceToUpstreamInfo.get(entry.getKey()).add(upstreamToInfo.get(upstream)); } else { serviceToUpstreamInfo.put(entry.getKey(), Lists.newArrayList(upstreamToInfo.get(upstream))); <START> } <END> } } return serviceToUpstreamInfo; }</code><technical_language>logic simpler instantiate collection if containsKey() is false, do add() of if statement</technical_language>

Target:
private Map<String, Collection<UpstreamInfo>> fetchServiceToUpstreamInfoMap(Collection<String> services) throws Exception { Map<String, Collection<String>> serviceToUpstreams = zkFetcher.fetchChildrenInParallel(services); Map<String, UpstreamInfo> upstreamToInfo = zkFetcher.fetchDataInParallel(upstreamPaths(serviceToUpstreams), new UpstreamInfoDeserializer()); Map<String, Collection<UpstreamInfo>> serviceToUpstreamInfo = new HashMap<>(services.size()); for (Entry<String, Collection<String>> entry : serviceToUpstreams.entrySet()) { for (String upstream : entry.getValue()) { if (!serviceToUpstreamInfo.containsKey(entry.getKey())) { serviceToUpstreamInfo.put(entry.getKey(), Lists.<UpstreamInfo>newArrayList(upstreamToInfo.get(upstream))); } else { serviceToUpstreamInfo.get(entry.getKey()).add(upstreamToInfo.get(upstream)); } } } return serviceToUpstreamInfo; }
Source:
<code>public void testMetaDataChangedEventListener(DBMSType dbmsType, DBMSConnection dbmsConnection, DBMSProcessor dbmsProcessor) throws Exception { <START> bibDatabase = new BibDatabase(); <END> BibDatabaseContext context = new BibDatabaseContext(bibDatabase); dbmsSynchronizer = new DBMSSynchronizer(context, ',', pattern, new DummyFileUpdateMonitor()); dbmsSynchronizer.openSharedDatabase(dbmsConnection); MetaData testMetaData = new MetaData(); testMetaData.registerListener(dbmsSynchronizer); dbmsSynchronizer.setMetaData(testMetaData); testMetaData.setMode(BibDatabaseMode.BIBTEX); Map<String, String> expectedMap = MetaDataSerializer.getSerializedStringMap(testMetaData, pattern); Map<String, String> actualMap = dbmsProcessor.getSharedMetaData(); assertEquals(expectedMap, actualMap); }</code><technical_language>lines shared tests, please extract setup method</technical_language>

Target:
public void testMetaDataChangedEventListener(DBMSType dbmsType, DBMSConnection dbmsConnection, DBMSProcessor dbmsProcessor) throws Exception { setUp(dbmsConnection); MetaData testMetaData = new MetaData(); testMetaData.registerListener(dbmsSynchronizer); dbmsSynchronizer.setMetaData(testMetaData); testMetaData.setMode(BibDatabaseMode.BIBTEX); Map<String, String> expectedMap = MetaDataSerializer.getSerializedStringMap(testMetaData, pattern); Map<String, String> actualMap = dbmsProcessor.getSharedMetaData(); assertEquals(expectedMap, actualMap); clear(dbmsConnection); }
Source:
<code>public static byte[] getByteBufferHash(final ByteBuffer byteBuffer) { try { <START> final MessageDigest md = MessageDigest.getInstance("SHA-256"); <END> final ByteBuffer bufferCopy = byteBuffer.slice(); final byte[] byteBufferArray = new byte[bufferCopy.remaining()]; bufferCopy.get(byteBufferArray); return md.digest(byteBufferArray); } catch (final NoSuchAlgorithmException e) { e.printStackTrace(); throw new RuntimeException("SHA-256 algorithm is not available in the current environment."); } }</code><technical_language>Do need this instance method is called? reuse it</technical_language>

Target:
public static byte[] getByteBufferHash(final ByteBuffer byteBuffer) { final ByteBuffer bufferCopy = byteBuffer.slice(); final byte[] byteBufferArray = new byte[bufferCopy.remaining()]; bufferCopy.get(byteBufferArray); return md.digest(byteBufferArray); }
Source:
<code>public void checkCidrFormatAnnotation() { CidrContainer container = new CidrContainer(cidr); Set<ConstraintViolation<CidrContainer>> result = validator.validate(container); <START> if ((!validNetworkAddressExpectedResult) && (validCidrFormatExpectedResult)) { <END> assertEquals("Failed to validate CIDR's error format: " + container.getCidr(), "CIDR_NOT_NETWORK_ADDRESS", result.iterator().next().getMessage()); } else if (!validCidrFormatExpectedResult) { assertEquals("Failed to validate CIDR's error format: " + container.getCidr(), "BAD_CIDR_FORMAT", result.iterator().next().getMessage()); } else { assertEquals("Failed to validate CIDR's format: " + container.getCidr(), validCidrFormatExpectedResult, result.isEmpty()); } }</code><technical_language>please remove surrounding brackets, contribute readability</technical_language>

Target:
public void checkCidrFormatAnnotation() { CidrContainer container = new CidrContainer(cidr); Set<ConstraintViolation<CidrContainer>> result = validator.validate(container); if (!validNetworkAddressExpectedResult && validCidrFormatExpectedResult) { assertEquals("Failed to validate CIDR's error format: " + container.getCidr(), VdcBllMessages.CIDR_NOT_NETWORK_ADDRESS.name(), result.iterator().next().getMessage()); } else if (!validCidrFormatExpectedResult) { assertEquals("Failed to validate CIDR's error format: " + container.getCidr(), VdcBllMessages.BAD_CIDR_FORMAT.name(), result.iterator().next().getMessage()); } else { assertEquals("Failed to validate CIDR's format: " + container.getCidr(), validCidrFormatExpectedResult, result.isEmpty()); } }
Source:
<code>private String convertAndAppendMetadata(StreamsDatum streamsDatum) throws IOException { Object object = streamsDatum.getDocument(); String docAsJson = (object instanceof String) ? object.toString() : OBJECT_MAPPER.writeValueAsString(object); if(streamsDatum.getMetadata() == null || streamsDatum.getMetadata().size() == 0) return docAsJson; else { ObjectNode node = (ObjectNode)OBJECT_MAPPER.readTree(docAsJson); try { node.put("_metadata", OBJECT_MAPPER.readTree(OBJECT_MAPPER.writeValueAsBytes(streamsDatum.getMetadata()))); } <START> catch(Throwable e) { <END> LOGGER.warn("Unable to write metadata"); } return OBJECT_MAPPER.writeValueAsString(node); } }</code><technical_language>caller of this method catches throwable. hurt exception bubble up</technical_language>

Target:
private String convertAndAppendMetadata(StreamsDatum streamsDatum) throws IOException { Object object = streamsDatum.getDocument(); String docAsJson = (object instanceof String) ? object.toString() : OBJECT_MAPPER.writeValueAsString(object); if(streamsDatum.getMetadata() == null || streamsDatum.getMetadata().size() == 0) return docAsJson; else { ObjectNode node = (ObjectNode)OBJECT_MAPPER.readTree(docAsJson); node.put("_metadata", OBJECT_MAPPER.readTree(OBJECT_MAPPER.writeValueAsBytes(streamsDatum.getMetadata()))); return OBJECT_MAPPER.writeValueAsString(node); } }
Source:
<code>protected Set<ApplicationResource> findResources(String path) throws IOException { Set<ApplicationResource> resources = new HashSet<>(); LOG.trace("Using ResourceFinder to find matches for {}", path); Pattern pattern = WildcardUtil.compileWildcardPattern(path); Map<String, URL> matches = finder.getResourcesMap(""); for (Map.Entry<String, URL> entry : matches.entrySet()) { if (pattern.matcher(entry.getKey()).matches()) { try { resources.add(new StrutsApplicationResource(entry.getValue())); } catch (MalformedURLException e) { <START> LOG.warn("Cannot access [{}]", entry.getValue(), e); <END> } } } LOG.trace("Found resources for path {}", resources, path); return resources; }</code><technical_language>if this is a debug level instead of warn ? _clearer a warn_, users expect warnings in logs (since happen before), a debug "safer"</technical_language>

Target:
protected Set<ApplicationResource> findResources(String path) throws IOException { Set<ApplicationResource> resources = new HashSet<>(); LOG.trace("Using ResourceFinder to find matches for {}", path); Pattern pattern = WildcardUtil.compileWildcardPattern(path); Map<String, URL> matches = finder.getResourcesMap(""); for (Map.Entry<String, URL> entry : matches.entrySet()) { if (pattern.matcher(entry.getKey()).matches()) { resources.add(new StrutsApplicationResource(entry.getValue())); } } LOG.trace("Found resources for path {}", resources, path); return resources; }
Source:
<code>public void testCustomLifeCycle() throws Exception { <START> restAPIPublisher.changeAPILifeCycleStatus(apiId, Constants.PUBLISHED); <END> Assert.assertEquals(APILifeCycleState.PUBLISHED.getState(), restAPIPublisher.getLifecycleStatus(apiId). getData(), "lifecycle not changed to published"); restAPIPublisher.changeAPILifeCycleStatus(apiId, PROMOTE); Assert.assertEquals(PROMOTE + "d", restAPIPublisher.getLifecycleStatus(apiId).getData(), "lifecycle not changed to custom"); restAPIPublisher.changeAPILifeCycleStatus(apiId, RE_PUBLISH); Assert.assertEquals(APILifeCycleState.PUBLISHED.getState(), restAPIPublisher.getLifecycleStatus(apiId). getData(), "lifecycle not changed to published"); }</code><technical_language>Lets APILifeCycleAction.PUBLISHED.getAction()</technical_language>

Target:
public void testCustomLifeCycle() throws Exception { restAPIPublisher.changeAPILifeCycleStatus(apiId, APILifeCycleAction.PUBLISH.getAction()); Assert.assertEquals(APILifeCycleState.PUBLISHED.getState(), restAPIPublisher.getLifecycleStatus(apiId). getData(), "lifecycle not changed to published"); restAPIPublisher.changeAPILifeCycleStatus(apiId, APILifeCycleAction.PROMOTE.getAction()); Assert.assertEquals(APILifeCycleState.PROMOTED.getState(), restAPIPublisher.getLifecycleStatus(apiId).getData(), "lifecycle not changed to custom"); restAPIPublisher.changeAPILifeCycleStatus(apiId, APILifeCycleAction.RE_PUBLISH.getAction()); Assert.assertEquals(APILifeCycleState.PUBLISHED.getState(), restAPIPublisher.getLifecycleStatus(apiId). getData(), "lifecycle not changed to published"); }
Source:
<code>public static void onAdvancementEvent(AdvancementEvent event) { <START> if (ENABLED && event.getAdvancement().getDisplay() != null && event.getAdvancement().getDisplay().shouldAnnounceToChat()) <END> { logger.info("{} got the advancement", event.getEntityPlayer().getDisplayNameString(), event.getAdvancement().getDisplayText().getUnformattedText()); } }</code><technical_language>ENABLED check is necessary if one</technical_language>

Target:
public static void onAdvancementEvent(AdvancementEvent event) { if (event.getAdvancement().getDisplay() != null && event.getAdvancement().getDisplay().shouldAnnounceToChat()) { logger.info("{} got the advancement", event.getEntityPlayer().getDisplayNameString(), event.getAdvancement().getDisplayText().getUnformattedText()); } }