auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void updateData(OCShare share) { share.setPath(mPath); if (mPath.endsWith(FileUtils.PATH_SEPARATOR)) { share.setIsFolder(true); } else { share.setIsFolder(false); } share.setPermissions(mPermissions); getStorageManager().saveShare(share); OCFile file = getStorageManager().getFileByPath(mPath); if (file!=null) { mSendIntent.putExtra(Intent.EXTRA_TEXT, share.getShareLink()); mSendIntent.putExtra(Intent.EXTRA_SUBJECT, <START> getClient().getCredentials().getUsername() + " shared >>" + file.getFileName() + "<< with you"); <END> file.setPublicLink(share.getShareLink()); file.setShareByLink(true); getStorageManager().saveFile(file); Log_OC.d(TAG, "Public Link = " + file.getPublicLink()); } }</code><technical_language>Tokens " shared" "with you" defined in strings.xml file in order translated</technical_language>

Target:
private void updateData(OCShare share) { share.setPath(mPath); if (mPath.endsWith(FileUtils.PATH_SEPARATOR)) { share.setIsFolder(true); } else { share.setIsFolder(false); } share.setPermissions(mPermissions); getStorageManager().saveShare(share); OCFile file = getStorageManager().getFileByPath(mPath); if (file!=null) { mSendIntent.putExtra(Intent.EXTRA_TEXT, share.getShareLink()); mSendIntent.putExtra(Intent.EXTRA_SUBJECT, String.format(mContext.getString(R.string.subject_token), getClient().getCredentials().getUsername(), mContext.getString(R.string.shared_subject_header), file.getFileName(), mContext.getString(R.string.with_you_subject_header))); file.setPublicLink(share.getShareLink()); file.setShareByLink(true); getStorageManager().saveFile(file); Log_OC.d(TAG, "Public Link = " + file.getPublicLink()); } }
Source:
<code>protected Event doExecute(final RequestContext context) throws Exception { final String activeFlow = context.getActiveFlow().getId(); <START> final MultifactorAuthenticationProvider provider = <END> ApplicationContextProvider.getApplicationContext() .getBeansOfType(MultifactorAuthenticationProvider.class) .entrySet().stream().filter(e -> e.getKey().startsWith(activeFlow)) .map(e -> e.getValue()) .findFirst().get(); if (provider != null) { context.getFlowScope().put("provider", provider); return success(); } return error(); }</code><technical_language>This need move MFA Utils (I is a similar call in already)</technical_language>

Target:
protected Event doExecute(final RequestContext context) throws Exception { final ApplicationContext applicationContext = ApplicationContextProvider.getApplicationContext(); final String activeFlow = context.getActiveFlow().getId(); final Optional<MultifactorAuthenticationProvider> provider = applicationContext .getBeansOfType(MultifactorAuthenticationProvider.class) .entrySet().stream().filter(e -> e.getKey().startsWith(activeFlow)) .map(e -> e.getValue()) .findFirst(); if (provider.isPresent()) { context.getFlowScope().put("provider", provider); return success(); } return error(); }
Source:
<code>public CqlQueryResponse executeCqlQuery(CqlRequest cqlRequest) throws UnsupportedQueryException, SourceUnavailableException, FederationException { QueryRequest request = cqlRequest.createQueryRequest(catalogFramework.getId(), filterBuilder); Stopwatch stopwatch = Stopwatch.createStarted(); List<QueryResponse> responses = Collections.synchronizedList(new ArrayList<>()); List<Result> results; if (cqlRequest.getCount() == 0) { results = retrieveHitCount(request, responses); } else { results = retrieveResults(cqlRequest, request, responses); } QueryResponse aggregatedResponse = new QueryResponseImpl( request, results, true, responses .stream() .filter(Objects::nonNull) .map(QueryResponse::getHits) .findFirst() .orElse(-1L), responses .stream() .filter(Objects::nonNull) .map(QueryResponse::getProperties) .findFirst() .orElse(Collections.emptyMap())); Set<ProcessingDetails> detailsOfAggregatedResponse = aggregatedResponse.getProcessingDetails(); <START> for (QueryResponse response : responses) { <END> detailsOfAggregatedResponse.addAll(response.getProcessingDetails()); } stopwatch.stop(); return new CqlQueryResponse( cqlRequest.getId(), request, aggregatedResponse, cqlRequest.getSourceResponseString(), stopwatch.elapsed(TimeUnit.MILLISECONDS), cqlRequest.isNormalize(), filterAdapter, actionRegistry, descriptors); }</code><technical_language>Consider a stream: java responses.stream() .map(QueryResponse::getProcessingDetails) .forEach(detailsOfAggregatedResponse::addAll);</technical_language>

Target:
public CqlQueryResponse executeCqlQuery(CqlRequest cqlRequest) throws UnsupportedQueryException, SourceUnavailableException, FederationException { QueryRequest request = cqlRequest.createQueryRequest(catalogFramework.getId(), filterBuilder); Stopwatch stopwatch = Stopwatch.createStarted(); List<QueryResponse> responses = Collections.synchronizedList(new ArrayList<>()); List<Result> results; if (cqlRequest.getCount() == 0) { results = retrieveHitCount(request, responses); } else { results = retrieveResults(cqlRequest, request, responses); } QueryResponse aggregatedResponse = new QueryResponseImpl( request, results, true, responses .stream() .filter(Objects::nonNull) .map(QueryResponse::getHits) .findFirst() .orElse(-1L), responses .stream() .filter(Objects::nonNull) .map(QueryResponse::getProperties) .findFirst() .orElse(Collections.emptyMap())); responses .stream() .map(QueryResponse::getProcessingDetails) .forEach(aggregatedResponse.getProcessingDetails()::addAll); stopwatch.stop(); return new CqlQueryResponse( cqlRequest.getId(), request, aggregatedResponse, cqlRequest.getSourceResponseString(), stopwatch.elapsed(TimeUnit.MILLISECONDS), cqlRequest.isNormalize(), filterAdapter, actionRegistry, descriptors); }
Source:
<code>public void execute() throws MojoExecutionException, MojoFailureException { if (skip) { getLog().info("Skipping pgpverify:check"); } else { final SkipFilter dependencyFilter = prepareDependencyFilters(); final SkipFilter pluginFilter = preparePluginFilters(); prepareForKeys(); final ArtifactResolver resolver = new ArtifactResolver(getLog(), repositorySystem, localRepository, remoteRepositories); final Configuration config = new Configuration(dependencyFilter, pluginFilter, this.verifyPomFiles, this.verifyPlugins, this.verifyPluginDependencies, this.verifyAtypical); final Set<Artifact> artifacts = resolver.resolveProjectArtifacts(this.project, config); getLog().info("Validating " + artifacts.size() + " artifacts ..."); <START> getLog().debug("Discovered project artifacts: " + artifacts); <END> final SignatureRequirement signaturePolicy = determineSignaturePolicy(); final Map<Artifact, Artifact> artifactMap = resolver.resolveSignatures(artifacts, signaturePolicy); verifyArtifactSignatures(artifactMap); } }</code><technical_language>please add ifDebugEnabled ... convert artifacts set String needed</technical_language>

