auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void runAutonomous() throws InterruptedException, AutonomousModeOverException { float startAngle = HeadingSensor.absoluteYaw.get(); setClampOpen(true); waitUntilNot(Clamp.waitingForAutoCalibration); startSetClampHeight(0.4f); <START> collectTote(shake.get(), 3500); <END> setClampHeight(0.0f); singleSideTurn((long) (containerTurnTime.get() * 1000), true); pickupContainer(nudge.get()); float nextAngle = HeadingSensor.absoluteYaw.get(); turnAbsolute(startAngle, -autoZoneAngle.get(), true); waitForTime(500); float curAngle = HeadingSensor.absoluteYaw.get(); Logger.info("Actual angle: " + (curAngle - startAngle) + " based on " + startAngle + "/" + nextAngle + "/" + curAngle); float now = Utils.getCurrentTimeSeconds(); Logger.info("Setting to mechanum: " + DriveCode.leftEncoder.get() + " and " + autoZoneDistance.get()); DriveCode.octocanumShifting.set(true); drive(autoZoneDistance.get(), autoZoneSpeed.get()); Rollers.closed.set(false); driveForTime((long) (autoZoneTime.get() * 1000), autoZoneSpeed.get()); Logger.info("Setting to traction: " + (Utils.getCurrentTimeSeconds() - now) + ": " + DriveCode.leftEncoder.get()); DriveCode.octocanumShifting.set(false); }</code><technical_language>this tunable</technical_language>

Target:
protected void runAutonomous() throws InterruptedException, AutonomousModeOverException { float startAngle = HeadingSensor.absoluteYaw.get(); setClampOpen(true); waitUntilNot(Clamp.waitingForAutoCalibration); startSetClampHeight(0.4f); collectTote(shake.get(), (int) (toteCollectTime.get() * 1000)); setClampHeight(0.0f); singleSideTurn((long) (containerTurnTime.get() * 1000), true); pickupContainer(nudge.get()); float nextAngle = HeadingSensor.absoluteYaw.get(); turnAbsolute(startAngle, -autoZoneAngle.get(), true); waitForTime(500); float curAngle = HeadingSensor.absoluteYaw.get(); Logger.info("Actual angle: " + (curAngle - startAngle) + " based on " + startAngle + "/" + nextAngle + "/" + curAngle); float now = Utils.getCurrentTimeSeconds(); Logger.info("About to drive: " + DriveCode.leftEncoder.get() + " and " + autoZoneDistance.get()); drive(autoZoneDistance.get(), autoZoneSpeed.get()); Rollers.closed.set(false); driveForTime((long) (autoZoneTime.get() * 1000), autoZoneSpeed.get()); Logger.info("Finished: " + (Utils.getCurrentTimeSeconds() - now) + ": " + DriveCode.leftEncoder.get()); }
Source:
<code>public void init(IActionBars bars) { super.init(bars); bars.setGlobalActionHandler(GlobalActionId.SAVE, null); bars.getToolBarManager().add(new DocumentationMenuAction()); <START> removeAppearanceButtonsInSimulationAndTestingPerspective(bars); <END> bars.getToolBarManager().remove(ActionIds.MENU_ARRANGE); bars.getMenuManager().findMenuUsingPath(ActionIds.MENU_DIAGRAM).remove(ActionIds.MENU_ARRANGE); }</code><technical_language>Rename more readable, e.g. showButtonsBasedOnPerspective shorter showButtonsByPerspective</technical_language>

Target:
public void init(IActionBars bars) { super.init(bars); bars.getToolBarManager().insertBefore(ActionIds.CUSTOM_ZOOM, new DocumentationMenuAction()); bars.setGlobalActionHandler(GlobalActionId.SAVE, null); showButtonsByPerspective(bars); bars.getToolBarManager().remove(ActionIds.MENU_ARRANGE); bars.getMenuManager().findMenuUsingPath(ActionIds.MENU_DIAGRAM).remove(ActionIds.MENU_ARRANGE); }
Source:
<code>public String weather() { <START> String result = this.restTemplate.getForObject("http://" + WEATHER_SERVICE + "/weather", String.class); <END> return "Weather Service Response: " + result; }</code><technical_language>this is redundant here</technical_language>

Target:
public String weather() { String result = restTemplate.getForObject("http://" + WEATHER_SERVICE + "/weather", String.class); return "Weather Service Response: " + result; }
Source:
<code>private void createKafkaTasksForGroup(int groupId, int replicas) { Map<Integer, Long> startPartitions = taskGroups.get(groupId).partitionOffsets; Map<Integer, Long> endPartitions = new HashMap<>(); for (Integer partition : startPartitions.keySet()) { endPartitions.put(partition, Long.MAX_VALUE); } String sequenceName = generateSequenceName(groupId); Map<String, String> consumerProperties = Maps.newHashMap(ioConfig.getConsumerProperties()); DateTime minimumMessageTime = taskGroups.get(groupId).minimumMessageTime.orNull(); DateTime maximumMessageTime = taskGroups.get(groupId).maximumMessageTime.orNull(); KafkaIOConfig kafkaIOConfig = new KafkaIOConfig( sequenceName, new KafkaPartitions(ioConfig.getTopic(), startPartitions), new KafkaPartitions(ioConfig.getTopic(), endPartitions), consumerProperties, true, false, minimumMessageTime, maximumMessageTime, ioConfig.isSkipOffsetGaps() ); for (int i = 0; i < replicas; i++) { String taskId = Joiner.on("_").join(sequenceName, getRandomId()); KafkaIndexTask indexTask = new KafkaIndexTask( taskId, new TaskResource(sequenceName, 1), spec.getDataSchema(), taskTuningConfig, kafkaIOConfig, spec.getContext(), null, <START> new AuthConfig(), <END> null ); Optional<TaskQueue> taskQueue = taskMaster.getTaskQueue(); if (taskQueue.isPresent()) { try { taskQueue.get().add(indexTask); } catch (EntryExistsException e) { log.error("Tried to add task [%s] but it already exists", indexTask.getId()); } } else { log.error("Failed to get task queue because I'm not the leader!"); } } }</code><technical_language>this authConfig field instead</technical_language>

