auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testXXXAclSuccessAudits() throws Exception { String userName = ugi.getUserName(); String adminName = ugi.getUserName(); String volumeName = "volume" + RandomStringUtils.randomNumeric(5); <START> org.apache.hadoop.ozone.client.VolumeArgs createVolumeArgs = <END> org.apache.hadoop.ozone.client.VolumeArgs.newBuilder() .setAdmin(adminName) .setOwner(userName) .build(); store.createVolume(volumeName, createVolumeArgs); verifyLog(OMAction.CREATE_VOLUME.name(), volumeName, AuditEventStatus.SUCCESS.name()); OzoneVolume retVolumeinfo = store.getVolume(volumeName); verifyLog(OMAction.READ_VOLUME.name(), volumeName, AuditEventStatus.SUCCESS.name()); Assert.assertTrue(retVolumeinfo.getName().equalsIgnoreCase(volumeName)); OzoneObj volObj = new OzoneObjInfo.Builder() .setVolumeName(volumeName) .setResType(VOLUME) .setStoreType(OZONE) .build(); List<OzoneAcl> acls = store.getAcl(volObj); verifyLog(OMAction.GET_ACL.name(), volumeName, AuditEventStatus.SUCCESS.name()); Assert.assertTrue(acls.size() > 0); store.addAcl(volObj, USER_ACL); verifyLog(OMAction.ADD_ACL.name(), volumeName, "johndoe", AuditEventStatus.SUCCESS.name()); store.removeAcl(volObj, USER_ACL); verifyLog(OMAction.REMOVE_ACL.name(), volumeName, "johndoe", AuditEventStatus.SUCCESS.name()); store.setAcl(volObj, aclListToAdd); verifyLog(OMAction.SET_ACL.name(), volumeName, "johndoe", "jane", AuditEventStatus.SUCCESS.name()); }</code><technical_language>Minor: import org.apache.hadoop.ozone.client.VolumeArgs VolumeArgs</technical_language>

Target:
public void testXXXAclSuccessAudits() throws Exception { String userName = ugi.getUserName(); String adminName = ugi.getUserName(); String volumeName = "volume" + RandomStringUtils.randomNumeric(5); VolumeArgs createVolumeArgs = VolumeArgs.newBuilder() .setAdmin(adminName) .setOwner(userName) .build(); store.createVolume(volumeName, createVolumeArgs); verifyLog(OMAction.CREATE_VOLUME.name(), volumeName, AuditEventStatus.SUCCESS.name()); OzoneVolume retVolumeinfo = store.getVolume(volumeName); verifyLog(OMAction.READ_VOLUME.name(), volumeName, AuditEventStatus.SUCCESS.name()); Assert.assertTrue(retVolumeinfo.getName().equalsIgnoreCase(volumeName)); OzoneObj volObj = new OzoneObjInfo.Builder() .setVolumeName(volumeName) .setResType(VOLUME) .setStoreType(OZONE) .build(); List<OzoneAcl> acls = store.getAcl(volObj); verifyLog(OMAction.GET_ACL.name(), volumeName, AuditEventStatus.SUCCESS.name()); Assert.assertTrue(acls.size() > 0); store.addAcl(volObj, USER_ACL); verifyLog(OMAction.ADD_ACL.name(), volumeName, "johndoe", AuditEventStatus.SUCCESS.name()); store.removeAcl(volObj, USER_ACL); verifyLog(OMAction.REMOVE_ACL.name(), volumeName, "johndoe", AuditEventStatus.SUCCESS.name()); store.setAcl(volObj, aclListToAdd); verifyLog(OMAction.SET_ACL.name(), volumeName, "johndoe", "jane", AuditEventStatus.SUCCESS.name()); }
Source:
<code>public void testSomethingByIterableHandleNullWithNull() { final SomethingByIterableHandleNull s = handle.attach(SomethingByIterableHandleNull.class); <START> final List<Something> out = s.get(null); <END> Assert.assertEquals(4, out.size()); }</code><technical_language>This considered a programming error -- assume null is empty list instead of a coding error</technical_language>

Target:
public void testSomethingByIterableHandleNullWithNull() { final SomethingByIterableHandleNull s = handle.attach(SomethingByIterableHandleNull.class); final List<Something> out = s.get(null); Assert.assertEquals(0, out.size()); }
Source:
<code>public String ToUnsupportedOptionsString() { String value = ""; <START> String delimiter = ""; <END> for (Map.Entry<String, String> pair : fencingAgentInstanceOptions.entrySet()) { String displayedKey = GetDisplayedKey(getAgent(), pair.getKey()); if (!IsSupported(displayedKey)) { value = value + delimiter + displayedKey + (pair.getValue().length() > 0 ? EQUAL + pair.getValue() : ""); delimiter = (new Character(COMMA)).toString(); } } return value; }</code><technical_language>, please change StringBuilder</technical_language>

Target:
public String ToUnsupportedOptionsString() { String delimiter = ""; StringBuilder value = new StringBuilder(); for (Map.Entry<String, String> pair : fencingAgentInstanceOptions.entrySet()) { String displayedKey = GetDisplayedKey(getAgent(), pair.getKey()); if (!IsSupported(displayedKey)) { value.append(delimiter) .append(displayedKey) .append((pair.getValue().length() > 0 ? EQUAL + pair.getValue() : "")); delimiter = COMMA; } } return value.toString(); }
Source:
<code>private void registerNullChannel() { if (this.beanFactory.containsBean(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME)) { BeanDefinition nullChannelDefinition = null; BeanFactory beanFactory = this.beanFactory; do { if (beanFactory instanceof ConfigurableListableBeanFactory) { ConfigurableListableBeanFactory listable = (ConfigurableListableBeanFactory) beanFactory; if (listable.containsBeanDefinition(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME)) { nullChannelDefinition = listable .getBeanDefinition(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME); } } if (beanFactory instanceof HierarchicalBeanFactory) { beanFactory = ((HierarchicalBeanFactory) beanFactory).getParentBeanFactory(); } <START> } while (nullChannelDefinition == null && beanFactory != null); END> if (nullChannelDefinition != null && !NullChannel.class.getName().equals(nullChannelDefinition.getBeanClassName())) { throw new IllegalStateException("The bean name '" + IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME + "' is reserved."); } } else { this.registry.registerBeanDefinition(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME, new RootBeanDefinition(NullChannel.class)); } }</code><technical_language>while a new line. I need check for beanFactory != null, right containsBean(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME) trick for do fail infinite loop. if Checkstyle Sonar Qube require I live extra check in this condition</technical_language>

