auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void logSessionData() { long sessionLengthSeconds = (sessionData.getLastTouchTime() - sessionData.getStartTime()) / DateUtils.SECOND_IN_MILLIS; log( "length", sessionLengthSeconds, "fromSearch", sessionData.getPagesFromSearch(), "fromRandom", sessionData.getPagesFromRandom(), "fromLanglink", sessionData.getPagesFromLangLink(), "fromInternal", sessionData.getPagesFromInternal(), "fromExternal", sessionData.getPagesFromExternal(), "fromHistory", sessionData.getPagesFromHistory(), "fromReadingList", sessionData.getPagesFromReadingList(), <START> "fromDisambig", sessionData.getPagesFromDisambig(), <END> "fromBack", sessionData.getPagesFromBack(), "noDescription", sessionData.getPagesWithNoDescription(), "fromSuggestedEdits", sessionData.getPagesFromSuggestedEdits(), "totalPages", sessionData.getTotalPages(), "leadLatency", sessionData.getLeadLatency(), "restLatency", sessionData.getRestLatency(), "languages", StringUtil.listToJsonArrayString(getApp().language().getAppLanguageCodes()), "apiMode", RbSwitch.INSTANCE.isRestBaseEnabled() ? 1 : 0 ); }</code><technical_language>Unfortunately, fromNearby is a required field in eventlogging schema. leave this field here, give a of 0</technical_language>

Target:
private void logSessionData() { long sessionLengthSeconds = (sessionData.getLastTouchTime() - sessionData.getStartTime()) / DateUtils.SECOND_IN_MILLIS; log( "length", sessionLengthSeconds, "fromSearch", sessionData.getPagesFromSearch(), "fromRandom", sessionData.getPagesFromRandom(), "fromLanglink", sessionData.getPagesFromLangLink(), "fromInternal", sessionData.getPagesFromInternal(), "fromExternal", sessionData.getPagesFromExternal(), "fromHistory", sessionData.getPagesFromHistory(), "fromReadingList", sessionData.getPagesFromReadingList(), "fromNearby", 0, "fromDisambig", sessionData.getPagesFromDisambig(), "fromBack", sessionData.getPagesFromBack(), "noDescription", sessionData.getPagesWithNoDescription(), "fromSuggestedEdits", sessionData.getPagesFromSuggestedEdits(), "totalPages", sessionData.getTotalPages(), "leadLatency", sessionData.getLeadLatency(), "restLatency", sessionData.getRestLatency(), "languages", StringUtil.listToJsonArrayString(getApp().language().getAppLanguageCodes()), "apiMode", RbSwitch.INSTANCE.isRestBaseEnabled() ? 1 : 0 ); }
Source:
<code>public static ZoneOffset getDefault() { final TimeZone timeZone = TimeZone.getDefault(); <START> final int seconds = timeZone <END> .getRawOffset() / (int) MILLIS_PER_SECOND; return ZoneOffset.newBuilder() .setAmountSeconds(seconds) .setId(nullToEmpty(timeZone.getID())) .build(); }</code><technical_language>Please fix wrapping</technical_language>

Target:
public static ZoneOffset getDefault() { final TimeZone timeZone = TimeZone.getDefault(); return toZoneOffset(timeZone); }
Source:
<code>public static Image map(RepoImage entity, Image template) { Image model = template != null ? template : new Image(); model.setId(entity.getRepoImageId()); model.setName(entity.getRepoImageName()); if <START> (entity.getSize() != null) { <END> model.setSize(entity.getSize().intValue()); } if (entity.getFileType() != null) { model.setFileType(map(entity.getFileType(), null)); } return model; }</code><technical_language>expect a "isSetSize" method, of nature</technical_language>

Target:
public static Image map(RepoImage entity, Image template) { Image model = template != null ? template : new Image(); model.setId(entity.getRepoImageId()); model.setName(entity.getRepoImageName()); if (entity.isSetSize()) { model.setSize(entity.getSize().intValue()); } if (entity.isSetFileType()) { model.setFileType(map(entity.getFileType(), null)); } return model; }
Source:
<code>public void setReferenceMD5(final byte[] ref) { validateAlignmentSpanForReference(ref); if (! alignmentContext.getReferenceContext().isMappedSingleRef() && alignmentContext.getAlignmentStart() < 1) { referenceMD5 = new byte[MD5_BYTE_SIZE]; <START> Arrays.fill(referenceMD5, (byte) 0); <END> } else { final int span = Math.min(alignmentContext.getAlignmentSpan(), ref.length - alignmentContext.getAlignmentStart() + 1); if (alignmentContext.getAlignmentStart() + span > ref.length + 1) { throw new CRAMException("Invalid alignment boundaries."); } referenceMD5 = SequenceUtil.calculateMD5(ref, alignmentContext.getAlignmentStart() - 1, span); } }</code><technical_language>I arrays 0 initialized definition</technical_language>

Target:
public void setReferenceMD5(final byte[] ref) { validateAlignmentSpanForReference(ref); if (! alignmentContext.getReferenceContext().isMappedSingleRef() && alignmentContext.getAlignmentStart() < 1) { referenceMD5 = new byte[MD5_BYTE_SIZE]; } else { final int span = Math.min(alignmentContext.getAlignmentSpan(), ref.length - alignmentContext.getAlignmentStart() + 1); if (alignmentContext.getAlignmentStart() + span > ref.length + 1) { throw new CRAMException("Invalid alignment boundaries."); } referenceMD5 = SequenceUtil.calculateMD5(ref, alignmentContext.getAlignmentStart() - 1, span); } }
Source:
<code>public void testPropagateAccountOptionsSpecified() throws IOException { Configuration conf = new Configuration(false); conf.set("fs.adl.account.dummy.oauth2.client.id", "dummyClientId"); conf.set("fs.adl.account.dummy.oauth2.credential", "dummyCredential"); conf.set("some.other.config", "someValue"); Configuration propagatedConf = AdlFileSystem.propagateAccountOptions(conf, "dummy"); <START> Assert.assertEquals("dummyClientId", <END> propagatedConf.get(AZURE_AD_CLIENT_ID_KEY)); Assert.assertEquals("dummyCredential", propagatedConf.get(AZURE_AD_CLIENT_SECRET_KEY)); Assert.assertEquals("someValue", propagatedConf.get("some.other.config")); propagatedConf = AdlFileSystem.propagateAccountOptions(conf, "anotherDummy"); Assert.assertEquals(null, propagatedConf.get(AZURE_AD_CLIENT_ID_KEY)); Assert.assertEquals(null, propagatedConf.get(AZURE_AD_CLIENT_SECRET_KEY)); Assert.assertEquals("someValue", propagatedConf.get("some.other.config")); }</code><technical_language>statically import Assert, test case extend Assert</technical_language>