Target:
private void createKafkaTasksForGroup(int groupId, int replicas) { Map<Integer, Long> startPartitions = taskGroups.get(groupId).partitionOffsets; Map<Integer, Long> endPartitions = new HashMap<>(); for (Integer partition : startPartitions.keySet()) { endPartitions.put(partition, Long.MAX_VALUE); } String sequenceName = generateSequenceName(groupId); Map<String, String> consumerProperties = Maps.newHashMap(ioConfig.getConsumerProperties()); DateTime minimumMessageTime = taskGroups.get(groupId).minimumMessageTime.orNull(); DateTime maximumMessageTime = taskGroups.get(groupId).maximumMessageTime.orNull(); KafkaIOConfig kafkaIOConfig = new KafkaIOConfig( sequenceName, new KafkaPartitions(ioConfig.getTopic(), startPartitions), new KafkaPartitions(ioConfig.getTopic(), endPartitions), consumerProperties, true, false, minimumMessageTime, maximumMessageTime, ioConfig.isSkipOffsetGaps() ); for (int i = 0; i < replicas; i++) { String taskId = Joiner.on("_").join(sequenceName, getRandomId()); KafkaIndexTask indexTask = new KafkaIndexTask( taskId, new TaskResource(sequenceName, 1), spec.getDataSchema(), taskTuningConfig, kafkaIOConfig, spec.getContext(), null, null ); Optional<TaskQueue> taskQueue = taskMaster.getTaskQueue(); if (taskQueue.isPresent()) { try { taskQueue.get().add(indexTask); } catch (EntryExistsException e) { log.error("Tried to add task [%s] but it already exists", indexTask.getId()); } } else { log.error("Failed to get task queue because I'm not the leader!"); } } }
Source:
<code>public void deleteAndDeleteAll() { final Realm realm = looperThread.realm; realm.beginTransaction(); for (int i = 0; i < 10; i++) { StringOnly stringOnly = realm.createObject(StringOnly.class); stringOnly.setChars("String " + i); } realm.commitTransaction(); RealmResults<StringOnly> stringOnlies = realm.where(StringOnly.class).findAll(); realm.beginTransaction(); stringOnlies.get(0).deleteFromRealm(); realm.commitTransaction(); realm.beginTransaction(); stringOnlies.deleteAllFromRealm(); realm.commitTransaction(); assertEquals(0, realm.where(StringOnly.class).findAll().size()); <START> looperThread.postRunnable(new Runnable() { <END> @Override public void run() { realm.close(); looperThread.testComplete(); } }); }</code><technical_language>need for this @RunTestInLooperTread. test assert fine</technical_language>

Target:
public void deleteAndDeleteAll() { realm.beginTransaction(); for (int i = 0; i < 10; i++) { StringOnly stringOnly = realm.createObject(StringOnly.class); stringOnly.setChars("String " + i); } realm.commitTransaction(); RealmResults<StringOnly> stringOnlies = realm.where(StringOnly.class).findAll(); realm.beginTransaction(); stringOnlies.get(0).deleteFromRealm(); realm.commitTransaction(); realm.beginTransaction(); stringOnlies.deleteAllFromRealm(); realm.commitTransaction(); assertEquals(0, realm.where(StringOnly.class).findAll().size()); }
Source:
<code>public void scanEntries(BinaryDequeScanner scanner) throws IOException { if (m_closed) { throw new IOException("Cannot scanForGap(): PBD has been closed"); } assertions(); if (m_segments.isEmpty()) { if (m_usageSpecificLog.isDebugEnabled()) { m_usageSpecificLog.debug("PBD " + m_nonce + " has no finished segments"); } return; } List<PBDSegment> toQuarantine = new ArrayList<>(); for (PBDSegment segment : m_segments.values()) { try { m_numObjects -= segment.scan(scanner); } catch (IOException e) { <START> LOG.warn("Error scanning segment: " + segment.file() + ". Qurantining segment."); <END> toQuarantine.add(segment); } } for (PBDSegment segment : toQuarantine) { quarantineSegment(segment, segment.getNumEntries()); } return; }</code><technical_language>Typo</technical_language>

