auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void handleRequest(HttpRequest httpRequest) throws RestServiceException { if (responseChannel == null || responseChannel.isResponseComplete()) { long processingStartTime = System.currentTimeMillis(); try { refreshState(); nettyMetrics.requestArrivalRate.mark(); if (!httpRequest.getDecoderResult().isSuccess()) { logger.warn("Decoder failed because of malformed request on channel {}", ctx.channel()); nettyMetrics.malformedRequestError.inc(); throw new RestServiceException("Decoder failed because of malformed request", RestServiceErrorCode.MalformedRequest); } request = new NettyRequest(httpRequest, nettyMetrics); <START> responseChannel.setRequest(request, HttpHeaders.isKeepAlive(httpRequest)); <END> logger.trace("Channel now handling request {}", ctx.channel(), request.getUri()); if (request.getRestMethod().equals(RestMethod.POST)) { requestHandler.handleRequest(request, responseChannel); } } finally { request.getMetricsTracker().nioMetricsTracker .addToRequestProcessingTime(System.currentTimeMillis() - processingStartTime); } } else { logger.warn("Discarding unexpected request on channel {}. Request under processing: {}. Unexpected request: {}", ctx.channel(), request.getUri(), httpRequest.getUri()); nettyMetrics.duplicateRequestError.inc(); } }</code><technical_language>embed alive information NettyRequest class? alive info is original request, sense request it</technical_language>

Target:
private void handleRequest(HttpRequest httpRequest) throws RestServiceException { if (responseChannel == null || responseChannel.isResponseComplete()) { long processingStartTime = System.currentTimeMillis(); try { resetState(); nettyMetrics.requestArrivalRate.mark(); if (!httpRequest.getDecoderResult().isSuccess()) { logger.warn("Decoder failed because of malformed request on channel {}", ctx.channel()); nettyMetrics.malformedRequestError.inc(); throw new RestServiceException("Decoder failed because of malformed request", RestServiceErrorCode.MalformedRequest); } request = new NettyRequest(httpRequest, nettyMetrics); responseChannel.setRequest(request); logger.trace("Channel now handling request {}", ctx.channel(), request.getUri()); if (request.getRestMethod().equals(RestMethod.POST)) { requestHandler.handleRequest(request, responseChannel); } } finally { request.getMetricsTracker().nioMetricsTracker .addToRequestProcessingTime(System.currentTimeMillis() - processingStartTime); } } else { logger.warn("Discarding unexpected request on channel {}. Request under processing: {}. Unexpected request: {}", ctx.channel(), request.getUri(), httpRequest.getUri()); nettyMetrics.duplicateRequestError.inc(); } }
Source:
<code>static FilterOutInJectedTypesResult filterOutInJectedTypesFromOptionalValues(Class<?>[] parameterTypes, String[] optionalValues) { List<Class<?>> typeList = Lists.newArrayList(); List<String> optionalValueList = Lists.newArrayList(); Collections.addAll(typeList, parameterTypes); Collections.addAll(optionalValueList, optionalValues); Iterator<Class<?>> typeIterator = typeList.iterator(); Iterator<String> optionalIterator = optionalValueList.iterator(); while (typeIterator.hasNext()) { Class<?> parameterType = typeIterator.next(); optionalIterator.next(); if (INJECTED_TYPES.contains(parameterType)) { optionalIterator.remove(); typeIterator.remove(); } } return new FilterOutInJectedTypesResult(typeList.toArray(new Class<?>[0]), <START> optionalValueList.toArray(new String[0])); <END> }</code><technical_language>size list instead of 0</technical_language>

Target:
static FilterOutInJectedTypesResult filterOutInJectedTypesFromOptionalValues(Class<?>[] parameterTypes, String[] optionalValues) { List<Class<?>> typeList = Lists.newArrayList(parameterTypes); List<String> optionalValueList = Lists.newArrayList(optionalValues); Iterator<Class<?>> typeIterator = typeList.iterator(); Iterator<String> optionalIterator = optionalValueList.iterator(); while (typeIterator.hasNext()) { Class<?> parameterType = typeIterator.next(); optionalIterator.next(); if (INJECTED_TYPES.contains(parameterType)) { optionalIterator.remove(); typeIterator.remove(); } } return new FilterOutInJectedTypesResult(typeList.toArray(new Class<?>[typeList.size()]), optionalValueList.toArray(new String[optionalValueList.size()])); }
Source:
<code>public ReactiveAuthenticationManagerResolver<ServerHttpRequest> resolver() { return request -> { if (request .getPath() .subPath(0) .value() .startsWith("/employee")) <START> return Mono.just(employeesAuthenticationManager()); <END> return Mono.just(customersAuthenticationManager()); }; }</code><technical_language>please enclose single statement of if clause in curly braces recommended practice</technical_language>

Target:
public ReactiveAuthenticationManagerResolver<ServerHttpRequest> resolver() { return request -> { if (request .getPath() .subPath(0) .value() .startsWith("/employee")) { return Mono.just(employeesAuthenticationManager()); } return Mono.just(customersAuthenticationManager()); }; }
Source:
<code>public long commitBlockLocked(long sessionId, long blockId, boolean pinOnCreate) throws BlockAlreadyExistsException, InvalidWorkerStateException, BlockDoesNotExistException, IOException { <START> LOG.debug("commitBlock: sessionId={}, blockId={}", sessionId, blockId); <END> long lockId = mLockManager.lockBlock(sessionId, blockId, BlockLockType.WRITE); try { BlockStoreLocation loc = commitBlockInternal(sessionId, blockId, pinOnCreate); synchronized (mBlockStoreEventListeners) { for (BlockStoreEventListener listener : mBlockStoreEventListeners) { listener.onCommitBlock(sessionId, blockId, loc); } } } catch (Exception e) { mLockManager.unlockBlock(lockId); throw e; } return lockId; }</code><technical_language>commitBlockLocked? add pinOnCreate</technical_language>

