auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public VeirfyBulkJobResult call() throws Exception { <END> try{ final Ds3ClientHelpers helper = getClientHelpers(); final Iterable<Contents> bulkContents = helper.listObjects(this.bucketName, this.prefix); if (bulkContents == null || !bulkContents.iterator().hasNext()) { throw new CommandException("No objects in bucket '" + this.bucketName + "' with prefix '" + this.prefix + "'"); } final List<Ds3Object> objectList = new ArrayList<>(); for (final Contents contents : bulkContents) { objectList.add(new Ds3Object(contents.getKey(), contents.getSize())); } final VerifyBulkJobSpectraS3Response verifyResponse = getClient().verifyBulkJobSpectraS3(new VerifyBulkJobSpectraS3Request(this.bucketName, objectList )); return new VeirfyBulkJobResult(this.bucketName, verifyResponse.getMasterObjectListResult().getObjects().iterator()); } catch (final FailedRequestException e) { if (e.getStatusCode() == 500) { throw new CommandException("Error: Cannot communicate with the remote DS3 appliance.", e); } else if (e.getStatusCode() == 404) { throw new CommandException("Cannot locate bucket: " + this.bucketName, e); } else { throw new CommandException("Encountered an unknown error of ("+ e.getStatusCode() +") while accessing the remote DS3 appliance.", e); } } }</code><technical_language>speeling error in veirfy</technical_language>

Target:
public VerifyBulkJobResult call() throws Exception { try{ final Ds3ClientHelpers helper = getClientHelpers(); final Iterable<Contents> bulkContents = helper.listObjects(this.bucketName, this.prefix); if (bulkContents == null || !bulkContents.iterator().hasNext()) { throw new CommandException("No objects in bucket '" + this.bucketName + "' with prefix '" + this.prefix + "'"); } final List<Ds3Object> objectList = new ArrayList<>(); for (final Contents contents : bulkContents) { objectList.add(new Ds3Object(contents.getKey(), contents.getSize())); } final VerifyBulkJobSpectraS3Response verifyResponse = getClient().verifyBulkJobSpectraS3(new VerifyBulkJobSpectraS3Request(this.bucketName, objectList )); return new VerifyBulkJobResult(this.bucketName, verifyResponse.getMasterObjectListResult().getObjects().iterator()); } catch (final FailedRequestException e) { if (e.getStatusCode() == 500) { throw new CommandException("Error: Cannot communicate with the remote DS3 appliance.", e); } else if (e.getStatusCode() == 404) { throw new CommandException("Cannot locate bucket: " + this.bucketName, e); } else { throw new CommandException("Encountered an unknown error of ("+ e.getStatusCode() +") while accessing the remote DS3 appliance.", e); } } }
Source:
<code>private Set<K> determineExcludedKeys(Map<Integer, Set<K>> keysToExclude, IntSet segmentsToUse) { if (keysToExclude.isEmpty()) { return Collections.emptySet(); } return segmentsToUse.intStream() .boxed() .flatMap(s -> { Set<K> keysForSegment = keysToExclude.get(s); if (keysForSegment != null) { return keysForSegment.stream(); } <START> return null; <END> }) .collect(Collectors.toSet()); }</code><technical_language>Again, IMO this (and more efficient) in a for loop</technical_language>

Target:
private Set<K> determineExcludedKeys(Map<Integer, Set<K>> keysToExclude, IntSet segmentsToUse) { if (keysToExclude.isEmpty()) { return Collections.emptySet(); } Set<K> excludedKeys = new HashSet<>(); for (PrimitiveIterator.OfInt segmentIterator = segmentsToUse.iterator(); segmentIterator.hasNext(); ) { Integer segment = segmentIterator.nextInt(); Set<K> keysForSegment = keysToExclude.get(segment); if (keysForSegment != null) { excludedKeys.addAll(keysForSegment); } } return excludedKeys; }
Source:
<code>public ActivationKeyDTO addPoolToKey( @PathParam("activation_key_id") @Verify(ActivationKey.class) String activationKeyId, @PathParam("pool_id") @Verify(Pool.class) String poolId, @QueryParam("quantity") Long quantity) { ActivationKey key = this.fetchActivationKey(activationKeyId); Pool pool = findPool(poolId); <START> activationKeyRules.validatePoolForActivationKey(key, pool, quantity) <END> .ifPresent(message -> { throw new BadRequestException(message); }); if (key.hasPool(pool)) { throw new BadRequestException( i18n.tr("Pool ID \"{0}\" has already been registered with this activation key", poolId) ); } key.addPool(pool, quantity); activationKeyCurator.update(key); return this.translator.translate(key, ActivationKeyDTO.class); }</code><technical_language>This is a interesting of handling this. feel yet, leave is if establishes a pattern for general output processing of Java rules output. If so, all; I argue this is expensive of a null check</technical_language>

Target:
public ActivationKeyDTO addPoolToKey( @PathParam("activation_key_id") @Verify(ActivationKey.class) String activationKeyId, @PathParam("pool_id") @Verify(Pool.class) String poolId, @QueryParam("quantity") Long quantity) { ActivationKey key = this.fetchActivationKey(activationKeyId); Pool pool = findPool(poolId); String message = activationKeyRules.validatePoolForActivationKey(key, pool, quantity); if (message != null) { throw new BadRequestException(message); } if (key.hasPool(pool)) { throw new BadRequestException( i18n.tr("Pool ID \"{0}\" has already been registered with this activation key", poolId) ); } key.addPool(pool, quantity); activationKeyCurator.update(key); return this.translator.translate(key, ActivationKeyDTO.class); }
Source:
<code>public T getLastValue() { <START> synchronized (arguments) { <END> if (arguments.isEmpty()) { throw noArgumentValueWasCaptured(); } return (T) arguments.get(arguments.size() - 1); } }</code><technical_language>synchronize this read operation, synchronize write operation in captureFrom(..)? a Lock here, a List abused lock instance</technical_language>

Target:
public T getLastValue() { readLock.lock(); try { if (arguments.isEmpty()) { throw noArgumentValueWasCaptured(); } return (T) arguments.get(arguments.size() - 1); } finally { readLock.unlock(); } }
Source:
<code>public Map<String, String> getCustomValues() { <START> addCustomValue("ClusterName", getVdsGroupName()); <END> return super.getCustomValues(); }</code><technical_language>vdsGroupName in message, custom is required</technical_language>

