auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testSendAndReceive() throws Exception { Binder binder = getBinder(); BindingProperties outputBindingProperties = createProducerBindingProperties(createProducerProperties()); DirectChannel moduleOutputChannel = createBindableChannel("output", outputBindingProperties); QueueChannel moduleInputChannel = new QueueChannel(); Binding<MessageChannel> producerBinding = binder.bindProducer("foo.0", moduleOutputChannel, outputBindingProperties.getProducer()); Binding<MessageChannel> consumerBinding = binder.bindConsumer("foo.0", "test", moduleInputChannel, createConsumerProperties()); Message<?> message = MessageBuilder.withPayload("foo").setHeader(MessageHeaders.CONTENT_TYPE, "foo/bar") .build(); binderBindUnbindLatency(); moduleOutputChannel.send(message); <START> Message<?> inbound = receive(moduleInputChannel, 5); <END> assertThat(inbound).isNotNull(); assertThat(inbound.getPayload()).isEqualTo("foo"); assertThat(inbound.getHeaders().get(BinderHeaders.BINDER_ORIGINAL_CONTENT_TYPE)).isNull(); assertThat(inbound.getHeaders().get(MessageHeaders.CONTENT_TYPE)).isEqualTo("foo/bar"); producerBinding.unbind(); consumerBinding.unbind(); }</code><technical_language>need increase timeouts test</technical_language>