Target:
public void testPropagateAccountOptionsSpecified() { Configuration conf = new Configuration(false); conf.set("fs.adl.account.dummy.oauth2.client.id", "dummyClientId"); conf.set("fs.adl.account.dummy.oauth2.credential", "dummyCredential"); conf.set("some.other.config", "someValue"); Configuration propagatedConf = AdlFileSystem.propagateAccountOptions(conf, "dummy"); assertEquals("dummyClientId", propagatedConf.get(AZURE_AD_CLIENT_ID_KEY)); assertEquals("dummyCredential", propagatedConf.get(AZURE_AD_CLIENT_SECRET_KEY)); assertEquals("someValue", propagatedConf.get("some.other.config")); propagatedConf = AdlFileSystem.propagateAccountOptions(conf, "anotherDummy"); assertEquals(null, propagatedConf.get(AZURE_AD_CLIENT_ID_KEY)); assertEquals(null, propagatedConf.get(AZURE_AD_CLIENT_SECRET_KEY)); assertEquals("someValue", propagatedConf.get("some.other.config")); }
Source:
<code>public StructuredFlowEvent createStucturedFlowEvent(Long stackId, FlowDetails flowDetails, Boolean detailed, Exception exception) { Stack stack = stackService.getByIdWithTransaction(stackId); <START> String resourceType = (stack.getType() == null || stack.getType().equals(StackType.WORKLOAD)) ? CloudbreakEventService.DATAHUB_RESOURCE_TYPE : "sdx"; <END> OperationDetails operationDetails = new OperationDetails(clock.getCurrentTimeMillis(), FLOW, resourceType, stackId, stack.getName(), nodeConfig.getId(), cbVersion, stack.getWorkspace().getId(), stack.getCreator().getUserId(), stack.getCreator().getUserName(), stack.getTenant().getName(), stack.getResourceCrn(), stack.getCreator().getUserCrn(), stack.getEnvironmentCrn(), null); StackDetails stackDetails = null; ClusterDetails clusterDetails = null; BlueprintDetails blueprintDetails = null; if (detailed) { stackDetails = conversionService.convert(stack, StackDetails.class); Cluster cluster = stack.getCluster(); if (cluster != null) { clusterDetails = clusterToClusterDetailsConverter.convert(cluster); blueprintDetails = conversionService.convert(cluster.getBlueprint(), BlueprintDetails.class); } } StructuredFlowEvent event = new StructuredFlowEvent(operationDetails, flowDetails, stackDetails, clusterDetails, blueprintDetails); if (exception != null) { event.setException(ExceptionUtils.getStackTrace(exception)); } return event; }</code><technical_language>"sdx" "datalake" (I assume is a crn service name, sdx is deprecated now) refactored a constant</technical_language>

Target:
public StructuredFlowEvent createStucturedFlowEvent(Long stackId, FlowDetails flowDetails, Boolean detailed, Exception exception) { Stack stack = stackService.getByIdWithTransaction(stackId); String resourceType = (stack.getType() == null || stack.getType().equals(StackType.WORKLOAD)) ? CloudbreakEventService.DATAHUB_RESOURCE_TYPE : CloudbreakEventService.DATALAKE_RESOURCE_TYPE; OperationDetails operationDetails = new OperationDetails(clock.getCurrentTimeMillis(), FLOW, resourceType, stackId, stack.getName(), nodeConfig.getId(), cbVersion, stack.getWorkspace().getId(), stack.getCreator().getUserId(), stack.getCreator().getUserName(), stack.getTenant().getName(), stack.getResourceCrn(), stack.getCreator().getUserCrn(), stack.getEnvironmentCrn(), null); StackDetails stackDetails = null; ClusterDetails clusterDetails = null; BlueprintDetails blueprintDetails = null; if (detailed) { stackDetails = conversionService.convert(stack, StackDetails.class); Cluster cluster = stack.getCluster(); if (cluster != null) { clusterDetails = clusterToClusterDetailsConverter.convert(cluster); blueprintDetails = conversionService.convert(cluster.getBlueprint(), BlueprintDetails.class); } } StructuredFlowEvent event = new StructuredFlowEvent(operationDetails, flowDetails, stackDetails, clusterDetails, blueprintDetails); if (exception != null) { event.setException(ExceptionUtils.getStackTrace(exception)); } return event; }
Source:
<code>private void startup() { <START> executor = Executors.newSingleThreadExecutor(); <END> consumer = new InstallationMetricsKafkaConsumer(metricsService); executor.execute(consumer); logger.debug("Consumer started.", InstallationMetricsKafkaConsumer.class); }</code><technical_language>JEE's managed executerservice here. lookup JNDI. create is managed</technical_language>

Target:
private void startup() { consumer = new InstallationMetricsKafkaConsumer(metricsService); executor.execute(consumer); logger.debug("Consumer started.", InstallationMetricsKafkaConsumer.class); }
Source:
<code>protected void runVm() { setActionReturnValue(VMStatus.Down); if (getVdsToRunOn()) { VMStatus status = null; try { incrementVdsPendingVmsCount(); attachCd(); if (connectLunDisks(getVdsId())) { status = createVm(); ExecutionHandler.setAsyncJob(getExecutionContext(), true); } } catch(VdcBLLException e) { VdcBllErrors errorCode = e.getErrorCode(); switch (errorCode) { case Done: case exist: case PROTOCOL_ERROR: throw e; default: } } finally { freeLock(); decrementVdsPendingVmsCount(); } setActionReturnValue(status); <START> if (status.isRunning() || status == VMStatus.RestoringState) { <END> setSucceeded(true); } else { log.infoFormat("Failed to run desktop {0}, rerun", getVm().getVmName()); setCommandShouldBeLogged(false); setSucceeded(true); rerun(); } } else { failedToRunVm(); setSucceeded(false); _isRerun = false; } }</code><technical_language>status null</technical_language>