Target:
public Map<String, String> getCustomValues() { return super.getCustomValues(); }
Source:
<code>public TransportClientFactory newTransportClientFactory(final EurekaClientConfig clientConfig, final Collection<ClientRequestFilter> additionalFilters, final InstanceInfo myInstanceInfo) { final TransportClientFactory jerseyFactory = Jersey2ApplicationClientFactory.create( clientConfig, additionalFilters, myInstanceInfo, <START> new EurekaClientIdentity(myInstanceInfo.getIPAddr()) <END> ); final TransportClientFactory metricsFactory = MetricsCollectingEurekaHttpClient.createFactory(jerseyFactory); return new TransportClientFactory() { @Override public EurekaHttpClient newClient(EurekaEndpoint serviceUrl) { return metricsFactory.newClient(serviceUrl); } @Override public void shutdown() { metricsFactory.shutdown(); jerseyFactory.shutdown(); } }; }</code><technical_language>worthwhile creating a jersey2 version of EurekaClientIdentity identify jersey2 variants of eureka-client</technical_language>

Target:
public TransportClientFactory newTransportClientFactory(final EurekaClientConfig clientConfig, final Collection<ClientRequestFilter> additionalFilters, final InstanceInfo myInstanceInfo) { final TransportClientFactory jerseyFactory = Jersey2ApplicationClientFactory.create( clientConfig, additionalFilters, myInstanceInfo, new EurekaClientIdentity(myInstanceInfo.getIPAddr(), "Jersey2DefaultClient") ); final TransportClientFactory metricsFactory = MetricsCollectingEurekaHttpClient.createFactory(jerseyFactory); return new TransportClientFactory() { @Override public EurekaHttpClient newClient(EurekaEndpoint serviceUrl) { return metricsFactory.newClient(serviceUrl); } @Override public void shutdown() { metricsFactory.shutdown(); jerseyFactory.shutdown(); } }; }
Source:
<code>public ActionResult execute() throws EntityDoesNotExistException { String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID); Assumption.assertNotNull(courseId); String studentEmail = getRequestParamValue(Const.ParamsNames.STUDENT_EMAIL); Assumption.assertNotNull(studentEmail); InstructorAttributes instructor = logic.getInstructorForGoogleId(courseId, account.googleId); new GateKeeper().verifyAccessible( instructor, logic.getCourse(courseId), Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_STUDENT); StudentAttributes student = logic.getStudentForEmail(courseId, studentEmail); if (student == null) { statusToUser.add(new StatusMessage(Const.StatusMessages.STUDENT_NOT_FOUND_EDIT, StatusMessageColor.DANGER)); isError = true; <START> return createRedirectResult(Const.ActionURIs.INSTRUCTOR_HOME_PAGE); <END> } boolean hasSection = logic.hasIndicatedSections(courseId); InstructorCourseStudentDetailsEditPageData data = new InstructorCourseStudentDetailsEditPageData(account, student, student.email, hasSection); statusToAdmin = "instructorCourseStudentEdit Page Load<br>" + "Editing Student <span class=\"bold\">" + studentEmail +"'s</span> details " + "in Course <span class=\"bold\">[" + courseId + "]</span>"; return createShowPageResult(Const.ViewURIs.INSTRUCTOR_COURSE_STUDENT_EDIT, data); }</code><technical_language>myself, is redirecting home page correct behavior</technical_language>

Target:
public ActionResult execute() throws EntityDoesNotExistException { String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID); Assumption.assertNotNull(courseId); String studentEmail = getRequestParamValue(Const.ParamsNames.STUDENT_EMAIL); Assumption.assertNotNull(studentEmail); InstructorAttributes instructor = logic.getInstructorForGoogleId(courseId, account.googleId); new GateKeeper().verifyAccessible( instructor, logic.getCourse(courseId), Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_STUDENT); StudentAttributes student = logic.getStudentForEmail(courseId, studentEmail); if (student == null) { statusToUser.add(new StatusMessage(Const.StatusMessages.STUDENT_NOT_FOUND_FOR_EDIT, StatusMessageColor.DANGER)); isError = true; return createRedirectResult(Const.ActionURIs.INSTRUCTOR_HOME_PAGE); } boolean hasSection = logic.hasIndicatedSections(courseId); InstructorCourseStudentDetailsEditPageData data = new InstructorCourseStudentDetailsEditPageData(account, student, student.email, hasSection); statusToAdmin = "instructorCourseStudentEdit Page Load<br>" + "Editing Student <span class=\"bold\">" + studentEmail +"'s</span> details " + "in Course <span class=\"bold\">[" + courseId + "]</span>"; return createShowPageResult(Const.ViewURIs.INSTRUCTOR_COURSE_STUDENT_EDIT, data); }
Source:
<code>public void rebootUtilTest() throws Exception { final int PORT_0 = 9000; final String SERVER_0 = "localhost:" + PORT_0; final int retries = 3; Process corfuServer = runPersistentServer(corfuSingleNodeHost, PORT_0, true); runtime = createDefaultRuntime(); Layout layout = incrementClusterEpoch(runtime); RebootUtil.restart(SERVER_0, runtime.getParameters(), retries, PARAMETERS.TIMEOUT_LONG); waitForEpochChange(epoch -> epoch >= layout.getEpoch() + 1, runtime); assertThat(shutdownCorfuServer(corfuServer)).isTrue(); runtime.shutdown(); <START> corfuServer = runPersistentServer(corfuSingleNodeHost, PORT_0, true); <END> runtime = createDefaultRuntime(); incrementClusterEpoch(runtime); RebootUtil.reset(SERVER_0, runtime.getParameters(), retries, PARAMETERS.TIMEOUT_LONG); runtime = createDefaultRuntime(); waitForEpochChange(epoch -> epoch == 0, runtime); assertThat(shutdownCorfuServer(corfuServer)).isTrue(); }</code><technical_language>a test optimization: reuse server restart check if epoch returns 0</technical_language>

Target:
public void rebootUtilTest() throws Exception { final int PORT_0 = 9000; final String SERVER_0 = "localhost:" + PORT_0; final int retries = 3; Process corfuServer = runPersistentServer(corfuSingleNodeHost, PORT_0, true); runtime = createDefaultRuntime(); Layout layout = incrementClusterEpoch(runtime); RebootUtil.restart(SERVER_0, runtime.getParameters(), retries, PARAMETERS.TIMEOUT_LONG); waitForEpochChange(epoch -> epoch >= layout.getEpoch() + 1, runtime); runtime = createDefaultRuntime(); RebootUtil.reset(SERVER_0, runtime.getParameters(), retries, PARAMETERS.TIMEOUT_LONG); runtime = createDefaultRuntime(); waitForEpochChange(epoch -> epoch == 0, runtime); assertThat(shutdownCorfuServer(corfuServer)).isTrue(); }
Source:
<code>private static String[] zipEntryContent(byte[] zipData, String path) throws IOException { final ZipInputStream in = new ZipInputStream( new ByteArrayInputStream(zipData)); ZipEntry e; while ((e = in.getNextEntry()) != null) { if (!e.getName().equals(path)) continue; final List<String> l = new ArrayList<String>(); final BufferedReader reader = new BufferedReader( <START> new InputStreamReader(in)); <END> String line; while ((line = reader.readLine()) != null) l.add(line); return l.toArray(new String[l.size()]); } return null; }</code><technical_language>This is dependent platform's default character encoding. is safer a encoding is required supported Java, e.g. UTF-8 ISO-8859-1</technical_language>