Target:
public void execute() throws MojoExecutionException, MojoFailureException { if (skip) { getLog().info("Skipping pgpverify:check"); } else { final SkipFilter dependencyFilter = prepareDependencyFilters(); final SkipFilter pluginFilter = preparePluginFilters(); prepareForKeys(); final ArtifactResolver resolver = new ArtifactResolver(getLog(), repositorySystem, localRepository, remoteRepositories); final Configuration config = new Configuration(dependencyFilter, pluginFilter, this.verifyPomFiles, this.verifyPlugins, this.verifyPluginDependencies, this.verifyAtypical); final Set<Artifact> artifacts = resolver.resolveProjectArtifacts(this.project, config); getLog().info("Validating " + artifacts.size() + " artifacts ..."); if (getLog().isDebugEnabled()) { getLog().debug("Discovered project artifacts: " + artifacts); } final SignatureRequirement signaturePolicy = determineSignaturePolicy(); final Map<Artifact, Artifact> artifactMap = resolver.resolveSignatures(artifacts, signaturePolicy); verifyArtifactSignatures(artifactMap); } }
Source:
<code>private boolean changedProductsInSet(Set<Product> products, Map<String, Product> changedProducts) { if (products != null && changedProducts != null) { <START> for (Product product: products) { <END> if (product != null && product.getId() != null && changedProducts.get(product.getId()) != null) { return true; } } } return false; }</code><technical_language>Checkstyle failure here: need a space product colon. pull method declaration line well</technical_language>

Target:
private boolean changedProductsInSet(Set<Product> products, Map<String, Product> changedProducts) { if (products != null && changedProducts != null) { for (Product product : products) { if (product != null && changedProducts.get(product.getId()) != null) { return true; } } } return false; }
Source:
<code>private void createIntegerAccessor() { accessors.put(Integer.class, new Accessor<Integer>() { @Override public Integer get(String key, Integer defaultValue) { <START> return preferences.getInt(key, (defaultValue == null) ? 0 : defaultValue); <END> } @Override public void put(String key, Integer value) { editor.putInt(key, value).apply(); } }); }</code><technical_language>issue above</technical_language>

Target:
private void createIntegerAccessor() { accessors.put(Integer.class, new Accessor<Integer>() { @Override public Integer get(String key) { return preferences.getInt(key, 0); } @Override public void put(String key, Integer value) { editor.putInt(key, value).apply(); } }); }
Source:
<code>public String get() { if (SystemInfo.isWindows()) { return System.getProperty("user.home") + "\\AppData\\Local\\che\\ext-conf"; } else { final String localConfDir = System.getenv(CheBootstrap.CHE_LOCAL_CONF_DIR); <START> String pathToExtConfDir = localConfDir == null ? "" : localConfDir + File.separator + "ext"; <END> if (!pathToExtConfDir.isEmpty() && new File(pathToExtConfDir).isDirectory()) { return pathToExtConfDir + ":" + EXT_CHE_LOCAL_CONF_DIR + ":ro"; } else { return ""; } } }</code><technical_language>I some doubts this block. Need alternatives</technical_language>

Target:
public String get() { if (SystemInfo.isWindows()) { return System.getProperty("user.home") + "\\AppData\\Local\\che\\ext-conf" + CONTAINER_TARGET; } String localConfDir = System.getenv(CheBootstrap.CHE_LOCAL_CONF_DIR); if (localConfDir != null) { File extConfDir = new File(localConfDir, "ext"); if (extConfDir.isDirectory()) { return extConfDir.getAbsolutePath() + CONTAINER_TARGET; } } return null; }
Source:
<code>private static <K extends WritableComparable<?>,V extends Writable> SortedKeyValueIterator<K,V> loadIteratorsHelper(IteratorScope scope, SortedKeyValueIterator<K,V> source, KeyExtent extent, AccumuloConfiguration conf, List<IterInfo> ssiList, Map<String,Map<String,String>> ssio, IteratorEnvironment env, boolean useAccumuloClassLoader, String classLoaderContext) throws IOException { List<IterInfo> iters = new ArrayList<>(ssiList); Map<String,Map<String,String>> allOptions = new HashMap<>(); parseIteratorConfiguration(scope, iters, ssio, allOptions, conf); <START> if (classLoaderContext == null) { <END> classLoaderContext = conf.get(Property.TABLE_CLASSPATH); } return loadIterators(source, iters, allOptions, env, useAccumuloClassLoader, classLoaderContext); }</code><technical_language>I this sense leave in callers. a fan of null values implicit "logic" them</technical_language>

Target:
private static <K extends WritableComparable<?>,V extends Writable> SortedKeyValueIterator<K,V> loadIteratorsHelper(IteratorScope scope, SortedKeyValueIterator<K,V> source, KeyExtent extent, AccumuloConfiguration conf, List<IterInfo> ssiList, Map<String,Map<String,String>> ssio, IteratorEnvironment env, boolean useAccumuloClassLoader, String classLoaderContext) throws IOException { List<IterInfo> iters = new ArrayList<>(ssiList); Map<String,Map<String,String>> allOptions = new HashMap<>(); parseIteratorConfiguration(scope, iters, ssio, allOptions, conf); return loadIterators(source, iters, allOptions, env, useAccumuloClassLoader, classLoaderContext); }
Source:
<code>public byte[] getCacheKey() { <START> final String tzId = tz == null ? "" : tz.getID(); <END> final String localeTag = locale == null ? "" : locale.toLanguageTag(); final byte[] exprBytes = StringUtils.toUtf8(format + "\u0001" + tzId + "\u0001" + localeTag); final byte[] granularityCacheKey = granularity.getCacheKey(); return ByteBuffer.allocate(4 + exprBytes.length + granularityCacheKey.length) .put(ExtractionCacheHelper.CACHE_TYPE_ID_TIME_FORMAT) .put(exprBytes) .put((byte) 0xFF) .put(granularityCacheKey) .put((byte) 0xFF) .put(asMillis ? (byte) 1 : (byte) 0) .array(); }</code><technical_language>if TZ is explicitly set UTC this match</technical_language>