Target:
protected void runVm() { setActionReturnValue(VMStatus.Down); if (getVdsToRunOn()) { VMStatus status = null; try { incrementVdsPendingVmsCount(); attachCd(); if (connectLunDisks(getVdsId())) { status = createVm(); ExecutionHandler.setAsyncJob(getExecutionContext(), true); } } catch(VdcBLLException e) { VdcBllErrors errorCode = e.getErrorCode(); switch (errorCode) { case Done: case exist: case PROTOCOL_ERROR: throw e; default: } } finally { freeLock(); decrementVdsPendingVmsCount(); } setActionReturnValue(status); if (status != null && (status.isRunning() || status == VMStatus.RestoringState)) { setSucceeded(true); } else { log.infoFormat("Failed to run desktop {0}, rerun", getVm().getVmName()); setCommandShouldBeLogged(false); setSucceeded(true); rerun(); } } else { failedToRunVm(); setSucceeded(false); _isRerun = false; } }
Source:
<code>public List<Relationship> getRelationshipsOfContentlet(String contentletInode, boolean hasParent) throws DotDataException, DotSecurityException { Contentlet cont = conAPI.find(contentletInode, user, true); <START> if(hasParent){ <END> return FactoryLocator.getRelationshipFactory().byParent(cont.getContentType()); } else{ return FactoryLocator.getRelationshipFactory().byChild(cont.getContentType()); } }</code><technical_language>hasParent? FactoryLocator.getRelationshipFactory().byParent(cont.getContentType()): FactoryLocator.getRelationshipFactory().byChild(cont.getContentType());</technical_language>

Target:
public List<Relationship> getRelationshipsOfContentlet(String contentletInode, boolean hasParent) throws DotDataException, DotSecurityException { Contentlet cont = conAPI.find(contentletInode, user, true); return (hasParent)? FactoryLocator.getRelationshipFactory().byParent(cont.getContentType()): FactoryLocator.getRelationshipFactory().byChild(cont.getContentType()); }
Source:
<code>public Optional<CommandData> fill(DataContainer container, CommandData commandData) { <START> if (container.contains(Keys.LAST_COMMAND_OUTPUT.getQuery()) || <END> container.contains(Keys.SUCCESS_COUNT.getQuery()) || container.contains(Keys.COMMAND.getQuery()) || container.contains(Keys.TRACKS_OUTPUT.getQuery())) { return Optional.empty(); } @SuppressWarnings("unchecked") Optional<Text> lastCommandOutput = (Optional<Text>) container.get(Keys.LAST_COMMAND_OUTPUT.getQuery()).get(); int successCount = container.getInt(Keys.SUCCESS_COUNT.getQuery()).get(); String command = container.getString(Keys.COMMAND.getQuery()).get(); boolean tracksOutput = container.getBoolean(Keys.TRACKS_OUTPUT.getQuery()).get(); commandData.set(Keys.LAST_COMMAND_OUTPUT, lastCommandOutput); commandData.set(Keys.SUCCESS_COUNT, successCount); commandData.set(Keys.COMMAND, command); commandData.set(Keys.TRACKS_OUTPUT, tracksOutput); return Optional.of(commandData); }</code><technical_language>Instead of checking for individual one, container.contains(Keys.FOO.getQuery(), Keys.BAR.getQuery()...)</technical_language>

Target:
public Optional<CommandData> fill(DataContainer container, CommandData commandData) { if (!container.contains( Keys.LAST_COMMAND_OUTPUT.getQuery(), Keys.SUCCESS_COUNT.getQuery(), Keys.COMMAND.getQuery(), Keys.TRACKS_OUTPUT.getQuery())) { return Optional.empty(); } @SuppressWarnings("unchecked") Optional<Text> lastCommandOutput = (Optional<Text>) container.get(Keys.LAST_COMMAND_OUTPUT.getQuery()).get(); int successCount = container.getInt(Keys.SUCCESS_COUNT.getQuery()).get(); String command = container.getString(Keys.COMMAND.getQuery()).get(); boolean tracksOutput = container.getBoolean(Keys.TRACKS_OUTPUT.getQuery()).get(); commandData.set(Keys.LAST_COMMAND_OUTPUT, lastCommandOutput); commandData.set(Keys.SUCCESS_COUNT, successCount); commandData.set(Keys.COMMAND, command); commandData.set(Keys.TRACKS_OUTPUT, tracksOutput); return Optional.of(commandData); }
Source:
<code>public void computeAggStats_noData() { final DateTime dateLocal = DateTime.now(); final List<DeviceData> deviceDataList = Lists.newArrayList(); final List<TrackerMotion> trackerMotionList = Lists.newArrayList(); final AggStats aggStats = AggStatsComputer.computeAggStats(FAKE_ACCOUNT_ID, FAKE_DEVICE_ID_EXT, dateLocal, deviceDataList, trackerMotionList, Optional.<Device.Color>absent(), Optional.< Calibration>absent()); assertThat(aggStats.accountId, is(FAKE_ACCOUNT_ID)); <START> System.out.println(aggStats.accountId); <END> System.out.println(aggStats.externalDeviceId); System.out.println(aggStats.avgDailyTemp); }</code><technical_language>nope, System.out.println used</technical_language>

Target:
public void computeAggStats_noData() { final DateTime dateLocal = DateTime.now(); final ImmutableList<DeviceData> deviceDataList = ImmutableList.copyOf(Lists.<DeviceData>newArrayList()); final ImmutableList<TrackerMotion> trackerMotionList = ImmutableList.copyOf(Lists.<TrackerMotion>newArrayList()); final AggStatsInputs aggStatsInputs = AggStatsInputs.create(Optional.<Device.Color>absent(), Optional.<Calibration>absent(), new Response(deviceDataList, Response.Status.SUCCESS, Optional.<Exception>absent()), trackerMotionList); final AggStats aggStats = AggStatsComputer.computeAggStats(FAKE_ACCOUNT_ID, FAKE_DEVICE_ID_EXT, dateLocal, aggStatsInputs); assertThat(aggStats.accountId, is(FAKE_ACCOUNT_ID)); }
Source:
<code>public JLoadScenario getJaggerScenario() { JTestDefinition sleep_service_5ms_simple_http_query = JTestDefinition <START> .builder(Id.of("sleep-service-5ms-simple-http-query-provider"), getEndpoints()) <END> .withComment("sleep-service-5ms-simple-http-query-provider") .withQueryProvider(getQueries()) .withValidators(Collections.singletonList(NotNullResponseValidator.class)) .build(); JLoadProfile load = JLoadProfileRps.builder(RequestsPerSecond.of(100)) .withMaxLoadThreads(10) .withWarmUpTimeInSeconds(1) .build(); JTerminationCriteria termination = new JTerminationCriteriaIterations(IterationsNumber.of(1000), MaxDurationInSeconds.of(60)); JLoadTest test1 = JLoadTest.builder(Id.of("sleep-service-5ms-simple-http-query-provider"), sleep_service_5ms_simple_http_query, load, termination).build(); JParallelTestsGroup testGroup = JParallelTestsGroup.builder(Id.of("sleep-service-5ms-http-query-provider"), test1) .build(); return JLoadScenario.builder(Id.of("ciJaggerTestSuite"), testGroup).build(); }</code><technical_language>do need query-provider in id</technical_language>