Target:
private static String[] zipEntryContent(byte[] zipData, String path) throws IOException { final ZipInputStream in = new ZipInputStream( new ByteArrayInputStream(zipData)); ZipEntry e; while ((e = in.getNextEntry()) != null) { if (!e.getName().equals(path)) continue; final List<String> l = new ArrayList<String>(); final BufferedReader reader = new BufferedReader( new InputStreamReader(in, "UTF-8")); String line; while ((line = reader.readLine()) != null) l.add(line); return l.toArray(new String[l.size()]); } return null; }
Source:
<code>public int getGroupingKeySize() { <START> return Doubles.BYTES; <END> }</code><technical_language>Double.BYTES</technical_language>

Target:
public int getGroupingKeySize() { return Double.BYTES; }
Source:
<code>public Jwt encode(JoseHeader headers, JwtClaimsSet claims) throws JwtEncodingException { Assert.notNull(headers, "headers cannot be null"); Assert.notNull(claims, "claims cannot be null"); headers = JoseHeader.from(headers) .type(JOSEObjectType.JWT.getType()) .keyId(this.jwk.getKeyID()) .build(); JWSHeader jwsHeader = JWS_HEADER_CONVERTER.convert(headers); claims = JwtClaimsSet.from(claims) .id(UUID.randomUUID().toString()) .build(); JWTClaimsSet jwtClaimsSet = JWT_CLAIMS_SET_CONVERTER.convert(claims); <START> <END> SignedJWT signedJWT = new SignedJWT(jwsHeader, jwtClaimsSet); try { signedJWT.sign(this.jwsSigner); } catch (JOSEException ex) { throw new JwtEncodingException(String.format(ENCODING_ERROR_MESSAGE_TEMPLATE, ex.getMessage()), ex); } String jws = signedJWT.serialize(); return new Jwt(jws, claims.getIssuedAt(), claims.getExpiresAt(), headers.getHeaders(), claims.getClaims()); }</code><technical_language>feels odd I able header values algorithm sha256Thumbprint ultimately incompatible JWK configured in constructor</technical_language>

Target:
public Jwt encode(JoseHeader headers, JwtClaimsSet claims) throws JwtEncodingException { Assert.notNull(headers, "headers cannot be null"); Assert.notNull(claims, "claims cannot be null"); JWK jwk = this.jwkSelector.apply(headers); if (jwk == null) { throw new JwtEncodingException( String.format(ENCODING_ERROR_MESSAGE_TEMPLATE, "Failed to select a JWK signing key")); } else if (!StringUtils.hasText(jwk.getKeyID())) { throw new JwtEncodingException(String.format(ENCODING_ERROR_MESSAGE_TEMPLATE, "The \"kid\" (key ID) from the selected JWK cannot be empty")); } JWSSigner jwsSigner = this.jwsSigners.computeIfAbsent(jwk, (key) -> { try { return JWS_SIGNER_FACTORY.createJWSSigner(key); } catch (JOSEException ex) { throw new JwtEncodingException(String.format(ENCODING_ERROR_MESSAGE_TEMPLATE, "Failed to create a JWS Signer -> " + ex.getMessage()), ex); } }); JoseHeader.Builder headersBuilder = JoseHeader.from(headers) .type(JOSEObjectType.JWT.getType()) .keyId(jwk.getKeyID()); JwtClaimsSet.Builder claimsBuilder = JwtClaimsSet.from(claims) .id(UUID.randomUUID().toString()); this.jwtCustomizer.accept(headersBuilder, claimsBuilder); headers = headersBuilder.build(); claims = claimsBuilder.build(); JWSHeader jwsHeader = JWS_HEADER_CONVERTER.convert(headers); JWTClaimsSet jwtClaimsSet = JWT_CLAIMS_SET_CONVERTER.convert(claims); SignedJWT signedJwt = new SignedJWT(jwsHeader, jwtClaimsSet); try { signedJwt.sign(jwsSigner); } catch (JOSEException ex) { throw new JwtEncodingException( String.format(ENCODING_ERROR_MESSAGE_TEMPLATE, "Failed to sign the JWT -> " + ex.getMessage()), ex); } String jws = signedJwt.serialize(); return new Jwt(jws, claims.getIssuedAt(), claims.getExpiresAt(), headers.getHeaders(), claims.getClaims()); }
Source:
<code>public List<PropertyEditorCategory> getPropertyCategories() { List<PropertyEditorCategory> result = new ArrayList<>(); <START> PropertyEditorCategory category = layoutCssHelper.createCategory(LayoutEditorCssHelper.CSS_CATEGORY_PANEL); <END> category.withField(layoutCssHelper.createField(this, CssProperty.WIDTH)); category.withField(layoutCssHelper.createField(this, CssProperty.HEIGHT)); category.withField(layoutCssHelper.createField(this, CssProperty.BACKGROUND_COLOR)); result.add(category); category = layoutCssHelper.createCategory(LayoutEditorCssHelper.CSS_CATEGORY_MARGIN); category.withField(layoutCssHelper.createField(this, CssProperty.MARGIN_TOP)); category.withField(layoutCssHelper.createField(this, CssProperty.MARGIN_BOTTOM)); category.withField(layoutCssHelper.createField(this, CssProperty.MARGIN_LEFT)); category.withField(layoutCssHelper.createField(this, CssProperty.MARGIN_RIGHT)); result.add(category); category = layoutCssHelper.createCategory(LayoutEditorCssHelper.CSS_CATEGORY_PADDING); category.withField(layoutCssHelper.createField(this, CssProperty.PADDING_TOP)); category.withField(layoutCssHelper.createField(this, CssProperty.PADDING_BOTTOM)); category.withField(layoutCssHelper.createField(this, CssProperty.PADDING_LEFT)); category.withField(layoutCssHelper.createField(this, CssProperty.PADDING_RIGHT)); result.add(category); return result; }</code><technical_language>please extract this container getPropertyCategories() block a helper class</technical_language>