Target:
public long commitBlockLocked(long sessionId, long blockId, boolean pinOnCreate) throws BlockAlreadyExistsException, InvalidWorkerStateException, BlockDoesNotExistException, IOException { LOG.debug("commitBlock: sessionId={}, blockId={}, pinOnCreate={}", sessionId, blockId, pinOnCreate); long lockId = mLockManager.lockBlock(sessionId, blockId, BlockLockType.WRITE); try { BlockStoreLocation loc = commitBlockInternal(sessionId, blockId, pinOnCreate); synchronized (mBlockStoreEventListeners) { for (BlockStoreEventListener listener : mBlockStoreEventListeners) { listener.onCommitBlock(sessionId, blockId, loc); } } } catch (Exception e) { mLockManager.unlockBlock(lockId); throw e; } return lockId; }
Source:
<code>private GraphicalEditPart getContainerEditPart(Object container) { GraphicalEditPart containerEditpart = null; Iterator<?> iterator = <START> getHost().getRoot().getViewer().getEditPartRegistry().keySet().iterator(); <END> while (iterator.hasNext() && null == containerEditpart) { Object key = iterator.next(); if (key instanceof Node) { Node keyNode = (Node) key; Element element = (Element) keyNode.getElement(); if (element == container) { GraphicalEditPart tempEditpart = (GraphicalEditPart) getHost().getRoot().getViewer().getEditPartRegistry().get(keyNode); if (tempEditpart instanceof InteractionInteractionCompartmentEditPart || tempEditpart instanceof InteractionOperandEditPart) { containerEditpart = tempEditpart; } } } } return containerEditpart; }</code><technical_language>Is check null host, root, viewer registry here</technical_language>

Target:
private GraphicalEditPart getContainerEditPart(Object container) { GraphicalEditPart containerEditpart = null; if (null != getHost().getRoot() && null != getHost().getRoot().getViewer() && null != getHost().getRoot().getViewer().getEditPartRegistry()) { Iterator<?> iterator = getHost().getRoot().getViewer().getEditPartRegistry().keySet().iterator(); while (iterator.hasNext() && null == containerEditpart) { Object key = iterator.next(); if (key instanceof Node) { Node keyNode = (Node) key; Element element = (Element) keyNode.getElement(); if (element == container) { GraphicalEditPart tempEditpart = (GraphicalEditPart) getHost().getRoot().getViewer().getEditPartRegistry().get(keyNode); if (tempEditpart instanceof InteractionInteractionCompartmentEditPart || tempEditpart instanceof InteractionOperandEditPart) { containerEditpart = tempEditpart; } } } } } return containerEditpart; }
Source:
<code>private String getFullPath(String strValue) throws IOException { File file = new File(strValue); if (!file.isAbsolute()) { file = new File(reference, strValue); } <START> return file.getPath(); <END> }</code><technical_language>explain this change</technical_language>

Target:
private String getFullPath(String strValue) throws IOException { File file = new File(strValue); if (!file.isAbsolute()) { file = new File(reference, strValue); } return file.getCanonicalPath(); }
Source:
<code>public void report(Trace trace) { <START> backingTraceRecorder.report(trace); <END> }</code><technical_language>checking 'instanceof' EnvAwareTR in TraceContext, add service name build stamp here? prior reporting trace backing trace recorder</technical_language>

Target:
public void report(Trace trace) { if (trace.getNodes() != null && trace.getNodes().size() > 0) { Node rootNode = trace.getNodes().get(0); if (this.deploymentMetaData != null) { if (!rootNode.hasProperty(Constants.PROP_SERVICE_NAME)) { rootNode.getProperties().add(new Property(Constants.PROP_SERVICE_NAME, this.deploymentMetaData.getServiceName())); } if (!rootNode.hasProperty(Constants.PROP_BUILD_STAMP)) { rootNode.getProperties().add(new Property(Constants.PROP_BUILD_STAMP, this.deploymentMetaData.getBuildStamp())); } } } backingTraceRecorder.report(trace); }
Source:
<code>protected void addCurrentImageToLayout() { answerLayout.removeView(imageView); if (binaryName != null) { DisplayMetrics metrics = getContext().getResources().getDisplayMetrics(); int screenWidth = metrics.widthPixels; int screenHeight = metrics.heightPixels; File f = new File(getInstanceFolder() + File.separator + binaryName); if (!f.exists()) { f = addDefaultImageIfExists(f); <START> } <END> if (f.exists()) { Bitmap bmp = FileUtils.getBitmapScaledToDisplay(f, screenHeight, screenWidth); if (bmp == null) { errorTextView.setVisibility(View.VISIBLE); } else { imageView = getAnswerImageView(bmp); imageView.setOnClickListener(v -> { if (imageClickHandler != null) { imageClickHandler.clickImage("viewImage"); } }); answerLayout.addView(imageView); } } } }</code><technical_language>I try reference manager resolve ref if works. want copy image want change is in instance (binaryName). instance change if image is replaced (including if image previously jr://images/ is annotated)</technical_language>

Target:
protected void addCurrentImageToLayout() { answerLayout.removeView(imageView); if (binaryName != null) { DisplayMetrics metrics = getContext().getResources().getDisplayMetrics(); int screenWidth = metrics.widthPixels; int screenHeight = metrics.heightPixels; File f = getFile(); if (f.exists()) { Bitmap bmp = FileUtils.getBitmapScaledToDisplay(f, screenHeight, screenWidth); if (bmp == null) { errorTextView.setVisibility(View.VISIBLE); } else { imageView = createAnswerImageView(getContext(), bmp); imageView.setOnClickListener(v -> { if (imageClickHandler != null) { imageClickHandler.clickImage("viewImage"); } }); answerLayout.addView(imageView); } } } }
Source:
<code>public void loadRatisSnapshotIndex() throws IOException { if (ratisSnapshotFile.exists()) { try (BufferedReader reader = new BufferedReader(new FileReader( ratisSnapshotFile))) { String termStr = reader.readLine(); String indexStr = reader.readLine(); updateTermIndex(Long.parseLong(termStr.split(SEPARATOR)[1]), Long.parseLong(indexStr.split(SEPARATOR)[1])); } catch (IOException e) { <START> LOG.error("Failed to load Ratis Snapshot file {}", ratisSnapshotFile); <END> throw e; } } }</code><technical_language>log rethrow. Instead wrap exception in another exception log message rethrow outer exception. <LINK_0> Oracle website some strong text - I is bad of a pattern good avoid</technical_language>

Target:
private void loadRatisSnapshotIndex() throws IOException { if (ratisSnapshotFile.exists()) { RatisSnapshotYaml ratisSnapshotYaml = readRatisSnapshotYaml(); updateTermIndex(ratisSnapshotYaml.term, ratisSnapshotYaml.snapshotIndex); } }
Source:
<code><START> public CopyNumberTriStateHiddenMarkovModel(@Nonnull final TargetLikelihoodCalculator<D> emissionProbabilityCalculator, <END> final double eventStartProbability, final double meanEventSize) { ParamUtils.inRange(eventStartProbability, 0, 1, "Event probability must be between 0 and 1."); ParamUtils.isPositive(meanEventSize, "Mean event size must be positive."); this.eventStartProbability = eventStartProbability; this.meanEventSize = meanEventSize; logTransitionProbabilityCache = new CopyNumberTriStateTransitionProbabilityCache(meanEventSize, eventStartProbability); this.targetLikelihoodCalculator = emissionProbabilityCalculator; }</code><technical_language>@Nonnull annotation useful. start it</technical_language>

Target:
public CopyNumberTriStateHiddenMarkovModel(@Nonnull final TargetLikelihoodCalculator<D> emissionProbabilityCalculator, final double eventStartProbability, final double meanEventSize) { ParamUtils.inRange(eventStartProbability, 0, 1, "Event probability must be between 0 and 1."); ParamUtils.isPositive(meanEventSize, "Mean event size must be positive."); this.eventStartProbability = eventStartProbability; this.meanEventSize = meanEventSize; logTransitionProbabilityCache = new CopyNumberTriStateTransitionProbabilityCache(meanEventSize, eventStartProbability); this.targetLikelihoodCalculator = Utils.nonNull(emissionProbabilityCalculator, "The emission probability calculator must be non-null"); }
Source:
<code>public void tookAndTimedOut_elasticsearch() { <START> Assume.assumeTrue( backendConfiguration instanceof ElasticsearchBackendConfiguration ); <END> OrmUtils.withinJPATransaction( entityManagerFactory, entityManager -> { SearchSession searchSession = Search.session( entityManager ); SearchQuery<Book> query = searchSession.search( Book.class ) .predicate( f -> f.match() .field( "title" ) .matching( "robot" ) ) .toQuery(); ElasticsearchSearchQuery<Book> elasticsearchQuery = query.extension( ElasticsearchExtension.get() ); ElasticsearchSearchResult<Book> result = elasticsearchQuery.fetchAll(); Integer took = result.getTook(); Boolean timedOut = result.getTimedOut(); assertThat( took ).isNotNull(); assertThat( timedOut ).isNotNull(); } ); }</code><technical_language>See, put example in integration test query DSL (not projection DSL) :)</technical_language>