Target:
public JLoadScenario getJaggerScenario() { JTestDefinition smokeTestDefinition = JTestDefinition .builder(Id.of("smoke-test-definition"), getEndpoints()) .withComment("smoke test") .withQueryProvider(getQueries()) .withValidators(Collections.singletonList(NotNullResponseValidator.class)) .build(); JLoadProfile load = JLoadProfileRps.builder(RequestsPerSecond.of(100)) .withMaxLoadThreads(10) .withWarmUpTimeInSeconds(1) .build(); JTerminationCriteria termination = new JTerminationCriteriaIterations(IterationsNumber.of(1000), MaxDurationInSeconds.of(60)); JLoadTest test1 = JLoadTest.builder(Id.of("smoke-test"), smokeTestDefinition, load, termination).build(); JParallelTestsGroup testGroup = JParallelTestsGroup.builder(Id.of("smoke-test-group"), test1) .build(); return JLoadScenario.builder(Id.of("JaggerSmokeTest"), testGroup).build(); }
Source:
<code>public Integer getReferenceIndex() { if (null == mReferenceIndex) { if (NO_ALIGNMENT_REFERENCE_NAME.equals(mReferenceName)) { mReferenceIndex = NO_ALIGNMENT_REFERENCE_INDEX; } else if (null != mHeader) { mReferenceIndex = mHeader.getSequenceIndex(mReferenceName); } else { <START> throw new IllegalArgumentException("A non-null SAMFileHeader is required to resolve the reference index"); <END> } } return mReferenceIndex; }</code><technical_language>This IllegalStateException, I (there arguments this method)</technical_language>

Target:
public Integer getReferenceIndex() { if (null == mReferenceIndex) { if (NO_ALIGNMENT_REFERENCE_NAME.equals(mReferenceName)) { mReferenceIndex = NO_ALIGNMENT_REFERENCE_INDEX; } else if (null != mHeader) { mReferenceIndex = mHeader.getSequenceIndex(mReferenceName); } else { throw new IllegalStateException("A non-null SAMFileHeader is required to resolve the reference index"); } } return mReferenceIndex; }
Source:
<code>public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final Bundle bundle; { if (savedInstanceState != null) { bundle = savedInstanceState; } else { bundle = getArguments(); } } final View view = inflater.inflate(R.layout.fragment_course_outline, container, false); listView = (ListView) view.findViewById(R.id.outline_list); swipeContainer = (SwipeRefreshLayout) view.findViewById(R.id.swipe_container); errorNotification = new FullScreenErrorNotification(swipeContainer); loadingIndicator = view.findViewById(R.id.loading_indicator); flBulkDownload = view.findViewById(R.id.fl_bulk_download_container); courseDateViewModel = new ViewModelProvider(this, new ViewModelFactory()).get(CourseDateViewModel.class); swipeContainer.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { loadingIndicator.setVisibility(View.GONE); errorNotification.hideError(); <START> canFetchBannerInfo = true; <END> getCourseComponentFromServer(false); } }); UiUtil.setSwipeRefreshLayoutColors(swipeContainer); restore(bundle); initListView(view); initObserver(); fetchCourseComponent(); trackAATestCourseOutline(); getCourseUpgradeFirebaseConfig(); return view; }</code><technical_language>need add this boolean</technical_language>

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final Bundle bundle; { if (savedInstanceState != null) { bundle = savedInstanceState; } else { bundle = getArguments(); } } final View view = inflater.inflate(R.layout.fragment_course_outline, container, false); listView = (ListView) view.findViewById(R.id.outline_list); swipeContainer = (SwipeRefreshLayout) view.findViewById(R.id.swipe_container); errorNotification = new FullScreenErrorNotification(swipeContainer); loadingIndicator = view.findViewById(R.id.loading_indicator); flBulkDownload = view.findViewById(R.id.fl_bulk_download_container); courseDateViewModel = new ViewModelProvider(this, new ViewModelFactory()).get(CourseDateViewModel.class); swipeContainer.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { loadingIndicator.setVisibility(View.GONE); errorNotification.hideError(); getCourseComponentFromServer(false); } }); UiUtil.setSwipeRefreshLayoutColors(swipeContainer); restore(bundle); initListView(view); initObserver(); fetchCourseComponent(); trackAATestCourseOutline(); getCourseUpgradeFirebaseConfig(); return view; }
Source:
<code>private AMethodWithItsArgs findBestMethodForVarargs(Set<Method> methods, JsonNode paramsNode) { for (Method method : methods) { <START> if(method.getParameterTypes().length!=1) { <END> continue; } if(method.isVarArgs()) { AMethodWithItsArgs matchedMethod = new AMethodWithItsArgs(method); if (paramsNode.isArray()) { ArrayNode arrayNode = ArrayNode.class.cast(paramsNode); for (int i = 0; i < paramsNode.size(); i++) { matchedMethod.arguments.add(arrayNode.get(i)); } } if (paramsNode.isObject()) { ObjectNode objectNode = ObjectNode.class.cast(paramsNode); Iterator<Map.Entry<String, JsonNode>> items = objectNode.fields(); while (items.hasNext()) { Map.Entry<String, JsonNode> item = items.next(); JsonNode name = JsonNodeFactory.instance.objectNode().put(item.getKey(),item.getKey()); matchedMethod.arguments.add(name.get(item.getKey())); matchedMethod.arguments.add(item.getValue()); } } return matchedMethod; } } return null; }</code><technical_language>single line continue clause space !=</technical_language>

Target:
private AMethodWithItsArgs findBestMethodForVarargs(Set<Method> methods, JsonNode paramsNode) { for (Method method : methods) { if (method.getParameterTypes().length != 1) { continue; } if (method.isVarArgs()) { AMethodWithItsArgs matchedMethod = new AMethodWithItsArgs(method); if (paramsNode.isArray()) { ArrayNode arrayNode = ArrayNode.class.cast(paramsNode); for (int i = 0; i < paramsNode.size(); i++) { matchedMethod.addArgument(arrayNode.get(i)); } } if (paramsNode.isObject()) { ObjectNode objectNode = ObjectNode.class.cast(paramsNode); Iterator<Map.Entry<String,JsonNode>> items = objectNode.fields(); while (items.hasNext()) { Map.Entry<String,JsonNode> item = items.next(); JsonNode name = JsonNodeFactory.instance.objectNode().put(item.getKey(),item.getKey()); matchedMethod.addArgument(name.get(item.getKey())); matchedMethod.addArgument(item.getValue()); } } return matchedMethod; } } return null; }
Source:
<code>public Response getServer(@PathParam("id") String queryId) { <START> log.info("Get cancel query for queryId[%s]", queryId); <END> queryManager.cancelQuery(queryId); return Response.status(Response.Status.ACCEPTED).build(); }</code><technical_language>Debug level please. suggest "Received cancel request for query [%s]" similar</technical_language>