Target:
public List<PropertyEditorCategory> getPropertyCategories() { return layoutCssHelper.getRowPropertyCategories(this); }
Source:
<code>private void stopLogReplication() { switch(localClusterDescriptor.getRole()) { case ACTIVE: <START> log.info("This cluster has lost leadership. Stopping lof replication, according to role {}", localClusterDescriptor.getRole()); <END> replicationManager.stop(); break; case STANDBY: log.info("This cluster has lost leadership. Stopping lof replication, according to role {}", localClusterDescriptor.getRole()); interClusterReplicationService.getLogReplicationServer().setLeadership(false); break; default: log.warn("Invalid role type {}. Failed to stop replication if any running.", localClusterDescriptor.getRole()); break; } }</code><technical_language>typo -> lof -> log</technical_language>

Target:
private void stopLogReplication() { switch(localClusterDescriptor.getRole()) { case ACTIVE: log.info("This cluster has lost leadership. Stopping log replication, according to role {}", localClusterDescriptor.getRole()); replicationManager.stop(); break; case STANDBY: log.info("This cluster has lost leadership. Stopping log replication, according to role {}", localClusterDescriptor.getRole()); interClusterReplicationService.getLogReplicationServer().setLeadership(false); break; default: log.warn("Invalid role type {}. Failed to stop replication if any running.", localClusterDescriptor.getRole()); break; } }
Source:
<code>private void update(Username username, PackageDefinition packageDeinition, HttpLocalizedOperationResult result, EntityConfigUpdateCommand command) { try { goConfigService.updateConfig(command, username); } catch (Exception e) { if (e instanceof GoConfigInvalidException && !result.hasMessage()) { result.unprocessableEntity(entityConfigValidationFailed(packageDeinition.getClass().getAnnotation(ConfigTag.class).value(), packageDeinition.getId(), e.getMessage())); } else if (e instanceof RulesViolationException || e instanceof SecretResolutionFailureException) { <START> LOGGER.error(e.getMessage(), e); <END> result.unprocessableEntity(saveFailedWithReason(e.getMessage())); } else { if (!result.hasMessage()) { LOGGER.error(e.getMessage(), e); result.internalServerError(saveFailedWithReason("An error occurred while saving the package config. Please check the logs for more information.")); } } } }</code><technical_language>log this error</technical_language>

Target:
private void update(Username username, PackageDefinition packageDeinition, HttpLocalizedOperationResult result, EntityConfigUpdateCommand command) { try { goConfigService.updateConfig(command, username); } catch (Exception e) { if (e instanceof GoConfigInvalidException && !result.hasMessage()) { result.unprocessableEntity(entityConfigValidationFailed(packageDeinition.getClass().getAnnotation(ConfigTag.class).value(), packageDeinition.getId(), e.getMessage())); } else if (e instanceof RulesViolationException || e instanceof SecretResolutionFailureException) { result.unprocessableEntity(saveFailedWithReason(e.getMessage())); } else { if (!result.hasMessage()) { LOGGER.error(e.getMessage(), e); result.internalServerError(saveFailedWithReason("An error occurred while saving the package config. Please check the logs for more information.")); } } } }
Source:
<code>protected ValueBlock(CustomUIPane pane, Type type, String value, String fxml) { super(pane); this.value = new SimpleStringProperty(value); this.output = new OutputAnchor(this); this.type = type; this.loadFXML(fxml); outputSpace.setCenter(this.getOutputAnchor().get()); outputSpace.toFront(); <START> this.valueType.setText("hoi"); <END> }</code><technical_language>debug code</technical_language>

Target:
protected ValueBlock(CustomUIPane pane, Type type, String value, String fxml) { super(pane); this.value = new SimpleStringProperty(value); this.output = new OutputAnchor(this); this.type = type; this.loadFXML(fxml); outputSpace.setCenter(this.getOutputAnchor().get()); outputSpace.toFront(); }
Source:
<code>default Object getDetail(String attribute) { <START> return getDetail(new ResultErrorBuilder.ErrorAttribute(attribute)); <END> }</code><technical_language>please</technical_language>

Target:
default Object getDetail(String attribute) { return getDetail(asAttribute(attribute)); }
Source:
<code>public void shouldThrowForUnknownTopic() { final String unknownTopic = "unknownTopic"; final byte[] nullValue = null; testDriver = new TopologyTestDriver(new Topology(), config); try { <START> pipeRecord(unknownTopic, new TestRecord<byte[], byte[]>(nullValue)); <END> fail("Should have throw IllegalArgumentException"); } catch (final IllegalArgumentException exception) { assertEquals("Unknown topic: " + unknownTopic, exception.getMessage()); } }</code><technical_language>final IllegalArgumentException exception = assertThrows(...) instead of try-catch</technical_language>

Target:
public void shouldThrowForUnknownTopic() { final String unknownTopic = "unknownTopic"; final byte[] nullValue = null; testDriver = new TopologyTestDriver(new Topology(), config); assertThrows(IllegalArgumentException.class, () -> { pipeRecord(unknownTopic, new TestRecord<byte[], byte[]>(nullValue)); }); }
Source:
<code>private CellEditor[] createTransitionViewerCellEditors(Table table) { BasicFBType fbType = getBasicFBType(); return new CellEditor[] { <START> ComboBoxWidgetFactory.createComboBoxCellEditor(table, ECCContentAndLabelProvider.getInputEventNames(fbType).toArray(new String[0]), SWT.READ_ONLY), <END> ComboBoxWidgetFactory.createComboBoxCellEditor(table, ECCContentAndLabelProvider.getInputEventNames(fbType).toArray(new String[0]), SWT.READ_ONLY), ComboBoxWidgetFactory.createComboBoxCellEditor(table, ECCContentAndLabelProvider.getTransitionConditionEventNames(fbType).toArray(new String[0]), SWT.READ_ONLY), new TextCellEditor(table), new TextCellEditor(table) }; }</code><technical_language>this empty priorities cell editor is needed (editing reorder-widget)</technical_language>