Target:
private void registerNullChannel() { if (this.beanFactory.containsBean(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME)) { BeanDefinition nullChannelDefinition = null; BeanFactory beanFactory = this.beanFactory; do { if (beanFactory instanceof ConfigurableListableBeanFactory) { ConfigurableListableBeanFactory listable = (ConfigurableListableBeanFactory) beanFactory; if (listable.containsBeanDefinition(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME)) { nullChannelDefinition = listable .getBeanDefinition(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME); } } if (beanFactory instanceof HierarchicalBeanFactory) { beanFactory = ((HierarchicalBeanFactory) beanFactory).getParentBeanFactory(); } } while (nullChannelDefinition == null); if (nullChannelDefinition != null && !NullChannel.class.getName().equals(nullChannelDefinition.getBeanClassName())) { throw new IllegalStateException("The bean name '" + IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME + "' is reserved."); } } else { this.registry.registerBeanDefinition(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME, new RootBeanDefinition(NullChannel.class)); } }
Source:
<code>public ImmutableSet<SanitizedSecret> getSanitizedSecretsFor(Group group) { checkNotNull(group); ImmutableSet.Builder<SanitizedSecret> set = ImmutableSet.builder(); return dslContext.transactionResult(configuration -> { SecretContentDAO secretContentDAO = secretContentDAOFactory.using(configuration); <START> List<SecretSeries> serieses = DSL.using(configuration) <END> .select() .from(SECRETS) .join(ACCESSGRANTS) .on(SECRETS.ID.eq(ACCESSGRANTS.SECRETID)) .join(GROUPS) .on(GROUPS.ID.eq(ACCESSGRANTS.GROUPID)) .where(GROUPS.NAME.eq(group.getName())) .fetchInto(SECRETS) .map(secretSeriesMapper); for (SecretSeries series : serieses) { for (SecretContent content : secretContentDAO.getSecretContentsBySecretId(series.getId())) { SecretSeriesAndContent seriesAndContent = SecretSeriesAndContent.of(series, content); set.add(SanitizedSecret.fromSecretSeriesAndContent(seriesAndContent)); } } return set.build(); }); }</code><technical_language>call getSecretSeriesFor(configuration, group) here</technical_language>

Target:
public ImmutableSet<SanitizedSecret> getSanitizedSecretsFor(Group group) { checkNotNull(group); ImmutableSet.Builder<SanitizedSecret> set = ImmutableSet.builder(); return dslContext.transactionResult(configuration -> { SecretContentDAO secretContentDAO = secretContentDAOFactory.using(configuration); for (SecretSeries series : getSecretSeriesFor(configuration, group)) { for (SecretContent content : secretContentDAO.getSecretContentsBySecretId(series.getId())) { SecretSeriesAndContent seriesAndContent = SecretSeriesAndContent.of(series, content); set.add(SanitizedSecret.fromSecretSeriesAndContent(seriesAndContent)); } } return set.build(); }); }
Source:
<code>private static void removeNetworkFromHosts(Network network, CommandContext context, List<VdsNetworkInterface> nics) { final ManagementNetworkUtil managementNetworkUtil = Injector.get(ManagementNetworkUtil.class); InterfaceDao interfaceDao = Injector.get(InterfaceDao.class); VdsStaticDao vdsStaticDao = Injector.get(VdsStaticDao.class); NetworkClusterDao networkClusterDao = Injector.get(NetworkClusterDao.class); NetworkAttachmentDao networkAttachmentDao = Injector.get(NetworkAttachmentDao.class); <START> RemoveNetworkParametersBuilder builder = <END> new RemoveNetworkParametersBuilder(network, context, managementNetworkUtil, interfaceDao, vdsStaticDao, networkClusterDao, networkAttachmentDao); ArrayList<VdcActionParametersBase> parameters = builder.buildParameters(nics); if (!parameters.isEmpty()) { HostSetupNetworksParametersBuilder.updateParametersSequencing(parameters); Backend.getInstance().runInternalMultipleActions(VdcActionType.PersistentHostSetupNetworks, parameters, context); } }</code><technical_language>changes discussed in individual builders bring of CI inject RemoveNetworkParametersBuilder remove other injections here</technical_language>

Target:
private static void removeNetworkFromHosts(Network network, CommandContext context, List<VdsNetworkInterface> nics) { RemoveNetworkParametersBuilder builder = Injector.get(RemoveNetworkParametersBuilder.class); ArrayList<VdcActionParametersBase> parameters = builder.buildParameters(network, nics); if (!parameters.isEmpty()) { HostSetupNetworksParametersBuilder.updateParametersSequencing(parameters); Backend.getInstance().runInternalMultipleActions(VdcActionType.PersistentHostSetupNetworks, parameters, context); } }
Source:
<code>private void undeploy(EventProcessingDeployer deployer, Artifact artifact) throws DeploymentException { List<CappFile> files = artifact.getFiles(); String fileName = artifact.getFiles().get(0).getName(); String artifactPath = artifact.getExtractedPath() + File.separator + fileName; try { deployer.processUndeployment(new DeploymentFileData(new File(artifactPath), deployer).getAbsolutePath()); <START> artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_DEPLOYED); <END> } catch (Exception e) { artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_FAILED); log.error("Undeployment is failed due to " + e.getMessage(), e); throw new DeploymentException(e.getMessage(), e); } }</code><technical_language>setting DEPLOYMENT_STATUS_DEPLOYED un-deployment</technical_language>

Target:
private void undeploy(EventProcessingDeployer deployer, Artifact artifact) throws DeploymentException { List<CappFile> files = artifact.getFiles(); String fileName = artifact.getFiles().get(0).getName(); String artifactPath = artifact.getExtractedPath() + File.separator + fileName; try { deployer.processUndeployment(new DeploymentFileData(new File(artifactPath), deployer).getAbsolutePath()); artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_PENDING); } catch (Exception e) { artifact.setDeploymentStatus(AppDeployerConstants.DEPLOYMENT_STATUS_FAILED); log.error("Undeployment is failed due to " + e.getMessage(), e); throw new DeploymentException(e.getMessage(), e); } }
Source:
<code>public void testRegisterProcessorAndGetIdShouldFailForDuplicateProcessorRegistration() { final String testHostName = "localhost"; final String testProcessId = "testProcessorId"; ProcessorData processorData1 = new ProcessorData(testHostName, testProcessId); zkUtils.registerProcessorAndGetId(processorData1); <START> ZkUtils zkUtils1 = new ZkUtils(KEY_BUILDER, zkClient, 1000, 500, new NoOpMetricsRegistry()); <END> zkUtils1.connect(); ProcessorData duplicateProcessorData = new ProcessorData(testHostName, testProcessId); expectedException.expect(SamzaException.class); zkUtils1.registerProcessorAndGetId(duplicateProcessorData); }</code><technical_language>reduce of SESSION_TIMEOUT_MS CONNECTION_TIMEOUT_MS constants getZkUtils uses</technical_language>