Target:
public void testSendAndReceive() throws Exception { Binder binder = getBinder(); BindingProperties outputBindingProperties = createProducerBindingProperties(createProducerProperties()); DirectChannel moduleOutputChannel = createBindableChannel("output", outputBindingProperties); QueueChannel moduleInputChannel = new QueueChannel(); Binding<MessageChannel> producerBinding = binder.bindProducer("foo.0", moduleOutputChannel, outputBindingProperties.getProducer()); Binding<MessageChannel> consumerBinding = binder.bindConsumer("foo.0", "test", moduleInputChannel, createConsumerProperties()); Message<?> message = MessageBuilder.withPayload("foo").setHeader(MessageHeaders.CONTENT_TYPE, "foo/bar") .build(); binderBindUnbindLatency(); moduleOutputChannel.send(message); Message<?> inbound = receive(moduleInputChannel); assertThat(inbound).isNotNull(); assertThat(inbound.getPayload()).isEqualTo("foo"); assertThat(inbound.getHeaders().get(BinderHeaders.BINDER_ORIGINAL_CONTENT_TYPE)).isNull(); assertThat(inbound.getHeaders().get(MessageHeaders.CONTENT_TYPE)).isEqualTo("foo/bar"); producerBinding.unbind(); consumerBinding.unbind(); }
Source:
<code>public void doGet( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException { if ( isJettyMode() && !request.getContextPath().startsWith( CONTEXT_PATH ) ) { return; } if ( log.isDebug() ) { logDebug( BaseMessages.getString( PKG, "GetJobImageServlet.Log.JobImageRequested" ) ); } String jobName = request.getParameter( "name" ); String id = request.getParameter( "id" ); boolean useXML = "Y".equalsIgnoreCase( request.getParameter( "xml" ) ); Job job; <START> CarteObjectEntry entry = null; <END> if ( Utils.isEmpty( id ) ) { try { entry = getJobMap().getUniqueCarteObjectEntry( jobName ); } catch ( DuplicateKeyException e ) { buildDuplicateResponse( response, jobName, useXML ); } if ( entry == null ) { job = null; } else { id = entry.getId(); job = getJobMap().getJob( entry ); } } else { entry = new CarteObjectEntry( jobName, id ); job = getJobMap().getJob( entry ); } try { if ( job != null ) { response.setStatus( HttpServletResponse.SC_OK ); response.setCharacterEncoding( "UTF-8" ); response.setContentType( "image/png" ); BufferedImage image = generateJobImage( job.getJobMeta() ); ByteArrayOutputStream os = new ByteArrayOutputStream(); try { ImageIO.write( image, "png", os ); } finally { os.flush(); } response.setContentLength( os.size() ); OutputStream out = response.getOutputStream(); out.write( os.toByteArray() ); } } catch ( Exception e ) { e.printStackTrace(); } }</code><technical_language>This is necessary, object initialized null</technical_language>

Target:
public void doGet( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException { if ( isJettyMode() && !request.getContextPath().startsWith( CONTEXT_PATH ) ) { return; } if ( log.isDebug() ) { logDebug( BaseMessages.getString( PKG, "GetJobImageServlet.Log.JobImageRequested" ) ); } String jobName = request.getParameter( "name" ); String id = request.getParameter( "id" ); boolean useXML = "Y".equalsIgnoreCase( request.getParameter( "xml" ) ); Job job; CarteObjectEntry entry; if ( Utils.isEmpty( id ) ) { try { entry = getJobMap().getUniqueCarteObjectEntry( jobName ); } catch ( DuplicateKeyException e ) { buildDuplicateResponse( response, jobName, useXML ); return; } if ( entry == null ) { job = null; } else { id = entry.getId(); job = getJobMap().getJob( entry ); } } else { entry = new CarteObjectEntry( jobName, id ); job = getJobMap().getJob( entry ); } try { if ( job != null ) { buildOkResponse( response, job ); } else { buildNotFoundResponse( response, jobName, id, useXML ); } } catch ( Exception e ) { e.printStackTrace(); } }
Source:
<code>private KafkaLog4jAppender createKafkaAppender() { KafkaLog4jAppender kafkaProducer = new KafkaLog4jAppender(); Props azkProps = AzkabanExecutorServer.getApp().getAzkabanProps(); kafkaProducer.setSyncSend(false); <START> kafkaProducer.setBrokerList(azkProps.getString("kafkaLogging.brokerList")); <END> kafkaProducer.setTopic(azkProps.getString("kafkaLogging.topic")); JSONObject layout = new JSONObject(); layout.put("category", "%c{1}"); layout.put("level", "%p"); layout.put("message", "%m"); layout.put("projectname", props.getString("azkaban.flow.projectname")); layout.put("flowid", props.getString("azkaban.flow.flowid")); layout.put("submituser", props.getString("azkaban.flow.submituser")); layout.put("execid", props.getString("azkaban.flow.execid")); layout.put("projectversion", props.getString("azkaban.flow.projectversion")); layout.put("logsource", "userJob"); kafkaProducer.setLayout(new EnhancedPatternLayout(layout.toString())); kafkaProducer.activateOptions(); flowLogger.info("Created kafka appender for " + this.jobId); return kafkaProducer; }</code><technical_language>constants for config names follow a consistent naming convention suggested above</technical_language>

Target:
private KafkaLog4jAppender createKafkaAppender() throws UndefinedPropertyException { KafkaLog4jAppender kafkaProducer = new KafkaLog4jAppender(); kafkaProducer.setSyncSend(false); kafkaProducer.setBrokerList(azkabanProps.getString(ServerProperties.AZKABAN_SERVER_LOGGING_KAFKA_BROKERLIST)); kafkaProducer.setTopic(azkabanProps.getString(ServerProperties.AZKABAN_SERVER_LOGGING_KAFKA_TOPIC)); JSONObject layout = new JSONObject(); layout.put("category", "%c{1}"); layout.put("level", "%p"); layout.put("message", "%m"); layout.put("projectname", props.getString(FlowProperties.AZKABAN_FLOW_PROJECT_NAME)); layout.put("flowid", props.getString(FlowProperties.AZKABAN_FLOW_FLOW_ID)); layout.put("submituser", props.getString(FlowProperties.AZKABAN_FLOW_SUBMIT_USER)); layout.put("execid", props.getString(FlowProperties.AZKABAN_FLOW_EXEC_ID)); layout.put("projectversion", props.getString(FlowProperties.AZKABAN_FLOW_PROJECT_VERSION)); layout.put("logsource", "userJob"); kafkaProducer.setLayout(new EnhancedPatternLayout(layout.toString())); kafkaProducer.activateOptions(); flowLogger.info("Created kafka appender for " + this.jobId); return kafkaProducer; }
Source:
<code>public Collection getCollectionById(@ApiParam(hidden = true) @Auth Optional<User> user, @ApiParam(value = "Organisation ID.", required = true) @PathParam("organisationId") Long organisationId, @ApiParam(value = "Collection ID.", required = true) @PathParam("collectionId") Long collectionId) { if (!user.isPresent()) { Collection collection = collectionDAO.findById(collectionId); if (collection == null) { String msg = "Collection not found."; LOG.info(msg); <START> throw new CustomWebApplicationException(msg, HttpStatus.SC_BAD_REQUEST); <END> } Organisation organisation = organisationDAO.findApprovedById(collection.getOrganisation().getId()); if (organisation == null) { String msg = "Collection not found."; LOG.info(msg); throw new CustomWebApplicationException(msg, HttpStatus.SC_BAD_REQUEST); } return collection; } else { boolean doesCollectionExist = doesCollectionExistToUser(collectionId, user.get().getId()) || user.get().getIsAdmin() || user.get().isCurator(); if (!doesCollectionExist) { String msg = "Collection not found."; LOG.info(msg); throw new CustomWebApplicationException(msg, HttpStatus.SC_BAD_REQUEST); } Collection collection = collectionDAO.findById(collectionId); return collection; } }</code><technical_language>404 more sense</technical_language>

Target:
public Collection getCollectionById(@ApiParam(hidden = true) @Auth Optional<User> user, @ApiParam(value = "Organisation ID.", required = true) @PathParam("organisationId") Long organisationId, @ApiParam(value = "Collection ID.", required = true) @PathParam("collectionId") Long collectionId) { if (!user.isPresent()) { Collection collection = collectionDAO.findById(collectionId); if (collection == null) { String msg = "Collection not found."; LOG.info(msg); throw new CustomWebApplicationException(msg, HttpStatus.SC_NOT_FOUND); } Organisation organisation = organisationDAO.findApprovedById(collection.getOrganisation().getId()); if (organisation == null) { String msg = "Collection not found."; LOG.info(msg); throw new CustomWebApplicationException(msg, HttpStatus.SC_NOT_FOUND); } return collection; } else { boolean doesCollectionExist = doesCollectionExistToUser(collectionId, user.get().getId()) || user.get().getIsAdmin() || user.get().isCurator(); if (!doesCollectionExist) { String msg = "Collection not found."; LOG.info(msg); throw new CustomWebApplicationException(msg, HttpStatus.SC_NOT_FOUND); } Collection collection = collectionDAO.findById(collectionId); return collection; } }
Source:
<code>public void executeCommand() { super.executeImportVm(!isUnregisteredVM()); <START> if (isUnregisteredVM()) { <END> getUnregisteredOVFDataDao().removeEntity(ovfEntityData.getVmId(), ovfEntityData.getStorageDomainId()); } else if (!vmDisksToAttach.isEmpty()) { AuditLogDirector.log(this, attemptToAttachDisksToImportedVm(vmDisksToAttach)); } setActionReturnValue(getVm().getId()); }</code><technical_language>check getSucceeded()</technical_language>

Target:
public void executeCommand() { super.executeImportVm(!isUnregisteredVM()); if (getSucceeded()) { if (isUnregisteredVM()) { getUnregisteredOVFDataDao().removeEntity(ovfEntityData.getVmId(), ovfEntityData.getStorageDomainId()); } else if (!vmDisksToAttach.isEmpty()) { AuditLogDirector.log(this, attemptToAttachDisksToImportedVm(vmDisksToAttach)); } } setActionReturnValue(getVm().getId()); }
Source:
<code>public Blob findOrCreateByPath(String tenantId, String path) { <START> String sanitizedPath = utils.sanitizePath(path); <END> if (Strings.isEmpty(sanitizedPath)) { throw new IllegalArgumentException("An empty path was provided!"); } String key = determinePathCacheKey(tenantId, sanitizedPath); Blob blob = blobByPathCache.get(key); if (blob == null) { blobByPathCache.remove(key); blob = fetchOrCreateByPath(tenantId, sanitizedPath); } return blob; }</code><technical_language>I this call added Blob::updateContent overwrite a sanitized path unsanitized accident updating content of a blob passing a file name</technical_language>

Target:
public Blob findOrCreateByPath(String tenantId, String path) { String sanitizedPath = utils.sanitizePath(path); if (Strings.isEmpty(sanitizedPath)) { throw new IllegalArgumentException("An empty path was provided!"); } String key = determinePathCacheKey(tenantId, sanitizedPath); Blob blob = blobByPathCache.get(key); if (blob == null) { blobByPathCache.remove(key); blob = fetchOrCreateByPath(tenantId, sanitizedPath); blobByPathCache.put(key, blob); } return blob; }
Source:
<code>public static void init() { if (!glusterModeSupported()) { log.debug("Gluster mode not supported. Will not schedule jobs for refreshing Gluster data."); return; } log.debug("Initializing Gluster Jobs Manager"); SchedulerUtil scheduler = SchedulerUtilQuartzImpl.getInstance(); scheduler.scheduleAFixedDelayJob(GlusterSyncJob.getInstance(), "refreshLightWeightData", new Class[0], new Object[0], getRefreshRate(ConfigValues.GlusterRefreshRateLight), getRefreshRate(ConfigValues.GlusterRefreshRateLight), TimeUnit.SECONDS); scheduler.scheduleAFixedDelayJob(GlusterSyncJob.getInstance(), "refreshHeavyWeightData", new Class[0], new Object[0], getRefreshRate(ConfigValues.GlusterRefreshRateHeavy), getRefreshRate(ConfigValues.GlusterRefreshRateHeavy), TimeUnit.SECONDS); scheduler.scheduleAFixedDelayJob(GlusterHookSyncJob.getInstance(), "refreshHooks", new Class[0], new Object[0], getRefreshRate(ConfigValues.GlusterRefreshRateHooks), getRefreshRate(ConfigValues.GlusterRefreshRateHooks), TimeUnit.SECONDS); scheduler.scheduleAFixedDelayJob(GlusterServiceSyncJob.getInstance(), "refreshGlusterServices", new Class[0], new Object[0], getRefreshRate(ConfigValues.GlusterRefreshRateLight), getRefreshRate(ConfigValues.GlusterRefreshRateLight), TimeUnit.SECONDS); scheduler.scheduleAFixedDelayJob(GlusterTasksSyncJob.getInstance(), "gluster_async_task_poll_event", new Class[0] , new Class [0], <START> 30, <END> 30, TimeUnit.SECONDS); }</code><technical_language>this configurable well</technical_language>

Target:
public static void init() { if (!glusterModeSupported()) { log.debug("Gluster mode not supported. Will not schedule jobs for refreshing Gluster data."); return; } log.debug("Initializing Gluster Jobs Manager"); SchedulerUtil scheduler = SchedulerUtilQuartzImpl.getInstance(); scheduler.scheduleAFixedDelayJob(GlusterSyncJob.getInstance(), "refreshLightWeightData", new Class[0], new Object[0], getRefreshRate(ConfigValues.GlusterRefreshRateLight), getRefreshRate(ConfigValues.GlusterRefreshRateLight), TimeUnit.SECONDS); scheduler.scheduleAFixedDelayJob(GlusterSyncJob.getInstance(), "refreshHeavyWeightData", new Class[0], new Object[0], getRefreshRate(ConfigValues.GlusterRefreshRateHeavy), getRefreshRate(ConfigValues.GlusterRefreshRateHeavy), TimeUnit.SECONDS); scheduler.scheduleAFixedDelayJob(GlusterHookSyncJob.getInstance(), "refreshHooks", new Class[0], new Object[0], getRefreshRate(ConfigValues.GlusterRefreshRateHooks), getRefreshRate(ConfigValues.GlusterRefreshRateHooks), TimeUnit.SECONDS); scheduler.scheduleAFixedDelayJob(GlusterServiceSyncJob.getInstance(), "refreshGlusterServices", new Class[0], new Object[0], getRefreshRate(ConfigValues.GlusterRefreshRateLight), getRefreshRate(ConfigValues.GlusterRefreshRateLight), TimeUnit.SECONDS); scheduler.scheduleAFixedDelayJob(GlusterTasksSyncJob.getInstance(), "gluster_async_task_poll_event", new Class[0] , new Class [0], getRefreshRate(ConfigValues.GlusterRefreshRateTasks), getRefreshRate(ConfigValues.GlusterRefreshRateTasks), TimeUnit.SECONDS); }
Source:
<code>public Collection<IPatternProvider> getPatternsList() { Collection<IPatternProvider> newPatternList = new ArrayList<IPatternProvider>(); ClassDiagramPattern pattern = new ClassDiagramPattern(); <START> pattern.setPatternCommand(new InitializerCommand(resourceSet, selection)); <END> newPatternList.add(pattern); return newPatternList; }</code><technical_language>init command. configuration page configure pattern provider instantiate command demand</technical_language>

Target:
public Collection<IPatternProvider> getPatternsList() { Collection<IPatternProvider> newPatternList = new ArrayList<IPatternProvider>(); ClassDiagramPattern pattern = new ClassDiagramPattern(this.resourceSet, this.selection); newPatternList.add(pattern); return newPatternList; }
Source:
<code>@BeforeClass public static void beforeClass() { service = AppiumDriverLocalService.buildDefaultService(); service.start(); if (service == null || !service.isRunning()) { throw new AppiumServerHasNotBeenStartedLocallyException( "An appium server node is not started!"); } File appDir = new File("src/test/java/io/appium/java_client"); File app = new File(appDir, "ApiDemos-debug.apk"); DesiredCapabilities capabilities = new DesiredCapabilities(); <START> capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.APPIUM); <END> capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator"); capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath()); driver = new AndroidDriver<>(service.getUrl(), capabilities); }</code><technical_language>this is changed</technical_language>

Target:
@BeforeClass public static void beforeClass() { service = AppiumDriverLocalService.buildDefaultService(); service.start(); if (service == null || !service.isRunning()) { throw new AppiumServerHasNotBeenStartedLocallyException( "An appium server node is not started!"); } File appDir = new File("src/test/java/io/appium/java_client"); File app = new File(appDir, "ApiDemos-debug.apk"); DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.ANDROID_UIAUTOMATOR2); capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator"); capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath()); driver = new AndroidDriver<>(service.getUrl(), capabilities); }
Source:
<code>public void setOverrideAcceptedPatterns(String acceptablePatterns) { <START> if (LOG.isWarnEnabled()) { <END> LOG.warn("Overriding accepted patterns with [{}], be aware that this affects all instances and safety of your application!", acceptedPatterns, acceptablePatterns); } acceptedPatterns = new HashSet<>(); for (String pattern : TextParseUtil.commaDelimitedStringToSet(acceptablePatterns)) { acceptedPatterns.add(Pattern.compile(pattern, Pattern.CASE_INSENSITIVE)); } }</code><technical_language>if is needed</technical_language>

Target:
protected void setOverrideAcceptedPatterns(String acceptablePatterns) { LOG.warn("Overriding accepted patterns with [{}], be aware that this affects all instances and safety of your application!", acceptedPatterns, acceptablePatterns); acceptedPatterns = new HashSet<>(); for (String pattern : TextParseUtil.commaDelimitedStringToSet(acceptablePatterns)) { acceptedPatterns.add(Pattern.compile(pattern, Pattern.CASE_INSENSITIVE)); } }
Source:
<code>public static QueryRunner makeMMappedQueryRunner( SegmentId segmentId, boolean rollup, boolean bitmaps, QueryRunnerFactory factory ) { QueryableIndex index = bitmaps <START> ? rollup <END> ? TestIndex.getMMappedTestIndex() : TestIndex.getNoRollupMMappedTestIndex() : TestIndex.getNoBitmapMMappedTestIndex(); return QueryRunnerTestHelper.makeQueryRunner( factory, segmentId, new QueryableIndexSegment(index, segmentId), null ); }</code><technical_language>Nested ternaries = . Please consider normal ifs</technical_language>

Target:
public static QueryRunner makeMMappedQueryRunner( SegmentId segmentId, boolean rollup, boolean bitmaps, QueryRunnerFactory factory ) { QueryableIndex index; if (bitmaps) { index = rollup ? TestIndex.getMMappedTestIndex() : TestIndex.getNoRollupMMappedTestIndex(); } else { index = TestIndex.getNoBitmapMMappedTestIndex(); } return QueryRunnerTestHelper.makeQueryRunner( factory, segmentId, new QueryableIndexSegment(index, segmentId), null ); }
Source:
<code>public boolean isActionPermitted(Package updatedPack, Action action) { boolean permitted; Package currentPack = delegate().findOneById(updatedPack.getId()); if (action == CREATE || action == UPDATE || action == DELETE) { <START> if ((PackageUtils.isSystemPackage(updatedPack) || PackageUtils.isSystemPackage(currentPack)) <END> && !currentUserIsSystem()) { throw new SystemMetadataModificationException(); } } if (action == CREATE || action == DELETE) { permitted = isActionPermittedOnParent(updatedPack, action); } else if (action == UPDATE) { permitted = isActionPermittedOnParent(updatedPack, action) && internalIsActionPermitted(updatedPack.getId(), action); } else { permitted = internalIsActionPermitted(updatedPack.getId(), action); } return permitted; }</code><technical_language>IntelliJ reports a warning</technical_language>

Target:
public boolean isActionPermitted(Package updatedPack, Action action) { boolean permitted; Package currentPack = delegate().findOneById(updatedPack.getId()); if ((action == CREATE || action == UPDATE || action == DELETE) && ((PackageUtils.isSystemPackage(updatedPack) || PackageUtils.isSystemPackage(currentPack)) && !currentUserIsSystem())) { throw new SystemMetadataModificationException(); } if (action == CREATE || action == DELETE) { permitted = isActionPermittedOnParent(updatedPack, action); } else if (action == UPDATE) { permitted = isActionPermittedOnParent(updatedPack, action) && internalIsActionPermitted(updatedPack.getId(), action); } else { permitted = internalIsActionPermitted(updatedPack.getId(), action); } return permitted; }
Source:
<code>public Object create(String type, ApiRequest request, ResourceManager next) { Map<String, Object> data = CollectionUtils.toMap(request.getRequestObject()); Object imageUuid = data.get(InstanceConstants.FIELD_IMAGE_UUID); if (imageUuid != null) { String image = imageUuid.toString(); String userProvidedRegistry = DockerImage.parse(image).getServer(); String whitelist = WHITELIST_REGISTRIES.get(); <START> String[] whitelist_registries; <END> if (specified(whitelist)) { whitelist_registries = WHITELIST_REGISTRIES.get().split(","); if (!contains(whitelist_registries,userProvidedRegistry)) { throw new ValidationErrorException(ValidationErrorCodes.INVALID_OPTION, InstanceConstants.FIELD_IMAGE_UUID); } } } return super.create(type, request, next); }</code><technical_language>Pick a consistent variable case (camelCase matches existing code)</technical_language>

Target:
public Object create(String type, ApiRequest request, ResourceManager next) { Map<String, Object> data = CollectionUtils.toMap(request.getRequestObject()); Object imageUuid = data.get(InstanceConstants.FIELD_IMAGE_UUID); if (imageUuid != null) { String image = imageUuid.toString(); String fullImageName = getImageUuid(image, storageService); if (!StringUtils.equals(image, fullImageName)) { data.put(InstanceConstants.FIELD_IMAGE_UUID, fullImageName); request.setRequestObject(data); } } return super.create(type, request, next); }
Source:
<code>Mono<Response<NamedEntityResult>> recognizeEntitiesWithResponse(String text, String language, Context context) { <START> List<TextDocumentInput> documentInputs = new ArrayList<>(); <END> documentInputs.add(new TextDocumentInput(Integer.toString(0), text, language)); return recognizeBatchEntitiesWithResponse(documentInputs, null, context).flatMap(response -> { Iterator<NamedEntityResult> responseItem = response.getValue().iterator(); if (responseItem.hasNext()) { return Mono.just(new SimpleResponse<>(response, responseItem.next())); } return monoError(logger, new RuntimeException("Unable to recognize entities for the provided text.")); }); }</code><technical_language>Consider Arrays.asList(</technical_language>

Target:
Mono<Response<RecognizeEntitiesResult>> recognizeEntitiesWithResponse(String text, String language, Context context) { Objects.requireNonNull(text, "'text' cannot be null."); return recognizeBatchEntitiesWithResponse( Collections.singletonList(new TextDocumentInput("0", text, language)), null, context) .map(response -> new SimpleResponse<>(response, response.getValue().iterator().next())); }
Source:
<code>private void setRouteTimeout(IResource resource, Connection connection, IProgressMonitor monitor) { monitor.subTask("Increasing route timeout while debugging..."); IRoute route = getRoute(resource, connection, monitor); if (route == null) { OpenShiftCoreActivator.pluginLog().logInfo( NLS.bind("Could not increase timeout for debugging: could not find any route for resource {0}", resource.getName())); return; } OpenShiftCoreActivator.pluginLog().logInfo( NLS.bind("Setting haproxy timeout for route {0}", route.getName())); <START> if (!hasTimeoutAnnotation(route)) { <END> route.setAnnotation(OpenShiftAPIAnnotations.TIMEOUT, ROUTE_DEBUG_TIMEOUT); safeSend(route, connection, monitor); } }</code><technical_language>if deployment a timeout is a one. I in of annotation recover invocations JBoss Tools restarts</technical_language>

Target:
private void setRouteTimeout(IResource resource, Connection connection, IProgressMonitor monitor) throws CoreException { monitor.subTask("Increasing route timeout while debugging..."); IRoute route = new RouteTimeout(resource, connection).set(context, monitor); if (route != null) { safeSend(route, connection, monitor); } }
Source:
<code>private void openFileFromExternalLibraryAndCheckDisplayedText() { <START> projectExplorer.waitVisibilityByName("README.md"); <END> projectExplorer.waitVisibilityByName("pom.xml"); projectExplorer.waitVisibilityByName("External Libraries"); projectExplorer.openItemByVisibleNameInExplorer("External Libraries"); projectExplorer.openItemByVisibleNameInExplorer("servlet-api-2.5.jar"); projectExplorer.openItemByVisibleNameInExplorer("javax.servlet"); projectExplorer.openItemByVisibleNameInExplorer("Filter"); editor.waitActive(); editor.waitTabIsPresent("Filter"); editor.waitTextIntoEditor(EXPECTED_EDITOR_TEXT); }</code><technical_language>shorten a code if method: projectExplorer.waitVisibilityByName(String... names) projectExplorer.openItemByVisibleNameInExplorer(String... names)</technical_language>

Target:
private void openFileFromExternalLibraryAndCheckDisplayedText() { projectExplorer.waitVisibilitySeveralItemsByName("README.md", "pom.xml", "External Libraries"); projectExplorer.openSeveralItemsByVisibleNameInExplorer( "External Libraries", "servlet-api-2.5.jar", "javax.servlet", CHECKING_FILE_NAME); editor.waitActive(); editor.waitTabIsPresent(CHECKING_FILE_NAME); editor.waitTextIntoEditor(EXPECTED_EDITOR_TEXT); }
Source:
<code>protected void handleUnloadRequest(HttpServletRequest req, HttpServletResponse resp, String uiSessionId) { <START> LOG.info("Unloading UI session with ID (requested by {})", uiSessionId, this.getClass().getSimpleName()); <END> final HttpSession httpSession = req.getSession(); final ISessionStore sessionStore = BEANS.get(HttpSessionHelper.class).getSessionStore(httpSession); IUiSession uiSession = sessionStore.getUiSession(uiSessionId); if (uiSession != null) { final ReentrantLock uiSessionLock = uiSession.uiSessionLock(); uiSessionLock.lock(); try { uiSession.dispose(); } finally { uiSessionLock.unlock(); } } }</code><technical_language>Printing classname is necessary, this information is added automatically logger. I text in JsonMessageRequestHandler</technical_language>

Target:
protected void handleUnloadRequest(HttpServletRequest req, HttpServletResponse resp, String uiSessionId) { LOG.info("Unloading UI session with ID (requested by UI)", uiSessionId); final HttpSession httpSession = req.getSession(); final ISessionStore sessionStore = BEANS.get(HttpSessionHelper.class).getSessionStore(httpSession); IUiSession uiSession = sessionStore.getUiSession(uiSessionId); if (uiSession != null) { final ReentrantLock uiSessionLock = uiSession.uiSessionLock(); uiSessionLock.lock(); try { uiSession.dispose(); } finally { uiSessionLock.unlock(); } } }
Source:
<code>public void visitCompilationUnit(CompilationUnitTree tree) { PackageDeclarationTree packageDeclaration = tree.packageDeclaration(); if (packageDeclaration != null) { String packageName = PackageUtils.packageName(packageDeclaration, File.separator); File javaFile = context.getFile(); String dir = javaFile.getParent(); if (!dir.endsWith(packageName)) { <START> String dirWithoutDots = dir.replace(".", "/"); <END> String issueMessage = MessageFormat.format(MESSAGE, javaFile.getName(), packageName, dir); if (dirWithoutDots.endsWith(packageName)) { context.reportIssue(this, packageDeclaration.packageName(), issueMessage + "(Do not use dots in directory names)."); } else { context.reportIssue( this, packageDeclaration.packageName(), issueMessage + "."); } } } }</code><technical_language>Replace "/" File.separator</technical_language>

Target:
public void visitCompilationUnit(CompilationUnitTree tree) { PackageDeclarationTree packageDeclaration = tree.packageDeclaration(); if (packageDeclaration != null) { String packageName = PackageUtils.packageName(packageDeclaration, File.separator); File javaFile = context.getFile(); String dir = javaFile.getParent(); if (!dir.endsWith(packageName)) { String dirWithoutDots = dir.replace(".", File.separator); String issueMessage = MessageFormat.format(MESSAGE, javaFile.getName(), packageName, dir); if (dirWithoutDots.endsWith(packageName)) { context.reportIssue(this, packageDeclaration.packageName(), issueMessage + "(Do not use dots in directory names)."); } else { context.reportIssue( this, packageDeclaration.packageName(), issueMessage + "."); } } } }
Source:
<code>public void setupTest() { this.mockQuery = Mockito.mock(Query.class); this.mockResult = Mockito.mock(Result.class); this.mockServer = Mockito.mock(Server.class); tvAddHostnameTagDefault = true; prepareSenderCalled = false; shutdownSenderCalled = false; startOutputCalled = false; finishOutputCalled = false; tvMetricLinesSent = new LinkedList<String>(); Mockito.when(this.mockResult.getValues()).thenReturn(ImmutableMap.of("x-att1-x", (Object) "120021")); Mockito.when(this.mockResult.getAttributeName()).thenReturn("X-ATT-X"); Mockito.when(this.mockResult.getClassName()).thenReturn("X-DOMAIN.PKG.CLASS-X"); Mockito.when(this.mockResult.getTypeName()). thenReturn("Type=x-type-x,Group=x-group-x,Other=x-other-x,Name=x-name-x"); <START> Mockito.when(this.mockServer.getLabel()).thenReturn("myhostname"); <END> }</code><technical_language>is necessary a mock here. of fixture in ServerFixtures work well</technical_language>

Target:
public void setupTest() { this.mockQuery = Mockito.mock(Query.class); this.mockResult = Mockito.mock(Result.class); tvAddHostnameTagDefault = true; prepareSenderCalled = false; shutdownSenderCalled = false; startOutputCalled = false; finishOutputCalled = false; tvMetricLinesSent = new LinkedList<String>(); Mockito.when(this.mockResult.getValues()).thenReturn(ImmutableMap.of("x-att1-x", (Object) "120021")); Mockito.when(this.mockResult.getAttributeName()).thenReturn("X-ATT-X"); Mockito.when(this.mockResult.getClassName()).thenReturn("X-DOMAIN.PKG.CLASS-X"); Mockito.when(this.mockResult.getTypeName()). thenReturn("Type=x-type-x,Group=x-group-x,Other=x-other-x,Name=x-name-x"); }
Source:
<code>protected int doWork() { IOUtil.assertFileIsWritable(CHART_OUTPUT); return super.doWork(); <START> <END> }</code><technical_language>this needs resolved. plotting is important</technical_language>

Target:
protected int doWork() { IOUtil.assertFileIsWritable(CHART_OUTPUT); IOUtil.assertFileIsReadable(INPUT); getSamReader(); this.collector = new WgsMetricsWithNonZeroCoverageCollector(COVERAGE_CAP, getIntervalsToExamine()); super.doWork(); final List<SAMReadGroupRecord> readGroups = getSamFileHeader().getReadGroups(); final String plotSubtitle = (readGroups.size() == 1) ? StringUtil.asEmptyIfNull(readGroups.get(0).getLibrary()) : ""; if (collector.areHistogramsEmpty()) { log.warn("No valid bases found in input file. No plot will be produced."); } else { final int rResult = RExecutor.executeFromClasspath("picard/analysis/wgsHistogram.R", OUTPUT.getAbsolutePath(), CHART_OUTPUT.getAbsolutePath(), INPUT.getName(), plotSubtitle); if (rResult != 0) { throw new PicardException("R script wgsHistogram.R failed with return code " + rResult); } } return 0; }
Source:
<code><START> public KeyVaultCredentialPolicy(TokenCredential credential) { <END> Objects.requireNonNull(credential); this.credential = credential; this.cache = new ScopeTokenCache((scopes) -> credential.getToken(scopes)); }</code><technical_language>other constructor inputs for values set this constructor this calling instead of other around</technical_language>

Target:
public KeyVaultCredentialPolicy(TokenCredential credential) { Objects.requireNonNull(credential); this.cache = new ScopeTokenCache((scopes) -> credential.getToken(scopes)); }
Source:
<code>private void loadGraph(final File vertexfile, final File edgefile) throws IOException { GraphFactory<SequenceSegment> gfact = new FactoryProducer<SequenceSegment>() <START> .getFactory("JGraphT"); <END> DefaultGraphParser graphParser = new DefaultGraphParser(); graph = graphParser.parseGraph(vertexfile, edgefile, gfact); shout(Message.LOADED, graph, graphParser.getSequences()); repaint(); }</code><technical_language>a constant instead of a raw String</technical_language>

Target:
private void loadGraph(final File vertexfile, final File edgefile) throws IOException { GraphFactory<SequenceSegment> gfact = FactoryProducer.getFactory(); GraphParser graphParser = new DefaultGraphParser(); graph = graphParser.parseGraph(vertexfile, edgefile, gfact); shout(Message.LOADED, graph, graphParser.getSequences()); repaint(); }
Source:
<code>public int getSize() { <START> return ingredients.size(); <END> }</code><technical_language>this</technical_language>

Target:
public int getSize() { return this.ingredients.size(); }
Source:
<code>public InstructorCourseDetailsPage clickDeleteAndCancel(String studentName) { int rowId = getStudentRowId(studentName); if (rowId > -1) { clickAndCancel(getDeleteLink(rowId)); <START> } <END> return this; }</code><technical_language>Instead of silencing error, throw exception here? If rowId is -1, test written correctly</technical_language>

Target:
public InstructorCourseDetailsPage clickDeleteAndCancel(String studentName) { int rowId = getStudentRowId(studentName); clickAndCancel(getDeleteLink(rowId)); return this; }
Source:
<code>@Override public RecordType type() { <START> return RecordType.ENCRYPTED_RECORD_V2; <END> }</code><technical_language>please describe in short need change type of this WAL record? WAL record changed itself, weird me</technical_language>

Target:
@Override public RecordType type() { return RecordType.ENCRYPTED_RECORD; }
Source:
<code>public static boolean isImage(Context context, Uri uri) { <START> return context.getContentResolver().getType(uri).contains("image"); <END> }</code><technical_language>suggestion String mimeType = context.getContentResolver().getType(uri); return mimeType != null && mimeType.toLowerCase(Locale.ROOT).startsWith("image/");</technical_language>

Target:
public static boolean isImage(Context context, Uri uri) { if (uri == null) return false; String mimeType = context.getContentResolver().getType(uri); return mimeType != null && mimeType.toLowerCase(Locale.ROOT).startsWith("image/"); }
Source:
<code>public void initialize() throws IOException, RepositoryManagementStrategyException { lock = hazelcastInstance.getLock("StorageBooterLock"); if (lock.tryLock()) { try { <START> final Configuration configuration = configurationManager.getConfiguration(); <END> initializeStorages(configuration.getStorages()); Collection<Repository> repositories = getRepositoriesHierarchy(configuration.getStorages()); if (!repositories.isEmpty()) { logger.info(" -> Initializing repositories..."); } repositories.forEach(ThrowingConsumer.unchecked(this::initializeRepository)); } finally { lock.unlock(); } } else { logger.debug("Failed to initialize the repositories. Another JVM may have already done this."); } }</code><technical_language>Cosmetic: Please follow [coding convention](<LINK_0> Braces new line, please</technical_language>

Target:
public void initialize() throws IOException, RepositoryManagementStrategyException { ILock lock = hazelcastInstance.getLock("StorageBooterLock"); if (lock.tryLock()) { try { final Configuration configuration = configurationManager.getConfiguration(); initializeStorages(configuration.getStorages()); Collection<Repository> repositories = getRepositoriesHierarchy(configuration.getStorages()); if (!repositories.isEmpty()) { logger.info(" -> Initializing repositories..."); } repositories.forEach(ThrowingConsumer.unchecked(this::initializeRepository)); } finally { lock.unlock(); } } else { logger.debug("Failed to initialize the repositories. Another JVM may have already done this."); } }
Source:
<code>public void testDDLWithHashDeprecatedWarning() { <START> String schema1 = <END> "create table test (dummy int); " + "create index hashidx on test(dummy);"; VoltCompiler compiler = new VoltCompiler(false); final boolean success = compileDDL(schema1, compiler); assertTrue(success); assertEquals(1, compiler.m_warnings.size()); String warningMsg = compiler.m_warnings.get(0).getMessage(); String expectedMsg = "Warning: hash indexes are deprecated. In a future release, VoltDB will only support tree indexes, even if the index name contains the string \"hash\""; assertEquals(expectedMsg, warningMsg); }</code><technical_language>Name "schema"? is other literal schema for this test case</technical_language>

Target:
public void testDDLWithHashDeprecatedWarning() { String schema = "create table test (dummy int); " + "create index hashidx on test(dummy);"; VoltCompiler compiler = new VoltCompiler(false); final boolean success = compileDDL(schema, compiler); assertTrue(success); assertEquals(1, compiler.m_warnings.size()); String warningMsg = compiler.m_warnings.get(0).getMessage(); String expectedMsg = "Hash indexes are deprecated. In a future release, VoltDB will only support tree indexes, even if the index name contains the string \"hash\""; assertEquals(expectedMsg, warningMsg); }
Source:
<code>private void createBulkNewBranchMenuItem(Menu menu, final Repository[] repositories) { MenuItem newBranch = getNewBranchMenuItem(menu); newBranch.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { InputDialog dialog = new InputDialog(e.display.getActiveShell(), <START> UIText.CreateBranchBulkDialog_Title, <END> UIText.CreateBranchBulkDialog_Description, "", new IInputValidator() { @Override public String isValid(String newBranchName) { return validateNewBulkBranchName(newBranchName, repositories); } }); if (dialog.open() == Window.OK) { String name = dialog.getValue(); try { for (Repository repository : repositories) { Ref ref = repository.getRefDatabase() .findRef(Constants.HEAD); CreateLocalBranchOperation op = new CreateLocalBranchOperation( repository, name, ref, BranchRebaseMode.REBASE); op.execute(null); } BranchOperationUI.checkout(repositories, name).start(); } catch (IOException | CoreException exception) { Activator.logError(UIText.CreateBranchBulkDialog_Error, exception); } } } }); }</code><technical_language>This "Create Branch (Bulk)". "Create Branch in Multiple Repositories"</technical_language>

Target:
private void createBulkNewBranchMenuItem(Menu menu, final Repository[] repositories) { MenuItem newBranch = getNewBranchMenuItem(menu); newBranch.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { InputDialog dialog = new InputDialog(e.display.getActiveShell(), UIText.CreateBranchBulkDialog_Title, UIText.CreateBranchBulkDialog_Description, "", new IInputValidator() { @Override public String isValid(String newBranchName) { return validateNewBulkBranchName(newBranchName, repositories); } }); if (dialog.open() == Window.OK) { String name = dialog.getValue(); try { for (Repository repository : repositories) { Ref headRef = repository.exactRef(Constants.HEAD); if (headRef != null) { ObjectId headId = headRef.getLeaf() .getObjectId(); RevCommit head = repository.parseCommit(headId); CreateLocalBranchOperation op = new CreateLocalBranchOperation( repository, name, head); op.execute(null); } } BranchOperationUI.checkout(repositories, name).start(); } catch (Exception exception) { Activator.handleError( UIText.CreateBranchBulkDialog_Error, exception, true); } } } }); }
Source:
<code>public void jumpBackTest() { int forward = getRandomSteps(20, 150); int backward = getRandomSteps(1, forward); debuggerSession.step(forward); <START> K debugResult = debuggerSession.backStep(backward).getCurrentK(); <END> K expectedResult = utils.stepRewrite(parsed, Optional.ofNullable(new Integer(forward - backward))); assertEquals("Normal and Debug results don't match, when normal takes 25 steps, and debugger goes back 25 steps", expectedResult, debugResult); }</code><technical_language>I need apply KtoKORE end a problem if tests apply in other order</technical_language>