Target:
public void scanEntries(BinaryDequeScanner scanner) throws IOException { if (m_closed) { throw new IOException("Cannot scanForGap(): PBD has been closed"); } assertions(); if (m_segments.isEmpty()) { if (m_usageSpecificLog.isDebugEnabled()) { m_usageSpecificLog.debug("PBD " + m_nonce + " has no finished segments"); } return; } List<PBDSegment> toQuarantine = new ArrayList<>(); for (PBDSegment segment : m_segments.values()) { try { int truncatedEntries = segment.scan(scanner); if (truncatedEntries > 0) { m_numObjects -= truncatedEntries; if (segment.getNumEntries() == 0) { toQuarantine.add(segment); } } } catch (IOException e) { m_usageSpecificLog.warn("Error scanning segment: " + segment.file() + ". Quarantining segment."); toQuarantine.add(segment); } } for (PBDSegment segment : toQuarantine) { quarantineSegment(segment, segment.getNumEntries()); } return; }
Source:
<code>private boolean validateDevices() { Set<String> devices = getParameters().getDevicesToReduce().stream().collect(toSet()); if (devices.size() != getParameters().getDevicesToReduce().size()) { return validate(new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_DUPLICATE_DEVICE)); } if (getParameters().getDevicesToReduce().size() == lunDao.getAllForVolumeGroup(getStorageDomain().getStorage()).size()) { <START> return validate(new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_CANNOT_REMOVE_ALL_LUNS)); <END> } return validate(blockSDValidator.lunsInDomain(getStorageDomain(), devices)) && validate(blockSDValidator.lunsEligibleForOperation(getStorageDomain(), devices)); }</code><technical_language>return failValidation(ValidationResult(EngineMessage.ACTION_TYPE_FAILED_CANNOT_REMOVE_ALL_LUNS)</technical_language>

Target:
private boolean validateDevices() { Set<String> devices = getParameters().getDevicesToReduce().stream().collect(toSet()); if (devices.size() != getParameters().getDevicesToReduce().size()) { return validate(new ValidationResult(EngineMessage.ACTION_TYPE_FAILED_DUPLICATE_DEVICE)); } return validate(blockSDValidator.lunsInDomain(getStorageDomain(), devices)) && validate(blockSDValidator.lunsEligibleForOperation(getStorageDomain(), devices)); }
Source:
<code>public Response uploadFile( @FormDataParam("file") InputStream uploadedInputStream, @FormDataParam("file") FormDataContentDisposition fileDetail) { Config config = createConfig(); if (uploadedInputStream == null) { <START> return Response.status(Response.Status.BAD_REQUEST).build(); <END> } if (fileDetail == null) { return Response.status(Response.Status.BAD_REQUEST).build(); } String uploadDir = config.getStringValue(FILE_SYSTEM_DIRECTORY); String fileName = UUID.randomUUID() + "-" + fileDetail.getFileName(); String uploadedFileLocation = uploadDir + "/" + fileName; writeToFile(uploadedInputStream, uploadedFileLocation); String uri = String.format("http://%s:%s/api/v1/file/download/%s", (hostname != null) ? hostname : ip, getPort(), fileName); return Response.status(Response.Status.OK).entity(uri).build(); }</code><technical_language>add some useful error messages here? some private helper methods (that refactored out) in TopologyResources this</technical_language>

Target:
public Response uploadFile( @FormDataParam("file") InputStream uploadedInputStream, @FormDataParam("file") FormDataContentDisposition fileDetail) { Config config = createConfig(); if (uploadedInputStream == null) { String msg = "input stream is null"; LOG.error(msg); return Response.status(Response.Status.BAD_REQUEST) .type(MediaType.APPLICATION_JSON) .entity(Utils.createMessage(msg)).build(); } if (fileDetail == null) { String msg = "form data content disposition is null"; LOG.error(msg); return Response.status(Response.Status.BAD_REQUEST) .type(MediaType.APPLICATION_JSON) .entity(Utils.createMessage(msg)).build(); } String uploadDir = config.getStringValue(FILE_SYSTEM_DIRECTORY); String fileName = UUID.randomUUID() + "-" + fileDetail.getFileName(); String uploadedFileLocation = uploadDir + "/" + fileName; try { FileHelper.writeToFile(uploadedInputStream, uploadedFileLocation); } catch (IOException e) { LOG.error("error uploading file {}", fileDetail.getFileName(), e); return Response.serverError() .type(MediaType.APPLICATION_JSON) .entity(Utils.createMessage(e.getMessage())) .build(); } String uri = String.format("http://%s:%s/api/v1/file/download/%s", (hostname != null) ? hostname : ip, getPort(), fileName); return Response.status(Response.Status.OK).entity(uri).build(); }
Source:
<code><START> static boolean isOfflineOnly(int networkPolicy) { <END> return (networkPolicy & NetworkPolicy.OFFLINE.index) == NetworkPolicy.OFFLINE.index; }</code><technical_language>methods need public, do I integer passed Downloader means</technical_language>

Target:
public static boolean isOfflineOnly(int networkPolicy) { return (networkPolicy & NetworkPolicy.OFFLINE.index) != 0; }
Source:
<code>public static void cleanupBuckets() throws IOException { GoogleCloudStorage rawStorage = createGoogleCloudStorage(); List<GoogleCloudStorageItemInfo> objectsToDelete = rawStorage.listObjectInfo( BUCKET_NAME, null, ListObjectOptions.DEFAULT_FLAT_LIST); rawStorage.deleteObjects( Lists.transform(objectsToDelete, GoogleCloudStorageItemInfo::getResourceId)); <START> rawStorage.deleteBuckets(Arrays.asList(BUCKET_NAME)); <END> }</code><technical_language>Cleanup in integration test helper is more complicated deletes leaked buckets well, current test bucket, ideally reuse here</technical_language>

Target:
public static void cleanupBuckets() throws IOException { GoogleCloudStorage rawStorage = createGoogleCloudStorage(); BUCKET_HELPER.cleanup(rawStorage); }
Source:
<code>public ApplicationDynamicConstants() { <START> this((CommonApplicationConstants) <END> GWT.create(CommonApplicationConstants.class)); }</code><technical_language>I cast is redundant here</technical_language>

Target:
public ApplicationDynamicConstants() { this((ApplicationConstants) GWT.create(ApplicationConstants.class)); }
Source:
<code>public void onPlayerInput(CharacterMoveInputEvent input, EntityRef entity) { CharacterCollider characterCollider = physics.getCharacterCollider(entity); if (characterCollider.isPending()) { logger.debug("Skipping input, collision not yet established"); return; } CircularBuffer<CharacterStateEvent> stateBuffer = characterStates.get(entity); CharacterStateEvent lastState = stateBuffer.getLast(); <START> float delta = input.getDelta() + lastState.getTime() - (time.getGameTimeInMs() + MAX_INPUT_OVERFLOW + 100); <END> if (RecordAndReplayStatus.getCurrentStatus() == RecordAndReplayStatus.REPLAYING) { delta -= MAX_INPUT_OVERFLOW_REPLAY_INCREASE; } if (delta < 0) { CharacterStateEvent newState = stepState(input, lastState, entity); stateBuffer.add(newState); if (RecordAndReplayStatus.getCurrentStatus() == RecordAndReplayStatus.REPLAYING) { characterStateEventPositionMap.updateCharacterStateEvent(newState); } else if (RecordAndReplayStatus.getCurrentStatus() == RecordAndReplayStatus.RECORDING) { characterStateEventPositionMap.add(newState.getSequenceNumber(), newState.getPosition(), newState.getVelocity()); } characterMovementSystemUtility.setToState(entity, newState); lastInputEvent.put(entity, input); } else { logger.warn("Received too much input from {}, dropping input. Delta difference: {}", entity, delta); } }</code><technical_language>100 here? Magic number (should a constant) effectively double max overflow? Is okay</technical_language>

Target:
public void onPlayerInput(CharacterMoveInputEvent input, EntityRef entity) { CharacterCollider characterCollider = physics.getCharacterCollider(entity); if (characterCollider.isPending()) { logger.debug("Skipping input, collision not yet established"); return; } CircularBuffer<CharacterStateEvent> stateBuffer = characterStates.get(entity); CharacterStateEvent lastState = stateBuffer.getLast(); float delta = input.getDelta() + lastState.getTime() - (time.getGameTimeInMs() + MAX_INPUT_OVERFLOW ); if (RecordAndReplayStatus.getCurrentStatus() == RecordAndReplayStatus.REPLAYING) { delta -= MAX_INPUT_OVERFLOW_REPLAY_INCREASE; } if (delta < 0) { CharacterStateEvent newState = stepState(input, lastState, entity); stateBuffer.add(newState); if (RecordAndReplayStatus.getCurrentStatus() == RecordAndReplayStatus.REPLAYING) { characterStateEventPositionMap.updateCharacterStateEvent(newState); } else if (RecordAndReplayStatus.getCurrentStatus() == RecordAndReplayStatus.RECORDING) { characterStateEventPositionMap.add(newState.getSequenceNumber(), newState.getPosition(), newState.getVelocity()); } characterMovementSystemUtility.setToState(entity, newState); lastInputEvent.put(entity, input); } else { logger.warn("Received too much input from {}, dropping input. Delta difference: {}", entity, delta); } }
Source:
<code>private Object genotypeValsToTargetType(final String key, final String vals) { if (!header.hasFormatLine(key)) { return vals; } final VCFFormatHeaderLine formLine = header.getFormatHeaderLine(key); final VCFHeaderLineType valType = formLine.getType(); <START> final boolean isSingleVal = formLine.isFixedCount() <END> ? formLine.getCount() == 1 : !vals.contains(VCFConstants.GENOTYPE_ATTRIBUTE_VALUE_SEPARATOR); if (isSingleVal) { return valType == VCFHeaderLineType.String ? vals : getMapperFunction(valType).apply(vals); } else { final List<?> targetTypeVals = mapToFormatLineType( ParsingUtils.split(vals, VCFConstants.GENOTYPE_ATTRIBUTE_VALUE_SEPARATOR_CHAR), valType); return targetTypeVals.isEmpty() ? vals : targetTypeVals; } }</code><technical_language>this a reasonable find count.....I consider count type (A, R, G, etc) instead</technical_language>

Target:
private Object genotypeValsToTargetType(final String key, final String vals) { if (!header.hasFormatLine(key)) { return vals; } final VCFFormatHeaderLine formLine = header.getFormatHeaderLine(key); final VCFHeaderLineType valType = formLine.getType(); final boolean isSingleVal = !vals.contains(VCFConstants.GENOTYPE_ATTRIBUTE_VALUE_SEPARATOR); return isSingleVal ? getMapperFunction(valType).apply(vals) : mapToFormatLineType( ParsingUtils.split(vals, VCFConstants.GENOTYPE_ATTRIBUTE_VALUE_SEPARATOR_CHAR), valType); }
Source:
<code>public void init(final AdditionalInfoPage page) { this.page = page; clear(); <START> setup(); <END> }</code><technical_language>This considered a strange implementation of MVP; P is calling V.init(..) calls V.setup() calls P call V setup some UI elements. P call perform complete setup V call P call V complete setup? I miss something</technical_language>

Target:
public void init(final AdditionalInfoPage page) { this.page = page; }
Source:
<code>private boolean connectStorageServersByType(StorageType storageType, List<StorageServerConnections> connections) { <START> Map<String, String> retValues = (HashMap<String, String>) Backend <END> .getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.ConnectStorageServer, new StorageServerConnectionManagementVDSParameters(getVds().getId(), getStoragePool().getId(), storageType, connections)).getReturnValue(); return StorageHelperDirector.getInstance().getItem(storageType).isConnectSucceeded(retValues, connections); }</code><technical_language>s/HashMap/Map/</technical_language>