Target:
public void testRegisterProcessorAndGetIdShouldFailForDuplicateProcessorRegistration() { final String testHostName = "localhost"; final String testProcessId = "testProcessorId"; ProcessorData processorData1 = new ProcessorData(testHostName, testProcessId); zkUtils.registerProcessorAndGetId(processorData1); ZkUtils zkUtils1 = getZkUtils(); zkUtils1.connect(); ProcessorData duplicateProcessorData = new ProcessorData(testHostName, testProcessId); expectedException.expect(SamzaException.class); zkUtils1.registerProcessorAndGetId(duplicateProcessorData); }
Source:
<code>public void testSearchOnChainedToken() { Patient patient = new Patient(); patient.setId("P"); patient.addIdentifier().setSystem("sys").setValue("val"); myPatientDao.update(patient); Observation obs = new Observation(); obs.setId("O"); obs.getSubject().setReference("Patient/P"); myObservationDao.update(obs); SearchParameterMap map = new SearchParameterMap(); map.setLoadSynchronous(true); map.add(Observation.SP_SUBJECT, new ReferenceParam("identifier", "sys|val")); myCaptureQueriesListener.clear(); IBundleProvider outcome = myObservationDao.search(map); assertThat(toUnqualifiedVersionlessIdValues(outcome), containsInAnyOrder("Observation/O")); assertEquals(2, myCaptureQueriesListener.countSelectQueriesForCurrentThread()); assertEquals(0, myCaptureQueriesListener.countInsertQueriesForCurrentThread()); assertEquals(0, myCaptureQueriesListener.countUpdateQueriesForCurrentThread()); assertEquals(0, myCaptureQueriesListener.countDeleteQueriesForCurrentThread()); myCaptureQueriesListener.logSelectQueriesForCurrentThread(); <START> assertEquals(1, StringUtils.countMatches(myCaptureQueriesListener.getSelectQueriesForCurrentThread().get(0).getSql(true, true).toLowerCase(), "join")); <END> }</code><technical_language>I assume this assert failed change</technical_language>

Target:
public void testSearchOnChainedToken() { Patient patient = new Patient(); patient.setId("P"); patient.addIdentifier().setSystem("sys").setValue("val"); myPatientDao.update(patient); Observation obs = new Observation(); obs.setId("O"); obs.getSubject().setReference("Patient/P"); myObservationDao.update(obs); SearchParameterMap map = SearchParameterMap.newSynchronous(Observation.SP_SUBJECT, new ReferenceParam("identifier", "sys|val")); myCaptureQueriesListener.clear(); IBundleProvider outcome = myObservationDao.search(map); assertThat(toUnqualifiedVersionlessIdValues(outcome), containsInAnyOrder("Observation/O")); assertEquals(2, myCaptureQueriesListener.countSelectQueriesForCurrentThread()); assertEquals(0, myCaptureQueriesListener.countInsertQueriesForCurrentThread()); assertEquals(0, myCaptureQueriesListener.countUpdateQueriesForCurrentThread()); assertEquals(0, myCaptureQueriesListener.countDeleteQueriesForCurrentThread()); myCaptureQueriesListener.logSelectQueriesForCurrentThread(); assertEquals(1, StringUtils.countMatches(myCaptureQueriesListener.getSelectQueriesForCurrentThread().get(0).getSql(true, true).toLowerCase(), "join")); }
Source:
<code>public int getLastChunkIndex() { int originalLineLength = originalLine.length(); int substitutedLineLength = substitutedLine.length(); if (originalLineLength == substitutedLineLength) return lastChunkIndex; else { return lastChunkIndex - (substitutedLineLength - originalLineLength); <START> } <END> }</code><technical_language>mind changing a single line? I.e. return lastChunkIndex - substitutedLine.length + originalLine.length();</technical_language>

Target:
public int getLastChunkIndex() { return lastChunkIndex - substitutedLine.length() + originalLine.length(); }
Source:
<code>public ScanQuery( @JsonProperty("dataSource") DataSource dataSource, @JsonProperty("intervals") QuerySegmentSpec querySegmentSpec, @JsonProperty("resultFormat") String resultFormat, @JsonProperty("batchSize") int batchSize, @JsonProperty("limit") int limit, @JsonProperty("filter") DimFilter dimFilter, <START> @JsonProperty("columns") List<String> columns, <END> @JsonProperty("context") Map<String, Object> context ) { super(dataSource, querySegmentSpec, false, context); this.resultFormat = resultFormat; this.batchSize = (batchSize == 0) ? 4096 * 5 : batchSize; this.limit = (limit == 0) ? Integer.MAX_VALUE : limit; this.dimFilter = dimFilter; this.columns = columns; }</code><technical_language>call dimensions</technical_language>

Target:
public ScanQuery( @JsonProperty("dataSource") DataSource dataSource, @JsonProperty("intervals") QuerySegmentSpec querySegmentSpec, @JsonProperty("resultFormat") String resultFormat, @JsonProperty("batchSize") int batchSize, @JsonProperty("limit") int limit, @JsonProperty("filter") DimFilter dimFilter, @JsonProperty("columns") List<String> columns, @JsonProperty("context") Map<String, Object> context ) { super(dataSource, querySegmentSpec, false, context); this.resultFormat = resultFormat == null ? RESULT_FORMAT_LIST : resultFormat; this.batchSize = (batchSize == 0) ? 4096 * 5 : batchSize; this.limit = (limit == 0) ? Integer.MAX_VALUE : limit; Preconditions.checkArgument(this.batchSize > 0, "batchSize must be greater than 0"); Preconditions.checkArgument(this.limit > 0, "limit must be greater than 0"); this.dimFilter = dimFilter; this.columns = columns; }
Source:
<code>public boolean isTrue(State state, String[] params) { List<ObjectInstance> ingredients = state.getObjectsOfTrueClass(IngredientFactory.ClassNameComplex); boolean failed; <START> boolean not_fail; END> for (ObjectInstance ingredient : ingredients) { failed = false; not_fail = false; for (BakingSubgoal sg : this.ing_subgoals) { IngredientRecipe goalIng = sg.getIngredient(); if (Recipe.isFailure(state, goalIng.makeFakeAttributeCopy(ingredient), ingredient)) { failed = true; } else { not_fail = true; } } if (failed && !not_fail) { return true; } } return false; }</code><technical_language>camelCase</technical_language>