Target:
public byte[] getCacheKey() { final String tzId = (tz == null ? DateTimeZone.UTC : tz).getID(); final String localeTag = (locale == null ? Locale.getDefault() : locale).toLanguageTag(); final byte[] exprBytes = StringUtils.toUtf8(format + "\u0001" + tzId + "\u0001" + localeTag); final byte[] granularityCacheKey = granularity.getCacheKey(); return ByteBuffer.allocate(4 + exprBytes.length + granularityCacheKey.length) .put(ExtractionCacheHelper.CACHE_TYPE_ID_TIME_FORMAT) .put(exprBytes) .put((byte) 0xFF) .put(granularityCacheKey) .put((byte) 0xFF) .put(asMillis ? (byte) 1 : (byte) 0) .array(); }
Source:
<code>public void testSchemaRetrieval() throws IOException { <START> InputStream stream = getClass().getClassLoader().getResourceAsStream("data/avro-schema-example.json"); <END> Schema schema = new Schema.Parser().parse(stream); long fingerprint = SchemaNormalization.parsingFingerprint64(schema); Schema retrieved = service.findByFingerprint(fingerprint); assertEquals(schema, retrieved); }</code><technical_language>Close stream</technical_language>

Target:
public void testSchemaRetrieval() throws IOException { try (InputStream stream = getClass().getClassLoader().getResourceAsStream("data/avro-schema-example.json")) { Schema schema = new Schema.Parser().parse(stream); long fingerprint = SchemaNormalization.parsingFingerprint64(schema); Schema retrieved = service.findByFingerprint(fingerprint); assertEquals(schema, retrieved); } }
Source:
<code>public void testWatchForCommitWithSmallerTimeoutValue() throws Exception { OzoneConfiguration conf = new OzoneConfiguration(); conf.setTimeDuration(OzoneConfigKeys.OZONE_CLIENT_WATCH_REQUEST_TIMEOUT, 3, TimeUnit.SECONDS); conf.setInt(OzoneConfigKeys.DFS_RATIS_CLIENT_REQUEST_MAX_RETRIES_KEY, 10); startCluster(conf); XceiverClientManager clientManager = new XceiverClientManager(conf); ContainerWithPipeline container1 = storageContainerLocationClient .allocateContainer(HddsProtos.ReplicationType.RATIS, HddsProtos.ReplicationFactor.THREE, containerOwner); XceiverClientSpi xceiverClient = clientManager .acquireClient(container1.getPipeline()); Assert.assertEquals(1, xceiverClient.getRefcount()); Assert.assertEquals(container1.getPipeline(), xceiverClient.getPipeline()); Pipeline pipeline = xceiverClient.getPipeline(); XceiverClientReply reply = xceiverClient.sendCommandAsync( ContainerTestHelper.getCreateContainerRequest( container1.getContainerInfo().getContainerID(), xceiverClient.getPipeline())); reply.getResponse().get(); long index = reply.getLogIndex(); cluster.shutdownHddsDatanode(pipeline.getNodes().get(0)); cluster.shutdownHddsDatanode(pipeline.getNodes().get(1)); try { xceiverClient .watchForCommit(index + new Random().nextInt(100) + 10, 3000); Assert.fail("expected exception not thrown"); } catch (Exception e) { <START> System.out.println("exception " + e); <END> Assert.assertTrue( HddsClientUtils.checkForException(e) instanceof TimeoutException); } clientManager.releaseClient(xceiverClient, false); shutdown(); }</code><technical_language>noticed, this needs go</technical_language>

Target:
public void testWatchForCommitWithSmallerTimeoutValue() throws Exception { OzoneConfiguration conf = new OzoneConfiguration(); conf.setTimeDuration(OzoneConfigKeys.OZONE_CLIENT_WATCH_REQUEST_TIMEOUT, 3, TimeUnit.SECONDS); conf.setInt(OzoneConfigKeys.DFS_RATIS_CLIENT_REQUEST_MAX_RETRIES_KEY, 20); startCluster(conf); XceiverClientManager clientManager = new XceiverClientManager(conf); ContainerWithPipeline container1 = storageContainerLocationClient .allocateContainer(HddsProtos.ReplicationType.RATIS, HddsProtos.ReplicationFactor.THREE, containerOwner); XceiverClientSpi xceiverClient = clientManager .acquireClient(container1.getPipeline()); Assert.assertEquals(1, xceiverClient.getRefcount()); Assert.assertEquals(container1.getPipeline(), xceiverClient.getPipeline()); Pipeline pipeline = xceiverClient.getPipeline(); XceiverClientReply reply = xceiverClient.sendCommandAsync( ContainerTestHelper.getCreateContainerRequest( container1.getContainerInfo().getContainerID(), xceiverClient.getPipeline())); reply.getResponse().get(); long index = reply.getLogIndex(); cluster.shutdownHddsDatanode(pipeline.getNodes().get(0)); cluster.shutdownHddsDatanode(pipeline.getNodes().get(1)); try { xceiverClient .watchForCommit(index + new Random().nextInt(100) + 10, 3000); Assert.fail("expected exception not thrown"); } catch (Exception e) { Assert.assertTrue( HddsClientUtils.checkForException(e) instanceof TimeoutException); } clientManager.releaseClient(xceiverClient, false); shutdown(); }
Source:
<code>public void setUp() { fetcher = new CollectionOfComputerScienceBibliographiesFetcher(); bibEntry1 = new BibEntry(); bibEntry1.setField(StandardField.TITLE, "The relationship of code churn and architectural violations in the open source software JabRef"); bibEntry1.setField(StandardField.AUTHOR, "Tobias Olsson, Morgan Ericsson, Anna Wingkvist"); bibEntry1.setField(StandardField.DATE, "2017"); bibEntry1.setField(StandardField.URL, "<LINK_1>"); bibEntry2 = new BibEntry(); <START> bibEntry2.setField(StandardField.TITLE, "Literaturverwaltungsprogramme im Überblick"); <END> bibEntry2.setField(StandardField.AUTHOR, "Michaele Adam, Jutta Musiat, Kathleen Hoffmann, Sandra Rahm, Matti Stöhr, Christina Wenzel"); bibEntry2.setField(StandardField.DATE, "2018"); bibEntry2.setField(StandardField.URL, "<LINK_0>"); }</code><technical_language>please BibEntry build thingy, java bibEntry2 = new BibEntry() .withField(...) .withField(...) ... try builders whereever in code contributors it</technical_language>