Target:
private boolean connectStorageServersByType(StorageType storageType, List<StorageServerConnections> connections) { Map<String, String> retValues = (Map<String, String>) runVdsCommand( VDSCommandType.ConnectStorageServer, new StorageServerConnectionManagementVDSParameters(getVds().getId(), getStoragePool().getId(), storageType, connections)).getReturnValue(); return StorageHelperDirector.getInstance().getItem(storageType).isConnectSucceeded(retValues, connections); }
Source:
<code>protected boolean isTagLoadedOnMercury() { <START> return isElementVisible(elementInVebatim); <END> }</code><technical_language><LINK_0></technical_language>

Target:
protected boolean isTagLoadedOnMercury() { throw new NotImplementedException(); }
Source:
<code><START> public long lock(String requestId, String name) { <END> final long start = System.currentTimeMillis(); LOG.trace("{} - Locking {}", name, requestId); ReentrantLock lock = requestLocks.computeIfAbsent(requestId, (r) -> new ReentrantLock()); lock.lock(); LOG.trace("{} - Acquired lock on ({})", name, requestId, JavaUtils.duration(start)); return System.currentTimeMillis(); }</code><technical_language>a good idea accept calling class instead of a name, log out class name in trace logs below? ensure names pass locking arbitrary useful for tracing flow of scheduler</technical_language>

Target:
private long lock(String requestId, String name) { final long start = System.currentTimeMillis(); LOG.trace("{} - Locking {}", name, requestId); ReentrantLock lock = requestLocks.computeIfAbsent(requestId, (r) -> new ReentrantLock()); lock.lock(); LOG.trace("{} - Acquired lock on ({})", name, requestId, JavaUtils.duration(start)); return System.currentTimeMillis(); }
Source:
<code>private void validateSortOrderValue(String[] value) { <START> if ("SO".equals(value[0])) { <END> try { SAMFileHeader.SortOrder.valueOf(value[1]); } catch (IllegalArgumentException e) { if (validationStringency == ValidationStringency.STRICT) { throw new SAMFormatException("Found non conforming header SO tag: " + value[1] + ", exiting because VALIDATION_STRINGENCY=STRICT"); } else if (validationStringency == ValidationStringency.LENIENT) { log.warn("Found non conforming header SO tag: " + value[1] + ". Treating as 'unknown'."); } value[1] = "unknown"; } } }</code><technical_language>SAMFileHeader.SORT_ORDER_TAG</technical_language>

Target:
private void validateSortOrderValue(String[] value) { if (SAMFileHeader.SORT_ORDER_TAG.equals(value[0])) { try { SortOrder.valueOf(value[1]); } catch (IllegalArgumentException e) { if (validationStringency == ValidationStringency.STRICT) { throw new SAMFormatException("Found non-conforming header SO tag: " + value[1] + ", exiting because VALIDATION_STRINGENCY=STRICT"); } else if (validationStringency == ValidationStringency.LENIENT) { log.warn("Found non-conforming header SO tag: " + value[1] + ". Treating as 'unknown'."); } value[1] = SortOrder.unknown.toString(); } } }
Source:
<code>private void prepareResponse(String realmName, HttpServerResponse response, boolean stale) throws HttpAuthenticationException { StringBuilder sb = new StringBuilder(CHALLENGE_PREFIX); <START> sb.append(REALM).append("=\"").append(realmName).append("\""); <END> if (domain != null) { sb.append(", ").append(DOMAIN).append("=\"").append(domain).append("\""); } sb.append(", ").append(NONCE).append("=\"").append(nonceManager.generateNonce(realmName.getBytes(StandardCharsets.UTF_8))).append("\""); sb.append(", ").append(OPAQUE).append("=\"").append(OPAQUE_VALUE).append("\""); if (stale) { sb.append(", ").append(STALE).append("=\"true\""); } sb.append(", ").append(ALGORITHM).append("=\"").append(MD5).append("\""); response.addResponseHeader(WWW_AUTHENTICATE, sb.toString()); response.setStatusCode(UNAUTHORIZED); }</code><technical_language>Do strings need escaped</technical_language>