Target:
public void tookAndTimedOut_elasticsearch() { Assume.assumeTrue( backendConfiguration instanceof ElasticsearchBackendConfiguration ); OrmUtils.withinJPATransaction( entityManagerFactory, entityManager -> { SearchSession searchSession = Search.session( entityManager ); SearchQuery<Book> query = searchSession.search( Book.class ) .predicate( f -> f.match() .field( "title" ) .matching( "robot" ) ) .toQuery(); ElasticsearchSearchQuery<Book> elasticsearchQuery = query.extension( ElasticsearchExtension.get() ); ElasticsearchSearchResult<Book> result = elasticsearchQuery.fetchAll(); Duration took = result.getTook(); Boolean timedOut = result.isTimedOut(); assertThat( took ).isNotNull(); assertThat( timedOut ).isNotNull(); } ); }
Source:
<code>private void calculateTxFee() { if (buyerPayoutAmount.getText().length() > 0 && sellerPayoutAmount.getText().length() > 0 && amountInMultisig.getText().length() > 0) { <START> Coin txFeeValue = Coin.parseCoin(amountInMultisig.getText()) <END> .subtract(Coin.parseCoin(buyerPayoutAmount.getText())) .subtract(Coin.parseCoin(sellerPayoutAmount.getText())); txFee.setText(txFeeValue.toPlainString()); } }</code><technical_language>Coin.parseCoin throw exceptions if input format is expected. add a try catch..</technical_language>

Target:
private void calculateTxFee() { if (buyerPayoutAmount.getText().length() > 0 && sellerPayoutAmount.getText().length() > 0 && amountInMultisig.getText().length() > 0) { Coin txFeeValue = getInputFieldAsCoin(amountInMultisig) .subtract(getInputFieldAsCoin(buyerPayoutAmount)) .subtract(getInputFieldAsCoin(sellerPayoutAmount)); txFee.setText(txFeeValue.toPlainString()); } }
Source:
<code>protected void internalReceiveCommand(String itemName, Command command) { logger.debug("internalReceiveCommand() called"); logger.debug("itemName={}", itemName); <START> logger.debug("command={}", command); <END> if (providesBindingFor(itemName)) { for (Enigma2BindingProvider provider : providers) { Enigma2BindingConfig bindingConfig = provider .getBindingConfigFor(itemName); if (bindingConfig == null) { continue; } Enigma2Node node = enigmaNodes.get(bindingConfig.getDeviceId()); if (node == null) { logger.error("Invalid deviceId {}", bindingConfig.getDeviceId()); } switch (bindingConfig.getCmdId()) { case VOLUME: node.setVolume(command); break; case CHANNEL: node.setChannel(command); break; case PAUSE: node.sendPlayPause(command); break; case MUTE: node.sendMuteUnmute(command); break; case REMOTE_CONTROL: node.sendRcCommand(command, bindingConfig.getCmdValue()); break; case POWERSTATE: node.sendOnOff(command, Enigma2PowerState.STANDBY); break; default: logger.error("Unknown cmdId \"{}\"", bindingConfig.getCmdId()); } } } else { logger.trace("No provider found for this item"); } }</code><technical_language>please squash single longline</technical_language>

Target:
protected void internalReceiveCommand(String itemName, Command command) { logger.debug( "internalReceiveCommand() called, itemName={}, command={}", itemName, command); if (providesBindingFor(itemName)) { for (Enigma2BindingProvider provider : providers) { Enigma2BindingConfig bindingConfig = provider .getBindingConfigFor(itemName); if (bindingConfig == null) { continue; } Enigma2Node node = enigmaNodes.get(bindingConfig.getDeviceId()); if (node == null) { logger.error("Invalid deviceId {}", bindingConfig.getDeviceId()); } switch (bindingConfig.getCmdId()) { case VOLUME: node.setVolume(command); break; case CHANNEL: node.setChannel(command); break; case PAUSE: node.sendPlayPause(command); break; case MUTE: node.sendMuteUnmute(command); break; case REMOTECONTROL: node.sendRcCommand(command, bindingConfig.getCmdValue()); break; case POWERSTATE: node.sendOnOff(command, Enigma2PowerState.STANDBY); break; default: logger.error("Unknown cmdId \"{}\"", bindingConfig.getCmdId()); } } } else { logger.trace("No provider found for this item"); } }
Source:
<code>public boolean checkValidity() { boolean isValid = false; try { isValid = !(StringUtils.isBlank(this.getEndpoint()) || StringUtils.isBlank(this.getTypeName())); new URL(this.getEndpoint()).toString(); } catch (MalformedURLException ex) { <START> isValid = false; <END> } return isValid; }</code><technical_language>need this variable starts out false anymore. essentially catch do log trace debug</technical_language>