Target:
public Response getServer(@PathParam("id") String queryId) { if (log.isDebugEnabled()) { log.debug("Received cancel request for query [%s]", queryId); } queryManager.cancelQuery(queryId); return Response.status(Response.Status.ACCEPTED).build(); }
Source:
<code>public String getUsage(ICommandSender commandSender) { <START> return new TextComponentTranslation("commands.bloodmagic.network.usage").getFormattedText(); <END> }</code><technical_language>getUsage(...) expects a localization key</technical_language>

Target:
public String getUsage(ICommandSender commandSender) { return "commands.bloodmagic.network.usage"; }
Source:
<code>public InputFormat<RowData, ?> getInputFormat() { if (!partitionKeys.isEmpty() && getOrFetchPartitions().isEmpty()) { return new CollectionInputFormat<>(new ArrayList<>(), null); } return createFormatFactory(formatProperties).createReader( new FileSystemFormatFactory.ReaderContext() { @Override public TableSchema getSchema() { return schema; } @Override <START> public TypeInformation<?> createTypeInformation(DataType dataType) { <END> DataType internalDataType = DataTypeUtils.transform( dataType, InternalConversionClassTransformation.INTERNAL_CLASS_TRANSFORM); return fromDataTypeToTypeInfo(internalDataType); } @Override public Map<String, String> getFormatProperties() { return formatProperties; } @Override public List<String> getPartitionKeys() { return partitionKeys; } @Override public String getDefaultPartName() { return defaultPartName; } @Override public Path[] getPaths() { if (partitionKeys.isEmpty()) { return new Path[] {path}; } else { return getOrFetchPartitions().stream() .map(FileSystemTableSource.this::toFullLinkedPartSpec) .map(PartitionPathUtils::generatePartitionPath) .map(n -> new Path(path, n)) .toArray(Path[]::new); } } @Override public int[] getProjectFields() { return readFields(); } @Override public long getPushedDownLimit() { return limit == null ? Long.MAX_VALUE : limit; } @Override public List<Expression> getPushedDownFilters() { return filters == null ? Collections.emptyList() : filters; } }); }</code><technical_language>need type info now</technical_language>

Target:
public InputFormat<RowData, ?> getInputFormat() { if (!partitionKeys.isEmpty() && getOrFetchPartitions().isEmpty()) { return new CollectionInputFormat<>(new ArrayList<>(), null); } return createFormatFactory(formatProperties).createReader( new FileSystemFormatFactory.ReaderContext() { @Override public TableSchema getSchema() { return schema; } @Override public Map<String, String> getFormatProperties() { return formatProperties; } @Override public List<String> getPartitionKeys() { return partitionKeys; } @Override public String getDefaultPartName() { return defaultPartName; } @Override public Path[] getPaths() { if (partitionKeys.isEmpty()) { return new Path[] {path}; } else { return getOrFetchPartitions().stream() .map(FileSystemTableSource.this::toFullLinkedPartSpec) .map(PartitionPathUtils::generatePartitionPath) .map(n -> new Path(path, n)) .toArray(Path[]::new); } } @Override public int[] getProjectFields() { return readFields(); } @Override public long getPushedDownLimit() { return limit == null ? Long.MAX_VALUE : limit; } @Override public List<Expression> getPushedDownFilters() { return filters == null ? Collections.emptyList() : filters; } }); }
Source:
<code>public void processStanza(Stanza packet) { try { if(packetLogging.isLoggingEnabled( PacketLoggingService.ProtocolName.JABBER) && packet != null && getSocket() != null) { Socket socket = getSocket(); if(remoteAddress == null) { if (socket != null) { remoteAddress = socket.getInetAddress().getAddress(); localAddress = socket.getLocalAddress().getAddress(); } } int localPort = 0; int remotePort = 5222; if (socket != null) { localPort = socket.getLocalPort(); remotePort = connection.getPort(); } byte[] packetBytes; if(packet instanceof Message) { packetBytes = cloneAnonyMessage(packet) .toXML().toString().getBytes("UTF-8"); } else { packetBytes = packet.toXML().toString().getBytes("UTF-8"); } packetLogging.logPacket( PacketLoggingService.ProtocolName.JABBER, <START> localAddress != null ? localAddress : new byte[4], <END> localPort, remoteAddress != null ? remoteAddress: new byte[4], remotePort, PacketLoggingService.TransportName.TCP, true, packetBytes ); } } catch(Throwable t) { t.printStackTrace(); } }</code><technical_language>added null check logPacket, checks unnecessary</technical_language>

Target:
public void processStanza(Stanza packet) { try { if(packetLogging.isLoggingEnabled( PacketLoggingService.ProtocolName.JABBER) && packet != null && getSocket() != null) { Socket socket = getSocket(); if(remoteAddress == null) { if (socket != null) { remoteAddress = socket.getInetAddress().getAddress(); localAddress = socket.getLocalAddress().getAddress(); } else { remoteAddress = new byte[4]; localAddress = new byte[4]; } } int localPort = 0; int remotePort = 5222; if (socket != null) { localPort = socket.getLocalPort(); remotePort = connection.getPort(); } byte[] packetBytes; if(packet instanceof Message) { packetBytes = cloneAnonyMessage(packet) .toXML().toString().getBytes("UTF-8"); } else { packetBytes = packet.toXML().toString().getBytes("UTF-8"); } packetLogging.logPacket( PacketLoggingService.ProtocolName.JABBER, localAddress, localPort, remoteAddress, remotePort, PacketLoggingService.TransportName.TCP, true, packetBytes ); } } catch(Throwable t) { t.printStackTrace(); } }
Source:
<code>public void testReloadBrooklynPropertiesDeploy() { brooklynMgmt.reloadBrooklynProperties(); CampPlatform reloadedPlatform = brooklynMgmt.getConfig().getConfig(BrooklynCampConstants.CAMP_PLATFORM); Assert.assertNotNull(reloadedPlatform); Reader input = Streams.reader(new ResourceUtils(this).getResourceFromUrl("test-entity-basic-template.yaml")); AssemblyTemplate template = reloadedPlatform.pdp().registerDeploymentPlan(input); try { Assembly assembly = template.getInstantiator().newInstance().instantiate(template, reloadedPlatform); LOG.info("Test - created " + assembly); final Entity app = brooklynMgmt.getEntityManager().getEntity(assembly.getId()); LOG.info("App - " + app); Assert.assertEquals(app.getDisplayName(), "test-entity-basic-template"); <START> Asserts.succeedsEventually(new Runnable() { <END> @Override public void run() { Assert.assertTrue(app.getAttribute(Startable.SERVICE_UP)); } }); } catch (Exception e) { LOG.warn("Unable to instantiate " + template + " (rethrowing): " + e); throw Exceptions.propagate(e); } }</code><technical_language>a convenience: EntityTestUtils.assertAttributeEqualsEventually(app, Startable.SERVICE_UP, true)</technical_language>