Target:
private void prepareResponse(String realmName, HttpServerResponse response, boolean stale) throws HttpAuthenticationException { StringBuilder sb = new StringBuilder(CHALLENGE_PREFIX); sb.append(REALM).append("=\"").append(DigestQuote.quote(realmName)).append("\""); if (domain != null) { sb.append(", ").append(DOMAIN).append("=\"").append(domain).append("\""); } sb.append(", ").append(NONCE).append("=\"").append(nonceManager.generateNonce(realmName.getBytes(StandardCharsets.UTF_8))).append("\""); sb.append(", ").append(OPAQUE).append("=\"").append(OPAQUE_VALUE).append("\""); if (stale) { sb.append(", ").append(STALE).append("=\"true\""); } sb.append(", ").append(ALGORITHM).append("=\"").append(MD5).append("\""); response.addResponseHeader(WWW_AUTHENTICATE, sb.toString()); response.setStatusCode(UNAUTHORIZED); }
Source:
<code>public void releaseBitmap() { if (mBitmapCanvas != null) { mBitmapCanvas.setBitmap(null); mBitmapCanvas = null; } if (mDrawBitmap != null) { mDrawBitmap.get().recycle(); mDrawBitmap.clear(); mDrawBitmap = null; } <START> System.gc(); <END> }</code><technical_language>This performance issues? <LINK_0></technical_language>

Target:
public void releaseBitmap() { if (mBitmapCanvas != null) { mBitmapCanvas.setBitmap(null); mBitmapCanvas = null; } if (mDrawBitmap != null) { mDrawBitmap.get().recycle(); mDrawBitmap.clear(); mDrawBitmap = null; } }
Source:
<code>private String appendNamespace(String name) { if (namespace.isEmpty()) { return name; } <START> return namespace + SEPARATOR + name; <END> }</code><technical_language>express this in a more concise readable: return namespace.isEmpty()? name : namespace + SEPARATOR + name;</technical_language>

Target:
private String appendNamespace(String name) { return namespace.isEmpty()? name : namespace + SEPARATOR + name; }
Source:
<code><START> public void bossBarProgressChanged(final BossBar bar, final float oldProgress, final float newProgress) { <END> if (Math.abs(newProgress - this.impl$lastSentProgress) > EPSILON) { this.impl$lastSentProgress = newProgress; this.sendUpdate(SUpdateBossInfoPacket.Operation.UPDATE_PCT); } }</code><technical_language>impl$</technical_language>

Target:
public void bossBarProgressChanged(final BossBar bar, final float oldProgress, final float newProgress) { if (Math.abs(newProgress - this.impl$lastSentProgress) > ServerBossInfoMixin.EPSILON) { this.impl$lastSentProgress = newProgress; this.sendUpdate(SUpdateBossInfoPacket.Operation.UPDATE_PCT); } }
Source:
<code>private CompletionStage<Void> handleInStoreExpirationInternal(K key, MarshallableEntry<K, V> marshallableEntry) { CompletableFuture<Boolean> completableFuture = new CompletableFuture<>(); CompletableFuture<Boolean> previousFuture = expiring.putIfAbsent(key, completableFuture); if (previousFuture == null) { <START> completableFuture.whenComplete((ignore, t) -> expiring.remove(key)); <END> AdvancedCache<K, V> cacheToUse = cache.withFlags(Flag.SKIP_SHARED_CACHE_STORE, Flag.ZERO_LOCK_ACQUISITION_TIMEOUT); CompletionStage<Boolean> resultStage; if (marshallableEntry != null) { Metadata metadata = marshallableEntry.getMetadata(); resultStage = cacheToUse.removeLifespanExpired(key, marshallableEntry.getValue(), metadata.lifespan() == -1 ? null : metadata.lifespan()); } else { resultStage = cacheToUse.removeLifespanExpired(key, null, null); } return CompletionStages.ignoreValue(resultStage.whenComplete((b, t) -> { if (t != null) { completableFuture.completeExceptionally(t); } else { completableFuture.complete(b); } })); } return CompletionStages.ignoreValue(previousFuture); }</code><technical_language>expiring.remove(key) moved line 403 avoid creating a new lambda :)</technical_language>

Target:
private CompletionStage<Void> handleInStoreExpirationInternal(K key, MarshallableEntry<K, V> marshallableEntry) { CompletableFuture<Boolean> completableFuture = new CompletableFuture<>(); CompletableFuture<Boolean> previousFuture = expiring.putIfAbsent(key, completableFuture); if (previousFuture == null) { AdvancedCache<K, V> cacheToUse = cache.withFlags(Flag.SKIP_SHARED_CACHE_STORE, Flag.ZERO_LOCK_ACQUISITION_TIMEOUT); CompletionStage<Boolean> resultStage; if (marshallableEntry != null) { Metadata metadata = marshallableEntry.getMetadata(); resultStage = cacheToUse.removeLifespanExpired(key, marshallableEntry.getValue(), metadata.lifespan() == -1 ? null : metadata.lifespan()); } else { resultStage = cacheToUse.removeLifespanExpired(key, null, null); } return CompletionStages.ignoreValue(resultStage.whenComplete((b, t) -> { expiring.remove(key); if (t != null) { completableFuture.completeExceptionally(t); } else { completableFuture.complete(b); } })); } return CompletionStages.ignoreValue(previousFuture); }
Source:
<code>public void swapReadWriteBuffers() { FBO fbo = get(new ResourceUrn("engine:sceneOpaque")); fboLookup.put(new ResourceUrn("engine:sceneOpaque"), get(new ResourceUrn("engine:sceneOpaquePingPong"))); <START> fboLookup.put(new ResourceUrn("engine:sceneOpaquePingPong"), fbo); <END> notifySubscribers(); }</code><technical_language>ResourceURNs static final fields please</technical_language>