Target:
public boolean checkValidity() { try { new URL(this.getEndpoint()); return StringUtils.isNotBlank(this.getTypeName()); } catch (MalformedURLException ex) { return false; } }
Source:
<code>public Account createAccount(Account account, String organizationName) { notNull(account, "account"); notNull(organizationName, "organizationName"); try { final UriResponse uriResponse = restTemplate.postForObject(Account.CREATE_URI, account, UriResponse.class, organizationName); return getAccount(Account.getId(uriResponse.getUri())); <START> } catch (GoodDataException | RestClientException e) { <END> throw new GoodDataException("Unable to create account", e); } }</code><technical_language>error states occur</technical_language>

Target:
public Account createAccount(Account account, String organizationName) { notNull(account, "account"); notEmpty(organizationName, "organizationName"); try { final UriResponse uriResponse = restTemplate.postForObject(Account.ACCOUNTS_URI, account, UriResponse.class, organizationName); return getAccount(Account.getId(uriResponse.getUri())); } catch (GoodDataException | RestClientException e) { throw new GoodDataException("Unable to create account", e); } }
Source:
<code>private Guid GetVdsRunOnDestination() { Guid result = Guid.Empty; if (getDestinationVdsId() != null) { VDS target_vds = getVdsDAO().get(getDestinationVdsId()); log.infoFormat("Checking for a specific VDS only - id:{0}, name:{1}, host_name(ip):{2}", getDestinationVdsId(), target_vds.getvds_name(), target_vds.gethost_name()); VmHandler.UpdateVmGuestAgentVersion(getVm()); if (target_vds.getvds_type() == VDSType.PowerClient && !Config.<Boolean> GetValue(ConfigValues.PowerClientAllowRunningGuestsWithoutTools) && getVm() != null && getVm().getHasAgent()) { log.infoFormat( "VdcBLL.RunVmCommandBase.getVdsToRunOn - VM {0} has no tools - skipping power client check", getVm().getId()); <START> } else { <END> result = getVdsToRunOn(Arrays.asList(new VDS[] { target_vds })); } } return result; }</code><technical_language>some problem, change if passed target_vds, getVdsToRun return false, of wrong group_id (less critical) wrong number of cpus, checks removed</technical_language>

Target:
private Guid GetVdsRunOnDestination() { if (getDestinationVdsId() != null) { VDS target_vds = getVdsDAO().get(getDestinationVdsId()); log.infoFormat("Checking for a specific VDS only - id:{0}, name:{1}, host_name(ip):{2}", getDestinationVdsId(), target_vds.getvds_name(), target_vds.gethost_name()); VmHandler.UpdateVmGuestAgentVersion(getVm()); if (target_vds.getvds_type() == VDSType.PowerClient && !Config.<Boolean> GetValue(ConfigValues.PowerClientAllowRunningGuestsWithoutTools) && getVm() != null && getVm().getHasAgent()) { log.infoFormat( "VdcBLL.RunVmCommandBase.getVdsToRunOn - VM {0} has no tools - skipping power client check", getVm().getId()); } else { if (!target_vds.getvds_group_id().equals(getVm().getvds_group_id()) || target_vds.getstatus() != VDSStatus.Up || (target_vds.getcpu_cores() != null && getVm().getnum_of_cpus() > target_vds.getcpu_cores())) { return Guid.Empty; } return getVdsToRunOn(Arrays.asList(new VDS[] { target_vds })); } } return Guid.Empty; }
Source:
<code>private static GerritCallback<JavaScriptObject> cs( final Change.Id id) { return new GerritCallback<JavaScriptObject>() { public void onSuccess(JavaScriptObject result) { redisplay(); } public void onFailure(Throwable err) { if (SubmitFailureDialog.isConflict(err)) { new SubmitFailureDialog(err.getMessage()).center(); redisplay(); } else { super.onFailure(err); } } <START> private void redisplay() { Gerrit.display(PageLinks.toChange2(id)); } <END> }; }</code><technical_language>shorter inline this method</technical_language>

Target:
private static GerritCallback<JavaScriptObject> cs( final Change.Id id) { return new GerritCallback<JavaScriptObject>() { public void onSuccess(JavaScriptObject result) { Gerrit.display(PageLinks.toChange2(id)); } public void onFailure(Throwable err) { if (SubmitFailureDialog.isConflict(err)) { new SubmitFailureDialog(err.getMessage()).center(); Gerrit.display(PageLinks.toChange2(id)); } else { super.onFailure(err); } } }; }
Source:
<code>public void callbackRunsOnlyOnceAsInitializationStatusChanges() { setInitializationStatus(true, true, true, true); Awaitility.waitAtMost(2L, TimeUnit.SECONDS).until(() -> manager.isInitialized()); setInitializationStatus(false, false, false, false); assertNotInitializedWithinTwoSeconds(); setInitializationStatus(true, true, true, true); assertTrue(manager.isInitialized()); <START> verify(mockCallback).runWithRetry(); <END> }</code><technical_language>this verify times(1)</technical_language>

Target:
public void callbackRunsOnlyOnceAsInitializationStatusChanges() { everythingInitialized(); Awaitility.waitAtMost(2L, TimeUnit.SECONDS).until(() -> manager.isInitialized()); nothingInitialized(); assertNotInitializedWithinTwoSeconds(); everythingInitialized(); assertTrue(manager.isInitialized()); verify(mockCallback).runWithRetry(any(SerializableTransactionManager.class)); }
Source:
<code>protected Reader createInputReader(URL apiUrl) throws UnsupportedEncodingException, IOException { <START> if (serverContent == null) { throw new IllegalStateException( "Please specify some server content for images used during the tests. See: TestMediaWikiApiImageFetchingStrategy#serverContent"); } <END> String key = apiUrl.toString(); if (!serverContent.containsKey(key)) { throw new IllegalStateException("Please define a server content used during the tests for the key: " + key); } String pageContent = serverContent.get(key); return new StringReader(pageContent); }</code><technical_language>checkNotNull in constructor instead</technical_language>