Target:
public void setUp() { ImportFormatPreferences importFormatPreferences = mock(ImportFormatPreferences.class, Answers.RETURNS_DEEP_STUBS); when(importFormatPreferences.getKeywordSeparator()).thenReturn(','); fetcher = new CollectionOfComputerScienceBibliographiesFetcher(importFormatPreferences); }
Source:
<code>private void registerReceivers() { this.registrar = new BroadcastRegistrar(); this.registrar .addAction(MessagingService.ACTION_TRANSFER_SONG_MESSAGE, new IBroadcastActionHandler() { @Override public void onReceiveAction(Context context, Intent intent) { String fromAddr = intent.getStringExtra(MessagingService.EXTRA_ADDRESS); <START> long songId = intent.getLongExtra( MessagingService.EXTRA_SONG_ID, -1 ); <END> String fileName = intent.getStringExtra(MessagingService.EXTRA_SONG_FILE_NAME); byte[] fileData = intent.getByteArrayExtra(MessagingService.EXTRA_SONG_DATA); saveTempFileData(fromAddr, songId, fileName, fileData); new BroadcastIntent(PlaylistService.ACTION_PLAYLIST_UPDATED).send(playlistService); } }) .register(this.playlistService); }</code><technical_language>is happening this line</technical_language>

Target:
private void registerReceivers() { this.registrar = new BroadcastRegistrar(); this.registrar .addAction(MessagingService.ACTION_TRANSFER_SONG_MESSAGE, new IBroadcastActionHandler() { @Override public void onReceiveAction(Context context, Intent intent) { String fromAddr = intent.getStringExtra(MessagingService.EXTRA_ADDRESS); long songId = intent.getLongExtra( MessagingService.EXTRA_SONG_ID, SongMetadata.UNKNOWN_SONG); String fileName = intent.getStringExtra(MessagingService.EXTRA_SONG_FILE_NAME); byte[] fileData = intent.getByteArrayExtra(MessagingService.EXTRA_SONG_DATA); if (songId == SongMetadata.UNKNOWN_SONG) { Log.wtf(TAG, "TRANSFER_SONG_MESSAGE action received without a valid song id"); } else { saveTempFileData(fromAddr, songId, fileName, fileData); new BroadcastIntent(PlaylistService.ACTION_PLAYLIST_UPDATED).send(playlistService); } } }) .register(this.playlistService); }
Source:
<code>public void setUp() throws Exception { super.setUp(); configurationService.setProperty("citation-page.enable_globally", false); context.turnOffAuthorisationSystem(); <START> bitstream = bitstreamService.create(context, new StringInputStream("test")); unknownFormat = bitstreamFormatService.create(context); unknownFormat.setMIMEType("unknown test mime type"); unknownFormat.setDescription("unknown test description"); unknownFormat.setShortDescription(context, "unknown test short description"); unknownFormat.setSupportLevel(UNKNOWN); knownFormat = bitstreamFormatService.create(context); knownFormat.setMIMEType("known test mime type"); knownFormat.setDescription("known test description"); knownFormat.setShortDescription(context, "known test short description"); knownFormat.setSupportLevel(KNOWN); supportedFormat = bitstreamFormatService.create(context); supportedFormat.setMIMEType("supported mime type"); supportedFormat.setDescription("supported description"); supportedFormat.setShortDescription(context, "supported short description"); supportedFormat.setSupportLevel(SUPPORTED); bitstream.setFormat(context, supportedFormat); <END> context.commit(); }</code><technical_language>Instead of rewriting logic create BitstreamFormats save a Bitstream, please existing org.dspace.app.rest.builder.BitstreamFormatBuilder org.dspace.app.rest.builder.BitstreamBuilder (or enhance test classes if do meet needs). important a Builder class in ITs, Builder framework ensures content created Builder class is automatically removed test runs</technical_language>

Target:
public void setUp() throws Exception { super.setUp(); configurationService.setProperty("citation-page.enable_globally", false); context.turnOffAuthorisationSystem(); Community community = createCommunity(context).build(); Collection collection = createCollection(context, community).build(); Item item = createItem(context, collection).build(); bitstream = createBitstream(context, item, toInputStream("test", UTF_8)) .withFormat("test format") .build(); unknownFormat = bitstreamFormatService.findUnknown(context); knownFormat = createBitstreamFormat(context) .withMimeType("known test mime type") .withDescription("known test description") .withShortDescription("known test short description") .withSupportLevel(KNOWN) .build(); supportedFormat = createBitstreamFormat(context) .withMimeType("supported mime type") .withDescription("supported description") .withShortDescription("supported short description") .withSupportLevel(SUPPORTED) .build(); bitstream.setFormat(context, supportedFormat); context.restoreAuthSystemState(); }
Source:
<code>private void cleanup(CacheAccessException from) { try { cache.obliterate(); } catch (CacheAccessException e) { inconsistent(from, e); } <START> recovered(from); <END> }</code><technical_language>recovered try block, obliterate()? This way, conveying original calling inconsistent() twice</technical_language>

Target:
private void cleanup(CacheAccessException from) { try { cache.obliterate(); } catch (CacheAccessException e) { inconsistent(from, e); return; } recovered(from); }
Source:
<code>public CompletableFuture<LogReplicationQueryMetadataResponse> sendQueryMetadataRequest() { <START> return null; <END> }</code><technical_language>I return new CompletableFuture<>(); Otherwise, hit NPE..</technical_language>