Target:
public void testReloadBrooklynPropertiesDeploy() { brooklynMgmt.reloadBrooklynProperties(); CampPlatform reloadedPlatform = brooklynMgmt.getConfig().getConfig(BrooklynCampConstants.CAMP_PLATFORM); Assert.assertNotNull(reloadedPlatform); Reader input = Streams.reader(new ResourceUtils(this).getResourceFromUrl("test-entity-basic-template.yaml")); AssemblyTemplate template = reloadedPlatform.pdp().registerDeploymentPlan(input); try { Assembly assembly = template.getInstantiator().newInstance().instantiate(template, reloadedPlatform); LOG.info("Test - created " + assembly); final Entity app = brooklynMgmt.getEntityManager().getEntity(assembly.getId()); LOG.info("App - " + app); Assert.assertEquals(app.getDisplayName(), "test-entity-basic-template"); EntityTestUtils.assertAttributeEqualsEventually(app, Startable.SERVICE_UP, true); } catch (Exception e) { LOG.warn("Unable to instantiate " + template + " (rethrowing): " + e); throw Exceptions.propagate(e); } }
Source:
<code>private void resumeVm() { setVdsId(getVm().getRunOnVds()); if (getVds() != null) { <START> initParametersForExternalNetworks(); <END> try { VDSReturnValue result = getBackend().getResourceManager() .RunAsyncVdsCommand( VDSCommandType.Resume, new ResumeVDSCommandParameters(getVdsId(), getVm().getId()), this); setActionReturnValue(result.getReturnValue()); setSucceeded(result.getSucceeded()); ExecutionHandler.setAsyncJob(getExecutionContext(), true); } finally { freeLock(); } } else { setActionReturnValue(getVm().getStatus()); } }</code><technical_language>need this resume? (just a reminder, resume is for paused vm, is running)</technical_language>