Target:
public boolean isTrue(State state, String[] params) { List<ObjectInstance> ingredients = state.getObjectsOfTrueClass(IngredientFactory.ClassNameComplex); boolean failed; boolean notFail; for (ObjectInstance ingredient : ingredients) { failed = false; notFail = false; for (BakingSubgoal sg : this.ingSubgoals) { IngredientRecipe goalIng = sg.getIngredient(); if (Recipe.isFailure(state, goalIng.makeFakeAttributeCopy(ingredient), ingredient)) { failed = true; } else { notFail = true; } } if (failed && !notFail) { return true; } } return false; }
Source:
<code>private JsonParserIterator<SegmentWithOvershadowedStatus> getMetadataSegments( DruidLeaderClient coordinatorClient, ObjectMapper jsonMapper, BytesAccumulatingResponseHandler responseHandler, Set<String> watchedDataSources ) { String query = "/druid/coordinator/v1/metadata/segments?includeOvershadowedStatus"; if (watchedDataSources != null && !watchedDataSources.isEmpty()) { log.debug( "filtering datasources in published segments based on broker's watchedDataSources[%s]", watchedDataSources); final StringBuilder sb = new StringBuilder(); for (String ds : watchedDataSources) { sb.append("datasources=").append(ds).append("&"); } sb.setLength(sb.length() - 1); <START> query = "/druid/coordinator/v1/metadata/segments?includeOvershadowedStatus?" + sb; <END> } Request request; try { request = coordinatorClient.makeRequest( HttpMethod.GET, StringUtils.format(query), false ); } catch (IOException e) { throw new RuntimeException(e); } ListenableFuture<InputStream> future = coordinatorClient.goAsync( request, responseHandler ); final JavaType typeRef = jsonMapper.getTypeFactory().constructType(new TypeReference<SegmentWithOvershadowedStatus>() { }); return new JsonParserIterator<>( typeRef, future, request.getUrl().toString(), null, request.getUrl().getHost(), jsonMapper, responseHandler ); }</code><technical_language>if ? in URL works, if does, poor form; a &</technical_language>

Target:
private JsonParserIterator<SegmentWithOvershadowedStatus> getMetadataSegments( DruidLeaderClient coordinatorClient, ObjectMapper jsonMapper, BytesAccumulatingResponseHandler responseHandler, Set<String> watchedDataSources ) { String query = "/druid/coordinator/v1/metadata/segments?includeOvershadowedStatus"; if (watchedDataSources != null && !watchedDataSources.isEmpty()) { log.debug( "filtering datasources in published segments based on broker's watchedDataSources[%s]", watchedDataSources); final StringBuilder sb = new StringBuilder(); for (String ds : watchedDataSources) { sb.append("datasources=").append(ds).append("&"); } sb.setLength(sb.length() - 1); query = "/druid/coordinator/v1/metadata/segments?includeOvershadowedStatus&" + sb; } Request request; try { request = coordinatorClient.makeRequest( HttpMethod.GET, StringUtils.format(query), false ); } catch (IOException e) { throw new RuntimeException(e); } ListenableFuture<InputStream> future = coordinatorClient.goAsync( request, responseHandler ); final JavaType typeRef = jsonMapper.getTypeFactory().constructType(new TypeReference<SegmentWithOvershadowedStatus>() { }); return new JsonParserIterator<>( typeRef, future, request.getUrl().toString(), null, request.getUrl().getHost(), jsonMapper, responseHandler ); }
Source:
<code>private List<HomeFeedbackSessionRow> createSessionRows(List<FeedbackSessionAttributes> sessions, InstructorAttributes instructor) { List<HomeFeedbackSessionRow> rows = new ArrayList<>(); int statsToDisplayLeft = MAX_CLOSED_SESSION_STATS; for (FeedbackSessionAttributes session : sessions) { boolean isRecent = session.isOpened() || session.isWaitingToOpen(); if (!isRecent && statsToDisplayLeft > 0 && !TimeHelper.isOlderThanAYear(session.getCreatedTime())) { isRecent = true; --statsToDisplayLeft; } InstructorHomeFeedbackSessionRow row = new InstructorHomeFeedbackSessionRow( sanitizeForHtml(session.getFeedbackSessionName()), getInstructorHoverMessageForFeedbackSession(session), getInstructorStatusForFeedbackSession(session), TimeHelper.formatDateTimeForInstructorHomePage(session.getStartTime()), <START> session.getStartTimeString(), <END> TimeHelper.formatDateTimeForInstructorHomePage(session.getEndTime()), session.getEndTimeString(), getInstructorFeedbackStatsLink(session.getCourseId(), session.getFeedbackSessionName()), isRecent, getInstructorFeedbackSessionActions( session, Const.ActionURIs.INSTRUCTOR_HOME_PAGE, instructor)); rows.add(row); } return rows; }</code><technical_language>@rclakmal I this a commit in #5760, remove commits for other PRs this branch PRs reviewed separately wish put PR hold while finishing other</technical_language>