Target:
public CompletableFuture<LogReplicationQueryMetadataResponse> sendQueryMetadataRequest() { return new CompletableFuture<>(); }
Source:
<code>public void testSaveGroup() { Group userGroup = builder.withGroup("testGroup1", "GROUP").buildGroup(); <START> Group savedUSerGroup = groupRepository.saveAndFlush(userGroup); <END> assertThat(savedUSerGroup.getId()).isNotNull(); assertThat(savedUSerGroup.getName()).isEqualTo(userGroup.getName()); assertThat(savedUSerGroup.getType()).isEqualTo(userGroup.getType()); }</code><technical_language>savedUserGroup instead of savedUSerGroup</technical_language>

Target:
public void testSaveGroup() { Group userGroup = builder.withGroup("testGroup1", "GROUP").buildGroup(); Group savedUserGroup = groupRepository.saveAndFlush(userGroup); assertThat(savedUserGroup.getId()).isNotNull(); assertThat(savedUserGroup.getName()).isEqualTo(userGroup.getName()); assertThat(savedUserGroup.getType()).isEqualTo(userGroup.getType()); }
Source:
<code>public void changePassword() throws Exception { <START> String username = "test" + (random.nextInt() % 10000); <END> String password = "password"; UserContext userContext = ensureSignedUp(username, password, network, crypto); String newPassword = "newPassword"; userContext.changePassword(password, newPassword, UserGenerationAlgorithm.getDefault(), UserGenerationAlgorithm.getDefault()).get(); ensureSignedUp(username, newPassword, network, crypto); }</code><technical_language>refactor username/password generation a method re-use logic in tests? Also, a random int</technical_language>

Target:
public void changePassword() throws Exception { String username = generateUsername(); String password = "password"; UserContext userContext = ensureSignedUp(username, password, network, crypto); String newPassword = "newPassword"; userContext.changePassword(password, newPassword, UserGenerationAlgorithm.getDefault(), UserGenerationAlgorithm.getDefault()).get(); ensureSignedUp(username, newPassword, network, crypto); }
Source:
<code>public static void main(String[] args) throws Exception { double[] yData = new double[] {2.0, 1.0, 0.0}; XYChart chart = new XYChart(500, 400); chart.setTitle("Sample Chart"); chart.setXAxisTitle("X"); chart.setXAxisTitle("Y"); XYSeries series = chart.addSeries("y(x)", null, yData); series.setMarker(SeriesMarkers.CIRCLE); BitmapEncoder.saveBitmap(chart, "./Sample_Chart", BitmapFormat.PNG); BitmapEncoder.saveBitmap(chart, "./Sample_Chart", BitmapFormat.JPG); BitmapEncoder.saveJPGWithQuality(chart, "./Sample_Chart_With_Quality.jpg", 0.95f); BitmapEncoder.saveBitmap(chart, "./Sample_Chart", BitmapFormat.BMP); BitmapEncoder.saveBitmap(chart, "./Sample_Chart", BitmapFormat.GIF); BitmapEncoder.saveBitmapWithDPI(chart, "./Sample_Chart_300_DPI", BitmapFormat.PNG, 300); BitmapEncoder.saveBitmapWithDPI(chart, "./Sample_Chart_300_DPI", BitmapFormat.JPG, 300); BitmapEncoder.saveBitmapWithDPI(chart, "./Sample_Chart_300_DPI", BitmapFormat.GIF, 300); VectorGraphicsEncoder.saveVectorGraphic(chart, "./Sample_Chart", VectorGraphicsFormat.EPS); VectorGraphicsEncoder.saveVectorGraphic(chart, "./Sample_Chart", VectorGraphicsFormat.SVG); <START> PdfboxGraphicsEncoder.savePdfboxGraphics(chart, "./Sample_Chart"); <END> }</code><technical_language>original VectorGraphicsEncoder instead of PdfboxGraphicsEncoder please? way, code break</technical_language>

Target:
public static void main(String[] args) throws Exception { double[] yData = new double[] {2.0, 1.0, 0.0}; XYChart chart = new XYChart(500, 400); chart.setTitle("Sample Chart"); chart.setXAxisTitle("X"); chart.setXAxisTitle("Y"); XYSeries series = chart.addSeries("y(x)", null, yData); series.setMarker(SeriesMarkers.CIRCLE); BitmapEncoder.saveBitmap(chart, "./Sample_Chart", BitmapFormat.PNG); BitmapEncoder.saveBitmap(chart, "./Sample_Chart", BitmapFormat.JPG); BitmapEncoder.saveJPGWithQuality(chart, "./Sample_Chart_With_Quality.jpg", 0.95f); BitmapEncoder.saveBitmap(chart, "./Sample_Chart", BitmapFormat.BMP); BitmapEncoder.saveBitmap(chart, "./Sample_Chart", BitmapFormat.GIF); BitmapEncoder.saveBitmapWithDPI(chart, "./Sample_Chart_300_DPI", BitmapFormat.PNG, 300); BitmapEncoder.saveBitmapWithDPI(chart, "./Sample_Chart_300_DPI", BitmapFormat.JPG, 300); BitmapEncoder.saveBitmapWithDPI(chart, "./Sample_Chart_300_DPI", BitmapFormat.GIF, 300); VectorGraphicsEncoder.saveVectorGraphic(chart, "./Sample_Chart", VectorGraphicsFormat.EPS); VectorGraphicsEncoder.saveVectorGraphic(chart, "./Sample_Chart", VectorGraphicsFormat.PDF); VectorGraphicsEncoder.saveVectorGraphic(chart, "./Sample_Chart", VectorGraphicsFormat.SVG); }
Source:
<code>private String getAddress() { String address; if (this.serverProperties != null && this.serverProperties.getAddress() != null) { <START> address = this.serverProperties.getAddress().getHostAddress(); <END> } else { address = this.localAdressResolver.getLocalIp4AddressAsString(); } return address; }</code><technical_language>ex I guess this properties, curious need a public type for local address resolver (as opposed package private utility). If a static utility method, need affect break public ctor of ServerPropertiesHostLocator</technical_language>

Target:
private String getAddress() { String address; if (this.serverProperties != null && this.serverProperties.getAddress() != null) { address = this.serverProperties.getAddress().getHostAddress(); } else { address = this.inetUtils.findFirstNonLoopbackAddress().getHostAddress(); } return address; }
Source:
<code>public static MetadataExpirationStrategyType ofStrategy(String strategy) { return Stream.of(values()) <START> .filter(e -> e.strategy.equalsIgnoreCase(strategy)) <END> .findFirst() .orElse(null); }</code><technical_language>equalsIgnoreCase I force equals consistent</technical_language>