Target:
private CellEditor[] createTransitionViewerCellEditors(Table table) { BasicFBType fbType = getBasicFBType(); return new CellEditor[] { null, null, ComboBoxWidgetFactory.createComboBoxCellEditor(table, ECCContentAndLabelProvider.getTransitionConditionEventNames(fbType).toArray(new String[0]), SWT.READ_ONLY), new TextCellEditor(table), new TextCellEditor(table) }; }
Source:
<code>private void updateColors(Display display) { if (display == null) display = fComposite.getDisplay(); Color bgColor = null; if (fBackground != null) bgColor = getColor(display, fBackground); if (fAncestor != null) fAncestor.setBackgroundColor(bgColor); if (fLeft != null) fLeft.setBackgroundColor(bgColor); if (fRight != null) fRight.setBackgroundColor(bgColor); Color fgColor = null; if (fForeground != null) fgColor = getColor(display, fForeground); if (fAncestor != null) fAncestor.setForegroundColor(fgColor); if (fLeft != null) fLeft.setForegroundColor(fgColor); if (fRight != null) fRight.setForegroundColor(fgColor); ColorRegistry registry= JFaceResources.getColorRegistry(); RGB bg= getBackground(display); incomingPalette = new ColorPalette(bg, INCOMING_COLOR, new RGB(0, 0, 255)); outgoingPalette = new ColorPalette(bg, OUTGOING_COLOR, new RGB(0, 0, 0)); conflictPalette = new ColorPalette(bg, CONFLICTING_COLOR, new RGB(255, 0, 0)); additionPalette = new ColorPalette(bg, ADDITION_COLOR, new RGB(0, 255, 0)); deletionPalette = new ColorPalette(bg, DELETION_COLOR, new RGB(255, 0, 0)); <START> editionPalette = outgoingPalette; <END> RESOLVED= registry.getRGB(RESOLVED_COLOR); if (RESOLVED == null) RESOLVED= new RGB(0, 255, 0); updatePresentation(); }</code><technical_language>EDITION_COLOR instantiate a new ColorPalette here</technical_language>

Target:
private void updateColors(Display display) { if (display == null) display = fComposite.getDisplay(); Color bgColor = null; if (fBackground != null) bgColor = getColor(display, fBackground); if (fAncestor != null) fAncestor.setBackgroundColor(bgColor); if (fLeft != null) fLeft.setBackgroundColor(bgColor); if (fRight != null) fRight.setBackgroundColor(bgColor); Color fgColor = null; if (fForeground != null) fgColor = getColor(display, fForeground); if (fAncestor != null) fAncestor.setForegroundColor(fgColor); if (fLeft != null) fLeft.setForegroundColor(fgColor); if (fRight != null) fRight.setForegroundColor(fgColor); ColorRegistry registry= JFaceResources.getColorRegistry(); RGB bg= getBackground(display); incomingPalette = new ColorPalette(bg, INCOMING_COLOR, new RGB(0, 0, 255)); outgoingPalette = new ColorPalette(bg, OUTGOING_COLOR, new RGB(0, 0, 0)); conflictPalette = new ColorPalette(bg, CONFLICTING_COLOR, new RGB(255, 0, 0)); additionPalette = new ColorPalette(bg, ADDITION_COLOR, new RGB(0, 255, 0)); deletionPalette = new ColorPalette(bg, DELETION_COLOR, new RGB(255, 0, 0)); editionPalette = new ColorPalette(bg, EDITION_COLOR, new RGB(0, 0, 0)); RESOLVED= registry.getRGB(RESOLVED_COLOR); if (RESOLVED == null) RESOLVED= new RGB(0, 255, 0); updatePresentation(); }
Source:
<code>public void testListHardwareHdds() throws InterruptedException { assertNodeAvailable(currentServer); <START> Thread.sleep(60000); <END> List<Hdd> hdds = serverApi().listHdds(currentServer.id()); for (Hdd hdd : hdds) { if (!hdd.isMain()) { currentHdd = hdd; break; } } assertNotNull(hdds); assertFalse(hdds.isEmpty()); Assert.assertTrue(hdds.size() > 0); }</code><technical_language>Is a smarter do this</technical_language>

Target:
public void testListHardwareHdds() throws InterruptedException { assertNodeAvailable(currentServer); List<Hdd> hdds = serverApi().listHdds(currentServer.id()); for (Hdd hdd : hdds) { if (!hdd.isMain()) { currentHdd = hdd; break; } } assertNotNull(hdds); assertFalse(hdds.isEmpty()); Assert.assertTrue(hdds.size() > 0); }
Source:
<code>public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) { if(!fromUser) { return; } if (rating < 1.0f) { ratingBar.setRating(1.0f); <START> } else if (rating > 1.0f && rating <= 2.0f) { <END> ratingBar.setRating(2.0f); } else if (rating > 2.0f && rating <= 3.0f) { ratingBar.setRating(3.0f); } else if (rating > 3.0f && rating <= 4.0f) { ratingBar.setRating(4.0f); } else if (rating > 4.0f && rating <= 5.0f) { ratingBar.setRating(5.0f); } if (inputChangedListener != null) { Map<String, Object> dataMap = new HashMap<>(); dataMap.put(model.getTag(), ratingBar.getRating()); inputChangedListener.onContentChanged(dataMap, model); } }</code><technical_language>Math.ceil(rating)</technical_language>

Target:
public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) { if(!fromUser) { return; } if (rating < 1.0f) { ratingBar.setRating(1.0f); } else { float rounded = (float) Math.ceil(rating); ratingBar.setRating(rounded); } if (inputChangedListener != null) { Map<String, Object> dataMap = new HashMap<>(); dataMap.put(model.getTag(), ratingBar.getRating()); inputChangedListener.onContentChanged(dataMap, model); } }
Source:
<code>private static boolean hasReachedAnyLocalQuorum(Map<String, Integer> totalNumberInDcs, Map<String, Integer> currentNumberInDcs) { for (String dcName : totalNumberInDcs.keySet()) { int totalNum = totalNumberInDcs.get(dcName); if (currentNumberInDcs.containsKey(dcName)) { int currentNum = currentNumberInDcs.get(dcName); <START> if (totalNum != 1 && currentNum > totalNum / 2) { <END> return true; } } } return false; }</code><technical_language>question here, do account for colo single replica</technical_language>