Target:
public void swapReadWriteBuffers() { FBO fbo = get(READONLY_GBUFFER); fboLookup.put(READONLY_GBUFFER, get(WRITEONLY_GBUFFER)); fboLookup.put(WRITEONLY_GBUFFER, fbo); notifySubscribers(); }
Source:
<code>static Map<String, Object> mergeFailingOnReplacement(Map<String, Object> first, Map<String, Object> second) { Objects.requireNonNull(first, "merging requires two non-null maps but the first map was null"); Objects.requireNonNull(second, "merging requires two non-null maps but the second map was null"); Map<String, Object> results = new HashMap<>(first); Set<String> prefixes = second.keySet().stream().map(MetadataCreateIndexService::prefix).collect(Collectors.toSet()); <START> List<String> matchedPrefixes = new ArrayList<>(); results.keySet().forEach(k -> { if (prefixes.contains(prefix(k))) { matchedPrefixes.add(k); } }); <END> if (matchedPrefixes.size() > 0) { throw new IllegalArgumentException("mapping fields " + matchedPrefixes + " cannot be replaced during template composition"); } results.putAll(second); return results; }</code><technical_language>I thnik this expressed as, I find a bit more readable, a personal preference feel free ignore List<String> matchedPrefixes = results.keySet().stream().filter(k -> prefixes.contains(prefix(k))).collect(Collectors.toList())</technical_language>

Target:
static Map<String, Object> mergeFailingOnReplacement(Map<String, Object> first, Map<String, Object> second) { Objects.requireNonNull(first, "merging requires two non-null maps but the first map was null"); Objects.requireNonNull(second, "merging requires two non-null maps but the second map was null"); Map<String, Object> results = new HashMap<>(first); Set<String> prefixes = second.keySet().stream().map(MetadataCreateIndexService::prefix).collect(Collectors.toSet()); List<String> matchedPrefixes = results.keySet().stream().filter(k -> prefixes.contains(prefix(k))).collect(Collectors.toList()); if (matchedPrefixes.size() > 0) { throw new IllegalArgumentException("mapping fields " + matchedPrefixes + " cannot be replaced during template composition"); } results.putAll(second); return results; }
Source:
<code>protected Long nullUnsafeScalar(LocalTime value) { <START> return value.atDate( LocalDate.of( 1970, Month.JANUARY, 1 ) ).atZone( ZoneOffset.UTC ).toInstant().toEpochMilli(); <END> }</code><technical_language>call value.toInstant( ZoneOffset.UTC ) instead of atZone(...).toInstant(). Also, LocalDate.of( 1970, Month.JANUARY, 1 ) a constant. Also, I value.toNanoOfDay() / 1_000_000 achieve result, readable</technical_language>

Target:
protected Long nullUnsafeScalar(LocalTime value) { return value.atDate( EPOCH_DAY ).toInstant( ZoneOffset.UTC ).toEpochMilli(); }
Source:
<code>private boolean isDevEnvironment() { Boolean result = false; String[] activeProfiles = environment.getActiveProfiles(); for (String profile : activeProfiles) { if (profile.equals(ENVIRONMENT_DEV_PROFILE)) { <START> result = true; <END> break; } } return result; }</code><technical_language>here, return true</technical_language>