Target:
private void resumeVm() { setVdsId(getVm().getRunOnVds()); if (getVds() != null) { try { VDSReturnValue result = getBackend().getResourceManager() .RunAsyncVdsCommand( VDSCommandType.Resume, new ResumeVDSCommandParameters(getVdsId(), getVm().getId()), this); setActionReturnValue(result.getReturnValue()); setSucceeded(result.getSucceeded()); ExecutionHandler.setAsyncJob(getExecutionContext(), true); } finally { freeLock(); } } else { setActionReturnValue(getVm().getStatus()); } }
Source:
<code><START> public StatementTree TOP_STATEMENT() { <END> return b.<StatementTree>nonterminal(PHPLexicalGrammar.TOP_STATEMENT) .is(b.firstOf( FUNCTION_DECLARATION(), NAMESPACE_STATEMENT(), USE_STATEMENT(), STATEMENT() )); }</code><technical_language>![MAJOR](<LINK_1> Rename this method name match regular expression '^[a-z][a-zA-Z0-9]*$'. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
public StatementTree TOP_STATEMENT() { return b.<StatementTree>nonterminal(PHPLexicalGrammar.TOP_STATEMENT).is( b.firstOf( CLASS_DECLARATION(), TRAIT_DECLARATION(), FUNCTION_DECLARATION(), INTERFACE_DECLARATION(), NAMESPACE_STATEMENT(), USE_STATEMENT(), CONSTANT_DECLARATION(), HALT_COMPILER_STATEMENT(), STATEMENT())); }
Source:
<code>private ResponseEntity<Object> getPermissions(String uuid) { PID pid = PIDs.get(uuid); Map<String, Object> result = new HashMap<>(); result.put("action", "retrieve acls"); result.put("pid", pid.getId()); try { <START> result.put("access controls", aclRetrievalService.getPermissions(AgentPrincipals.createFromThread(), pid)); <END> } catch (Exception e) { result.put("error", e.getMessage()); if (e instanceof AuthorizationException || e instanceof AccessRestrictionException) { return new ResponseEntity<>(result, HttpStatus.FORBIDDEN); } else { log.error("Failed to retrieve access controls for object with pid " + pid, e); return new ResponseEntity<>(result, HttpStatus.INTERNAL_SERVER_ERROR); } } result.put("timestamp", System.currentTimeMillis()); return new ResponseEntity<>(result, HttpStatus.OK); }</code><technical_language>other keys in result map (from service) in camel case, switch this "accessControls"</technical_language>

Target:
private ResponseEntity<Object> getPermissions(String uuid) { PID pid = PIDs.get(uuid); Map<String, Object> result = new HashMap<>(); result.put("action", "retrieve acls"); result.put("pid", pid.getId()); try { result.put("accessControls", aclRetrievalService.getPermissions(AgentPrincipals.createFromThread(), pid)); } catch (Exception e) { result.put("error", e.getMessage()); if (e instanceof AuthorizationException || e instanceof AccessRestrictionException) { return new ResponseEntity<>(result, HttpStatus.FORBIDDEN); } else { log.error("Failed to retrieve access controls for object with pid " + pid, e); return new ResponseEntity<>(result, HttpStatus.INTERNAL_SERVER_ERROR); } } result.put("timestamp", System.currentTimeMillis()); return new ResponseEntity<>(result, HttpStatus.OK); }
Source:
<code><START> public short getShortFromAllowedValues(String name, Short defaultVal, Short[] allowedValues) { <END> Set<Object> allowedValuesSet = new HashSet<>(Arrays.asList(allowedValues)); Short v = containsKey(name) ? Short.parseShort(getProperty(name)) : defaultVal; if (allowedValuesSet.contains(v)) { return v; } else { throw new IllegalArgumentException( name + " has value " + v + " which is not among the allowed values: " + allowedValuesSet); } }</code><technical_language>minor: some inconsistency in sense list of allowed values is Short (which allows null) return type is short (which not)</technical_language>

Target:
public Short getShortFromAllowedValues(String name, Short defaultVal, Short[] allowedValues) { List<Short> allowedValuesList = Arrays.asList(allowedValues); Short v = containsKey(name) ? Short.parseShort(getProperty(name)) : defaultVal; if (allowedValuesList.contains(v)) { return v; } else { throw new IllegalArgumentException( name + " has value " + v + " which is not among the allowed values: " + allowedValuesList); } }
Source:
<code>protected OneStreamStateHandlerOperator() { this.latestTimestampBeforeCheckpoint = 0L; this.recoveredCheckpointTimestamp = 0L; <START> this.checkpointMap = new TreeMap<>(); <END> }</code><technical_language>concurrency issue? While checkpoint thread read map, event processor write state map. removeOldStates performed concurrently reader threads</technical_language>

Target:
protected OneStreamStateHandlerOperator() { this.latestTimestampBeforeCheckpoint = 0L; this.recoveredCheckpointTimestamp = 0L; this.checkpointMap = new ConcurrentSkipListMap<>(); }
Source:
<code>public Table getTable() { String realTableId = cachingTableSpec.getConfig().get(REAL_TABLE_ID); ReadableTable table = (ReadableTable) taskContext.getTable(realTableId); String cacheTableId = cachingTableSpec.getConfig().get(CACHE_TABLE_ID); ReadWriteTable cache; if (cacheTableId != null) { cache = (ReadWriteTable) taskContext.getTable(cacheTableId); } else { cache = createDefaultCacheTable(realTableId); <START> } <END> tableCaches.add(Pair.of(table, cache)); boolean isWriteAround = Boolean.parseBoolean(cachingTableSpec.getConfig().get(WRITE_AROUND)); return new CachingTable(table, cache, isWriteAround); }</code><technical_language>reuse cache instance</technical_language>

Target:
public Table getTable() { String realTableId = cachingTableSpec.getConfig().get(REAL_TABLE_ID); ReadableTable table = (ReadableTable) taskContext.getTable(realTableId); String cacheTableId = cachingTableSpec.getConfig().get(CACHE_TABLE_ID); ReadWriteTable cache; if (cacheTableId != null) { cache = (ReadWriteTable) taskContext.getTable(cacheTableId); } else { cache = createDefaultCacheTable(realTableId); } tableCaches.add(Pair.of(table, cache)); int stripes = Integer.parseInt(cachingTableSpec.getConfig().get(LOCK_STRIPES)); boolean isWriteAround = Boolean.parseBoolean(cachingTableSpec.getConfig().get(WRITE_AROUND)); return new CachingTable(cachingTableSpec.getId(), table, cache, stripes, isWriteAround); }
Source:
<code>public void showLinkPreview(PageTitle title, int entrySource, @Nullable Location location) { if (getSupportFragmentManager().findFragmentByTag(LINK_PREVIEW_FRAGMENT_TAG) == null) { DialogFragment linkPreview = app.isLinkPreviewExperimental() <START> ? LinkPreviewDialogB.newInstance(title, entrySource) <END> : LinkPreviewDialog.newInstance(title, entrySource, location); linkPreview.show(getSupportFragmentManager(), LINK_PREVIEW_FRAGMENT_TAG); } }</code><technical_language>this need a rebase patch removing a/b test (or vice versa)</technical_language>

Target:
public void showLinkPreview(PageTitle title, int entrySource, @Nullable Location location) { if (getSupportFragmentManager().findFragmentByTag(LINK_PREVIEW_FRAGMENT_TAG) == null) { DialogFragment linkPreview = LinkPreviewDialog.newInstance(title, entrySource, location); linkPreview.show(getSupportFragmentManager(), LINK_PREVIEW_FRAGMENT_TAG); } }
Source:
<code>public static void startServerInstance(File dataDir, ServerCnxnFactory factory, String hostPort) throws IOException, <START> InterruptedException, KeeperException.NoNodeException { <END> final int port = getPort(hostPort); LOG.info("STARTING server instance 127.0.0.1:{}", port); ZooKeeperServer zks = new ZooKeeperServer(dataDir, dataDir, 3000); factory.startup(zks); Assert.assertTrue("waiting for server up", ClientBase.waitForServerUp( "127.0.0.1:" + port, CONNECTION_TIMEOUT, factory.isSecure())); }</code><technical_language>this needed anymore right</technical_language>

Target:
public static void startServerInstance(File dataDir, ServerCnxnFactory factory, String hostPort) throws IOException, InterruptedException { final int port = getPort(hostPort); LOG.info("STARTING server instance 127.0.0.1:{}", port); ZooKeeperServer zks = new ZooKeeperServer(dataDir, dataDir, 3000); factory.startup(zks); Assert.assertTrue("waiting for server up", ClientBase.waitForServerUp( "127.0.0.1:" + port, CONNECTION_TIMEOUT, factory.isSecure())); }
Source:
<code>private void goThroughShop() { State.setCoins(COINS); mainMenu(MAIN_SHOP); final ObservableList<Skin> skinList = Skin.loadSkinsToList(); assertEquals(State.getSkin(), skinList.get(0)); shopBuyEquipSkin(SHOP_SKIN_IRONMAN); assertEquals(State.getSkin(), skinList.get(0)); shopBuyEquipSkin(SHOP_SKIN_CAPTAIN); assertEquals(State.getSkin(), skinList.get(0)); shopBuyEquipSkin(SHOP_SKIN_CAPTAIN); assertEquals(State.getSkin(), skinList.get(1)); shopBuyEquipSkin(SHOP_SKIN_IRONMAN); <START> assertEquals(State.getSkin(), skinList.get(0)); <END> shopScreen(SHOP_BACK); }</code><technical_language>also, harcode position of skins in list <review</technical_language>

Target:
private void goThroughShop() { State.setCoins(COINS); mainMenu(MAIN_SHOP); final ObservableList<Skin> skinList = Skin.loadSkinsToList(); assertEquals(State.getSkin(), skinList.get(SHOP_SKIN_NOOB)); shopBuyEquipSkin(SHOP_SKIN_NOOB); assertEquals(State.getSkin(), skinList.get(SHOP_SKIN_NOOB)); shopBuyEquipSkin(SHOP_SKIN_ANDY); assertEquals(State.getSkin(), skinList.get(SHOP_SKIN_NOOB)); shopBuyEquipSkin(SHOP_SKIN_ANDY); assertEquals(State.getSkin(), skinList.get(SHOP_SKIN_ANDY)); shopBuyEquipSkin(SHOP_SKIN_NOOB); assertEquals(State.getSkin(), skinList.get(SHOP_SKIN_NOOB)); shopScreen(SHOP_BACK); }
Source:
<code>public Set<PatternWrapper> getPatterns() { final Set<PatternWrapper> patterns = new HashSet<>(); if (isNewColumn() || !isNewFactPattern()) { final BRLRuleModel brlRuleModel = new BRLRuleModel(presenter.getModel()); final List<String> variables = brlRuleModel.getLHSPatternVariables(); <START> variables.stream().forEach(var -> { <END> final String factType = brlRuleModel.getLHSBoundFact(var).getFactType(); final boolean isNegated = brlRuleModel.getLHSBoundFact(var).isNegated(); patterns.add(new PatternWrapper(factType, var, isNegated)); }); } if (isNewColumn() || isNewFactPattern()) { final BRLRuleModel brlRuleModel = new BRLRuleModel(presenter.getModel()); final List<String> variables = brlRuleModel.getRHSBoundFacts(); variables.stream().forEach(var -> { final String factType = brlRuleModel.getRHSBoundFact(var).getFactType(); patterns.add(new PatternWrapper(factType, var)); }); } return patterns; }</code><technical_language>I only: java variables.forEach(var -> { // ..</technical_language>

Target:
public Set<PatternWrapper> getPatterns() { final Set<PatternWrapper> patterns = new HashSet<>(); if (isNewColumn() || !isNewFactPattern()) { final BRLRuleModel brlRuleModel = new BRLRuleModel(presenter.getModel()); final List<String> variables = brlRuleModel.getLHSPatternVariables(); variables.forEach(var -> { final String factType = brlRuleModel.getLHSBoundFact(var).getFactType(); final boolean isNegated = brlRuleModel.getLHSBoundFact(var).isNegated(); patterns.add(new PatternWrapper(factType, var, isNegated)); }); } if (isNewColumn() || isNewFactPattern()) { final BRLRuleModel brlRuleModel = new BRLRuleModel(presenter.getModel()); final List<String> variables = brlRuleModel.getRHSBoundFacts(); variables.forEach(var -> { final String factType = brlRuleModel.getRHSBoundFact(var).getFactType(); patterns.add(new PatternWrapper(factType, var)); }); } return patterns; }
Source:
<code>private OverviewStatsBuilder.OverviewStats.AnswerButtonsOverview toOverview(int type, ArrayList<double[]> list) { OverviewStatsBuilder.OverviewStats.AnswerButtonsOverview answerButtonsOverview = new OverviewStatsBuilder.OverviewStats.AnswerButtonsOverview(); for (double[] elements : list) { if (elements[0] != type) { continue; } answerButtonsOverview.total += elements[2]; <START> answerButtonsOverview.correct += elements[1] == 1 ? 0 : elements[2]; <END> } return answerButtonsOverview; }</code><technical_language>magic number 1? (I 1 a Const)</technical_language>

Target:
private AnswerButtonsOverview toOverview(int type, ArrayList<double[]> list) { AnswerButtonsOverview answerButtonsOverview = new AnswerButtonsOverview(); final int INDEX_TYPE = 0; final int INDEX_EASE = 1; final int INDEX_COUNT = 2; final double EASE_AGAIN = 1d; for (double[] elements : list) { if (elements[INDEX_TYPE] != type) { continue; } double answersCountForTypeAndEase = elements[INDEX_COUNT]; boolean isAgain = elements[INDEX_EASE] == EASE_AGAIN; answerButtonsOverview.total += answersCountForTypeAndEase; answerButtonsOverview.correct += isAgain ? 0 : answersCountForTypeAndEase; } return answerButtonsOverview; }
Source:
<code>protected void showDialog(Bundle state) { super.showDialog(state); Typeface typeface = TypefaceCache.getTypeface(getContext(), TypefaceCache.FAMILY_OPEN_SANS, Typeface.BOLD, TypefaceCache.VARIATION_LIGHT); int buttonColor = ContextCompat.getColor(getContext(), R.color.blue_medium); final AlertDialog dialog = (AlertDialog) getDialog(); Button positiveButton = dialog.getButton(DialogInterface.BUTTON_POSITIVE); Button negativeButton = dialog.getButton(DialogInterface.BUTTON_NEGATIVE); if (positiveButton != null) { dialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String error = null; CharSequence text = getEditText().getText(); if (mValidationType == ValidationType.EMAIL) { error = validateEmail(text); } else if (!TextUtils.isEmpty(text) && mValidationType == ValidationType.URL) { error = validateUrl(text); } if (error != null) { getEditText().setError(error); } else { callChangeListener(text); dialog.dismiss(); } } }); <START> positiveButton.setTextColor(buttonColor); <END> positiveButton.setTypeface(typeface); } if (negativeButton != null) { negativeButton.setTextColor(buttonColor); negativeButton.setTypeface(typeface); } }</code><technical_language>utility methods for buttons. [Example here](<LINK_0></technical_language>

Target:
protected void showDialog(Bundle state) { super.showDialog(state); final AlertDialog dialog = (AlertDialog) getDialog(); Button positiveButton = dialog.getButton(DialogInterface.BUTTON_POSITIVE); if (positiveButton != null) { positiveButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String error = null; CharSequence text = getEditText().getText(); if (mValidationType == ValidationType.EMAIL) { error = validateEmail(text); } else if (!TextUtils.isEmpty(text) && mValidationType == ValidationType.URL) { error = validateUrl(text); } if (error != null) { getEditText().setError(error); } else { callChangeListener(text); dialog.dismiss(); } } }); } CharSequence summary = getSummary(); if (TextUtils.isEmpty(summary)) { getEditText().setText(""); } else { getEditText().setText(summary); getEditText().setSelection(0, summary.length()); } getEditText().setError(null); }
Source:
<code>public static SortedSet<Text> getDefaultSplits() { SortedSet<Text> splits = new TreeSet<>(); String splitsFn = "src/main/resources/default-splits.txt"; try { <START> try (BufferedReader br = new BufferedReader(new FileReader(new File(splitsFn)))) { <END> String line; while ((line = br.readLine()) != null) { splits.add(new Text(line)); } } } catch (IOException e) { log.error("Failed to find splits file - {}", splitsFn); } return splits; }</code><technical_language>classloader resource methods read this. work matter CWD is</technical_language>

Target:
public static SortedSet<Text> getDefaultSplits() { SortedSet<Text> splits = new TreeSet<>(); InputStream is = IndexEnv.class.getClassLoader().getResourceAsStream("default-splits.txt"); try { try (BufferedReader br = new BufferedReader(new InputStreamReader(is))) { String line; while ((line = br.readLine()) != null) { splits.add(new Text(line)); } } } catch (IOException e) { log.error("Failed to read default-splits.txt resource", e); System.exit(-1); } return splits; }