auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testRenameTable() { assertUpdate("CREATE TABLE test_rename (a BIGINT)"); <START> assertQueryFails("ALTER TABLE test_rename RENAME TO memory.rename.test_rename", "Schema rename not found"); <END> assertUpdate("ALTER TABLE test_rename RENAME TO test_renamed"); assertQueryResult("SELECT count(*) FROM test_renamed", 0L); assertUpdate("CREATE SCHEMA rename"); assertUpdate("ALTER TABLE test_renamed RENAME TO rename.test_renamed"); assertQueryResult("SELECT count(*) FROM rename.test_renamed", 0L); }</code><technical_language>message looked like: Schema 'rename' found</technical_language>

Target:
public void testRenameTable() { assertUpdate("CREATE TABLE test_table_to_be_renamed (a BIGINT)"); assertQueryFails("ALTER TABLE test_table_to_be_renamed RENAME TO memory.test_schema_not_exist.test_table_renamed", "Schema test_schema_not_exist not found"); assertUpdate("ALTER TABLE test_table_to_be_renamed RENAME TO test_table_renamed"); assertQueryResult("SELECT count(*) FROM test_table_renamed", 0L); assertUpdate("CREATE SCHEMA test_different_schema"); assertUpdate("ALTER TABLE test_table_renamed RENAME TO test_different_schema.test_table_renamed"); assertQueryResult("SELECT count(*) FROM test_different_schema.test_table_renamed", 0L); }
Source:
<code>public void onComplete(final AsyncEvent event) { <START> FlowIdUtils.push(this.flowId); <END> writeToAccessLogAndEventType(requestLogInfo, response); }</code><technical_language>need clean that, flowid left thread calls AsyncRequestListener</technical_language>

Target:
public void onComplete(final AsyncEvent event) { logOnEvent(); }
Source:
<code>private void loadMetadataIfNotExist(RpcContext rpcContext, AlluxioURI path, LoadMetadataContext context, boolean isGetFileInfo) throws InvalidPathException, AccessControlException { LockingScheme scheme = new LockingScheme(path, LockPattern.READ, false); boolean lm; try (LockedInodePath inodePath = mInodeTree.lockInodePath(scheme)) { <START> lm = shouldLoadMetadataIfNotExists(inodePath, context); <END> } if (lm) { DescendantType syncDescendantType = GrpcUtils.fromProto(context.getOptions().getLoadDescendantType()); FileSystemMasterCommonPOptions commonOptions = context.getOptions().getCommonOptions(); InodeSyncStream sync = new InodeSyncStream(new LockingScheme(path, LockPattern.READ, false), this, rpcContext, syncDescendantType, commonOptions, isGetFileInfo, true, true); if (!sync.sync()) { LOG.debug("Failed to load metadata for path from UFS: {}", path); } } }</code><technical_language>rpcs shouldLoadMetadataIfNotExists check load metadata, this method calls shouldLoadMetadataIfNotExists again. Is intentional, do need check again</technical_language>

Target:
private void loadMetadataIfNotExist(RpcContext rpcContext, AlluxioURI path, LoadMetadataContext context, boolean isGetFileInfo) throws InvalidPathException, AccessControlException { DescendantType syncDescendantType = GrpcUtils.fromProto(context.getOptions().getLoadDescendantType()); FileSystemMasterCommonPOptions commonOptions = context.getOptions().getCommonOptions(); InodeSyncStream sync = new InodeSyncStream(new LockingScheme(path, LockPattern.READ, false), this, rpcContext, syncDescendantType, commonOptions, isGetFileInfo, true, true); if (!sync.sync()) { LOG.debug("Failed to load metadata for path from UFS: {}", path); } }
Source:
<code><START> private List<PartP2PFluids> getOutputs( final Fluid input ) <END> { final List<PartP2PFluids> outs = new LinkedList<PartP2PFluids>(); try { for( final PartP2PFluids l : this.getOutputs() ) { final IFluidHandler handler = l.getTarget(); if( handler != null ) { outs.add( l ); } } } catch( final GridAccessException e ) { } return outs; }</code><technical_language>![MAJOR](<LINK_0> Remove this unused method parameter "input". [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
private List<PartP2PFluids> getOutputs( final Fluid input ) { final List<PartP2PFluids> outs = new LinkedList<>(); try { for( final PartP2PFluids l : this.getOutputs() ) { final IFluidHandler handler = l.getTarget(); if( handler != null ) { outs.add( l ); } } } catch( final GridAccessException e ) { } return outs; }
Source:
<code>public static IBlockState getBlockState(String name, String properties) { <START> IBlockState iBlock = null; <END> Block block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(name)); if (block != null) { iBlock = new MCBlockState(block.getDefaultState()); if (properties != null && properties.length() > 0) { for (String propertyPair : properties.split(",")) { String[] splitPair = propertyPair.split("="); if (splitPair.length != 2) return null; iBlock = iBlock.withProperty(splitPair[0], splitPair[1]); } } } return iBlock; }</code><technical_language>IBlock is a thing, call this blockstate something</technical_language>

Target:
public static IBlockState getBlockState(String name, String properties) { IBlockState blockState = null; if (!ForgeRegistries.BLOCKS.containsKey(new ResourceLocation(name))) { CraftTweakerAPI.logError("No block found with name '" + name + "'. Air block used instead."); } Block block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(name)); if (block != null) { blockState = new MCBlockState(block.getDefaultState()); if (properties != null && properties.length() > 0) { for (String propertyPair : properties.split(",")) { String[] splitPair = propertyPair.split("="); if (splitPair.length != 2) { CraftTweakerAPI.logWarning("Invalid blockstate property format '" + propertyPair + "'. Using default property value."); continue; } blockState = blockState.withProperty(splitPair[0], splitPair[1]); } } } return blockState; }
Source:
<code>public SeekableByteChannel open( final StorageResourceId resourceId, GoogleCloudStorageReadOptions readOptions) throws IOException { logger.atFine().log("open(%s, %s)", resourceId, readOptions); Preconditions.checkArgument( resourceId.isStorageObject(), "Expected full StorageObject id, got %s", resourceId); GoogleCloudStorageItemInfo info; if (readOptions.getFastFailOnNotFound()) { info = getItemInfo(resourceId); if (!info.exists()) { throw createFileNotFoundException( resourceId.getBucketName(), resourceId.getObjectName(), null); } } else { info = null; } return new GoogleCloudStorageReadChannel( gcs, resourceId, errorExtractor, clientRequestHelper, readOptions) { @Override @Nullable protected GoogleCloudStorageItemInfo getInitialMetadata() { return info; } @Override protected Storage.Objects.Get createRequest() throws IOException { Storage.Objects.Get getObject = super.createRequest(); setEncryptionHeaders(getObject); <START> return configureRequest(getObject, resourceId.getBucketName()); <END> } }; }</code><technical_language>done in configureRequest method? a good feet if applies requests</technical_language>