Target:
public void jumpBackTest() { int forward = getRandomSteps(20, 150); int backward = getRandomSteps(1, forward); debuggerSession.step(forward); K debugResult = trans.apply(debuggerSession.backStep(backward).getCurrentK()); K expectedResult = trans.apply(utils.stepRewrite(parsed, Optional.ofNullable(new Integer(forward - backward)))); assertEquals("Normal and Debug results don't match, when normal takes 25 steps, and debugger goes back 25 steps", expectedResult, debugResult); }
Source:
<code><START> public PieChart getGlobalPC() { <END> return fGlobalPC; }</code><technical_language>For this method package visible</technical_language>

Target:
PieChart getGlobalPC() { return fGlobalPC; }
Source:
<code>public static Procedure compileNibbleDeleteProcedure(Table catTable, String procName, Column col, ComparisonConstant comp) { Procedure newCatProc = addProcedure(catTable, procName); String countingQuery = genSelectSql(catTable, col, comp); addStatement(catTable, newCatProc, countingQuery, "0"); String deleteQuery = genDeleteSql(catTable, col, comp); addStatement(catTable, newCatProc, deleteQuery, "1"); <START> String valueAtQuery = genValueAtOffsetSql(catTable, col); <END> addStatement(catTable, newCatProc, valueAtQuery, "2"); return newCatProc; }</code><technical_language>this is ben's midpoint guessing strategy. I ok initial version</technical_language>