Target:
private boolean isDevEnvironment() { String[] activeProfiles = environment.getActiveProfiles(); for (String profile : activeProfiles) { if (profile.equals(ENVIRONMENT_DEV_PROFILE)) { return true; } } return false; }
Source:
<code>public void addDesc(Entity entity) { if (entity != null) { <START> if(indentation <= Report.DEFAULT_INDENTATION || showImage) { <END> imageCode = "<span id='" + entity.getId() + "'></span>"; } add("<font color='0xffffff'><a href=\"#entity:" + entity.getId() + "\">" + entity.getShortName() + "</a></font>", true); String colorcode = Integer.toHexString(PlayerColors.getColor( entity.getOwner().getColorIndex()).getRGB() & 0x00f0f0f0); add("<B><font color='" + colorcode + "'>" + entity.getOwner().getName() + "</font></B>"); } }</code><technical_language>suggestion if ((indentation <= Report.DEFAULT_INDENTATION) || showImage) {</technical_language>

Target:
public void addDesc(Entity entity) { if (entity != null) { if ((indentation <= Report.DEFAULT_INDENTATION) || showImage) { imageCode = "<span id='" + entity.getId() + "'></span>"; } add("<font color='0xffffff'><a href=\"#entity:" + entity.getId() + "\">" + entity.getShortName() + "</a></font>", true); String colorcode = Integer.toHexString(PlayerColors.getColor( entity.getOwner().getColorIndex()).getRGB() & 0x00f0f0f0); add("<B><font color='" + colorcode + "'>" + entity.getOwner().getName() + "</font></B>"); } }
Source:
<code>public boolean equals(Object obj) { if ((obj != null) && (obj instanceof ClusterFeature)) { ClusterFeature clusterFeature = (ClusterFeature) obj; if (ObjectUtils.objectsEqual(getVdsGroupId(), clusterFeature.getVdsGroupId()) && enabled == clusterFeature.isEnabled() && (ObjectUtils.objectsEqual(getFeature(), clusterFeature.getFeature()))) { return true; } } return false; <START> } <END></code><technical_language>please implement toString ToStringBuilder simplifies debug</technical_language>

Target:
public boolean equals(Object obj) { if ((obj != null) && (obj instanceof ClusterFeature)) { ClusterFeature clusterFeature = (ClusterFeature) obj; if (Objects.equals(getFeatureId(), clusterFeature.getFeatureId()) && Objects.equals(getFeature(), clusterFeature.getFeature()) && Objects.equals(getVersion(), clusterFeature.getVersion()) && Objects.equals(getDescription(), clusterFeature.getDescription()) && Objects.equals(getApplicationMode(), clusterFeature.getApplicationMode()) && enabled == clusterFeature.isEnabled() && Objects.equals(getClusterId(), clusterFeature.getClusterId())) { return true; } } return false; }
Source:
<code>public void processElement(ProcessContext c) throws Exception { final BoundedSource<T> source = c.element(); List<? extends BoundedSource<T>> splitSources = source.splitIntoBundles( DESIRED_SHARD_SIZE, c.getPipelineOptions() ); totalShardCount.addValue((long) splitSources.size()); LOG.info("Split into shards", splitSources.size()); final List<ExportShard<T>> shards = new ArrayList<>(splitSources.size()); int i = 0; for (BoundedSource<T> splitSource : splitSources) { final String filename = IOChannelUtils.constructName( <START> "part", ShardNameTemplate.INDEX_OF_MAX, "", ++i, splitSources.size() <END> ); shards.add(new ExportShard<>(splitSource, filename)); } Collections.shuffle(shards); i = 0; for (ExportShard<T> shard : shards) { c.output(KV.of(i++, shard)); } }</code><technical_language>I thought zero based indexing weird too. FileBasedIO & I wanted stay consistent</technical_language>

Target:
public void processElement(ProcessContext c) throws Exception { final BoundedSource<T> source = c.element(); List<? extends BoundedSource<T>> splitSources = source.splitIntoBundles( DESIRED_SHARD_SIZE, c.getPipelineOptions() ); totalShardCount.addValue((long) splitSources.size()); LOG.info("Split into shards", splitSources.size()); final List<ExportShard<T>> shards = new ArrayList<>(splitSources.size()); int i = 0; for (BoundedSource<T> splitSource : splitSources) { final String filename = IOChannelUtils.constructName( "part", ShardNameTemplate.INDEX_OF_MAX, "", i++, splitSources.size() ); shards.add(new ExportShard<>(splitSource, filename)); } Collections.shuffle(shards); i = 0; for (ExportShard<T> shard : shards) { c.output(KV.of(i++, shard)); } }
Source:
<code>public void updateTableConfig(TableConfig tableConfig) throws IOException { TenantConfig tenantConfig = tableConfig.getTenantConfig(); String brokerTag = tenantConfig.getBroker(); String serverTag = tenantConfig.getServer(); if (brokerTag == null || serverTag == null) { if (!_isSingleTenantCluster) { throw new InvalidTableConfigException("server and broker tenants must be specified for multi-tenant cluster"); } <START> } <END> validateTableTenantConfig(tableConfig); setExistingTableConfig(tableConfig); }</code><technical_language>put default tenant if is single-tenant cluster, similar addTable() extract this part a helper method</technical_language>

Target:
public void updateTableConfig(TableConfig tableConfig) throws IOException { validateTableTenantConfig(tableConfig); setExistingTableConfig(tableConfig); }
Source:
<code>public Set<Material> getBreedingFoods() { <START> return EnumSet.noneOf(Material.class); <END> }</code><technical_language>cache set in a static field</technical_language>

Target:
public Set<Material> getBreedingFoods() { return DEFAULT_BREEDING_FOODS; }
Source:
<code>public void selectAndReveal(ITimeGraphEntry entry) { <START> fTimeGraphCtrl.expandEntry(entry.getParent()); <END> setSelection(entry); adjustVerticalScrollBar(); }</code><technical_language>getParent() return null</technical_language>

Target:
public void selectAndReveal(ITimeGraphEntry entry) { fTimeGraphCtrl.expand(entry.getParent()); setSelection(entry); adjustVerticalScrollBar(); }
Source:
<code>public final Object closeFile(final SFileDescriptor file) { file.closeFile(); <START> return Nil.nilObject; <END> }</code><technical_language>nicer return file</technical_language>

Target:
public final Object closeFile(final SFileDescriptor file) { file.closeFile(); return file; }
Source:
<code>public void clear() { <START> pos = 0; END> if (this.buf == null) { return; } this.buf.clear(); }</code><technical_language>too, "the exception" is unclear refers to</technical_language>

Target:
public void clear() { resetPosition(); if (fBuffer == null) { return; } fBuffer.clear(); }
Source:
<code><START> public void testSingleExecutionHookViaRegisterMethod() { <END> RxJavaPlugins p = new RxJavaPlugins(); p.registerSingleExecutionHook(new RxJavaSingleExecutionHookTestImpl()); RxJavaSingleExecutionHook impl = p.getSingleExecutionHook(); assertTrue(impl instanceof RxJavaSingleExecutionHookTestImpl); }</code><technical_language>need for test prefix</technical_language>

Target:
public void testSingleExecutionHookViaRegisterMethod() { RxJavaPlugins p = new RxJavaPlugins(); RxJavaSingleExecutionHook customHook = mock(RxJavaSingleExecutionHook.class); p.registerSingleExecutionHook(customHook); RxJavaSingleExecutionHook impl = p.getSingleExecutionHook(); assertSame(impl, customHook); }
Source:
<code><START> public static ICalBean parse(Reader r, String characterSet) { <END> try (UnfoldingReader reader = new UnfoldingReader(r, characterSet)) { ICalBean cal = new ICalBean(); Property property = reader.readProperty(); if (!property.equals(ICalProperties.BEGIN_ICALENDAR)) { return null; } cal.addProperty(property); while ((property = reader.readProperty()) != null) { cal.addProperty(property); } return cal; } catch (Exception e) { throw new ProcessingException("invalid ical format", e); } }</code><technical_language>Move method application scoped helper (overridable custom code)</technical_language>

Target:
public static ICalBean parse(Reader r, String characterSet) { return BEANS.get(ICalVCardHelper.class).parse(r, characterSet, BEANS.get(ICalBean.class)); }
Source:
<code>private C getConf(final C conf) { conf.setUseMock(useMock); conf.set("sc.useMongo", "true"); if (user != null) { conf.setMongoUser(user); } if (pass != null) { conf.setMongoPassword(pass); } conf.setMongoDBName(mongoDBName); <START> conf.setRyaInstanceName(mongoDBName); <END> conf.setMongoHostname(host); conf.setMongoPort(port); conf.setUseAggregationPipeline(usePipeline); return conf; }</code><technical_language>If Mongo DB Name Rya Instance Name same, of fields</technical_language>

Target:
private C getConf(final C conf) { conf.setUseMock(useMock); conf.set("sc.useMongo", "true"); if (user != null) { conf.setMongoUser(user); } if (pass != null) { conf.setMongoPassword(pass); } conf.setRyaInstanceName(mongoDBName); conf.setMongoHostname(host); conf.setMongoPort(port); conf.setUseAggregationPipeline(usePipeline); return conf; }
Source:
<code>public Object execute(final ExecutionEvent event) throws ExecutionException { final Repository repository = getRepository(true, event); if (repository == null) { return null; } boolean useStagingView = Activator.getDefault().getPreferenceStore() .getBoolean(UIPreferences.ALWAYS_USE_STAGING_VIEW); if (useStagingView) { <START> Display.getDefault().asyncExec(new <END> Runnable() { @Override public void run() { try { StagingView view = (StagingView) PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getActivePage() .showView(StagingView.VIEW_ID); view.setFocus(); } catch (PartInitException e) { Activator.logError(e.getMessage(), e); } } }); } else { final Shell shell = getShell(event); IResource[] resourcesInScope; try { IResource[] selectedResources = getSelectedResources(event); if (selectedResources.length > 0) { IWorkbenchPart part = getPart(event); resourcesInScope = GitScopeUtil.getRelatedChanges(part, selectedResources); } else resourcesInScope = new IResource[0]; } catch (InterruptedException e) { return null; } CommitUI commitUi = new CommitUI(shell, repository, resourcesInScope, false); commitUi.commit(); } return null; }</code><technical_language>PlatformUI.getWorkbench().getDisplay() recommended way. IWorkbench.getDisplay(). Alternatively getShell(event).getDisplay()</technical_language>

Target:
public Object execute(final ExecutionEvent event) throws ExecutionException { final Repository repository = getRepository(true, event); if (repository == null) { return null; } boolean useStagingView = Activator.getDefault().getPreferenceStore() .getBoolean(UIPreferences.ALWAYS_USE_STAGING_VIEW); if (useStagingView) { PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { @Override public void run() { try { StagingView view = (StagingView) PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getActivePage() .showView(StagingView.VIEW_ID); view.setFocus(); } catch (PartInitException e) { Activator.logError(e.getMessage(), e); } } }); } else { final Shell shell = getShell(event); IResource[] resourcesInScope; try { IResource[] selectedResources = getSelectedResources(event); if (selectedResources.length > 0) { IWorkbenchPart part = getPart(event); resourcesInScope = GitScopeUtil.getRelatedChanges(part, selectedResources); } else resourcesInScope = new IResource[0]; } catch (InterruptedException e) { return null; } CommitUI commitUi = new CommitUI(shell, repository, resourcesInScope, false); commitUi.commit(); } return null; }
Source:
<code><START> public static long parseParamDate(final String diff) throws java.text.ParseException { <END> String secs = "00"; String mins = "00"; String hours = "00"; String date = "01"; String month = "01"; String year = "0000"; final String[] units = diff.split("[.]"); for (final String unit : units) { if (unit.matches("[YMDhms][0-9]+")) { final char unitdesc = unit.charAt(0); switch (unitdesc) { case 's': secs = unit.replace("s", "00"); secs = secs.substring(secs.length()-2, secs.length()); break; case 'm': mins = unit.replace("m", "00"); mins = mins.substring(mins.length()-2, mins.length()); break; case 'h': hours = unit.replace("h", "0"); hours = hours.substring(hours.length()-2, hours.length()); break; case 'D': date = unit.replace("D", "00"); date = date.substring(date.length()-2, date.length()); break; case 'M': month = unit.replace("M", "00"); month = month.substring(month.length()-2, month.length()); break; case 'Y': year = unit.replace("Y", "0000"); year = year.substring(year.length()-4, year.length()); break; } } } final StringBuilder dateString = new StringBuilder(year) .append("-") .append(month) .append("-") .append(date) .append("T") .append(hours) .append(":") .append(mins) .append(":") .append(secs) .append(".000Z"); return Constants.DATE_FORMAT.parse(dateString.toString()).getTime(); }</code><technical_language>input converting format, if trouble of parsing it, capture data need create date object manually</technical_language>