Target:
public SeekableByteChannel open( final StorageResourceId resourceId, GoogleCloudStorageReadOptions readOptions) throws IOException { logger.atFine().log("open(%s, %s)", resourceId, readOptions); Preconditions.checkArgument( resourceId.isStorageObject(), "Expected full StorageObject id, got %s", resourceId); GoogleCloudStorageItemInfo info; if (readOptions.getFastFailOnNotFound()) { info = getItemInfo(resourceId); if (!info.exists()) { throw createFileNotFoundException( resourceId.getBucketName(), resourceId.getObjectName(), null); } } else { info = null; } return new GoogleCloudStorageReadChannel( gcs, resourceId, errorExtractor, clientRequestHelper, readOptions) { @Override @Nullable protected GoogleCloudStorageItemInfo getInitialMetadata() { return info; } @Override protected Storage.Objects.Get createRequest() throws IOException { return configureRequest(super.createRequest(), resourceId.getBucketName()); } }; }
Source:
<code>public Req understand(final Comment.Smart comment, final URI home) throws IOException { final Req req; <START> final List<String> logins = new ListOf<>( <END> new Mapped<>( input -> input.toLowerCase(Locale.ENGLISH), this.profile.read().xpath(this.xpath) ) ); final boolean legal = logins.isEmpty() || logins.contains( comment.author().login().toLowerCase(Locale.ENGLISH) ); if (legal) { req = this.origin.understand(comment, home); } else { new Answer(comment).post( true, String.format( QnByArchitect.PHRASES.getString("QnByArchitect.denied"), logins.get(0).toLowerCase(Locale.ENGLISH) ) ); req = Req.DONE; } return req; }</code><technical_language>@filfreire SolidList instead</technical_language>

Target:
public Req understand(final Comment.Smart comment, final URI home) throws IOException { final Req req; final SolidList<String> logins = new SolidList<>( new Mapped<>( input -> input.toLowerCase(Locale.ENGLISH), this.profile.read().xpath(this.xpath) ) ); final boolean legal = logins.isEmpty() || logins.contains( comment.author().login().toLowerCase(Locale.ENGLISH) ); if (legal) { req = this.origin.understand(comment, home); } else { new Answer(comment).post( true, String.format( QnByArchitect.PHRASES.getString("QnByArchitect.denied"), logins.get(0).toLowerCase(Locale.ENGLISH) ) ); req = Req.DONE; } return req; }
Source:
<code>public <Msg> void identifier(MessageAdapter<Msg> adapter, Msg message, SpanCustomizer customizer) { String identifier = adapter.identifier(message); if (identifier != null) { <START> customizer.tag(adapter.identifierTagKey(), adapter.identifier(message)); <END> } }</code><technical_language>Small I this customizer.tag(adapter.identifierTagKey(), identifier);. do a null empty string check adapter.identifierTagKey() ensure a bad adapter issues</technical_language>

Target:
public <Msg> void identifier(MessageAdapter<Msg> adapter, Msg message, SpanCustomizer customizer) { String identifier = adapter.identifier(message); if (identifier != null) { customizer.tag(adapter.identifierTagKey(), identifier); } }
Source:
<code><START> public PrefetchableAndPredicate(Predicate<ChangeData>... that) { <END> super(that); }</code><technical_language>need public</technical_language>

Target:
PrefetchableAndPredicate(Predicate<ChangeData>... that) { super(that); }
Source:
<code>protected File writeFileContent(String fileContent) throws IOException { new RenderingManager().render( this.outputDirectory, this.applicationTemplate, this.applicationDirectory, Renderer.FOP, options ); File index_fo = new File( this.outputDirectory, "index.fo" ); File index_pdf = new File( this.outputDirectory, "index.pdf" ); InputStream conf = getClass().getResourceAsStream( "/fop.xconf" ); File fopConfig = new File( this.outputDirectory, "fop.xconf" ); Utils.copyStream( conf, fopConfig ); OutputStream out = null; try { out = new BufferedOutputStream( new FileOutputStream(index_pdf) ); FopFactory fopFactory = FopFactory.newInstance( fopConfig ); Fop fop = fopFactory.newFop( "application/pdf", out ); Source src = new StreamSource( index_fo ); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); Result res = new SAXResult(fop.getDefaultHandler()); transformer.transform(src, res); <START> } catch (SAXException e) { <END> e.printStackTrace(); } catch (TransformerConfigurationException e) { e.printStackTrace(); } catch (TransformerException e) { e.printStackTrace(); } finally { Utils.closeQuietly ( out ); } return index_pdf; }</code><technical_language>Wrap catch blocks a single one. propagate IO exception. java try { } catch( Exception e) { throw new IOException( e ); } finally { }</technical_language>