Target:
public static Procedure compileNibbleDeleteProcedure(Table catTable, String procName, Column col, ComparisonConstant comp) { Procedure newCatProc = addProcedure(catTable, procName); String countingQuery = genSelectSqlForNibbleDelete(catTable, col, comp); addStatement(catTable, newCatProc, countingQuery, "0"); String deleteQuery = genDeleteSqlForNibbleDelete(catTable, col, comp); addStatement(catTable, newCatProc, deleteQuery, "1"); String valueAtQuery = genValueAtOffsetSqlForNibbleDelete(catTable, col, comp); addStatement(catTable, newCatProc, valueAtQuery, "2"); return newCatProc; }
Source:
<code>protected void applyCurrentLocalFilter() { int nbOfItems = this.ds.getCacheData().length + 1; DataSource dataSource = this.getDataSource(); Integer[] visibleRows = this.getVisibleRows(); DSRequest request = new DSRequest(); request.setStartRow(0); request.setEndRow(nbOfItems + visibleRows[1]); request.setSortBy(this.getSort()); <START> <END> dataSource.fetchData(this.filter, (response, rawData, request1) -> { RecordList recordList = new RecordList(response.getData()); setData(recordList); recordList.destroy(); }, request); }</code><technical_language>rename request1 more relevant fetchRequest, unusedRequestor callbackRequest</technical_language>