Target:
protected Reader createInputReader(URL apiUrl) throws UnsupportedEncodingException, IOException { String key = apiUrl.toString(); if (!serverContent.containsKey(key)) { throw new IllegalStateException("Please define a server content used during the tests for the key: " + key); } String pageContent = serverContent.get(key); return new StringReader(pageContent); }
Source:
<code>public BooleanStreamReader(StreamDescriptor streamDescriptor, LocalMemoryContext systemMemoryContext) { this.streamDescriptor = requireNonNull(streamDescriptor, "stream is null"); <START> this.systemMemoryContext = requireNonNull(systemMemoryContext, "memory context is null"); <END> }</code><technical_language>nit: "systemMemoryContext is null"</technical_language>

Target:
public BooleanStreamReader(StreamDescriptor streamDescriptor, LocalMemoryContext systemMemoryContext) { this.streamDescriptor = requireNonNull(streamDescriptor, "stream is null"); this.systemMemoryContext = requireNonNull(systemMemoryContext, "systemMemoryContext is null"); }
Source:
<code>public void onItemClick(AdapterView<?> parent, View view, int position, long id) { <START> if (position == Settings.NAME.ordinal()){ <END> changeNameListener(); } else if (position == Settings.TYPE.ordinal()){ changeTypeListener(); } else if (position == Settings.IMAGE.ordinal()){ changeImageListener(); } else { addUsersListener(); } }</code><technical_language>consider a switch here</technical_language>

Target:
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Settings[] settings = Settings.values(); switch(settings[position]){ case NAME: changeNameListener(); break; case TYPE: changeTypeListener(); break; case IMAGE: changeImageListener(); break; default: addUsersListener(); break; } }
Source:
<code>private void addToSpread(List<Integer> spread, ZonedDateTime startTime, ZonedDateTime endTime) { int spreadStartIndex = getSpreadIndex(startTime); int spreadEndIndex = getSpreadIndex(endTime); for (int spreadItemIndex = spreadStartIndex; spreadItemIndex <= spreadEndIndex; spreadItemIndex++) { <START> if (spreadItemIndex > 95) <END> break; int durationInSpreadItem = getDurationInSpreadItem(startTime, endTime, spreadStartIndex, spreadEndIndex, spreadItemIndex); spread.set(spreadItemIndex, spread.get(spreadItemIndex) + durationInSpreadItem); } }</code><technical_language>is this</technical_language>

Target:
private void addToSpread(List<Integer> spread, ZonedDateTime startTime, ZonedDateTime endTime) { int spreadStartIndex = getSpreadIndex(startTime); int spreadEndIndex = getSpreadIndex(endTime); for (int spreadItemIndex = spreadStartIndex; spreadItemIndex <= spreadEndIndex; spreadItemIndex++) { if (spreadItemIndex > 95) { break; } int durationInSpreadItem = getDurationInSpreadItem(startTime, endTime, spreadStartIndex, spreadEndIndex, spreadItemIndex); spread.set(spreadItemIndex, spread.get(spreadItemIndex) + durationInSpreadItem); } }
Source:
<code>public ProviderNotificationManager createProviderNotificationManager(final DiagramEventBroker diagramEventBroker, final EObject view, final NotificationListener notificationListener) { <START> if (manager != null) { <END> return manager; } manager = new ProviderNotificationManager(diagramEventBroker, view, notificationListener) { @Override protected void registerListeners() { } }; return manager; }</code><technical_language>'null' operande</technical_language>

Target:
public ProviderNotificationManager createProviderNotificationManager(final DiagramEventBroker diagramEventBroker, final EObject view, final NotificationListener notificationListener) { if (null != manager) { return manager; } manager = new ProviderNotificationManager(diagramEventBroker, view, notificationListener) { @Override protected void registerListeners() { } }; return manager; }
Source:
<code>private TestResult runAll3x() throws Exception { List<String> testClassNames = new ArrayList<>(); Files.walk(Paths.get(projectPath, "target", "test-classes")).forEach(filePath -> { if (Files.isRegularFile(filePath) && filePath.toString().toLowerCase().endsWith(".class")) { String path = Paths.get(projectPath, "target", "test-classes").relativize(filePath).toString(); <START> String className = path.replace('/', '.'); <END> className = className.replace('\\', '.'); className = className.substring(0, className.length() - 6); testClassNames.add(className); } }); List<Class> testableClasses = new ArrayList<>(); for (String className : testClassNames) { Class<?> clazz = Class.forName(className, false, projectClassLoader); if (isTestable3x(clazz)) { testableClasses.add(clazz); } } return run3xTestClasses(testableClasses.toArray(new Class[testableClasses.size()])); }</code><technical_language>file separator</technical_language>

Target:
private TestResult runAll3x() throws Exception { List<String> testClassNames = new ArrayList<>(); Files.walk(Paths.get(projectPath, "target", "test-classes")).forEach(filePath -> { if (Files.isRegularFile(filePath) && filePath.toString().toLowerCase().endsWith(".class")) { String path = Paths.get(projectPath, "target", "test-classes").relativize(filePath).toString(); String className = path.replace(File.separatorChar, '.'); className = className.substring(0, className.length() - 6); testClassNames.add(className); } }); List<Class> testableClasses = new ArrayList<>(); for (String className : testClassNames) { Class<?> clazz = Class.forName(className, false, projectClassLoader); if (isTestable3x(clazz)) { testableClasses.add(clazz); } } return run3xTestClasses(testableClasses.toArray(new Class[testableClasses.size()])); }
Source:
<code><START> public void shouldRecordBufferedRecords() { <END> task = createStatelessTask(createConfig(false, "0"), StreamsConfig.METRICS_LATEST); final KafkaMetric metric = getMetric("active-process", "%s-ratio", task.id().toString(), StreamsConfig.METRICS_LATEST); assertThat(metric.metricValue(), equalTo(0.0d)); task.recordProcessBatchTime(10L); task.recordProcessBatchTime(15L); task.recordProcessTimeRatioAndBufferSize(100L); assertThat(metric.metricValue(), equalTo(0.25d)); task.recordProcessBatchTime(10L); assertThat(metric.metricValue(), equalTo(0.25d)); task.recordProcessBatchTime(10L); task.recordProcessTimeRatioAndBufferSize(20L); assertThat(metric.metricValue(), equalTo(1.0d)); }</code><technical_language>req: names of this method previous method switched</technical_language>