Target:
protected File writeFileContent(String fileContent) throws IOException { new RenderingManager().render( this.outputDirectory, this.applicationTemplate, this.applicationDirectory, Renderer.FOP, options ); File index_fo = new File( this.outputDirectory, "index.fo" ); File index_pdf = new File( this.outputDirectory, "index.pdf" ); InputStream conf = getClass().getResourceAsStream( "/fop.xconf" ); File fopConfig = new File( this.outputDirectory, "fop.xconf" ); Utils.copyStream( conf, fopConfig ); OutputStream out = null; try { out = new BufferedOutputStream( new FileOutputStream(index_pdf) ); FopFactory fopFactory = FopFactory.newInstance( fopConfig ); Fop fop = fopFactory.newFop( "application/pdf", out ); Source src = new StreamSource( index_fo ); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); Result res = new SAXResult(fop.getDefaultHandler()); transformer.transform(src, res); } catch ( Exception e) { throw new IOException( e ); } finally { Utils.closeQuietly ( out ); } return index_pdf; }
Source:
<code>public void testFindNew() throws NoSuchFieldException, IllegalAccessException, ExecutionException, InterruptedException { long startTime = System.currentTimeMillis(); MetadataStorageConnectorConfig config = new MetadataStorageConnectorConfig(); Field uriField = MetadataStorageConnectorConfig.class.getDeclaredField("connectURI"); uriField.setAccessible(true); uriField.set(config, connectionURI); final JDBCExtractionNamespace extractionNamespace = new JDBCExtractionNamespace( namespace, config, tableName, keyName, valName, tsColumn, new Period(10) ); extractionCacheManager.schedule(extractionNamespace); while (!fnCache.containsKey(extractionNamespace.getNamespace())) { Thread.sleep(1); Assert.assertTrue("Timeout waiting on fn cache update", System.currentTimeMillis() - startTime < 30_000); } Function<String, String> extractionFn = fnCache.get(extractionNamespace.getNamespace()); Assert.assertEquals( "sanity check", "bar", extractionFn.apply("foo") ); insertValues("foo", "baz", "2900-01-01 00:00:00"); startTime = System.currentTimeMillis(); <START> long pre = 0L; <END> synchronized (updateLock) { pre = updates.get(); } do { Thread.sleep(1); synchronized (updateLock) { Assert.assertTrue("Failed waiting for update", System.currentTimeMillis() - startTime < 10_000); } } while (updates.get() < pre + 2); extractionFn = fnCache.get(extractionNamespace.getNamespace()); Assert.assertEquals( "update check", "baz", extractionFn.apply("foo") ); Assert.assertTrue("Delete failed", extractionCacheManager.delete(namespace)); }</code><technical_language>this code similar above, create a function for explain does</technical_language>

Target:
public void testFindNew() throws NoSuchFieldException, IllegalAccessException, ExecutionException, InterruptedException { final JDBCExtractionNamespace extractionNamespace = ensureNamespace(); assertUpdated(extractionNamespace.getNamespace(), "foo", "bar"); insertValues("foo", "baz", "2900-01-01 00:00:00"); assertUpdated(extractionNamespace.getNamespace(), "foo", "baz"); }
Source:
<code>public Preview.PreviewSurfaceProvider getPreviewSurfaceProvider() { return (resolution, surfaceReleaseFuture) -> { mResolution = resolution; mSurfaceReleaseFuture = surfaceReleaseFuture; return CallbackToFutureAdapter.getFuture( (CallbackToFutureAdapter.Resolver<Surface>) completer -> { completer.addCancellationListener(() -> { <START> mSurfaceCompleter = null; mSurfaceReleaseFuture = null; <END> }, ContextCompat.getMainExecutor(mTextureView.getContext())); mSurfaceCompleter = completer; tryToProvidePreviewSurface(); return "provide preview surface"; }); }; }</code><technical_language>careful nulling out shared state based local state. mSurfaceCompleter reference a completer this cancellation listener added to. check local variable matches shared variable nulling out</technical_language>

Target:
public Preview.PreviewSurfaceProvider getPreviewSurfaceProvider() { return (resolution, surfaceReleaseFuture) -> { mResolution = resolution; mSurfaceReleaseFuture = surfaceReleaseFuture; return CallbackToFutureAdapter.getFuture( (CallbackToFutureAdapter.Resolver<Surface>) completer -> { completer.addCancellationListener(() -> { if (mSurfaceCompleter == completer) { mSurfaceCompleter = null; mSurfaceReleaseFuture = null; } }, ContextCompat.getMainExecutor(mTextureView.getContext())); mSurfaceCompleter = completer; tryToProvidePreviewSurface(); return "provide preview surface"; }); }; }
Source:
<code>private void processHandshakeRecord(final Record record, final Connection connection) { LOGGER.debug("Received record from peer [{}]", record.getType(), record.getPeerAddress()); try { if (record.isNewClientHello()) { <START> throw new IllegalArgumentException("new CLIENT_HELLO must be processed by processClientHello!"); <END> } HandshakeMessage handshakeMessage = (HandshakeMessage) record.getFragment(); switch (handshakeMessage.getMessageType()) { case CLIENT_HELLO: if (record.getEpoch() > 0) { DTLSSession session = connection.getEstablishedSession(); send(new AlertMessage(AlertLevel.WARNING, AlertDescription.NO_RENEGOTIATION, record.getPeerAddress()), session); } else { LOGGER.error("Unexpected CLIENT_HELLO {}", record.getPeerAddress(), new IllegalArgumentException("Unexpected CLIENT_HELLO")); } break; case HELLO_REQUEST: processHelloRequest(connection); break; default: Handshaker handshaker = connection.getOngoingHandshake(); if (handshaker != null) { handshaker.processMessage(record); } else { LOGGER.debug( "Discarding HANDSHAKE message [epoch={}] from peer [{}], no ongoing handshake!", record.getEpoch(), record.getPeerAddress()); } break; } } catch (HandshakeException e) { handleExceptionDuringHandshake(e, e.getAlert().getLevel(), e.getAlert().getDescription(), connection, record); } }</code><technical_language>remove of</technical_language>