Target:
protected void applyCurrentLocalFilter() { int nbOfItems = this.ds.getCacheData().length + 1; DataSource dataSource = this.getDataSource(); Integer[] visibleRows = this.getVisibleRows(); DSRequest request = new DSRequest(); request.setStartRow(0); request.setEndRow(nbOfItems + visibleRows[1]); request.setSortBy(this.getSort()); dataSource.fetchData(this.filter, (response, rawData, fetchRequest) -> { RecordList recordList = new RecordList(response.getData()); setData(recordList); recordList.destroy(); }, request); }
Source:
<code><START> public StateChange getDefaultInstance() { <END> if (defaultInstance.frameBuffersManager == null) { defaultInstance.frameBuffersManager = frameBuffersManager; defaultInstance.fbo = frameBuffersManager.getFBO(DEFAULT_FBO_NAME); } return defaultInstance; }</code><technical_language>Hmmm. Trickytrickytricky. I a couple of thoughts. 1. Theoretically, default instance reset viewport size of window size of a buffer, this free default instance deal FBM. This work if accept need query size of display frame monitor for changes. a subscribable object do monitoring work, notifying subscribers default instance if display changes. 2. In practice, convert frameBuffersManager variable a static one, initialize in WorldRendererImpl, frameBuffersManager is instantiated? This class instance of FBM shorten constructors</technical_language>