Target:
private List<HomeFeedbackSessionRow> createSessionRows(List<FeedbackSessionAttributes> sessions, InstructorAttributes instructor) { List<HomeFeedbackSessionRow> rows = new ArrayList<>(); int statsToDisplayLeft = MAX_CLOSED_SESSION_STATS; for (FeedbackSessionAttributes session : sessions) { boolean isRecent = session.isOpened() || session.isWaitingToOpen(); if (!isRecent && statsToDisplayLeft > 0 && !TimeHelper.isOlderThanAYear(session.getCreatedTime())) { isRecent = true; --statsToDisplayLeft; } InstructorHomeFeedbackSessionRow row = new InstructorHomeFeedbackSessionRow( sanitizeForHtml(session.getFeedbackSessionName()), getInstructorHoverMessageForFeedbackSession(session), getInstructorStatusForFeedbackSession(session), TimeHelper.formatDateTimeForInstructorHomePage(session.getStartTime()), TimeHelper.formatDateTimeForInstructorHomePage(session.getEndTime()), getInstructorFeedbackStatsLink(session.getCourseId(), session.getFeedbackSessionName()), isRecent, getInstructorFeedbackSessionActions( session, Const.ActionURIs.INSTRUCTOR_HOME_PAGE, instructor)); rows.add(row); } return rows; }
Source:
<code>protected boolean triangleContains(float x, float y, float p1x, float p1y, float p2x, float p2y, float p3x, float p3y) { boolean b1, b2, b3; <START> if (p1x == p2x && p2x == p3x && p1y == p2y && p2y == p3y){ <END> return x == p1x && y == p2y; } b1 = sign(x, y, p1x, p1y, p2x, p2y) < 0.0f; b2 = sign(x, y, p2x, p2y, p3x, p3y) < 0.0f; b3 = sign(x, y, p3x, p3y, p1x, p1y) < 0.0f; return ((b1 == b2) && (b2 == b3)); }</code><technical_language>MathUtils.IsEqual accomodate float rounding errors</technical_language>

Target:
protected boolean triangleContains(float x, float y, float p1x, float p1y, float p2x, float p2y, float p3x, float p3y) { boolean b1, b2, b3; if (MathUtils.isEqual(p1x, p2x) && MathUtils.isEqual(p2x, p3x) && MathUtils.isEqual(p1y, p2y) && MathUtils.isEqual(p2y, p3y)){ return MathUtils.isEqual(x, p1x) && MathUtils.isEqual(y, p1y); } b1 = sign(x, y, p1x, p1y, p2x, p2y) < 0.0f; b2 = sign(x, y, p2x, p2y, p3x, p3y) < 0.0f; b3 = sign(x, y, p3x, p3y, p1x, p1y) < 0.0f; return ((b1 == b2) && (b2 == b3)); }
Source:
<code>private Expression translateParameter(RexDynamicParam expr, RexImpTable.NullAs nullAs, Type storageType) { if (storageType == null) { storageType = typeFactory.getJavaClass(expr.getType()); } Expression expression = Expressions.call(root, BuiltInMethod.DATA_CONTEXT_GET.method, Expressions.constant("?" + expr.getIndex())); Set<SqlTypeName> toIntegerTypes = Sets.newHashSet( DATE, TIME, TIME_WITH_LOCAL_TIME_ZONE, INTERVAL_YEAR, <START> INTERVAL_YEAR_MONTH, <END> INTERVAL_MONTH); Expression midExpress = expression; if (toIntegerTypes.contains(expr.getType().getSqlTypeName())) { SqlTypeName t = expr.getType().getSqlTypeName(); switch (t) { case DATE: midExpress = Expressions.call( BuiltInMethod.STRING_TO_DATE_ALLOW_NULLABLE.method, convert(expression, String.class)); break; case TIME: midExpress = Expressions.call( BuiltInMethod.STRING_TO_TIME_ALLOW_NULLABLE.method, convert(expression, String.class)); break; default: } } return nullAs.handle(convert(midExpress, storageType)); }</code><technical_language>If support DATE TIME type, enum 2 is enough, better, do need this enum Set add another convert phrase for initial expression,</technical_language>

Target:
private Expression translateParameter(RexDynamicParam expr, RexImpTable.NullAs nullAs, Type storageType) { if (storageType == null) { storageType = typeFactory.getJavaClass(expr.getType()); } Expression expression = Expressions.call(root, BuiltInMethod.DATA_CONTEXT_GET.method, Expressions.constant("?" + expr.getIndex())); Expression midExpress = expression; if (NEED_TO_CONVERT_TYPES_FOR_DYNAMIC_PARAM.contains(expr.getType().getSqlTypeName())) { SqlTypeName t = expr.getType().getSqlTypeName(); switch (t) { case DATE: midExpress = Expressions.call( BuiltInMethod.STRING_TO_DATE_ALLOW_NULLABLE.method, convert(expression, String.class)); break; case TIME: midExpress = Expressions.call( BuiltInMethod.STRING_TO_TIME_ALLOW_NULLABLE.method, convert(expression, String.class)); break; case INTEGER: midExpress = Expressions.call(BuiltInMethod.STRING_TO_INTEGER.method, convert(expression, String.class)); break; case TINYINT: midExpress = Expressions.call(BuiltInMethod.STRING_TO_BYTE.method, convert(expression, String.class)); break; case SMALLINT: midExpress = Expressions.call(BuiltInMethod.STRING_TO_SHORT.method, convert(expression, String.class)); break; case BIGINT: midExpress = Expressions.call(BuiltInMethod.STRING_TO_LONG.method, convert(expression, String.class)); break; case FLOAT: midExpress = Expressions.call(BuiltInMethod.STRING_TO_FLOAT.method, convert(expression, String.class)); break; case DOUBLE: midExpress = Expressions.call(BuiltInMethod.STRING_TO_DOUBLE.method, convert(expression, String.class)); break; case BOOLEAN: midExpress = Expressions.call(BuiltInMethod.STRING_TO_BOOLEAN.method, convert(expression, String.class)); break; default: } } return nullAs.handle(convert(midExpress, storageType)); }
Source:
<code><START> public void setUp() { <END> semanticModel = SETestUtils.getSemanticModel("src/test/files/se/annotations/NullableAnnotationUtils.java"); }</code><technical_language>This change implies parsing semantic computation for test of this class. This some overhead</technical_language>

Target:
public static void setUp() { semanticModel = SETestUtils.getSemanticModel("src/test/files/se/annotations/NullableAnnotationUtils.java"); }
Source:
<code>public CharSequence toXML() { XmlStringBuilder xml = new XmlStringBuilder(); xml.openElement("always"); for (Jid jid : alwaysJids) { <START> xml.element("jid", jid.toString()); <END> } xml.closeElement("always"); return xml; }</code><technical_language>I need call toString()</technical_language>

Target:
public CharSequence toXML() { XmlStringBuilder xml = new XmlStringBuilder(); xml.openElement("always"); for (Jid jid : alwaysJids) { xml.element("jid", jid); } xml.closeElement("always"); return xml; }
Source:
<code>public void testBug503035_1() { <START> IGraph<String> graph = getBug503035_cyclicGraph_1(); <END> Iterator<String> it = graph.breadthFirstIterator(); assertEquals("A", it.next()); assertTrue(it.hasNext()); assertEquals("B", it.next()); assertEquals("C", it.next()); assertFalse(it.hasNext()); }</code><technical_language>Please extract other methods, tests hard read. multiply test classes, of test method setup, classes test methods then, test method readable a glance rely other methods located elsewhere, intention of test unclear</technical_language>