Target:
private void processHandshakeRecord(final Record record, final Connection connection) { LOGGER.debug("Received record from peer [{}]", record.getType(), record.getPeerAddress()); try { if (record.isNewClientHello()) { throw new IllegalArgumentException("new CLIENT_HELLO must be processed by processClientHello!"); } HandshakeMessage handshakeMessage = (HandshakeMessage) record.getFragment(); switch (handshakeMessage.getMessageType()) { case CLIENT_HELLO: if (record.getEpoch() > 0) { DTLSSession session = connection.getEstablishedSession(); send(new AlertMessage(AlertLevel.WARNING, AlertDescription.NO_RENEGOTIATION, record.getPeerAddress()), session); } break; case HELLO_REQUEST: processHelloRequest(connection); break; default: Handshaker handshaker = connection.getOngoingHandshake(); if (handshaker != null) { handshaker.processMessage(record); } else { LOGGER.debug( "Discarding HANDSHAKE message [epoch={}] from peer [{}], no ongoing handshake!", record.getEpoch(), record.getPeerAddress()); } break; } } catch (HandshakeException e) { handleExceptionDuringHandshake(e, e.getAlert().getLevel(), e.getAlert().getDescription(), connection, record); } }
Source:
<code>private Workbook readEncryptedFile(String fileName) throws IOException, GeneralSecurityException { InputStream inp = new FileInputStream(fileName); POIFSFileSystem fs = new POIFSFileSystem(inp); EncryptionInfo info = new EncryptionInfo(fs); Decryptor decryptor = Decryptor.getInstance(info); if (!decryptor.verifyPassword(password)) { <START> throw new GeneralSecurityException("Error: Wrong password provided!"); <END> } InputStream dataStream = decryptor.getDataStream(fs); return WorkbookFactory.create(dataStream); }</code><technical_language>IMO plain Incorrect password</technical_language>

Target:
private Workbook readEncryptedFile(String fileName) throws IOException, GeneralSecurityException { InputStream inp = new FileInputStream(fileName); POIFSFileSystem fs = new POIFSFileSystem(inp); EncryptionInfo info = new EncryptionInfo(fs); Decryptor decryptor = Decryptor.getInstance(info); if (!decryptor.verifyPassword(password)) { throw new GeneralSecurityException("Error: Incorrect password!"); } InputStream dataStream = decryptor.getDataStream(fs); return WorkbookFactory.create(dataStream); }
Source:
<code>protected void scanDirectory() { if (System.currentTimeMillis() - scanIntervalMillis >= lastScanMillis) { <START> if (!visitedDirectory) { <END> visitDirectory(filePath); visitedDirectory = true; } Set<Path> newPaths = scanner.scan(fs, filePath, processedFiles); for (Path newPath : newPaths) { String newPathString = newPath.toString(); pendingFiles.add(newPathString); processedFiles.add(newPathString); localProcessedFileCount.increment(); } lastScanMillis = System.currentTimeMillis(); } }</code><technical_language>This care of empty child directory. e.g. a directory structure a | 1.txt, 2.txt, c dir "c" is empty need send a control tuple for "c" well</technical_language>

Target:
protected void scanDirectory() { if (System.currentTimeMillis() - scanIntervalMillis >= lastScanMillis) { Set<Path> newPaths = scanner.scan(fs, filePath, processedFiles); for (Path newPath : newPaths) { try { FileStatus fileStatus = fs.getFileStatus(newPath); if (fileStatus.isDirectory()) { checkVisitedDirectory(newPath); } else { String newPathString = newPath.toString(); pendingFiles.add(newPathString); processedFiles.add(newPathString); localProcessedFileCount.increment(); } } catch (IOException e) { throw new RuntimeException(e); } } lastScanMillis = System.currentTimeMillis(); } }
Source:
<code>protected List<Metacard> query(CatalogFacade framework, int startIndex, Filter filter) { QueryImpl query = new QueryImpl(filter); query.setRequestsTotalResultsCount(false); query.setPageSize(batchSize); query.setSortBy(new SortByImpl(Metacard.MODIFIED, SortOrder.DESCENDING)); QueryRequest queryRequest = new QueryRequestImpl(query); query.setStartIndex(startIndex); SourceResponse response = null; try { LOGGER.debug("Querying with startIndex: {}", startIndex); response = framework.query(queryRequest); } catch (UnsupportedQueryException e) { <START> console.printf("Received error from Framework: %s\n", e.getMessage()); <END> return null; } catch (SourceUnavailableException e) { console.printf("Received error from Frameworks: %s\n", e.getMessage()); return null; } catch (FederationException e) { console.printf("Received error from Frameworks: %s\n", e.getMessage()); return null; } if (response.getProcessingDetails() != null && !response.getProcessingDetails().isEmpty()) { for (SourceProcessingDetails details : response.getProcessingDetails()) { LOGGER.debug("Got Issues: {}", details.getWarnings()); } return null; } List<Metacard> metacards = new ArrayList<Metacard>(); for (Result result : response.getResults()) { metacards.add(result.getMetacard()); } return metacards; }</code><technical_language>statement printErrorMessage</technical_language>

Target:
protected List<Metacard> query(CatalogFacade framework, int startIndex, Filter filter) { QueryImpl query = new QueryImpl(filter); query.setRequestsTotalResultsCount(false); query.setPageSize(batchSize); query.setSortBy(new SortByImpl(Metacard.MODIFIED, SortOrder.DESCENDING)); QueryRequest queryRequest = new QueryRequestImpl(query); query.setStartIndex(startIndex); SourceResponse response = null; try { LOGGER.debug("Querying with startIndex: {}", startIndex); response = framework.query(queryRequest); } catch (UnsupportedQueryException e) { printErrorMessage(String.format("Received error from Framework: %s\n", e.getMessage())); return null; } catch (SourceUnavailableException e) { printErrorMessage(String.format("Received error from Frameworks: %s\n", e.getMessage())); return null; } catch (FederationException e) { printErrorMessage(String.format("Received error from Frameworks: %s\n", e.getMessage())); return null; } if (response.getProcessingDetails() != null && !response.getProcessingDetails().isEmpty()) { for (SourceProcessingDetails details : response.getProcessingDetails()) { LOGGER.debug("Got Issues: {}", details.getWarnings()); } return null; } List<Metacard> metacards = new ArrayList<Metacard>(); for (Result result : response.getResults()) { metacards.add(result.getMetacard()); } return metacards; }
Source:
<code>public void synchronizeGroups() { Perun perun = ldapcManager.getPerunBl(); try { log.debug("Group synchronization - getting list of VOs"); List<Vo> vos = perun.getVosManager().getVos(ldapcManager.getPerunSession()); for(Vo vo : vos) { try { log.debug("Getting list of groups for VO {}", vo); List<Group> groups = perun.getGroupsManager().getAllGroups(ldapcManager.getPerunSession(), vo); for(Group group : groups) { try { log.debug("Synchronizing group {}", group); perunGroup.synchronizeEntry(group); log.debug("Getting list of members for group {}", group.getId()); <START> List<Member> members = perun.getGroupsManager().getActiveGroupMembers(ldapcManager.getPerunSession(), group); <END> log.debug("Synchronizing members of group {}", members.size(), group.getId()); perunGroup.synchronizeMembers(group, members); log.debug("Getting list of resources assigned to group {}", group.getId()); List<Resource> resources = perun.getResourcesManager().getAssignedResources(ldapcManager.getPerunSession(), group); log.debug("Synchronizing resources assigned to group {}", resources.size(), group.getId()); perunGroup.synchronizeResources(group, resources); } catch (PerunException e) { log.error("Error synchronizing group", e); } } } catch (PerunException e) { log.error("Error synchronizing groups", e); } } } catch (InternalErrorException | PrivilegeException e) { log.error("Error reading list of VOs", e); } }</code><technical_language>In LDAP "Status.VALID" filtering. need too</technical_language>