Target:
public StateChange getDefaultInstance() { return defaultInstance; }
Source:
<code>public void updateStatus(JID jid, String type) throws NodeStoreException { if (!LocalDomainChecker.isLocal(jid.getDomain(), configuration)) { return; } if ((type != null) && type.equals(UNAVAILABLE)) { LOGGER.info("User going offline: " + jid.toString()); if (true == useDatabaseStorage) { channelManager.jidOffline(jid); } else { if (users.containsKey(jid.toBareJID())) { <START> ArrayList<JID> user = users.get(jid.toBareJID()); <END> user.remove(jid); } } return; } if (true == useDatabaseStorage) { channelManager.jidOnline(jid); } else { if (!users.containsKey(jid.toBareJID())) { users.put(jid.toBareJID(), new ArrayList<JID>()); } ArrayList<JID> entry = users.get(jid.toBareJID()); if (!entry.contains(jid)) { entry.add(jid); } } LOGGER.info("User now online: " + jid.toFullJID()); }</code><technical_language>Extract user a local variable **if** statement check if user == null instead of calling containsKey</technical_language>

Target:
public void updateStatus(JID jid, String type) throws NodeStoreException { if (!LocalDomainChecker.isLocal(jid.getDomain(), configuration)) { return; } ArrayList<JID> user = null; if (users.containsKey(jid.toBareJID())) { user = users.get(jid.toBareJID()); } if ((type != null) && type.equals(UNAVAILABLE)) { LOGGER.info("User going offline: " + jid.toString()); if (true == useDatabaseStorage) { channelManager.jidOffline(jid); } else { if (null != user) { user.remove(jid); } } return; } if (true == useDatabaseStorage) { channelManager.jidOnline(jid); } else { if (null == user) { users.put(jid.toBareJID(), new ArrayList<JID>()); } ArrayList<JID> entry = users.get(jid.toBareJID()); if (!entry.contains(jid)) { entry.add(jid); } } LOGGER.info("User now online: " + jid.toFullJID()); }
Source:
<code>public RefreshToken getAsRefreshToken(){ Map<String, Object> props = new LinkedHashMap<String, Object>(1); <START> String accessTokenID = (String)((Map)this.getAsAccessToken().getExpandedJwt().get("claims")).get("rti"); <END> props.put("href", "/refreshTokens/" + accessTokenID); return getDataStore().instantiate(RefreshToken.class, props); }</code><technical_language>This variable called refreshTokenID</technical_language>

Target:
public RefreshToken getAsRefreshToken(){ Map<String, Object> props = new LinkedHashMap<String, Object>(1); String refreshTokenID = (String)((Map)this.getAsAccessToken().getExpandedJwt().get("claims")).get("rti"); props.put("href", "/refreshTokens/" + refreshTokenID); return getDataStore().instantiate(RefreshToken.class, props); }