Target:
public void testBug503035_1() { IGraph<String> graph = new Graph<String>(); graph.addChildren("A", ImmutableSet.of("B", "C")); graph.addChildren("B", ImmutableSet.of("C")); graph.addChildren("C", ImmutableSet.of("B")); Iterator<String> it = graph.breadthFirstIterator(); assertEquals("A", it.next()); assertTrue(it.hasNext()); assertEquals("B", it.next()); assertEquals("C", it.next()); assertFalse(it.hasNext()); }
Source:
<code>private Response cloneVmFromTemplate(VmStatic staticVm, VM vm, Guid templateId) { AddVmFromTemplateParameters params = new AddVmFromTemplateParameters(staticVm, getDisksToClone(vm.getDisks(), templateId), Guid.Empty); params.setVmPayload(getPayload(vm)); if (vm.isSetMemoryPolicy() && vm.getMemoryPolicy().isSetBallooning()) { params.setBalloonEnabled(vm.getMemoryPolicy().isBallooning()); } if (vm.isSetConsoleDeviceEnabled()) { params.setConsoleEnabled(vm.isConsoleDeviceEnabled()); <START> } <END> params.setMakeCreatorExplicitOwner(shouldMakeCreatorExplicitOwner()); return performCreate(VdcActionType.AddVmFromTemplate, params, new QueryIdResolver<Guid>(VdcQueryType.GetVmByVmId, IdQueryParameters.class)); }</code><technical_language>here, need "else": ConsoleDeviceEnabled set template</technical_language>

Target:
private Response cloneVmFromTemplate(VmStatic staticVm, VM vm, Guid templateId) { AddVmFromTemplateParameters params = new AddVmFromTemplateParameters(staticVm, getDisksToClone(vm.getDisks(), templateId), Guid.Empty); params.setVmPayload(getPayload(vm)); if (vm.isSetMemoryPolicy() && vm.getMemoryPolicy().isSetBallooning()) { params.setBalloonEnabled(vm.getMemoryPolicy().isBallooning()); } params.setConsoleEnabled(vm.isSetConsole() && vm.getConsole().isSetEnabled() ? vm.getConsole().isEnabled() : !getConsoleDevicesForEntity(templateId).isEmpty()); params.setMakeCreatorExplicitOwner(shouldMakeCreatorExplicitOwner()); return performCreate(VdcActionType.AddVmFromTemplate, params, new QueryIdResolver<Guid>(VdcQueryType.GetVmByVmId, IdQueryParameters.class)); }
Source:
<code>public OutputStream call() throws IOException { <START> File f = File.createTempFile(filename, ""); <END> System.err.println("Creating: " + f); return new RemoteOutputStream(new FileOutputStream(f)); }</code><technical_language>This is wrong. if filename ends in .zip, end this: $ jrunscript -e 'println(java.io.File.createTempFile("foo.zip", ""))' /tmp/foo.zip6023275810588304403</technical_language>

Target:
public OutputStream call() throws IOException { Path path = Files.createFile(Paths.get(System.getProperty("java.io.tmpdir"), filename)); System.err.println("Creating: " + path); return new RemoteOutputStream(new FileOutputStream(path.toFile())); }
Source:
<code>private double calculateTotalCost (List<Integer> books,double priceSoFar ){ double minPrice = Double.MAX_VALUE; if(books.size() == 0) <START> return priceSoFar; <END> List<Integer> groups = (ArrayList<Integer>) books.stream().distinct().collect(Collectors.toList()); double price = 0; for(int i = 0;i<groups.size();i++){ books.remove(groups.get(i)); } try { price = calculateTotalCost(books,priceSoFar + costPerGroup(groups.size())); } catch (Exception e) { e.printStackTrace(); } minPrice = Math.min(minPrice, price); return minPrice; }</code><technical_language>Curly braces please</technical_language>

Target:
private double calculateTotalCost (List<Integer> books,double priceSoFar ){ double minPrice = Double.MAX_VALUE; if(books.size() == 0){ return priceSoFar; } List<Integer> groups = (ArrayList<Integer>) books.stream().distinct().collect(Collectors.toList()); double price = 0; for(int i = 0;i<groups.size();i++){ books.remove(groups.get(i)); } try { price = calculateTotalCost(books,priceSoFar + costPerGroup(groups.size())); } catch (Exception e) { e.printStackTrace(); } minPrice = Math.min(minPrice, price); return minPrice; }
Source:
<code>public List<K> getKeys(V value) { final List<K> listOfKey = reverseCache.get(value); if (listOfKey == null) { <START> reverseCache.put(value, Collections.<K>emptyList()); <END> return Collections.emptyList(); } return listOfKey; }</code><technical_language>extra lists heap</technical_language>

Target:
public List<K> getKeys(V value) { final List<K> listOfKey = reverseCache.get(value); if (listOfKey == null) { return Collections.emptyList(); } return listOfKey; }
Source:
<code>private String computeLabel(StoragePathAdapter adapter) { String computedLabel = ""; if (adapter != null) { String commitId = adapter.getCommitId(); String username = adapter.getUsername(); if (adapter.isLocal()) { computedLabel = "Local: " + adapter.getStoragePath(); } else { computedLabel = adapter.getStoragePath(); } if (commitId != null && !"".equals(commitId)) { <START> if (commitId.length() > 7) { <END> commitId = commitId.substring(0, 7); } computedLabel += " " + commitId; } if (username != null && !"".equals(username)) { computedLabel += " (" + username + ")"; } } return computedLabel; }</code><technical_language>block can, I think, replaced if (commitId != null) { computedLabel = String.format("%s %0.7s", computedLabel, commitId).trim(); }</technical_language>

Target:
private String computeLabel(StoragePathAdapter adapter) { String computedLabel = ""; if (adapter != null) { String commitId = adapter.getCommitId(); String username = adapter.getUsername(); if (adapter.isLocal()) { computedLabel = "Local: " + adapter.getStoragePath(); } else { computedLabel = adapter.getStoragePath(); } if (commitId != null) { if (commitId.length() > 7) { commitId = commitId.substring(0, 7); } computedLabel = String.format("%s %s", computedLabel, commitId).trim(); } if (username != null && !"".equals(username)) { computedLabel += " (" + username + ")"; } } return computedLabel; }
Source:
<code>public void updatePersonAddress(Config config, String uuid, Person.Address address) { String requestJson = buildGson().toJson(address); <START> postWithEmptyResponseBody(config, requestJson, "/person/{personUuid}/address/{addressUuid}?v=full", uuid, address.getUuid()); <END> }</code><technical_language>is this required ? This is POST request empty response body. I suppose this 'full' option refers response body only</technical_language>