Target:
public static MetadataExpirationStrategyType ofStrategy(String strategy) { return Stream.of(values()) .filter(e -> e.strategy.equals(strategy)) .findFirst() .orElse(null); }
Source:
<code>CompletableFuture<Void> getFailureOp(CommitData cd) { return CompletableFuture.supplyAsync(() -> { getStats().setRejected(cd.getRejected()); try { checkForOrphanedLocks(cd); } catch (Exception e) { throw new CompletionException(e); } return null; }, env.getSharedResources().getSyncCommitExecutor()).thenCompose(v -> { <START> try { <END> return rollbackLocks(cd); } catch (Exception e) { throw new CompletionException(e); } }); }</code><technical_language>This try/catch dropped throws is dropped rollbackLocks</technical_language>

Target:
CompletableFuture<Void> getFailureOp(CommitData cd) { return CompletableFuture.supplyAsync(() -> { getStats().setRejected(cd.getRejected()); try { checkForOrphanedLocks(cd); } catch (Exception e) { throw new CompletionException(e); } return null; }, env.getSharedResources().getSyncCommitExecutor()).thenCompose(v -> rollbackLocks(cd)); }
Source:
<code>protected void onMention(ChatMessage chatMessage) { if (preferencesService.getPreferences().getNotification().getNotifyOnAtMentionOnlyEnabled() <START> && !chatMessage.getMessage().contains("@" + this.userService.getUsername())) { <END> return; } if (!hasFocus()) { audioService.playChatMentionSound(); showNotificationIfNecessary(chatMessage); incrementUnreadMessagesCount(1); setUnread(true); } }</code><technical_language>skip this. if required</technical_language>

Target:
protected void onMention(ChatMessage chatMessage) { if (preferencesService.getPreferences().getNotification().getNotifyOnAtMentionOnlyEnabled() && !chatMessage.getMessage().contains("@" + userService.getUsername())) { return; } if (!hasFocus()) { audioService.playChatMentionSound(); showNotificationIfNecessary(chatMessage); incrementUnreadMessagesCount(1); setUnread(true); } }
Source:
<code>public static void main(String[] args) { boolean usingRI = false; try { <START> Class.forName("dalvik.system.PathClassLoader"); <END> } catch (ClassNotFoundException e) { usingRI = true; } try { invokeUserTest("Test1Derived"); invokeUserTest("Test1User"); invokeUserTest("Test1User2"); invokeUserTest("Test2User"); invokeUserTest("Test2User2"); invokeUserTest("Test3User"); invokeUserTest("Test4User"); invokeUserTest("Test5User"); invokeUserTest("Test5User2"); invokeUserTest("Test6User"); invokeUserTest("Test6User2"); if (usingRI) { System.out.println("Calling Test7User.test():\nTest7Interface.foo()"); } else { invokeUserTest("Test7User"); } } catch (Throwable t) { t.printStackTrace(System.out); } }</code><technical_language>BTW, put art-specific code src-art directory [with class name]? avoid this separate runtime check</technical_language>

Target:
public static void main(String[] args) { usingRI = false; try { Class.forName("dalvik.system.PathClassLoader"); } catch (ClassNotFoundException e) { usingRI = true; } try { test1(); test2(); test3(); test4(); test5(); test6(); test7(); test8(); test9(); } catch (Throwable t) { t.printStackTrace(System.out); } }
Source:
<code>public void login() { <START> page.login(validAdminPassword, validAdminLogin); <END> }</code><technical_language>strange</technical_language>

Target:
public void login() { page.login(validAdminLogin, validAdminPassword); }
Source:
<code>protected void processWatchEvent(WatchEvent<?> event, Kind<?> kind, Path path) { logger.debug("New watch event for path {}.", kind, path); if (kind == OVERFLOW) { return; } final WatchEvent<Path> ev = (WatchEvent<Path>) event; final Path filename = ev.context(); <START> logger.debug("Reloading javascript file {}.", filename.toString()); <END> manager.removeFromCache(filename.toString()); }</code><technical_language>call toString parameterized slf4j logging</technical_language>

Target:
protected void processWatchEvent(WatchEvent<?> event, Kind<?> kind, Path path) { logger.debug("New watch event for path {}.", kind, path); if (kind == OVERFLOW) { return; } final WatchEvent<Path> ev = (WatchEvent<Path>) event; final Path filename = ev.context(); logger.debug("Reloading javascript file {}.", filename); manager.removeFromCache(filename.toString()); }
Source:
<code>protected void doInit() throws Exception { super.doInit(); <START> <END> String placeholder = getEndpoint().isUsePlaceholder() ? getEndpoint().getPlaceholder() : null; resolvedQuery = SqlHelper.resolveQuery(getEndpoint().getCamelContext(), query, placeholder); }</code><technical_language>This doStart SqlHelper.resolveQuery potentially load SQL template file system. SQL docs</technical_language>

Target:
protected void doInit() throws Exception { super.doInit(); if (ResourceHelper.isClasspathUri(query)) { String placeholder = getEndpoint().isUsePlaceholder() ? getEndpoint().getPlaceholder() : null; resolvedQuery = SqlHelper.resolveQuery(getEndpoint().getCamelContext(), query, placeholder); } }
Source:
<code>public boolean isMotionBlur() { <START> return motionBlur; <END> }</code><technical_language>So, motion blur works fine in stereo? I constrain in place then</technical_language>

Target:
public boolean isMotionBlur() { return motionBlur && !isVrSupport(); }
Source:
<code><START> public List<ExternalSubnet> getSubnets() { <END> return subnets; }</code><technical_language>I this getter is needed, publicly</technical_language>

Target:
private List<ExternalSubnet> getSubnets() { return subnets; }
Source:
<code>public static String getSingular(Class<? extends CustomResource> clazz) { final Singular fromAnnotation = clazz.getAnnotation(Singular.class); <START> return (fromAnnotation != null ? fromAnnotation.value().toLowerCase(Locale.ROOT) : HasMetadata.getKind(clazz)).toLowerCase(Locale.ROOT); <END> }</code><technical_language>suggestion return (fromAnnotation != null ? fromAnnotation.value() : HasMetadata.getKind(clazz)).toLowerCase(Locale.ROOT);</technical_language>