Target:
public void shouldRecordBufferedRecords() { task = createStatelessTask(createConfig(false, "0"), StreamsConfig.METRICS_LATEST); final KafkaMetric metric = getMetric("active-buffer", "%s-count", task.id().toString(), StreamsConfig.METRICS_LATEST); assertThat(metric.metricValue(), equalTo(0.0d)); task.addRecords(partition1, asList( getConsumerRecord(partition1, 10), getConsumerRecord(partition1, 20) )); task.recordProcessTimeRatioAndBufferSize(100L); assertThat(metric.metricValue(), equalTo(2.0d)); task.process(0L); task.recordProcessTimeRatioAndBufferSize(100L); assertThat(metric.metricValue(), equalTo(1.0d)); }
Source:
<code>private void copyParentDetails(final BasicDBObject insertQuery, final String itemId, final School.ItemType itemType, final String parentId) throws DatabaseAccessException { final School.ItemType collectionType = getParentItemType(itemType); final DBCollection collection = database.getCollection(getCollectionFromType(collectionType)); final DBObject result = collection.findOne(new ObjectId(parentId), new BasicDBObject(DatabaseStringConstants.USER_LIST, true) .append(DatabaseStringConstants.COURSE_ID, true) .append(DatabaseStringConstants.OWNER_ID, true)); if (result == null) { <START> throw new DatabaseAccessException("The item with the id " + itemId + " Was not found in the database"); <END> } result.removeField(DatabaseStringConstants.SELF_ID); insertQuery.putAll(result); }</code><technical_language>lowercase "W" in "was". Add a period end of message</technical_language>

Target:
private void copyParentDetails(final BasicDBObject insertQuery, final String itemId, final School.ItemType itemType, final String parentId) throws DatabaseAccessException { final School.ItemType collectionType = getParentItemType(itemType); final DBCollection collection = database.getCollection(getCollectionFromType(collectionType)); final DBObject result = collection.findOne(new ObjectId(parentId), new BasicDBObject(DatabaseStringConstants.USER_LIST, true) .append(DatabaseStringConstants.COURSE_ID, true) .append(DatabaseStringConstants.OWNER_ID, true)); if (result == null) { throw new DatabaseAccessException("The item with the id " + itemId + " was not found in the database."); } result.removeField(DatabaseStringConstants.SELF_ID); insertQuery.putAll(result); }
Source:
<code>private void updateQuota(StoragePool datacenter) { if (datacenter.getQuotaEnforcementType().equals(QuotaEnforcementTypeEnum.DISABLED) || !getDiskStorageType().getEntity().isInternal()) { getQuota().setIsAvailable(false); return; } getQuota().setIsAvailable(true); StorageDomain storageDomain = getStorageDomain().getSelectedItem(); if (storageDomain == null) { return; } IdQueryParameters parameters = new IdQueryParameters(storageDomain.getId()); Frontend.getInstance().runQuery(VdcQueryType.GetAllRelevantQuotasForStorage, parameters, new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object innerModel, Object innerReturnValue) { ArrayList<Quota> quotaList = ((VdcQueryReturnValue) innerReturnValue).getReturnValue(); if (quotaList != null && !quotaList.isEmpty()) { getQuota().setItems(quotaList); } Guid diskQuota = getDisk() != null ? ((DiskImage) getDisk()).getQuotaId() : null; Guid vmQuota = getVm() != null ? getVm().getQuotaId() : null; Guid defaultQuota = diskQuota != null ? diskQuota : vmQuota; if (defaultQuota == null) { return; } for (Quota quota : quotaList) { if (quota.getId().equals(defaultQuota)) { getQuota().setSelectedItem(quota); return; } } if (diskQuota != null) { Quota quota = new Quota(); quota.setId(diskQuota); quota.setQuotaName(getDiskImage().getQuotaName()); <START> quotaList.add(quota); <END> getQuota().setItems(quotaList); getQuota().setSelectedItem(quota); } } })); }</code><technical_language>this add vm/disk quota is list bottom, instead of top requested in bug? UI renders list. I guess is in order. If so, this element pushed (use linkedList?)</technical_language>

Target:
private void updateQuota(StoragePool datacenter) { if (datacenter.getQuotaEnforcementType().equals(QuotaEnforcementTypeEnum.DISABLED) || !getDiskStorageType().getEntity().isInternal()) { getQuota().setIsAvailable(false); return; } getQuota().setIsAvailable(true); StorageDomain storageDomain = getStorageDomain().getSelectedItem(); if (storageDomain == null) { return; } IdQueryParameters parameters = new IdQueryParameters(storageDomain.getId()); Frontend.getInstance().runQuery(VdcQueryType.GetAllRelevantQuotasForStorage, parameters, new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object innerModel, Object innerReturnValue) { ArrayList<Quota> quotaList = ((VdcQueryReturnValue) innerReturnValue).getReturnValue(); if (quotaList != null && !quotaList.isEmpty()) { getQuota().setItems(quotaList); } Guid diskQuota = getDisk() != null ? ((DiskImage) getDisk()).getQuotaId() : null; Guid vmQuota = getVm() != null ? getVm().getQuotaId() : null; Guid defaultQuota = diskQuota != null ? diskQuota : vmQuota; if (defaultQuota == null) { return; } if (quotaList != null) { for (Quota quota : quotaList) { if (quota.getId().equals(defaultQuota)) { getQuota().setSelectedItem(quota); return; } } } if (diskQuota != null) { Quota quota = new Quota(); quota.setId(diskQuota); quota.setQuotaName(getDiskImage().getQuotaName()); if (quotaList == null){ quotaList = new ArrayList<>(); } quotaList.add(quota); getQuota().setItems(quotaList); getQuota().setSelectedItem(quota); } } })); }
Source:
<code>public String toString() { StringBuilder builder = new StringBuilder(); builder.append(getName()) .append(" {id=") .append(getId()) .append(", networkId=") .append(getNetworkId()) <START> .append(", networkQoSId=") <END> .append(getNetworkQoSId()) .append(", portMirroring=") .append(isPortMirroring()) .append(", customProperties=") .append(getCustomProperties()) .append(", description=") .append(getDescription()) .append("}"); return builder.toString(); }</code><technical_language>s/networkQoSId/networkQosId</technical_language>