Target:
public void updatePersonAddress(Config config, String uuid, Person.Address address) { String requestJson = buildGson().toJson(address); postWithEmptyResponseBody(config, requestJson, "/person/{personUuid}/address/{addressUuid}", uuid, address.getUuid()); }
Source:
<code>private void checkCollection(Supplier<Collection<Ignite>> s) { Ignite srv = grid(SRV); Ignite clnt = grid(CLNT); clnt.compute(clnt.cluster().forNodeId(srv.cluster().localNode().id())) .broadcast(() -> { Collection<Ignite> nodes = s.get(); for (Ignite node : nodes) { <START> assertTrue(Proxy.isProxyClass(node.getClass())); <END> assertFalse(node instanceof IgniteEx); } }); Collection<Ignite> nodes = s.get(); for (Ignite node : nodes) { assertFalse(Proxy.isProxyClass(node.getClass())); assertTrue(node instanceof IgniteEx); } }</code><technical_language>Proxy a goal itself. check perform some operations ignite instances perform proxy</technical_language>

Target:
private void checkCollection(Supplier<Collection<Ignite>> s) { Ignite srv = grid(SRV); Ignite clnt = grid(CLNT); clnt.compute(clnt.cluster().forNodeId(srv.cluster().localNode().id())) .broadcast(() -> { Collection<Ignite> nodes = s.get(); for (Ignite node : nodes) { node.compute().call(() -> true); } }); }
Source:
<code>public void selectAll() { assertMultiSelect(); waitForEnabled(); setFocus(); TreeItem first = syncExec(new Result<TreeItem>() { @Override public TreeItem run() { if (widget.getItemCount() == 0) { return null; } return widget.getItem(0); } }); if (first == null) { return; } notifySelect(first, SWT.NONE); TreeItem last = syncExec(new Result<TreeItem>() { @Override public TreeItem run() { if (widget.getItemCount() == 0) { return null; } TreeItem last = widget.getItem(widget.getItemCount() - 1); while (last.getExpanded() && last.getItemCount() > 0) { last = last.getItem(last.getItemCount() - 1); } return last; } }); if (last != null && last != first) { notifySelect(last, <START> SWT.SHIFT, selectAllRunnable()); <END> } }</code><technical_language>MOD2 instead of SHIFT</technical_language>

Target:
public void selectAll() { assertMultiSelect(); waitForEnabled(); setFocus(); TreeItem first = syncExec(new Result<TreeItem>() { @Override public TreeItem run() { if (widget.getItemCount() == 0) { return null; } return widget.getItem(0); } }); if (first == null) { return; } notifySelect(first, SWT.NONE); TreeItem last = syncExec(new Result<TreeItem>() { @Override public TreeItem run() { if (widget.getItemCount() == 0) { return null; } TreeItem last = widget.getItem(widget.getItemCount() - 1); while (last.getExpanded() && last.getItemCount() > 0) { last = last.getItem(last.getItemCount() - 1); } return last; } }); if (last != null && last != first) { notifySelect(last, SWT.MOD2, selectAllRunnable()); } }
Source:
<code>public TaskReview(String summary, String cr, String v, String incomingChanges) { <START> super(); <END> this.summary = summary; this.cr = cr; this.v = v; this.incomingChanges = incomingChanges; }</code><technical_language>call super if is it? a practice I missed memo on</technical_language>

Target:
public TaskReview(String summary, String cr, String v, String incomingChanges) { this.summary = summary; this.cr = cr; this.v = v; this.incomingChanges = incomingChanges; }
Source:
<code>public void onAcquireTokenSilentClicked(final AcquireTokenFragment.RequestOptions requestOptions) { prepareRequestParameters(requestOptions); new Thread(new Runnable() { @Override public void run() { String uId = getUserIdBasedOnUPN(requestOptions.getLoginHint(), requestOptions.getAuthority()); if (TextUtils.isEmpty(uId)) { try { final UserInfo[] userInfos = mAuthContext.getBrokerUsers(); for (UserInfo userInfo : userInfos) { if (userInfo.getDisplayableId().equalsIgnoreCase(requestOptions.getLoginHint())) { uId = userInfo.getUserId(); break; } } } catch (OperationCanceledException | AuthenticatorException | IOException e) { <START> Logger.e(TAG, "Unable to getbrokerusers from broker " + e.getMessage()); <END> } } callAcquireTokenSilent(requestOptions.getDataProfile().getText(), uId, requestOptions.getClientId().getText()); } }).start(); }</code><technical_language>Toast this message? If this fails hooked a debugger, happened</technical_language>

Target:
public void onAcquireTokenSilentClicked(final AcquireTokenFragment.RequestOptions requestOptions) { prepareRequestParameters(requestOptions); new Thread(new Runnable() { @Override public void run() { String uId = getUserIdBasedOnUPN(requestOptions.getLoginHint(), requestOptions.getAuthority()); if (TextUtils.isEmpty(uId)) { try { final UserInfo[] userInfos = mAuthContext.getBrokerUsers(); for (UserInfo userInfo : userInfos) { if (userInfo.getDisplayableId().equalsIgnoreCase(requestOptions.getLoginHint())) { uId = userInfo.getUserId(); break; } } if (!TextUtils.isEmpty(uId)) { callAcquireTokenSilent(requestOptions.getDataProfile().getText(), uId, requestOptions.getClientId().getText()); } else { showMessage("No uId matching the provided upn, cannot proceed with silent call"); } } catch (final OperationCanceledException | AuthenticatorException | IOException e) { showMessage("getBrokerUsers call to broker failed: " + e.getMessage()); } } } }).start(); }
Source:
<code>protected boolean canDoAction() { VmStatic vm = getVm().getStaticData(); if (vm == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_EXIST); return false; } if (!canRunActionOnNonManagedVm()) { return false; } if (!updateVnicForBackwardCompatibility()) { return false; } if (!validate(vmStatusLegal(getVmDynamicDao().get(getParameters().getVmId()).getStatus()))) { return false; } List<VmNic> interfaces = getVmNicDao().getAllForVm(getParameters().getVmId()); if (!uniqueInterfaceName(interfaces)) { return false; } if (!validate(vmTemplateEmpty())) { return false; } List<VmNic> allInterfaces = new ArrayList<>(interfaces); allInterfaces.add(getInterface()); if (!pciAndIdeWithinLimit(getVm(), allInterfaces)) { return false; } Version compatibilityVersion = getVm().getVdsGroupCompatibilityVersion(); VmNicValidator nicValidator = new VmNicValidator(getInterface(), compatibilityVersion, getVm().getOs()); if (!validate(nicValidator.linkedCorrectly()) || !validate(nicValidator.isCompatibleWithOs()) || !validate(nicValidator.emptyNetworkValid()) || !validate(nicValidator.profileValid(vm.getVdsGroupId()))) { return false; } if (StringUtils.isNotEmpty(getMacAddress())) { if (!validate(macAvailable(getMacPoolManager()))) { return false; } <START> } else if (getMacPoolManager().getAvailableMacsCount() <= 0){ <END> addCanDoActionMessage(VdcBllMessages.MAC_POOL_NOT_ENOUGH_MAC_ADDRESSES); return false; } return true; }</code><technical_language>need delete space brackets</technical_language>