Target:
public static String getSingular(Class<? extends CustomResource> clazz) { final Singular fromAnnotation = clazz.getAnnotation(Singular.class); return (fromAnnotation != null ? fromAnnotation.value() : HasMetadata.getKind(clazz)).toLowerCase(Locale.ROOT); }
Source:
<code>private boolean isCurrentDataExpired() { <START> return lastUpdateTime + MAX_DATA_AGE < new Date().getTime(); <END> }</code><technical_language>System.currentTimeMillis() slightly more elegant :-)</technical_language>

Target:
private boolean isCurrentDataExpired() { return lastUpdateTime + MAX_DATA_AGE < System.currentTimeMillis(); }
Source:
<code>public boolean canPrincipalConfigure( IAuthorizationPrincipal principal, String portletDefinitionId) throws AuthorizationException { String owner = IPermission.PORTAL_PUBLISH; String target = IPermission.PORTLET_PREFIX + portletDefinitionId; IPortletDefinition portlet = this.portletDefinitionRegistry.getPortletDefinition(portletDefinitionId); if (portlet == null) { throw new AuthorizationException("Unable to locate portlet " + portletDefinitionId); } final String activity = IPermission.PORTLET_MODE_CONFIG; boolean isAllowed = doesPrincipalHavePermission(principal, owner, activity, target); if (this.log.isTraceEnabled()) { log.trace( String.format( "In canPrincipalConfigure() - principal.key=[%s], is allowed?=[%s]", principal.getKey(), isAllowed)); <START> } <END> return isAllowed; }</code><technical_language>org.slf4j.Logger turns this mess 1 line -- handles isTraceEnabled String.format automatically (though syntax is different)</technical_language>

Target:
public boolean canPrincipalConfigure( IAuthorizationPrincipal principal, String portletDefinitionId) throws AuthorizationException { String owner = IPermission.PORTAL_PUBLISH; String target = IPermission.PORTLET_PREFIX + portletDefinitionId; IPortletDefinition portlet = this.portletDefinitionRegistry.getPortletDefinition(portletDefinitionId); if (portlet == null) { throw new AuthorizationException("Unable to locate portlet " + portletDefinitionId); } final String activity = IPermission.PORTLET_MODE_CONFIG; boolean isAllowed = doesPrincipalHavePermission(principal, owner, activity, target); log.trace( "In canPrincipalConfigure() - principal.key=[{}], is allowed?=[{}]", principal.getKey(), isAllowed); return isAllowed; }
Source:
<code><START> public default Stream<X> stream() { <END> return asList().stream() ; }</code><technical_language>Iterable a default impl for ::spliterator a Stream. I avoid extra object creation in Tuple::asList. default works for Collection::stream</technical_language>

Target:
public default Stream<X> stream() { return StreamSupport.stream(spliterator(), false) ; }
Source:
<code>private List<PublicIPAddress> getIPAddresses(Deployment deployment) { List<PublicIPAddress> list = new ArrayList<PublicIPAddress>(); String resourceGroup = getResourceGroupFromId(deployment.id()); if (deployment.properties() != null && deployment.properties().dependencies() != null) { List<Deployment.Dependency> dependencies = deployment.properties().dependencies(); for (int d = 0; d < dependencies.size(); d++) { if (dependencies.get(d).resourceType().equals("Microsoft.Network/networkInterfaces")) { List<Deployment.Dependency> dependsOn = dependencies.get(d).dependsOn(); for (int e = 0; e < dependsOn.size(); e++) { if (dependsOn.get(e).resourceType().equals("Microsoft.Network/publicIPAddresses")) { String resourceName = dependsOn.get(e).resourceName(); PublicIPAddress ip = api.getPublicIPAddressApi(resourceGroup).get(resourceName); <START> list.add(ip); <END> } } } } } return list; }</code><technical_language>break continue iterating</technical_language>

Target:
private List<PublicIPAddress> getIPAddresses(Deployment deployment) { List<PublicIPAddress> list = new ArrayList<PublicIPAddress>(); String resourceGroup = getResourceGroupFromId(deployment.id()); if (deployment.properties() != null && deployment.properties().dependencies() != null) { List<Deployment.Dependency> dependencies = deployment.properties().dependencies(); for (int d = 0; d < dependencies.size(); d++) { if (dependencies.get(d).resourceType().equals("Microsoft.Network/networkInterfaces")) { List<Deployment.Dependency> dependsOn = dependencies.get(d).dependsOn(); for (int e = 0; e < dependsOn.size(); e++) { if (dependsOn.get(e).resourceType().equals("Microsoft.Network/publicIPAddresses")) { String resourceName = dependsOn.get(e).resourceName(); PublicIPAddress ip = api.getPublicIPAddressApi(resourceGroup).get(resourceName); list.add(ip); break; } } } } } return list; }
Source:
<code>public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); emptyView = new EmptyViewHandler(getContext()); emptyView.setIcon(R.attr.ic_folder); <START> emptyView.setTitle(R.string.no_subscriptions_head_label); <END> emptyView.setMessage(R.string.no_subscriptions_label); emptyView.attachToListView(subscriptionGridLayout); subscriptionAdapter = new SubscriptionsAdapter((MainActivity) getActivity(), itemAccess); subscriptionGridLayout.setAdapter(subscriptionAdapter); subscriptionGridLayout.setOnItemClickListener(subscriptionAdapter); subscriptionAddButton.setOnClickListener(view -> { if (getActivity() instanceof MainActivity) { ((MainActivity) getActivity()).loadChildFragment(new AddFeedFragment()); } }); if (getActivity() instanceof MainActivity) { ((MainActivity) getActivity()).getSupportActionBar().setTitle(R.string.subscriptions_label); } }</code><technical_language>put this code a new method setupEmptyView</technical_language>