Target:
public String toString() { StringBuilder builder = new StringBuilder(); builder.append(getName()) .append(" {id=") .append(getId()) .append(", networkId=") .append(getNetworkId()) .append(", networkQosId=") .append(getNetworkQosId()) .append(", portMirroring=") .append(isPortMirroring()) .append(", customProperties=") .append(getCustomProperties()) .append(", description=") .append(getDescription()) .append("}"); return builder.toString(); }
Source:
<code>private NPFPacket decipherFromSeqnum(byte[] buf, int offset, int length, SessionKey sessionKey, int sequenceNumber) { BlockCipher ivCipher = sessionKey.ivCipher; byte[] IV = new byte[ivCipher.getBlockSize() / 8]; System.arraycopy(sessionKey.ivNonce, 0, IV, 0, IV.length); IV[IV.length - 4] = (byte) (sequenceNumber >>> 24); IV[IV.length - 3] = (byte) (sequenceNumber >>> 16); IV[IV.length - 2] = (byte) (sequenceNumber >>> 8); IV[IV.length - 1] = (byte) (sequenceNumber); ivCipher.encipher(IV, IV); byte[] payload = Arrays.copyOfRange(buf, offset + hmacLength, offset + length); byte[] hash = Arrays.copyOfRange(buf, offset, offset + hmacLength); <START> byte[] localHash = Arrays.copyOf(HMAC.macWithSHA256(sessionKey.hmacKey, payload), HMAC_LENGTH); <END> if (!MessageDigest.isEqual(hash, localHash)) { if (logMINOR) { Logger.minor(this, "Failed to validate the HMAC using TrackerID="+sessionKey.trackerID); } return null; } PCFBMode payloadCipher = PCFBMode.create(sessionKey.incommingCipher, IV); payloadCipher.blockDecipher(payload, 0, payload.length); NPFPacket p = NPFPacket.create(payload, pn); NewPacketFormatKeyContext keyContext = sessionKey.packetContext; synchronized(this) { if(seqNumGreaterThan(sequenceNumber, keyContext.highestReceivedSeqNum, 31)) { keyContext.highestReceivedSeqNum = sequenceNumber; } } return p; }</code><technical_language>rest of code, including lines this one, hmacLength instead of HMAC_LENGTH. Please choose one</technical_language>

Target:
private NPFPacket decipherFromSeqnum(byte[] buf, int offset, int length, SessionKey sessionKey, int sequenceNumber) { BlockCipher ivCipher = sessionKey.ivCipher; byte[] IV = new byte[ivCipher.getBlockSize() / 8]; System.arraycopy(sessionKey.ivNonce, 0, IV, 0, IV.length); IV[IV.length - 4] = (byte) (sequenceNumber >>> 24); IV[IV.length - 3] = (byte) (sequenceNumber >>> 16); IV[IV.length - 2] = (byte) (sequenceNumber >>> 8); IV[IV.length - 1] = (byte) (sequenceNumber); ivCipher.encipher(IV, IV); byte[] payload = Arrays.copyOfRange(buf, offset + HMAC_LENGTH, offset + length); byte[] hash = Arrays.copyOfRange(buf, offset, offset + HMAC_LENGTH); byte[] localHash = Arrays.copyOf(HMAC.macWithSHA256(sessionKey.hmacKey, payload), HMAC_LENGTH); if (!MessageDigest.isEqual(hash, localHash)) { if (logMINOR) { Logger.minor(this, "Failed to validate the HMAC using TrackerID="+sessionKey.trackerID); } return null; } PCFBMode payloadCipher = PCFBMode.create(sessionKey.incommingCipher, IV); payloadCipher.blockDecipher(payload, 0, payload.length); NPFPacket p = NPFPacket.create(payload, pn); NewPacketFormatKeyContext keyContext = sessionKey.packetContext; synchronized(this) { if(seqNumGreaterThan(sequenceNumber, keyContext.highestReceivedSeqNum, 31)) { keyContext.highestReceivedSeqNum = sequenceNumber; } } return p; }
Source:
<code>public void cannot_delete_built_in_profile_even_when_non_default() { QualityProfile builtInProfile = getProfile(p -> p.getIsBuiltIn() && "Basic".equals(p.getName()) && "xoo".equals(p.getLanguage())); QualityProfiles.CopyWsResponse copiedProfile = adminWsClient.qualityProfiles().copy(new CopyRequest(builtInProfile.getKey(), randomAscii(20))); adminWsClient.qualityProfiles().setDefault(new SetDefaultRequest(copiedProfile.getKey())); try { adminWsClient.qualityProfiles().delete(new DeleteRequest(builtInProfile.getKey())); } catch (HttpException e) { assertThat(e.code()).isEqualTo(400); <START> assertThat(e.content()).contains("Operation forbidden for built-in Quality Profile 'Basic' with language 'xoo'"); <END> } }</code><technical_language>fail() is missing in try-catch</technical_language>

Target:
public void cannot_delete_built_in_profile_even_when_non_default() { QualityProfile defaultBuiltInProfile = getProfile(p -> p.getIsBuiltIn() && p.getIsDefault() && "Basic".equals(p.getName()) && "xoo".equals(p.getLanguage())); QualityProfiles.CopyWsResponse copiedProfile = adminWsClient.qualityProfiles().copy(new CopyRequest(defaultBuiltInProfile.getKey(), randomAscii(20))); adminWsClient.qualityProfiles().setDefault(new SetDefaultRequest(copiedProfile.getKey())); try { adminWsClient.qualityProfiles().delete(new DeleteRequest(defaultBuiltInProfile.getKey())); fail(); } catch (HttpException e) { assertThat(e.code()).isEqualTo(400); assertThat(e.content()).contains("Operation forbidden for built-in Quality Profile 'Basic' with language 'xoo'"); } finally { adminWsClient.qualityProfiles().setDefault(new SetDefaultRequest(defaultBuiltInProfile.getKey())); adminWsClient.qualityProfiles().delete(new DeleteRequest(copiedProfile.getKey())); } }
Source:
<code>private Constraint parseOR() { List<Constraint> constraints = Lists.newArrayList(); while (!reader.current().isEndOfInput() && !reader.current().is(')')) { Constraint inner = parseAND(); if (inner != null) { constraints.add(inner); } if (!isAtOR(reader)) { break; } else { reader.consume(2); } } if (constraints.isEmpty()) { return null; } else { <START> System.out.println(constraints); <END> return Or.of(constraints); } }</code><technical_language>woot</technical_language>

Target:
private Constraint parseOR() { List<Constraint> constraints = Lists.newArrayList(); while (!reader.current().isEndOfInput() && !reader.current().is(')')) { Constraint inner = parseAND(); if (inner != null) { constraints.add(inner); } if (!isAtOR(reader)) { break; } else { reader.consume(2); } } if (constraints.isEmpty()) { return null; } else { return Or.of(constraints); } }
Source:
<code>private static String toLispString(Tree<?> tree) { final String value = String.valueOf(tree.getValue()); if (tree.isLeaf()) { return value; } else { <START> return "(" + value + " " + (tree.getChildren().map(Node::toLispString).mkString(" ")) + ")"; <END> } }</code><technical_language>please separate computations string concatenation</technical_language>