Target:
protected boolean canDoAction() { VmStatic vm = getVm().getStaticData(); if (vm == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_NOT_EXIST); return false; } if (!canRunActionOnNonManagedVm()) { return false; } if (!updateVnicForBackwardCompatibility()) { return false; } if (!validate(vmStatusLegal(getVmDynamicDao().get(getParameters().getVmId()).getStatus()))) { return false; } List<VmNic> interfaces = getVmNicDao().getAllForVm(getParameters().getVmId()); if (!uniqueInterfaceName(interfaces)) { return false; } if (!validate(vmTemplateEmpty())) { return false; } List<VmNic> allInterfaces = new ArrayList<>(interfaces); allInterfaces.add(getInterface()); if (!pciAndIdeWithinLimit(getVm(), allInterfaces)) { return false; } Version compatibilityVersion = getVm().getVdsGroupCompatibilityVersion(); VmNicValidator nicValidator = new VmNicValidator(getInterface(), compatibilityVersion, getVm().getOs()); if (!validate(nicValidator.linkedCorrectly()) || !validate(nicValidator.isCompatibleWithOs()) || !validate(nicValidator.emptyNetworkValid()) || !validate(nicValidator.profileValid(vm.getVdsGroupId()))) { return false; } if (StringUtils.isNotEmpty(getMacAddress())) { if (!validate(macAvailable())) { return false; } } else if (getMacPool().getAvailableMacsCount() <= 0) { addCanDoActionMessage(VdcBllMessages.MAC_POOL_NOT_ENOUGH_MAC_ADDRESSES); return false; } return true; }
Source:
<code>private static void assertSimplifies(String expression, String expected, String rowExpressionExpected) { Expression actualExpression = rewriteIdentifiersToSymbolReferences(SQL_PARSER.createExpression(expression)); Expression expectedExpression = rewriteIdentifiersToSymbolReferences(SQL_PARSER.createExpression(expected)); Expression rewritten = rewrite(actualExpression, TEST_SESSION, new PlanVariableAllocator(booleanVariablesFor(actualExpression)), METADATA, LITERAL_ENCODER, SQL_PARSER); assertEquals( normalize(rewritten), normalize(expectedExpression)); TestingRowExpressionTranslator translator = new TestingRowExpressionTranslator(METADATA); RowExpression actualRowExpression = translator.translate(actualExpression, TypeProvider.viewOf(TYPES)); <START> RowExpression simplifiedByRowExpression = SimplifyRowExpressions.rewrite(actualRowExpression, METADATA, TEST_SESSION.toConnectorSession()); <END> Expression expectedByRowExpression = Optional.ofNullable(rowExpressionExpected).map(expr -> rewriteIdentifiersToSymbolReferences(SQL_PARSER.createExpression(expr))).orElse(rewritten); RowExpression simplifiedByExpression = translator.translate(expectedByRowExpression, TypeProvider.viewOf(TYPES)); assertEquals(simplifiedByRowExpression, simplifiedByExpression); }</code><technical_language>I something.... Remove variable name. for other Bys</technical_language>

Target:
private static void assertSimplifies(String expression, String expected, String rowExpressionExpected) { Expression actualExpression = rewriteIdentifiersToSymbolReferences(SQL_PARSER.createExpression(expression)); Expression expectedExpression = rewriteIdentifiersToSymbolReferences(SQL_PARSER.createExpression(expected)); Expression rewritten = rewrite(actualExpression, TEST_SESSION, new PlanVariableAllocator(booleanVariablesFor(actualExpression)), METADATA, LITERAL_ENCODER, SQL_PARSER); assertEquals( normalize(rewritten), normalize(expectedExpression)); TestingRowExpressionTranslator translator = new TestingRowExpressionTranslator(METADATA); RowExpression actualRowExpression = translator.translate(actualExpression, TypeProvider.viewOf(TYPES)); RowExpression simplifiedRowExpression = SimplifyRowExpressions.rewrite(actualRowExpression, METADATA, TEST_SESSION.toConnectorSession()); Expression expectedByRowExpression = Optional.ofNullable(rowExpressionExpected).map(expr -> rewriteIdentifiersToSymbolReferences(SQL_PARSER.createExpression(expr))).orElse(rewritten); RowExpression simplifiedByExpression = translator.translate(expectedByRowExpression, TypeProvider.viewOf(TYPES)); assertEquals(simplifiedRowExpression, simplifiedByExpression); }
Source:
<code>public void handleUnimprovedSecondsSpentInputChange( ChangeEvent event ) { try { Long value = unimprovedSecondsSpentInput.getValue().isEmpty() ? null : Long.parseLong( unimprovedSecondsSpentInput.getValue() ); presenter.onUnimprovedSecondsSpentChange( value ); } catch ( NumberFormatException e ) { <START> <END> } }</code><technical_language>Likewise.</technical_language>

Target:
public void handleUnimprovedSecondsSpentInputChange( ChangeEvent event ) { boolean isNumeric = unimprovedSecondsSpentInput.getValue().matches( "\\d+" ); if (isNumeric) { presenter.onUnimprovedSecondsSpentChange( Long.parseLong( unimprovedSecondsSpentInput.getValue() ) ); } else { presenter.onUnimprovedSecondsSpentChange( 0l ); unimprovedSecondsSpentInput.setValue( "0" ); } }