Target:
static boolean hasReachedAnyLocalQuorum(Map<String, Integer> totalNumberInDcs, Map<String, Integer> currentNumberInDcs) { for (String dcName : totalNumberInDcs.keySet()) { int totalNum = totalNumberInDcs.get(dcName); if (currentNumberInDcs.containsKey(dcName)) { int currentNum = currentNumberInDcs.get(dcName); if (currentNum > totalNum / 2) { return true; } } } return false; }
Source:
<code>public static String getPackageNameByNameSpaceURI(String nameSpaceURI) { int idx = nameSpaceURI.indexOf(':'); String scheme = ""; if (idx >= 0) { scheme = nameSpaceURI.substring(0, idx); if ("http".equalsIgnoreCase(scheme) || "urn".equalsIgnoreCase(scheme)) { nameSpaceURI = nameSpaceURI.substring(idx + 1); } } List<String> tokens = tokenize(nameSpaceURI, "/: "); if (tokens.isEmpty()) { return null; } if (tokens.size() > 1) { String lastToken = tokens.get(tokens.size() - 1); idx = lastToken.lastIndexOf('.'); if (idx > 0) { lastToken = lastToken.substring(0, idx); tokens.set(tokens.size() - 1, lastToken); } } String domain = tokens.get(0); idx = domain.indexOf(':'); if (idx >= 0) { domain = domain.substring(0, idx); } List<String> r = tokenize(domain, "urn".equals(scheme) ? ".-" : "."); <START> if ("www".equalsIgnoreCase(r.get(0))) { <END> r.remove(0); } Collections.reverse(r); tokens.addAll(1, r); tokens.remove(0); for (int i = 0; i < tokens.size(); i++) { String token = tokens.get(i); token = removeIllegalIdentifierChars(token); if (containsReservedKeywords(token)) { token = '_' + token; } tokens.set(i, token.toLowerCase()); } return String.join(".", tokens); }</code><technical_language>Intuitively, of time dealing ArrayList, removing end of list is more efficient beginning of list</technical_language>

Target:
public static String getPackageNameByNameSpaceURI(String nameSpaceURI) { int idx = nameSpaceURI.indexOf(':'); boolean urnScheme = false; if (idx >= 0) { final String scheme = nameSpaceURI.substring(0, idx); urnScheme = "urn".equalsIgnoreCase(scheme); if ("http".equalsIgnoreCase(scheme) || urnScheme) { nameSpaceURI = nameSpaceURI.substring(idx + (urnScheme ? 1 : 3)); } } List<String> tokens = tokenize(nameSpaceURI, "/:"); if (tokens.isEmpty()) { return null; } if (tokens.size() > 1) { String lastToken = tokens.get(tokens.size() - 1); idx = lastToken.lastIndexOf('.'); if (idx > 0) { lastToken = lastToken.substring(0, idx); tokens.set(tokens.size() - 1, lastToken); } } String domain = tokens.remove(0); List<String> r = tokenize(domain, urnScheme ? ".-" : "."); Collections.reverse(r); if ("www".equalsIgnoreCase(r.get(r.size() - 1))) { r.remove(r.size() - 1); } tokens.addAll(0, r); for (int i = 0; i < tokens.size(); i++) { String token = tokens.get(i); token = removeIllegalIdentifierChars(token); if (JavaUtils.isJavaKeyword(token)) { token = '_' + token; } tokens.set(i, token.toLowerCase()); } return String.join(".", tokens); }
Source:
<code><START> public void testReplaceNicsMacSequenceInBootArgs() throws Exception { <END> String bootArgs = "nic_macs=02:00:65:b5:00:03|7C02:00:4f:1b:00:15|7C1e:00:54:00:00:0f|7C02:00:35:fa:00:11|7C02:00:47:40:00:12"; doReturn(bootArgs).when(vmSpec).getBootArgs(); String oldMacSequence = "7C02:00:35:fa:00:11|7C02:00:47:40:00:12"; String newMacSequence = "7C02:00:0c:1d:00:1d|7C02:00:68:0f:00:1e"; String updatedBootArgs = _resource.replaceNicsMacSequenceInBootArgs(oldMacSequence, newMacSequence, vmSpec); String newBootArgs = "nic_macs=02:00:65:b5:00:03|7C02:00:4f:1b:00:15|7C1e:00:54:00:00:0f|7C02:00:0c:1d:00:1d|7C02:00:68:0f:00:1e"; assertEquals(newBootArgs, updatedBootArgs); }</code><technical_language>Do need this throws Exception here? o required of method calls here</technical_language>

Target:
public void testReplaceNicsMacSequenceInBootArgs() { String bootArgs = "nic_macs=02:00:65:b5:00:03|7C02:00:4f:1b:00:15|7C1e:00:54:00:00:0f|7C02:00:35:fa:00:11|7C02:00:47:40:00:12"; doReturn(bootArgs).when(vmSpec).getBootArgs(); String oldMacSequence = "7C02:00:35:fa:00:11|7C02:00:47:40:00:12"; String newMacSequence = "7C02:00:0c:1d:00:1d|7C02:00:68:0f:00:1e"; String updatedBootArgs = _resource.replaceNicsMacSequenceInBootArgs(oldMacSequence, newMacSequence, vmSpec); String newBootArgs = "nic_macs=02:00:65:b5:00:03|7C02:00:4f:1b:00:15|7C1e:00:54:00:00:0f|7C02:00:0c:1d:00:1d|7C02:00:68:0f:00:1e"; assertEquals(newBootArgs, updatedBootArgs); }
Source:
<code>protected Operation(Builder builder) { operationId = checkNotNull(builder.operationId, "operationId"); status = checkNotNull(builder.status, "status"); type = checkNotNull(builder.type, "type"); direction = checkNotNull(builder.direction, "direction"); title = checkNotNull(builder.title, "title"); patternId = builder.patternId; amount = checkNotNull(builder.amount, "amount"); amountDue = builder.amountDue; fee = builder.fee; datetime = checkNotNull(builder.datetime, "datetime"); sender = builder.sender; recipient = builder.recipient; recipientType = builder.recipientType; message = builder.message; comment = builder.comment; codepro = builder.codepro; protectionCode = builder.protectionCode; expires = builder.expires; answerDatetime = builder.answerDatetime; label = builder.label; details = builder.details; repeatable = builder.repeatable; paymentParameters = Collections.unmodifiableMap(checkNotNull(builder.paymentParameters,"paymentParameters")); <START> favorite = builder.favorite; <END> digitalGoods = builder.digitalGoods; categories = Collections.unmodifiableList(builder.categories); format = builder.format; }</code><technical_language>Unnecessary change</technical_language>