Target:
public static Date parseParamDate(final String diff) throws java.text.ParseException { final String dateString = "0000-01-01T00:00:00.000UTC"; final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZZZ"); final char[] dateChars = dateString.toCharArray(); String timeZone = "UTC"; final String[] units = diff.split("[.]"); for (final String unit : units) { if (unit.matches("[YMDhms][0-9]+") || unit.matches("[Z]...")) { final char unitdesc = unit.charAt(0); switch (unitdesc) { case 's': updateDateArray(dateChars, unit.replace("s", "00"), 19, 2); break; case 'm': updateDateArray(dateChars, unit.replace("m", "00"), 16, 2); break; case 'h': updateDateArray(dateChars, unit.replace("h", "00"), 13, 2); break; case 'D': updateDateArray(dateChars, unit.replace("D", "00"), 10, 2); break; case 'M': updateDateArray(dateChars, unit.replace("M", "00"), 7, 2); break; case 'Y': updateDateArray(dateChars, unit.replace("Y", "0000"), 4, 4); break; case 'Z': updateDateArray(dateChars, unit.replace("Z", ""), 26, 3); timeZone = unit.replace("Z", ""); break; } } else { throw new ParseException("Cannot process date token: '" + unit + "'", diff.indexOf(unit)); } } dateFormat.setTimeZone(TimeZone.getTimeZone(timeZone)); return dateFormat.parse(new String(dateChars)); }
Source:
<code>public void testJFaceWizardButtons() { Assume.assumeTrue("UI Harness is requires for that test", Display.getCurrent() != null); final WizardDialog dialog = new WizardDialog(shell, new Wizard() { @Override public void addPages() { addPage(new WizardPage("Page 1") { public void createControl(Composite parent) { setControl(new Label(parent, SWT.NONE)); } }); addPage(new WizardPage("Page 2") { public void createControl(Composite parent) { setControl(new Label(parent, SWT.NONE)); } }); } <START> <END> @Override public boolean performFinish() { return true; } }); dialog.setBlockOnOpen(false); UIThreadRunnable.syncExec(new VoidResult() { @Override public void run() { dialog.open(); } }); Shell shell = dialog.getShell(); SWTBotButton nextButton = bot.buttonWithId(null, Integer.valueOf(IDialogConstants.NEXT_ID)); nextButton.click(); Assert.assertEquals("Page 2", dialog.getCurrentPage().getName()); SWTBotButton finishButton = bot.buttonWithId(null, Integer.valueOf(IDialogConstants.FINISH_ID)); finishButton.click(); Assert.assertTrue(shell.isDisposed()); Assert.assertNull(dialog.getShell()); }</code><technical_language>trailing</technical_language>

Target:
public void testJFaceWizardButtons() { Assume.assumeTrue("UI Harness is requires for that test", Display.getCurrent() != null); final WizardDialog dialog = new WizardDialog(shell, new Wizard() { @Override public void addPages() { addPage(new WizardPage("Page 1") { @Override public void createControl(Composite parent) { setControl(new Label(parent, SWT.NONE)); } }); addPage(new WizardPage("Page 2") { @Override public void createControl(Composite parent) { setControl(new Label(parent, SWT.NONE)); } }); } @Override public boolean performFinish() { return true; } }); dialog.setBlockOnOpen(false); UIThreadRunnable.syncExec(new VoidResult() { @Override public void run() { dialog.open(); } }); Shell shell = dialog.getShell(); SWTBotButton nextButton = bot.buttonWithId(null, Integer.valueOf(IDialogConstants.NEXT_ID)); nextButton.click(); Assert.assertEquals("Page 2", dialog.getCurrentPage().getName()); SWTBotButton finishButton = bot.buttonWithId(null, Integer.valueOf(IDialogConstants.FINISH_ID)); finishButton.click(); Assert.assertTrue(shell.isDisposed()); Assert.assertNull(dialog.getShell()); }