Target:
private static String toLispString(Tree<?> tree) { final String value = String.valueOf(tree.getValue()); if (tree.isLeaf()) { return value; } else { final String children = tree.getChildren().map(Node::toLispString).mkString(" "); return "(" + value + " " + children + ")"; } }
Source:
<code>public void createVersionSnapshot(final String path,final String versionId) { try { final FcrepoHttpClientBuilder client = new FcrepoHttpClientBuilder(username, password, new URI(baseUri).toURL().getHost()); <START> final CloseableHttpClient c = client.build(); <END> final HttpMethods method = HttpMethods.POST; final URI uri = pathToURI(path + "/fcr:versions"); final HttpEntityEnclosingRequestBase request = (HttpEntityEnclosingRequestBase) method.createRequest(uri); request.addHeader("Slug", versionId); final HttpResponse response = c.execute(request); final int statusCode = response.getStatusLine().getStatusCode(); if (!(statusCode >= 200 && statusCode < 300)) { throw new RuntimeException("Unable to create version! " + response.getStatusLine().toString()); } } catch (URISyntaxException | IOException e) { throw new RuntimeException(e); } }</code><technical_language>This belongs a try-with-resource</technical_language>

Target:
public void createVersionSnapshot(final String path,final String versionId) { try { final FcrepoHttpClientBuilder client = new FcrepoHttpClientBuilder(username, password, new URI(baseUri).toURL().getHost()); try (final CloseableHttpClient c = client.build()) { final HttpMethods method = HttpMethods.POST; final URI uri = pathToURI(path + "/fcr:versions"); final HttpEntityEnclosingRequestBase request = (HttpEntityEnclosingRequestBase) method.createRequest(uri); request.addHeader("Slug", versionId); try (final CloseableHttpResponse response = c.execute(request)) { final int statusCode = response.getStatusLine().getStatusCode(); if (!(statusCode >= 200 && statusCode < 300)) { throw new RuntimeException("Unable to create version! " + response.getStatusLine().toString()); } } } } catch (URISyntaxException | IOException e) { throw new RuntimeException(e); } }
Source:
<code><START> public void testMethodFilter_EnumValues() { <END> analyzer.visit(Opcodes.V1_5, Opcodes.ACC_PUBLIC, "Foo", null, "java/lang/Enum", null); final MethodProbesVisitor mv = analyzer.visitMethod(0, "values", "()V", null, null); assertNull(mv); assertTrue(coverage.getMethods().isEmpty()); }</code><technical_language>@Godin a negative test for signature</technical_language>

Target:
public void testMethodFilter_EnumValues() { analyzer.visit(Opcodes.V1_5, Opcodes.ACC_PUBLIC, "Foo", null, "java/lang/Enum", null); final MethodProbesVisitor mv = analyzer.visitMethod(0, "values", "()[LFoo;", null, null); assertNull(mv); assertTrue(coverage.getMethods().isEmpty()); }
Source:
<code>public PurgeUpToDatePopup(FormSummary formSummary) { super(); this.summary = formSummary; confirm = new AggregateButton(BUTTON_TXT, TOOLTIP_TXT, HELP_BALLOON_TXT); confirm.addClickHandler(new PurgeHandler()); confirm.setEnabled(false); picker = new DatePicker(); picker.addValueChangeHandler(new ValueChangeHandler<Date>() { @Override public void onValueChange(ValueChangeEvent<Date> event) { if ( selectedDate != null ) { picker.removeStyleFromDates("datePickerDayIsSelectedAndHighlighted", selectedDate); } selectedDate = event.getValue(); if ( selectedDate != null ) { picker.addTransientStyleToDates("datePickerDayIsSelectedAndHighlighted", selectedDate); } confirm.setEnabled(selectedDate != null); }}); FlexTable layout = new FlexTable(); layout.setWidget(0, 0, new HTML(new SafeHtmlBuilder() .appendEscaped("Purge submissions data for:") .appendHtmlConstant("<br/>") <START> .appendHtmlConstant("<b>" + summary.getTitle() + " [" + summary.getId() + "]</b>") <END> .appendHtmlConstant("<br>") .appendEscaped("up to the chosen GMT date.") .appendHtmlConstant("<br>") .appendEscaped("Incomplete submissions will") .appendHtmlConstant("<br>") .appendEscaped("not be deleted.") .toSafeHtml())); layout.setWidget(0, 1, picker); layout.setWidget(0, 2, confirm); layout.setWidget(0, 3, new ClosePopupButton(this)); setWidget(layout); }</code><technical_language>this change formSummary summary</technical_language>

Target:
public PurgeUpToDatePopup(FormSummary formSummary) { super(); this.summary = formSummary; confirm = new AggregateButton(BUTTON_TXT, TOOLTIP_TXT, HELP_BALLOON_TXT); confirm.addClickHandler(new PurgeHandler()); confirm.setEnabled(false); picker = new DatePicker(); picker.addValueChangeHandler(new ValueChangeHandler<Date>() { @Override public void onValueChange(ValueChangeEvent<Date> event) { if ( selectedDate != null ) { picker.removeStyleFromDates("datePickerDayIsSelectedAndHighlighted", selectedDate); } selectedDate = event.getValue(); if ( selectedDate != null ) { picker.addTransientStyleToDates("datePickerDayIsSelectedAndHighlighted", selectedDate); } confirm.setEnabled(selectedDate != null); }}); FlexTable layout = new FlexTable(); layout.setWidget(0, 0, new HTML(new SafeHtmlBuilder() .appendEscaped("Purge submissions data for:") .appendHtmlConstant("<br/>") .appendHtmlConstant("<b>" + formSummary.getTitle() + " [" + formSummary.getId() + "]</b>") .appendHtmlConstant("<br>") .appendEscaped("up to the chosen GMT date.") .appendHtmlConstant("<br>") .appendEscaped("Incomplete submissions will") .appendHtmlConstant("<br>") .appendEscaped("not be deleted.") .toSafeHtml())); layout.setWidget(0, 1, picker); layout.setWidget(0, 2, confirm); layout.setWidget(0, 3, new ClosePopupButton(this)); setWidget(layout); }