Target:
protected Operation(Builder builder) { operationId = checkNotNull(builder.operationId, "operationId"); status = checkNotNull(builder.status, "status"); type = checkNotNull(builder.type, "type"); direction = checkNotNull(builder.direction, "direction"); title = checkNotNull(builder.title, "title"); patternId = builder.patternId; amount = checkNotNull(builder.amount, "amount"); amountDue = builder.amountDue; fee = builder.fee; datetime = checkNotNull(builder.datetime, "datetime"); sender = builder.sender; recipient = builder.recipient; recipientType = builder.recipientType; message = builder.message; comment = builder.comment; codepro = builder.codepro; protectionCode = builder.protectionCode; expires = builder.expires; answerDatetime = builder.answerDatetime; label = builder.label; details = builder.details; repeatable = builder.repeatable; paymentParameters = Collections.unmodifiableMap(checkNotNull(builder.paymentParameters,"paymentParameters")); favorite = builder.favorite; digitalGoods = builder.digitalGoods; categories = Collections.unmodifiableList(checkNotNull(builder.categories, "categories")); format = builder.format; }
Source:
<code>public static String join(Iterable<?> iterable, String separator) { StringBuilder sb = new StringBuilder(); boolean isFirst = true; for ( Object object : iterable ) { if ( !isFirst ) { sb.append( separator ); } else { isFirst = false; } <START> sb.append( object ); <END> } return sb.toString(); }</code><technical_language>handle 'null' properly</technical_language>