Target:
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); subscriptionAdapter = new SubscriptionsAdapter((MainActivity) getActivity(), itemAccess); subscriptionGridLayout.setAdapter(subscriptionAdapter); subscriptionGridLayout.setOnItemClickListener(subscriptionAdapter); subscriptionAddButton.setOnClickListener(view -> { if (getActivity() instanceof MainActivity) { ((MainActivity) getActivity()).loadChildFragment(new AddFeedFragment()); } }); if (getActivity() instanceof MainActivity) { ((MainActivity) getActivity()).getSupportActionBar().setTitle(R.string.subscriptions_label); } }
Source:
<code>public String addCssClass(String cssClasses, String cssClass) { if (StringUtility.hasText(cssClasses) && StringUtility.hasText(cssClass) && !cssClasses.matches("(.* |^)" + Pattern.quote(cssClass) + "( .*|$)")) { return cssClasses + " " + cssClass; } <START> else if (!StringUtility.hasText(cssClasses) && StringUtility.hasText(cssClass)) { <END> return cssClass; } else { return cssClasses; } }</code><technical_language>store result of hasText(String) calls in a local variable, is executed for string in method. consider removing else-ifs, required of return statements</technical_language>

Target:
public String addCssClass(String cssClasses, String cssClass) { boolean hasCssClasses = StringUtility.hasText(cssClasses); boolean hasCssClass = StringUtility.hasText(cssClass); if (hasCssClasses && hasCssClass && !cssClasses.matches("(.* |^)" + Pattern.quote(cssClass) + "( .*|$)")) { return cssClasses + " " + cssClass; } if (!hasCssClasses && hasCssClass) { return cssClass; } return cssClasses; }
Source:
<code>public void blobUrlWithLines() { String blobUrl = GitHubUrlUtils.getBlobUrl( HTTPS_URL, "mysql", "src/test/java/org/springframework" + "/samples/petclinic/service/ClinicServiceJdbcTests.java", 10, 20); <START> System.out.println(blobUrl); <END> }</code><technical_language>verification Assert.assertEquals(blobUrl, BLOB_URL) is missed in test **blobUrlWithLines**</technical_language>

Target:
public void blobUrlWithLines() { String blobUrl = GitHubUrlUtils.getBlobUrl( HTTPS_URL, "mysql", "src/test/java/org/springframework" + "/samples/petclinic/service/ClinicServiceJdbcTests.java", 10, 20); assertEquals(blobUrl, BLOB_URL + "#L10-L20"); }
Source:
<code>protected void checkSignedAssertion(AssertionWrapper assertion, RequestData data) throws WSSecurityException { SAMLKeyInfo samlKeyInfo = assertion.getSignatureKeyInfo(); X509Certificate[] certs = samlKeyInfo.getCerts(); PublicKey publicKey = samlKeyInfo.getPublicKey(); try { super.verifySignedAssertion(assertion, data); } catch (WSSecurityException e) { if (certs == null && publicKey != null) { LOG.warn("Could not establish trust of the signature's public key because no matching public key " + "exists in the truststore. Please see GATEWAY-3146 for more details."); } else { if (isValidateChainOfTrust() && e.getCause() instanceof CertPathValidatorException){ CertificateChainValidator chainValidator = CertificateChainValidator.getInstance(); List<X509Certificate> certList = Arrays.asList(certs); LOG.debug("Detect number of certs in saml {}", certList.size()); for (X509Certificate cert: certList){ String serialNumber = cert.getSerialNumber().toString(16); if (chainValidator.validateCert(cert)){ LOG.info("A certs serial number in saml already in the truststore {}",serialNumber); }else{ LOG.error("Unable to find cert serial number in the truststore {}",serialNumber); throw e; } } <START> <END> }else{ throw e; } } } }</code><technical_language>Remove extra line spaces</technical_language>

Target:
protected void checkSignedAssertion(AssertionWrapper assertion, RequestData data) throws WSSecurityException { SAMLKeyInfo samlKeyInfo = assertion.getSignatureKeyInfo(); X509Certificate[] certs = samlKeyInfo.getCerts(); PublicKey publicKey = samlKeyInfo.getPublicKey(); try { super.verifySignedAssertion(assertion, data); } catch (WSSecurityException e) { if (certs == null && publicKey != null) { LOG.warn("Could not establish trust of the signature's public key because no matching public key " + "exists in the truststore. Please see GATEWAY-3146 for more details."); } else { if (isValidateChainOfTrust() && e.getCause() instanceof CertPathValidatorException){ CertificateChainValidator chainValidator = CertificateChainValidator.getInstance(); List<X509Certificate> certList = Arrays.asList(certs); LOG.debug("Detect number of certs in saml " + certList.size()); for (X509Certificate cert: certList){ String serialNumber = chainValidator.getCertSerialNumber(cert); if (chainValidator.validateCert(cert)){ LOG.info("A certs serial number in saml already in the truststore " + serialNumber); }else{ LOG.error("Unable to find cert serial number in the truststore " + serialNumber); throw e; } } } else { throw e; } } } }
Source:
<code>public Object visit(ASTCompilationUnit node, Object data) { literals.clear(); if (getProperty(EXCEPTION_LIST_DESCRIPTOR) != null) { ExceptionParser p = new ExceptionParser(getProperty(SEPARATOR_DESCRIPTOR)); exceptions = p.parse(getProperty(EXCEPTION_LIST_DESCRIPTOR)); } else if (getProperty(EXCEPTION_FILE_DESCRIPTOR) != null) { exceptions = new HashSet<>(); try (LineNumberReader reader = getLineReader()) { String line; while ((line = reader.readLine()) != null) { exceptions.add(line); } } catch (IOException ioe) { <START> ioe.printStackTrace(); <END> } } minLength = 2 + getProperty(MINIMUM_LENGTH_DESCRIPTOR); super.visit(node, data); processResults(data); return data; }</code><technical_language>change this printStackTrace please? rethrow throw new RuntimeException(ioe); if get error here, sense continue rule all, simply abort</technical_language>

Target:
public Object visit(ASTCompilationUnit node, Object data) { literals.clear(); if (getProperty(EXCEPTION_LIST_DESCRIPTOR) != null) { ExceptionParser p = new ExceptionParser(getProperty(SEPARATOR_DESCRIPTOR)); exceptions = p.parse(getProperty(EXCEPTION_LIST_DESCRIPTOR)); } else if (getProperty(EXCEPTION_FILE_DESCRIPTOR) != null) { exceptions = new HashSet<>(); try (LineNumberReader reader = getLineReader()) { String line; while ((line = reader.readLine()) != null) { exceptions.add(line); } } catch (IOException ioe) { throw new RuntimeException(ioe); } } minLength = 2 + getProperty(MINIMUM_LENGTH_DESCRIPTOR); super.visit(node, data); processResults(data); return data; }