Target:
public void synchronizeGroups() { Perun perun = ldapcManager.getPerunBl(); try { log.debug("Group synchronization - getting list of VOs"); List<Vo> vos = perun.getVosManager().getVos(ldapcManager.getPerunSession()); for(Vo vo : vos) { try { log.debug("Getting list of groups for VO {}", vo); List<Group> groups = perun.getGroupsManager().getAllGroups(ldapcManager.getPerunSession(), vo); for(Group group : groups) { try { log.debug("Synchronizing group {}", group); perunGroup.synchronizeEntry(group); log.debug("Getting list of members for group {}", group.getId()); List<Member> members = ((PerunBl)perun).getGroupsManagerBl().getActiveGroupMembers(ldapcManager.getPerunSession(), group, Status.VALID); log.debug("Synchronizing members of group {}", members.size(), group.getId()); perunGroup.synchronizeMembers(group, members); log.debug("Getting list of resources assigned to group {}", group.getId()); List<Resource> resources = perun.getResourcesManager().getAssignedResources(ldapcManager.getPerunSession(), group); log.debug("Synchronizing resources assigned to group {}", resources.size(), group.getId()); perunGroup.synchronizeResources(group, resources); } catch (PerunException e) { log.error("Error synchronizing group", e); } } } catch (PerunException e) { log.error("Error synchronizing groups", e); } } } catch (InternalErrorException | PrivilegeException e) { log.error("Error reading list of VOs", e); } }
Source:
<code>public LoadData<InputStream> buildLoadData(@NonNull CloudinaryRequest model, int width, int height, @NonNull Options options) { Url url = MediaManager.get().url().publicId(model.getPublicId()); Transformation transformation = model.getTransformation(); if (transformation == null) { transformation = options.get(TRANSFORMATION); } if (transformation != null) { url.transformation(transformation); } ResponsiveUrl.Preset responsive = model.getResponsive(); if (responsive == null) { responsive = options.get(RESPONSIVE); } if (responsive != null) { <START> url = MediaManager.get().responsiveUrl(responsive).buildUrl(url, width, height); <END> } return urlLoader.buildLoadData(new GlideUrl(url.generate()), width, height, options); }</code><technical_language>a ResponsiveUrl call buildUrl (no need MediaManager</technical_language>

Target:
public LoadData<InputStream> buildLoadData(@NonNull CloudinaryRequest model, int width, int height, @NonNull Options options) { Url url = MediaManager.get().url().publicId(model.getPublicId()); Transformation transformation = model.getTransformation(); if (transformation == null) { transformation = options.get(TRANSFORMATION); } if (transformation != null) { url.transformation(transformation); } ResponsiveUrl responsive = model.getResponsive(); if (responsive == null) { responsive = options.get(RESPONSIVE); } if (responsive != null) { url = responsive.buildUrl(url, width, height); } return urlLoader.buildLoadData(new GlideUrl(url.generate()), width, height, options); }
Source:
<code>private Map<String, Map<String, HiveColumnStatistics>> getPartitionColumnStatistics(String databaseName, String tableName, Set<String> partitionNames, List<String> columnNames) { <START> try { <END> return retry() .stopOn(NoSuchObjectException.class, HiveViewNotSupportedException.class) .stopOnIllegalExceptions() .run("getPartitionColumnStatistics", stats.getGetPartitionColumnStatistics().wrap(() -> { try (HiveMetastoreClient client = clientProvider.createMetastoreClient()) { Map<String, List<ColumnStatisticsObj>> partitionColumnStatistics = client.getPartitionColumnStatistics(databaseName, tableName, ImmutableList.copyOf(partitionNames), columnNames); return partitionColumnStatistics.entrySet() .stream() .filter(entry -> !entry.getValue().isEmpty()) .collect(toImmutableMap(Map.Entry::getKey, entry -> groupStatisticsByColumn(entry.getValue()))); } })); } catch (NoSuchObjectException e) { return ImmutableMap.of(); } catch (TException e) { throw new PrestoException(HIVE_METASTORE_ERROR, e); } catch (Exception e) { throw propagate(e); } }</code><technical_language>java Map<String, HiveColumnStatistics> columnStatistics = partitionColumnStatistics.getOrDefault(partitionName, ImmutableMap.of());</technical_language>

Target:
private Map<String, Map<String, HiveColumnStatistics>> getPartitionColumnStatistics(String databaseName, String tableName, Set<String> partitionNames, List<String> columnNames) { try { return retry() .stopOn(NoSuchObjectException.class, HiveViewNotSupportedException.class) .stopOnIllegalExceptions() .run("getPartitionColumnStatistics", stats.getGetPartitionColumnStatistics().wrap(() -> { try (HiveMetastoreClient client = clientProvider.createMetastoreClient()) { Map<String, List<ColumnStatisticsObj>> partitionColumnStatistics = client.getPartitionColumnStatistics(databaseName, tableName, ImmutableList.copyOf(partitionNames), columnNames); return partitionColumnStatistics.entrySet() .stream() .filter(entry -> !entry.getValue().isEmpty()) .collect(toImmutableMap(Map.Entry::getKey, entry -> groupStatisticsByColumn(entry.getValue()))); } })); } catch (NoSuchObjectException e) { throw new TableNotFoundException(new SchemaTableName(databaseName, tableName)); } catch (TException e) { throw new PrestoException(HIVE_METASTORE_ERROR, e); } catch (Exception e) { throw propagate(e); } }
Source:
<code><START> public static ArrayList<String> splitParams(String parameterString) { <END> ArrayList<String> params = new ArrayList<>(); Matcher m = WHITESPACE_IF_NOT_QUOTED.matcher(parameterString); while (m.find()) { if (m.group(1) != null) { params.add(m.group(1)); } else { params.add(m.group(2)); } } return params; }</code><technical_language>This return a List, Collection Iterable. return a concrete type this</technical_language>

Target:
public static List<String> splitParams(String parameterString) { ArrayList<String> params = new ArrayList<>(); Matcher m = WHITESPACE_IF_NOT_QUOTED.matcher(parameterString); while (m.find()) { if (m.group(1) != null) { params.add(m.group(1)); } else { params.add(m.group(2)); } } return params; }
Source:
<code><START> public void visit(NodeTraversal t, Node n, Node parent) { <END> if (!n.isFunction() || parent == null) { return; } Node call; if (parent.isCall() && parent.getFirstChild() == n) { call = parent; } else if (parent.isGetProp() && parent.getFirstChild() == n && n.getNext() != null && n.getNext().isString() && n.getNext().getString().equals("call") && parent.getParent() != null && parent.getParent().isCall() && parent.getParent().getFirstChild() == parent) { call = parent.getParent(); } else { return; } Node funcParams = n.getSecondChild(); if (!funcParams.hasChildren() || NodeUtil.isVarArgsFunction(n)) { return; } Node param = funcParams.getFirstChild(); List<Node> newVars = new ArrayList<>(); while (param != null) { newVars.add(IR.var(param.cloneNode(), getCallArgument(param, call)) .useSourceInfoFromForTree(param)); param = param.getNext(); } funcParams.removeChildren(); for (int i = newVars.size() - 1; i >= 0; i--) { funcParams.getNext().addChildToFront(newVars.get(i)); } Node removeRef; if (call.getBooleanProp(Node.FREE_CALL)) { removeRef = call.getFirstChild(); } else { removeRef = call.getSecondChild(); } while (removeRef.getNext() != null) { call.removeChildAfter(removeRef); } compiler.reportCodeChange(); }</code><technical_language>This check IIFE is expr-result. matter, do want do this optimization for iifes</technical_language>

Target:
public void visit(NodeTraversal t, Node n, Node parent) { if (!n.isFunction() || parent == null) { return; } Node call; Node grandparent = parent.getParent(); if (parent.isCall() && parent.getFirstChild() == n) { call = parent; } else if (parent.isGetProp() && parent.getFirstChild() == n && n.getNext() != null && n.getNext().isString() && n.getNext().getString().equals("call") && grandparent != null && grandparent.isCall() && grandparent.getFirstChild() == parent) { call = grandparent; } else { return; } Node funcParams = NodeUtil.getFunctionParameters(n); if (!funcParams.hasChildren() || NodeUtil.isVarArgsFunction(n)) { return; } Node param = funcParams.getFirstChild(); List<Node> newVars = new ArrayList<>(); while (param != null) { newVars.add(IR.var(param.cloneNode(), getCallArgument(param, call)) .useSourceInfoFromForTree(param)); param = param.getNext(); } funcParams.removeChildren(); for (int i = newVars.size() - 1; i >= 0; i--) { funcParams.getNext().addChildToFront(newVars.get(i)); } Node removeRef; if (call.getBooleanProp(Node.FREE_CALL)) { removeRef = call.getFirstChild(); } else { removeRef = call.getSecondChild(); } while (removeRef.getNext() != null) { call.removeChildAfter(removeRef); } compiler.reportCodeChange(); }
Source:
<code>public SpongeExecutorService get() { <START> return this.schedulerService.createSyncExecutor(this.container.getInstance()); <END> }</code><technical_language>need for getInstance(), container passed</technical_language>

Target:
public SpongeExecutorService get() { return this.schedulerService.createSyncExecutor(this.container); }
Source:
<code>private void setupBackgroundImageControls(SharedPreferences prefs) { if (!Utility.isLowRamDevice(mContext)) { showPreference("preference_category_background"); } String selection = prefs.getString("backgroundMode", "1"); showPreference("chooseBackgroundImage", selection.equals("3")); showPreference("slideshowStyle", selection.equals("4")); boolean on = selection.equals("4"); showPreference("backgroundImageDuration", on); showPreference("zoominBackgroundImage", on); showPreference("fadeinBackgroundImage", on); showPreference("moveinBackgroundImage", on); on = selection.equals("3") || selection.equals(("4")); showPreference("hideBackgroundImage", on); <START> showPreference("autoAccentColor", on); <END> if (settings.background_movein && selection.equals("4")) showPreference("backgroundMovein", true); else showPreference("backgroundMovein", false); boolean isPurchasedWeather = isPurchased(BillingHelperActivity.ITEM_WEATHER_DATA); showPreference("purchaseDesignPackageBackground", selection.equals("4") && !isPurchasedWeather); }</code><technical_language>Please stop adding new features this PR. is large get ready quickly. New features slow entire process</technical_language>

Target:
private void setupBackgroundImageControls(SharedPreferences prefs) { if (!Utility.isLowRamDevice(mContext)) { showPreference("preference_category_background"); } String selection = prefs.getString("backgroundMode", "1"); showPreference("chooseBackgroundImage", selection.equals("3")); boolean on = selection.equals("4"); showPreference("backgroundImageDuration", on); showPreference("backgroundImageZoomIn", on); showPreference("backgroundImageFadeIn", on); showPreference("backgroundImageMoveIn", on); showPreference("backgroundMovein", on); on = selection.equals("3") || selection.equals(("4")); showPreference("slideshowStyle", on); showPreference("hideBackgroundImage", on); showPreference("autoAccentColor", on); boolean isPurchasedWeather = isPurchased(BillingHelperActivity.ITEM_WEATHER_DATA); showPreference("purchaseDesignPackageBackground", selection.equals("4") && !isPurchasedWeather); }
Source:
<code>public double simpleGeometry(BenchmarkData data) { <START> return GeoFunctions.stXMin(data.simpleGeometry); <END> }</code><technical_language>static import stXMin</technical_language>

Target:
public double simpleGeometry(BenchmarkData data) { return stXMin(data.simpleGeometry); }
Source:
<code>protected Map<QuestionGroupDto, List<QuestionDto>> loadAllQuestions( String surveyId, boolean performRollups, String serverBase, String apiKey) throws Exception { Map<QuestionGroupDto, List<QuestionDto>> questionMap = new HashMap<QuestionGroupDto, List<QuestionDto>>(); orderedGroupList = fetchQuestionGroups(serverBase, surveyId, apiKey); rollupOrder = new ArrayList<QuestionDto>(); <START> for (QuestionGroupDto group : orderedGroupList) { <END> List<QuestionDto> questions = fetchQuestions(serverBase, group.getKeyId(), apiKey); if (performRollups && questions != null) { for (QuestionDto q : questions) { for (int i = 0; i < ROLLUP_QUESTIONS.length; i++) { if (ROLLUP_QUESTIONS[i].equalsIgnoreCase(q.getText())) { rollupOrder.add(q); } } } } questionMap.put(group, questions); } return questionMap; }</code><technical_language>need question order, fetch questions in do local processing reorder based question group</technical_language>

Target:
protected Map<QuestionGroupDto, List<QuestionDto>> loadAllQuestions( String surveyId, boolean performRollups, String serverBase, String apiKey) throws Exception { Map<QuestionGroupDto, List<QuestionDto>> questionMap = new HashMap<>(); orderedGroupList = fetchQuestionGroups(serverBase, surveyId, apiKey); List<QuestionDto> allQuestions = fetchQuestionsOfSurvey(serverBase, surveyId, apiKey); Map<Long, List<QuestionDto>> idMap = new HashMap<>(); for (QuestionGroupDto group : orderedGroupList) { List<QuestionDto> questions = new ArrayList<>(); idMap.put(group.getKeyId(), questions); } for (QuestionDto q:allQuestions) { List<QuestionDto> myList = idMap.get(q.getQuestionGroupId()); myList.add(q); } rollupOrder = new ArrayList<QuestionDto>(); for (QuestionGroupDto group : orderedGroupList) { List<QuestionDto> questions = idMap.get(group.getKeyId()); Collections.sort(questions, new Comparator<QuestionDto>() { @Override public int compare(QuestionDto o1, QuestionDto o2) { int v1 = o1.getOrder() != null ? o1.getOrder() : 0; int v2 = o2.getOrder() != null ? o2.getOrder() : 0; return v1-v2; } }); if (performRollups && questions != null) { for (QuestionDto q : questions) { for (int i = 0; i < ROLLUP_QUESTIONS.length; i++) { if (ROLLUP_QUESTIONS[i].equalsIgnoreCase(q.getText())) { rollupOrder.add(q); } } } } questionMap.put(group, questions); } return questionMap; }
Source:
<code>private void swapHighFrequencyTriggersData() { <START> synchronized (lock) { <END> if (System.currentTimeMillis() - highFrequencyTriggersTS.get() > highFrequencyDataRecycleMS) { highFrequencyMetrics.set(new HashMap<>()); highFrequencyTriggersTS.set(System.currentTimeMillis()); } } }</code><technical_language>Ha I do lock. need a lock synchronize entire method methods provide atomicity for multiple operations for example compareAndSet ..</technical_language>

Target:
private synchronized void swapHighFrequencyTriggersData() { if (System.currentTimeMillis() - highFrequencyTriggersTS.get() > highFrequencyDataRecycleMS) { highFrequencyMetrics.set(new HashMap<>()); highFrequencyTriggersTS.set(System.currentTimeMillis()); } }
Source:
<code>private static DistributionType determineDistributionType(JoinNode node, Context context) { JoinNode.Type type = node.getType(); if (type == RIGHT || type == FULL) { return PARTITIONED; } if (node.getCriteria().isEmpty() && type == INNER) { return REPLICATED; } <START> if (isAtMostScalar(node.getRight(), context.getLookup())) { <END> return REPLICATED; } if (isDistributedJoinEnabled(context.getSession())) { return PARTITIONED; } return REPLICATED; }</code><technical_language>I conditions returns REPLICATED tested PARTITIONED</technical_language>

Target:
private static DistributionType determineDistributionType(JoinNode node, Context context) { JoinNode.Type type = node.getType(); if (type == RIGHT || type == FULL) { return PARTITIONED; } if (node.getCriteria().isEmpty() && (type == INNER || type == LEFT)) { return REPLICATED; } if (isAtMostScalar(node.getRight(), context.getLookup())) { return REPLICATED; } if (isDistributedJoinEnabled(context.getSession())) { return PARTITIONED; } return REPLICATED; }
Source:
<code>static void connectionWithQueryOptions(String projectId, String instanceId, String databaseId) throws SQLException { <START> String optimizerVersion = "LATEST"; <END> String connectionUrl = String.format( "jdbc:cloudspanner:/projects/%s/instances/%s/databases/%s?optimizerVersion=%s", projectId, instanceId, databaseId, optimizerVersion); try (Connection connection = DriverManager.getConnection(connectionUrl)) { try (Statement statement = connection.createStatement()) { try (ResultSet rs = statement.executeQuery( "SELECT SingerId, FirstName, LastName FROM Singers ORDER BY LastName")) { while (rs.next()) { System.out.printf("%d %s %s\n", rs.getLong(1), rs.getString(2), rs.getString(3)); } } try (ResultSet rs = statement.executeQuery("SHOW VARIABLE OPTIMIZER_VERSION")) { while (rs.next()) { System.out.printf("Optimizer version: %s\n", rs.getString(1)); } } } } }</code><technical_language>suggestion String optimizerVersion = "1";</technical_language>

Target:
static void connectionWithQueryOptions(String projectId, String instanceId, String databaseId) throws SQLException { String optimizerVersion = "1"; String connectionUrl = String.format( "jdbc:cloudspanner:/projects/%s/instances/%s/databases/%s?optimizerVersion=%s", projectId, instanceId, databaseId, optimizerVersion); try (Connection connection = DriverManager.getConnection(connectionUrl)) { try (Statement statement = connection.createStatement()) { try (ResultSet rs = statement.executeQuery( "SELECT SingerId, FirstName, LastName FROM Singers ORDER BY LastName")) { while (rs.next()) { System.out.printf("%d %s %s\n", rs.getLong(1), rs.getString(2), rs.getString(3)); } } try (ResultSet rs = statement.executeQuery("SHOW VARIABLE OPTIMIZER_VERSION")) { while (rs.next()) { System.out.printf("Optimizer version: %s\n", rs.getString(1)); } } } } }
Source:
<code>public void updated(Map<String, Object> properties) { cancelPollTask(); this.options = new WatchdogServiceOptions(properties); <START> if (this.options.isEnabled()) { <END> try (PrintWriter wdWriter = new PrintWriter(this.options.getWatchdogDevice());) { wdWriter.write(this.options.getWatchdogDevice()); } catch (IOException e) { logger.error("Unable to write watchdog config file", e); } logger.debug("activating WatchdogService with watchdog enabled"); } else { logger.debug("activating WatchdogService with watchdog disabled"); } this.rebootCauseWriter = new RebootCauseFileWriter(this.options.getRebootCauseFilePath()); if (!this.options.isEnabled()) { disableWatchdog(); } else { this.pollTask = this.pollExecutor.scheduleAtFixedRate(() -> { Thread.currentThread().setName("WatchdogServiceImpl"); checkCriticalComponents(); }, 0, this.options.getPingInterval(), TimeUnit.MILLISECONDS); } }</code><technical_language>this merged line 85</technical_language>

Target:
public void updated(Map<String, Object> properties) { cancelPollTask(); this.options = new WatchdogServiceOptions(properties); if (this.options.isEnabled()) { this.rebootCauseWriter = new RebootCauseFileWriter(this.options.getRebootCauseFilePath()); try (PrintWriter wdWriter = new PrintWriter(this.options.getWatchdogDevice());) { wdWriter.write(this.options.getWatchdogDevice()); } catch (IOException e) { logger.error("Unable to write watchdog config file", e); } this.pollTask = this.pollExecutor.scheduleAtFixedRate(() -> { Thread.currentThread().setName("WatchdogServiceImpl"); checkCriticalComponents(); }, 0, this.options.getPingInterval(), TimeUnit.MILLISECONDS); } else { disableWatchdog(); } }
Source:
<code>public Document toXml() throws IOException, SAXException { Document setDocument = Xml.newDocument(); <START> Element rootElement = setDocument.createElementNS("urn:oasis:names:tc:xacml:3.0:core:schema:wd-17", "PolicySet"); <END> setDocument.appendChild(rootElement); for (Policy p: policies) { Document policyDocument = Xml.toXml(p.getPolicy()); Element policyElement = policyDocument.getDocumentElement(); rootElement.appendChild(setDocument.importNode(policyElement, true)); } return setDocument; }</code><technical_language>I tested it, I more attributes (PolicySetId) children nodes (Target) in a PolicySet, some of mandatory. a <LINK_0> please check conformance XSD</technical_language>

Target:
public Document toXml() throws IOException, SAXException { Document setDocument = Xml.newDocument(); Element rootElement = setDocument.createElementNS(NAMESPACE, "PolicySet"); setDocument.appendChild(rootElement); rootElement.setAttributeNS(NAMESPACE, "PolicySetId", id); rootElement.setAttributeNS(NAMESPACE, "Version", VERSION); rootElement.setAttributeNS(NAMESPACE, "PolicySetId", COMBINING_POLICY); for (Policy p: policies) { Document policyDocument = Xml.toXml(p.getPolicy()); Element policyElement = policyDocument.getDocumentElement(); rootElement.appendChild(setDocument.importNode(policyElement, true)); } return setDocument; }
Source:
<code>public String getColumnText(Object element, int columnIndex) { RepositoryTreeNode node = (RepositoryTreeNode) element; switch (node.getType()) { case REPO: File directory = ((Repository) node.getObject()).getDirectory() .getParentFile(); return (directory.getName() + " - " + directory .getAbsolutePath()); case BRANCHES: return "Branches"; case PROJECTS: return "Existing Projects"; case REF: Ref ref = (Ref) node.getObject(); String refName = ref.getName(); if (ref.isSymbolic()) { <START> refName = refName + " - " + ref.getLeaf().getName(); <END> } try { String fullBranch = node.getRepository().getFullBranch(); if (refName.equals(fullBranch)) { return "* " + refName; } } catch (IOException e1) { e1.printStackTrace(); } return refName; case PROJ: File file = (File) node.getObject(); for (IProject proj : ResourcesPlugin.getWorkspace().getRoot() .getProjects()) { if (proj.getLocation().equals( new Path(file.getAbsolutePath()))) { return ("* " + file.getName()); } } return file.getName(); default: return null; } }</code><technical_language>Repository.shortenRefName shorten leaf's name? Showing refs/heads/ a user is ugly</technical_language>

Target:
public String getColumnText(Object element, int columnIndex) { RepositoryTreeNode node = (RepositoryTreeNode) element; switch (node.getType()) { case REPO: File directory = ((Repository) node.getObject()).getDirectory() .getParentFile(); return (directory.getName() + " - " + directory .getAbsolutePath()); case BRANCHES: return RepositoryViewUITexts.RepositoriesView_Branches_Nodetext; case PROJECTS: return RepositoryViewUITexts.RepositoriesView_ExistingProjects_Nodetext; case REF: Ref ref = (Ref) node.getObject(); String refName = node.getRepository().shortenRefName( ref.getName()); if (ref.isSymbolic()) { refName = refName + " - " + node.getRepository().shortenRefName( ref.getLeaf().getName()); } return refName; case PROJ: File file = (File) node.getObject(); return file.getName(); default: return null; } }