Target:
public static String join(Iterable<?> iterable, String separator) { if ( iterable == null ) { return null; } StringBuilder sb = new StringBuilder(); boolean isFirst = true; for ( Object object : iterable ) { if ( !isFirst ) { sb.append( separator ); } else { isFirst = false; } sb.append( object ); } return sb.toString(); }
Source:
<code>public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) { List<IHyperlink> links = new ArrayList<IHyperlink>(); IFile file = getFile(); if(file == null) return null; StructuredModelWrapper smw = new StructuredModelWrapper(); smw.init(textViewer.getDocument()); try { Document xmlDocument = smw.getDocument(); if (xmlDocument == null) return null; Node n = findNodeForOffset(xmlDocument, region.getOffset()); if(n != null){ if(n.getNodeType() == Node.ELEMENT_NODE && n instanceof ElementImpl){ ITextRegion textRegion = ((ElementImpl)n).getStartStructuredDocumentRegion(); Region nodeRegion = new Region(textRegion.getStart(), textRegion.getLength()); String id = findID(n); if(id != null){ <START> String url = "file:/ END> String shortName = file.getName()+"#"+id; links.add(new OpenWithBrowserSimHyperlink(textViewer.getDocument(), nodeRegion, shortName, url)); } } } if (links.size() == 0) return null; return (IHyperlink[])links.toArray(new IHyperlink[links.size()]); } finally { smw.dispose(); } }</code><technical_language>toUrl()</technical_language>

Target:
public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) { List<IHyperlink> links = new ArrayList<IHyperlink>(); IFile file = getFile(); if(file == null) return null; StructuredModelWrapper smw = new StructuredModelWrapper(); smw.init(textViewer.getDocument()); try { Document xmlDocument = smw.getDocument(); if (xmlDocument == null) return null; Node n = findNodeForOffset(xmlDocument, region.getOffset()); if(n != null){ if(n.getNodeType() == Node.ELEMENT_NODE && n instanceof ElementImpl){ ITextRegion textRegion = ((ElementImpl)n).getStartStructuredDocumentRegion(); Region nodeRegion = new Region(textRegion.getStart(), textRegion.getLength()); String id = findID(n); if(id != null){ String url = file.getLocation().toFile().toURI()+"#"+id; String shortName = file.getName()+"#"+id; links.add(new OpenWithBrowserSimHyperlink(textViewer.getDocument(), nodeRegion, shortName, url)); links.add(new OpenWithBrowserHyperlink(textViewer.getDocument(), nodeRegion, shortName, url)); } } } if (links.size() == 0) return null; return (IHyperlink[])links.toArray(new IHyperlink[links.size()]); } finally { smw.dispose(); } }
Source:
<code>public void fireEventListeners(final Event event) { final ArrayList<EventListener> listeners = new ArrayList<>(this.listeners); for (final EventListener listener : listeners) { <START> try { listener.handleEvent(event); } catch (Exception e) { logger.warn("Error while calling handleEvent for: " + listener.getClass()); logger.warn(e.getMessage(), e); } <END> } }</code><technical_language>Wondering benefit of catching java.lang.Exceptions for EventListener.handleEvent() handleEvent declare a throw in signature: public interface EventListener { public void handleEvent(Event event); } more specific catch java.lang.RuntimeException? is throw in signature, lose functionality, intention clearer in code itself</technical_language>

Target:
public void fireEventListeners(final Event event) { final ArrayList<EventListener> listeners = new ArrayList<>(this.listeners); for (final EventListener listener : listeners) { try { listener.handleEvent(event); } catch (RuntimeException e) { logger.warn("Error while calling handleEvent for: " + listener.getClass()); logger.warn(e.getMessage(), e); } } }
Source:
<code>private static StatementTree getBody(StatementTree tree, int expectedSize) { <START> StatementTree statement = tree; <END> if (statement.is(Kind.BLOCK)) { BlockTree block = (BlockTree) statement; List<StatementTree> body = block.body(); statement = body.size() == expectedSize ? body.get(0) : null; } return statement; }</code><technical_language>Do need this variable</technical_language>

Target:
private static StatementTree getBody(StatementTree tree, int expectedSize) { if (tree.is(Kind.BLOCK)) { BlockTree block = (BlockTree) tree; List<StatementTree> body = block.body(); tree = body.size() == expectedSize ? body.get(0) : null; } return tree; }
Source:
<code>default boolean isBrowser() { return ofNullable(getSessionDetail("browserName")) <START> .map(browserName -> browserName.toString()) <END> .orElse(null) != null; }</code><technical_language>String::valueOf</technical_language>

Target:
default boolean isBrowser() { return ofNullable(getSessionDetail("browserName")) .orElse(null) != null; }
Source:
<code>private void onOpenEditor(VirtualFile file, EditorPartPresenter editor) { final List<Breakpoint> fileBreakpoints = breakpoints.get(file.getPath()); if (fileBreakpoints != null) { final BreakpointRenderer breakpointRenderer = getBreakpointRendererForEditor(editor); if (breakpointRenderer != null) { for (final Breakpoint breakpoint : fileBreakpoints) { int lineNumber = breakpoint.getLineNumber(); breakpointRenderer.addBreakpointMark(lineNumber, new LineChangeAction() { @Override public void onLineChange(VirtualFile file, int firstLine, int linesAdded, int linesRemoved) { BreakpointManagerImpl.this.onLineChange(file, firstLine, linesAdded, linesRemoved); } }); <START> if (debuggerState == CONNECTED && breakpoint.isActive()) { <END> breakpointRenderer.setBreakpointActive(lineNumber, true); } if (isCurrentBreakpoint(lineNumber)) { breakpointRenderer.setLineActive(lineNumber, true); } } } } }</code><technical_language>if level, try avoid it. unreadable</technical_language>

Target:
private void onOpenEditor(VirtualFile file, EditorPartPresenter editor) { final List<Breakpoint> fileBreakpoints = breakpoints.get(file.getPath()); if (fileBreakpoints != null) { final BreakpointRenderer breakpointRenderer = getBreakpointRendererForEditor(editor); if (breakpointRenderer != null) { for (final Breakpoint breakpoint : fileBreakpoints) { readdBreakpointMark(breakpointRenderer, breakpoint); } } } }
Source:
<code>public void onNext(T value) { <START> R v = this.value; <END> try { this.value = ObjectHelper.requireNonNull(reducer.apply(v, value), "The reducer returned a null value"); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); d.dispose(); onError(ex); } }</code><technical_language>done checks in this class</technical_language>

Target:
public void onNext(T value) { R v = this.value; if (v != null) { try { this.value = ObjectHelper.requireNonNull(reducer.apply(v, value), "The reducer returned a null value"); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); d.dispose(); onError(ex); } } }
Source:
<code>public void testNestedNonTerminals1() throws Exception { Grammar.NonTerminalId ntistart = new Grammar.NonTerminalId("StartNT"); Grammar.StateId stistart = new Grammar.StateId("StartState"); Grammar.StateId stiend = new Grammar.StateId("EndState"); Grammar.NonTerminal nt1 = new Grammar.NonTerminal(ntistart, stistart, new Grammar.State.OrderingInfo(0), stiend, new Grammar.State.OrderingInfo(100)); Grammar.RegExState resx = new Grammar.RegExState(new Grammar.StateId("RegExStidx"), nt1, new Grammar.State.OrderingInfo(1), Pattern.compile("x")); Grammar.RegExState resy = new Grammar.RegExState(new Grammar.StateId("RegExStidy"), nt1, new Grammar.State.OrderingInfo(3), Pattern.compile("y")); Grammar.NonTerminalState nts = new Grammar.NonTerminalState(new Grammar.StateId("NT"), nt1, new Grammar.State.OrderingInfo(2), nt1, false); nt1.entryState.next.add(resx); nt1.entryState.next.add(nt1.exitState); resx.next.add(nts); nts.next.add(resy); resy.next.add(nt1.exitState); { Term result = new Parser(new ParseState("")).parse(nt1, 0); Term expected = amb(klist(amb(KList.EMPTY))); assertEquals("EmtpyString check: ", expected, result); } { Term result = new Parser(new ParseState("xxyy")).parse(nt1, 0); Term expected = amb(klist(amb(klist(Token.kAppOf("K", "x"), amb(klist(Token.kAppOf("K", "x"), amb(KList.EMPTY), Token.kAppOf("K", "y"))), Token.kAppOf("K", "y"))))); assertEquals("x^ny^n check: ", expected, result); } <START> assertEquals("Expected Nullable NTs", 1, NullabilityCheck.getReachableNullableNT(nt1).size()); <END> }</code><technical_language>Please assert nullable nonterminal is</technical_language>

Target:
public void testNestedNonTerminals1() throws Exception { Grammar.NonTerminalId ntistart = new Grammar.NonTerminalId("StartNT"); Grammar.StateId stistart = new Grammar.StateId("StartState"); Grammar.StateId stiend = new Grammar.StateId("EndState"); Grammar.NonTerminal nt1 = new Grammar.NonTerminal(ntistart, stistart, new Grammar.State.OrderingInfo(0), stiend, new Grammar.State.OrderingInfo(100)); Grammar.RegExState resx = new Grammar.RegExState(new Grammar.StateId("RegExStidx"), nt1, new Grammar.State.OrderingInfo(1), Pattern.compile("x")); Grammar.RegExState resy = new Grammar.RegExState(new Grammar.StateId("RegExStidy"), nt1, new Grammar.State.OrderingInfo(3), Pattern.compile("y")); Grammar.NonTerminalState nts = new Grammar.NonTerminalState(new Grammar.StateId("NT"), nt1, new Grammar.State.OrderingInfo(2), nt1, false); nt1.entryState.next.add(resx); nt1.entryState.next.add(nt1.exitState); resx.next.add(nts); nts.next.add(resy); resy.next.add(nt1.exitState); { Term result = new Parser(new ParseState("")).parse(nt1, 0); Term expected = amb(klist(amb(KList.EMPTY))); Assert.assertEquals("EmtpyString check: ", expected, result); } { Term result = new Parser(new ParseState("xxyy")).parse(nt1, 0); Term expected = amb(klist(amb(klist(Token.kAppOf("K", "x"), amb(klist(Token.kAppOf("K", "x"), amb(KList.EMPTY), Token.kAppOf("K", "y"))), Token.kAppOf("K", "y"))))); Assert.assertEquals("x^ny^n check: ", expected, result); } Assert.assertEquals("Expected Nullable NTs", nt1, NullabilityCheck.getReachableNullableNT(nt1).iterator().next()); }
Source:
<code>public void addPlayer(Player player) { <START> if(player == null || this.players.contains(player)) { <END> return; } this.players.add(player); calculateSkillLevel(); }</code><technical_language>Again. Max player number</technical_language>

Target:
public int addPlayer(Player player) { if(player == null || this.players.contains(player)) { return -1; } if(this.players.size() == tournament.getMaxPlayers()) { return 0; } this.players.add(player); calculateSkillLevel(); return 1; }
Source:
<code>public void testCancellationExceptionIsReturnedAsCause() throws InterruptedException, ExecutionException, TimeoutException { final Promise<Void> promise = new DefaultPromise<Void>(ImmediateEventExecutor.INSTANCE); <START> promise.cancel(false); <END> assertThat(promise.cause(), instanceOf(CancellationException.class)); }</code><technical_language>please assert return</technical_language>

Target:
public void testCancellationExceptionIsReturnedAsCause() throws InterruptedException, ExecutionException, TimeoutException { final Promise<Void> promise = new DefaultPromise<Void>(ImmediateEventExecutor.INSTANCE); assertTrue(promise.cancel(false)); assertThat(promise.cause(), instanceOf(CancellationException.class)); }
Source:
<code>public ServletContainer getContainer() { <START> if (container instanceof ServletContainer) <END> return (ServletContainer) container; throw new RuntimeException("Not a ServletContainer. Use getServlet instead."); }</code><technical_language>Code style alert. :wink: Please add curly braces consistent code style of rest of project</technical_language>

Target:
public Servlet getContainer() { return container; }