auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void commitFiles(ConnectorSession session, String schemaName, String tableName, List<PartitionUpdate> partitionUpdates) { HdfsContext context = new HdfsContext(session, schemaName, tableName); List<CompletableFuture<?>> fileRenameFutures = new ArrayList<>(); for (PartitionUpdate partitionUpdate : partitionUpdates) { Path path = partitionUpdate.getWritePath(); FileSystem fileSystem; try { fileSystem = hdfsEnvironment.getFileSystem(context, path); } catch (IOException e) { <START> throw new PrestoException(HIVE_FILESYSTEM_ERROR, "Error moving data files to final location. Error listing directory " + path, e); <END> } for (StagingFileInfo stagingFileInfo : partitionUpdate.getStagingFileInfos()) { fileRenameFutures.add(CompletableFuture.runAsync(() -> renameFile(fileSystem, path, stagingFileInfo), renameExecutor)); } } for (Future<?> fileRenameFuture : fileRenameFutures) { getFutureValue(fileRenameFuture, PrestoException.class); } }</code><technical_language>exception filesystem, exception message "Error listing directory", is confusing file listing listXYZ methods fileSystem</technical_language>

Target:
public void commitFiles(ConnectorSession session, String schemaName, String tableName, List<PartitionUpdate> partitionUpdates) { HdfsContext context = new HdfsContext(session, schemaName, tableName); List<ListenableFuture<?>> commitFutures = new ArrayList<>(); for (PartitionUpdate partitionUpdate : partitionUpdates) { Path path = partitionUpdate.getWritePath(); FileSystem fileSystem = getFileSystem(hdfsEnvironment, context, path); for (FileWriteInfo fileWriteInfo : partitionUpdate.getFileWriteInfos()) { checkState(!fileWriteInfo.getWriteFileName().equals(fileWriteInfo.getTargetFileName())); Path source = new Path(path, fileWriteInfo.getWriteFileName()); Path target = new Path(path, fileWriteInfo.getTargetFileName()); commitFutures.add(commitExecutor.submit(() -> renameFile(fileSystem, source, target))); } } waitForListenableFutures(commitFutures); }
Source:
<code>public static <T> T getMapper(Class<T> clazz) { try { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); if ( classLoader == null ) { classLoader = Mappers.class.getClassLoader(); } <START> ServiceLoader<T> loader = ServiceLoader.load( clazz, classLoader ); <END> if ( loader != null ) { for ( T mapper : loader ) { if ( mapper != null ) { return mapper; } } } @SuppressWarnings("unchecked") T mapper = (T) classLoader.loadClass( clazz.getName() + IMPLEMENTATION_SUFFIX ).newInstance(); return mapper; } catch ( Exception e ) { throw new RuntimeException( e ); } }</code><technical_language>do a fall-back normal approach, I suppose service loader is slower</technical_language>

Target:
public static <T> T getMapper(Class<T> clazz) { try { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); if ( classLoader == null ) { classLoader = Mappers.class.getClassLoader(); } try { @SuppressWarnings("unchecked") T mapper = (T) classLoader.loadClass( clazz.getName() + IMPLEMENTATION_SUFFIX ).newInstance(); return mapper; } catch (ClassNotFoundException e) { ServiceLoader<T> loader = ServiceLoader.load( clazz, classLoader ); if ( loader != null ) { for ( T mapper : loader ) { if ( mapper != null ) { return mapper; } } } throw new ClassNotFoundException("Cannot find implementation for " + clazz.getName()); } } catch ( Exception e ) { throw new RuntimeException( e ); } }
Source:
<code>public void testAfterNoTimezone() throws IOException { BundleFilterTimeRange filter1 = Configs.decodeObject(BundleFilterTimeRange.class, AFTER_160921); BundleFilterTimeRange filter2 = Configs.decodeObject(BundleFilterTimeRange.class, AFTER_170921); assertTrue("Expected true since filtered out earlier than 160921", filter1.filter(bundle)); <START> assertFalse("Expected false since filtered out earlier than 170921", filter2.filter(bundle)); <END> }</code><technical_language>messages</technical_language>

Target:
public void testAfterNoTimezone() throws IOException { BundleFilterTimeRange filter1 = Configs.decodeObject(BundleFilterTimeRange.class, AFTER_160921); BundleFilterTimeRange filter2 = Configs.decodeObject(BundleFilterTimeRange.class, AFTER_170921); assertTrue("Expected true since 160922 is later than 160921", filter1.filter(bundle)); assertFalse("Expected false since 160922 is earlier than 170921", filter2.filter(bundle)); }
Source:
<code>protected BeanManager lookupBeanManager() { final BeanManager bmgr = CDI.current() .getBeanManager(); Logger logger = LoggerFactory.getLogger( getClass() ); logger.info( "\n\n\n\nRESTEasy Using BeanManager: {}\n\n\n\n", bmgr ); <START> Set<Bean<?>> mappers = bmgr.getBeans( ObjectMapper.class ); <END> mappers.forEach( bean -> { CreationalContext ctx = bmgr.createCreationalContext( null ); logger.debug( "Found ObjectMapper: {}", bean.create( ctx ) ); ctx.release(); } ); return bmgr; }</code><technical_language>If this is diagnostic, I if wrap in a if(logger.isDebugEnabled()) condition, prevent expensive reflection / lookup if result</technical_language>

Target:
protected BeanManager lookupBeanManager() { final BeanManager bmgr = CDI.current() .getBeanManager(); Logger logger = LoggerFactory.getLogger( getClass() ); if ( logger.isDebugEnabled() ) { Set<Bean<?>> mappers = bmgr.getBeans( ObjectMapper.class ); mappers.forEach( bean -> { CreationalContext ctx = bmgr.createCreationalContext( null ); logger.debug( "Found ObjectMapper: {}", bean.create( ctx ) ); ctx.release(); } ); logger.debug( "\n\n\n\nRESTEasy CDI Injector Factory Using BeanManager: (@{})\n\n\n\n", bmgr, bmgr.hashCode() ); } return bmgr; }
Source:
<code>public DeveloperDTO create(final DeveloperDTO dto) throws EntityRetrievalException, EntityCreationException, JsonProcessingException { <START> if (dto.getWebsite() != null && !StringUtils.isEmpty(dto.getWebsite())) { <END> if (!ValidationUtils.isWellFormedUrl(dto.getWebsite())) { String msg = msgUtil.getMessage("developer.websiteIsInvalid"); throw new EntityCreationException(msg); } } DeveloperDTO created = developerDao.create(dto); List<CertificationBodyDTO> availableAcbs = acbManager.getAllForUser(false); if (availableAcbs != null && availableAcbs.size() > 0) { for (CertificationBodyDTO acb : availableAcbs) { for (DeveloperACBMapDTO attMap : dto.getTransparencyAttestationMappings()) { if (acb.getId().longValue() == attMap.getAcbId().longValue() && !StringUtils.isEmpty(attMap.getTransparencyAttestation())) { attMap.setDeveloperId(created.getId()); developerDao.createTransparencyMapping(attMap); } } } } activityManager.addActivity(ActivityConcept.ACTIVITY_CONCEPT_DEVELOPER, created.getId(), "Developer " + created.getName() + " has been created.", null, created); return created; }</code><technical_language>need for null check</technical_language>

Target:
public DeveloperDTO create(final DeveloperDTO dto) throws EntityRetrievalException, EntityCreationException, JsonProcessingException { if (!StringUtils.isEmpty(dto.getWebsite())) { if (!ValidationUtils.isWellFormedUrl(dto.getWebsite())) { String msg = msgUtil.getMessage("developer.websiteIsInvalid"); throw new EntityCreationException(msg); } } DeveloperDTO created = developerDao.create(dto); List<CertificationBodyDTO> availableAcbs = acbManager.getAllForUser(false); if (availableAcbs != null && availableAcbs.size() > 0) { for (CertificationBodyDTO acb : availableAcbs) { for (DeveloperACBMapDTO attMap : dto.getTransparencyAttestationMappings()) { if (acb.getId().longValue() == attMap.getAcbId().longValue() && !StringUtils.isEmpty(attMap.getTransparencyAttestation())) { attMap.setDeveloperId(created.getId()); developerDao.createTransparencyMapping(attMap); } } } } activityManager.addActivity(ActivityConcept.ACTIVITY_CONCEPT_DEVELOPER, created.getId(), "Developer " + created.getName() + " has been created.", null, created); return created; }
Source:
<code><START> public boolean hasNext() { <END> if (tuple == null) { try { tuple = loadFunc.getNext(); } catch (IOException e) { throw new RuntimeException(e); } } if (tuple != null) { return true; } return false; }</code><technical_language>next() return null if hasNext() is called? I Iterator contract invoking hasNext() next() strictly in pairs</technical_language>

Target:
public boolean hasNext() { if (!hasNextCalled) { hasNextCalled = true; if (tuple == null) { try { tuple = loadFunc.getNext(); } catch (IOException e) { throw new RuntimeException(e); } } } return tuple != null; }
Source:
<code>public void stop() { if (!started) { throw new IllegalStateException("calling `stop` without first calling `start`."); } <START> if (stopped) { <END> return; } synchronized (startStopLock) { if (stopped) { return; } pool.shutdownNow(); regionNormalizerTracker.stop(); stopped = true; } }</code><technical_language>Ditto these. want a guava Service? much</technical_language>

Target:
public void stop() { synchronized (startStopLock) { if (!started) { throw new IllegalStateException("calling `stop` without first calling `start`."); } if (stopped) { return; } pool.shutdownNow(); regionNormalizerTracker.stop(); stopped = true; } }
Source:
<code>public void testSourceStoppedOnFlumeExceptionIfPortUsed() throws InterruptedException, IOException { final String loopbackIPv4 = "127.0.0.1"; final int port = 10500; try (ServerSocketChannel dummyServerSocket = ServerSocketChannel.open()) { dummyServerSocket.socket().setReuseAddress(true); dummyServerSocket.socket().bind(new InetSocketAddress(loopbackIPv4, port)); Context context = new Context(); context.put("port", String.valueOf(port)); context.put("bind", loopbackIPv4); Configurables.configure(source, context); try { source.start(); Assert.fail("Expected an exception during startup caused by binding on a used port"); } catch (FlumeException e) { logger.info("Received an expected exception.", e); <START> Assert.assertTrue("Expected a bind related root cause", <END> e.getMessage().contains("Failed to bind to")); } } Assert.assertEquals("Server is stopped", LifecycleState.STOP, source.getLifecycleState()); }</code><technical_language>useful do instanceof check for e.getCause()</technical_language>

Target:
public void testSourceStoppedOnFlumeExceptionIfPortUsed() throws InterruptedException, IOException { final String loopbackIPv4 = "127.0.0.1"; final int port = 10500; try (ServerSocketChannel dummyServerSocket = ServerSocketChannel.open()) { dummyServerSocket.socket().setReuseAddress(true); dummyServerSocket.socket().bind(new InetSocketAddress(loopbackIPv4, port)); Context context = new Context(); context.put("port", String.valueOf(port)); context.put("bind", loopbackIPv4); Configurables.configure(source, context); try { source.start(); Assert.fail("Expected an exception during startup caused by binding on a used port"); } catch (FlumeException e) { logger.info("Received an expected exception.", e); Assert.assertTrue("Expected a server socket setup related root cause", e.getMessage().contains("server socket")); } } Assert.assertEquals("Server is stopped", LifecycleState.STOP, source.getLifecycleState()); }
Source:
<code>private boolean isPIDAlive(String pid) { if (pid != null) { <START> ProcessBuilder pb = new ProcessBuilder().command("ps", "-o", "pid=", "-p", pid); <END> pb.redirectError(ProcessBuilder.Redirect.INHERIT); pb.redirectInput(ProcessBuilder.Redirect.INHERIT); try { Process process = pb.start(); StringBuilder sb = new StringBuilder(); try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))) { if (reader.readLine() != null) return true; } return false; } catch (IOException e) { log.error("Failed to test if service " + pid + " is running", e); return false; } } return false; }</code><technical_language>Platform specific code isolated scripts unix-kill.sh etc. (prefix + "kill" + extension)</technical_language>

Target:
private boolean isPIDAlive(String pid) { if (pid != null) { ProcessBuilder pb = new ProcessBuilder().command(prefix + "is_alive" + extension, pid); pb.redirectError(ProcessBuilder.Redirect.INHERIT); pb.redirectInput(ProcessBuilder.Redirect.INHERIT); try { Process process = pb.start(); StringBuilder sb = new StringBuilder(); try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))) { String line = reader.readLine(); if (line != null && !line.isEmpty()) { return true; } } return false; } catch (IOException e) { log.error("Failed to test if service " + pid + " is running", e); return false; } } return false; }
Source:
<code>private BlobId unwrapChunkInfo(ChunkInfo chunkInfo, long intermediateChunkSize, boolean lastChunk) throws RouterException { long chunkSize = chunkInfo.getChunkSizeInBytes(); long chunkExpirationTimeInMs = chunkInfo.getExpirationTimeInMs(); if (chunkSize == 0 || (lastChunk ? chunkSize > intermediateChunkSize : chunkSize != intermediateChunkSize)) { <START> throw new RouterException("Invalid chunkSize: " + chunkSize + "; intermediateChunkSize: " + intermediateChunkSize, <END> RouterErrorCode.InvalidPutArgument); } long metadataExpirationTimeInMs = Utils.addSecondsToEpochTime(passedInBlobProperties.getCreationTimeInMs(), passedInBlobProperties.getTimeToLiveInSeconds()); if (Utils.compareTimes(chunkExpirationTimeInMs, metadataExpirationTimeInMs) < 0) { throw new RouterException("Chunk expiration time (" + chunkExpirationTimeInMs + ") < metadata expiration time (" + metadataExpirationTimeInMs + ")", RouterErrorCode.InvalidPutArgument); } BlobId blobId = RouterUtils.getBlobIdFromString(chunkInfo.getBlobId(), clusterMap); if (blobId.getBlobDataType() != BlobDataType.DATACHUNK) { throw new RouterException("Cannot stitch together multiple composite blobs", RouterErrorCode.InvalidBlobId); } return blobId; }</code><technical_language>message include if this chunk</technical_language>

Target:
private BlobId unwrapChunkInfo(ChunkInfo chunkInfo, long intermediateChunkSize, boolean lastChunk) throws RouterException { long chunkSize = chunkInfo.getChunkSizeInBytes(); long chunkExpirationTimeInMs = chunkInfo.getExpirationTimeInMs(); if (chunkSize == 0 || chunkSize > intermediateChunkSize || (!lastChunk && chunkSize < intermediateChunkSize)) { throw new RouterException( "Invalid chunkSize for " + (lastChunk ? "last" : "intermediate") + " chunk: " + chunkSize + "; intermediateChunkSize: " + intermediateChunkSize, RouterErrorCode.InvalidPutArgument); } long metadataExpirationTimeInMs = Utils.addSecondsToEpochTime(passedInBlobProperties.getCreationTimeInMs(), passedInBlobProperties.getTimeToLiveInSeconds()); if (Utils.compareTimes(chunkExpirationTimeInMs, metadataExpirationTimeInMs) < 0) { throw new RouterException("Chunk expiration time (" + chunkExpirationTimeInMs + ") < metadata expiration time (" + metadataExpirationTimeInMs + ")", RouterErrorCode.InvalidPutArgument); } BlobId blobId = RouterUtils.getBlobIdFromString(chunkInfo.getBlobId(), clusterMap); if (blobId.getBlobDataType() != BlobDataType.DATACHUNK) { throw new RouterException("Cannot stitch together multiple composite blobs", RouterErrorCode.InvalidBlobId); } return blobId; }
Source:
<code>public Builder toBuilder() { Builder builder = new Builder(type); builder.members.putAll(members); <START> for (Map.Entry<String, List<CodeBlock>> entry : builder.members.entrySet()) { <END> entry.setValue(new ArrayList<>(entry.getValue())); } return builder; }</code><technical_language>I looped members' entry set put() entry builder.members instead of putAll replacing entries' values</technical_language>

Target:
public Builder toBuilder() { Builder builder = new Builder(type); for (Map.Entry<String, List<CodeBlock>> entry : members.entrySet()) { builder.members.put(entry.getKey(), new ArrayList<>(entry.getValue())); } return builder; }
Source:
<code>private void handleMessageFormat(MethodInvocationTree mit, String formatString, List<ExpressionTree> args) { String newFormatString = cleanupDoubleQuote(formatString); Set<Integer> indexes = getMessageFormatIndexes(newFormatString); List<ExpressionTree> newArgs = args; if (newArgs.size() == 1) { <START> ExpressionTree firstArg = args.get(0); <END> if (firstArg.symbolType().isArray()) { if (isNewArrayWithInitializers(firstArg)) { newArgs = ((NewArrayTree) firstArg).initializers(); } else { return; } } } if (checkEmptyParams(mit, indexes) || checkArgumentNumber(mit, indexes.size(), newArgs.size()) || checkUnbalancedQuotes(mit, newFormatString) || checkUnbalancedBraces(mit, newFormatString)) { return; } checkToStringInvocation(newArgs); verifyParameters(mit, newArgs, indexes); }</code><technical_language>This is correct, strange check newArgs.size() access args.get(0), newArgs.get(0) instead</technical_language>

Target:
private void handleMessageFormat(MethodInvocationTree mit, String formatString, List<ExpressionTree> args) { String newFormatString = cleanupDoubleQuote(formatString); Set<Integer> indexes = getMessageFormatIndexes(newFormatString); List<ExpressionTree> newArgs = args; if (newArgs.size() == 1) { ExpressionTree firstArg = newArgs.get(0); if (firstArg.symbolType().isArray()) { if (isNewArrayWithInitializers(firstArg)) { newArgs = ((NewArrayTree) firstArg).initializers(); } else { return; } } } if (checkEmptyParams(mit, indexes) || checkArgumentNumber(mit, indexes.size(), newArgs.size()) || checkUnbalancedQuotes(mit, newFormatString) || checkUnbalancedBraces(mit, newFormatString)) { return; } checkToStringInvocation(newArgs); verifyParameters(mit, newArgs, indexes); }
Source:
<code>private File doExport(SnomedRefSetDSVExportModel exportModel) throws Exception { SnomedRefSetDSVExportClientRequest dsvRequest = new SnomedRefSetDSVExportClientRequest(SnomedClientProtocol.getInstance(), exportModel); IProgressMonitor submonitor = SubMonitor.convert(new NullProgressMonitor(), "Performing SNOMED CT export to DSV format...", 1000).newChild(1000, SubMonitor.SUPPRESS_ALL_LABELS); <START> File exportFile = dsvRequest.send(new EclipseMonitor(submonitor)); <END> SnomedExportResult result = dsvRequest.getExportResult(); exportModel.getExportResult().setResultAndMessage(result.getResult(), result.getMessage()); return exportFile; }</code><technical_language>No-op Net4j monitors built org.eclipse.net4j.util.om.monitor.Monitor. care output here</technical_language>

Target:
private File doExport(SnomedRefSetDSVExportModel exportModel) throws Exception { SnomedRefSetDSVExportClientRequest dsvRequest = new SnomedRefSetDSVExportClientRequest(SnomedClientProtocol.getInstance(), exportModel); File exportFile = dsvRequest.send(new Monitor()); SnomedExportResult result = dsvRequest.getExportResult(); exportModel.getExportResult().setResultAndMessage(result.getResult(), result.getMessage()); return exportFile; }
Source:
<code>private static void registerTransformers_EAP_7_2_0(ResourceTransformationDescriptionBuilder subsystemBuilder) { subsystemBuilder .addChildResource(UndertowExtension.PATH_APPLICATION_SECURITY_DOMAIN) .getAttributeBuilder() .addRejectCheck(RejectAttributeChecker.DEFINED, ENABLE_JASPI, INTEGRATED_JASPI) .setDiscard(DiscardAttributeChecker.ALWAYS, ENABLE_JASPI, INTEGRATED_JASPI) .end(); ResourceTransformationDescriptionBuilder builder = subsystemBuilder.addChildResource(UndertowExtension.PATH_FILTERS) .addChildResource(PathElement.pathElement(Constants.MOD_CLUSTER)); <START> builder.discardChildResource(NoAffinityResourceDefinition.PATH); <END> builder.discardChildResource(SingleAffinityResourceDefinition.PATH); builder.discardChildResource(RankedAffinityResourceDefinition.PATH); }</code><technical_language>legacy behavior corresponds SingleAffinityResourceDefinition.PATH, I want use: builder.rejectChildResource(NoAffinityResourceDefinition.PATH)</technical_language>

Target:
private static void registerTransformers_EAP_7_2_0(ResourceTransformationDescriptionBuilder subsystemBuilder) { subsystemBuilder .addChildResource(UndertowExtension.PATH_APPLICATION_SECURITY_DOMAIN) .getAttributeBuilder() .addRejectCheck(RejectAttributeChecker.DEFINED, ENABLE_JASPI, INTEGRATED_JASPI) .setDiscard(DiscardAttributeChecker.ALWAYS, ENABLE_JASPI, INTEGRATED_JASPI) .end(); ResourceTransformationDescriptionBuilder builder = subsystemBuilder.addChildResource(UndertowExtension.PATH_FILTERS) .addChildResource(PathElement.pathElement(Constants.MOD_CLUSTER)); builder.rejectChildResource(NoAffinityResourceDefinition.PATH); builder.discardChildResource(SingleAffinityResourceDefinition.PATH); builder.rejectChildResource(RankedAffinityResourceDefinition.PATH); }
Source:
<code>public Iterable<Object> orderedKeys() { <START> return Collections.list(keys()); <END> }</code><technical_language>I return keys direct;ly I do added of current solution: java Set<Object> orderedKeys() { return keys; }</technical_language>

Target:
Set<Object> orderedKeys() { return keys; }
Source:
<code>public void visitNode(Tree tree) { if (!hasSemantic()) { return; } SwitchStatementTree switchStatementTree = (SwitchStatementTree) tree; <START> Optional<CaseLabelTree> defaultLabel = getDefaultLabel(switchStatementTree); <END> if (!defaultLabel.isPresent()) { if (!isSwitchOnEnum(switchStatementTree)) { reportIssue(switchStatementTree.switchKeyword(), "Add a default case to this switch."); } else if (missingCasesOfEnum(switchStatementTree)) { reportIssue(switchStatementTree.switchKeyword(), "Complete cases by adding the missing enum constants or add a default case to this switch."); } } }</code><technical_language>step more in simplifying rule: Change this method return a boolean: hasNoDefault(switchStatementTree) return allLabels(switchStatementTree).noneMatch(SwitchLastCaseIsDefaultCheck::isDefault);</technical_language>

Target:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } SwitchStatementTree switchStatementTree = (SwitchStatementTree) tree; if (getDefaultLabel(switchStatementTree)) { if (!isSwitchOnEnum(switchStatementTree)) { reportIssue(switchStatementTree.switchKeyword(), "Add a default case to this switch."); } else if (missingCasesOfEnum(switchStatementTree)) { reportIssue(switchStatementTree.switchKeyword(), "Complete cases by adding the missing enum constants or add a default case to this switch."); } } }
Source:
<code>protected Response performRemove(String id) { <START> DiskImage diskImage = (DiskImage) DiskSnapshotMapper.map(getDeviceSubResource(id).get(), null); <END> return performAction(VdcActionType.RemoveDiskSnapshots, new RemoveDiskSnapshotsParameters(diskImage)); }</code><technical_language>1) is getDeviceSubResource(id).get() necessary? id of disk. avoid additional query? 2) above, consider mapping locator</technical_language>

Target:
protected Response performRemove(String id) { return performAction(VdcActionType.RemoveDiskSnapshots, new RemoveDiskSnapshotsParameters(Guid.createGuidFromString(id))); }
Source:
<code>public boolean isIgnored(String fullyQualifiedName) { if (getIgnoreFilters() != null) { for (StringMatcher ignoreFilter : getIgnoreFilters()) { <START> String fullyQualifiedName1 = fullyQualifiedName; <END> if (ignoreFilter.match(fullyQualifiedName1)) { return true; } } } return false; }</code><technical_language>is a fullyQualifiedName1 ? I patch introduce ..</technical_language>

Target:
public boolean isIgnored(String fullyQualifiedName) { StringMatcher[] ignoreFilters= getIgnoreFilters(); if (ignoreFilters != null) { for (StringMatcher ignoreFilter : ignoreFilters) { if (ignoreFilter.match(fullyQualifiedName)) { return true; } } } return false; }
Source:
<code>public void changePermission(User user, Permission permission) throws CancellationException, InterruptedException; public boolean hasWriteAccess(); public User getHost(); public boolean isHost(); public void addUser(User user); public void userStartedQueuing(final User user); public void userFinishedProjectNegotiation(final User user); public void removeUser(User user); public void kickUser(User user); public void addListener(ISessionListener listener); public void removeListener(ISessionListener listener); <START> default void disposeProject(IProject project) { <END> }</code><technical_language>if remove project sharing ? I guess inconsistency warnings I is broadcast</technical_language>

Target:
public void changePermission(User user, Permission permission) throws CancellationException, InterruptedException; public boolean hasWriteAccess(); public User getHost(); public boolean isHost(); public void addUser(User user); public void userStartedQueuing(final User user); public void userFinishedProjectNegotiation(final User user); public void removeUser(User user); public void kickUser(User user); public void addListener(ISessionListener listener); public void removeListener(ISessionListener listener); default void setActivityExecution(IProject project, boolean enabled) { }
Source:
<code>private Position parseCommandResponse(Channel channel, SocketAddress remoteAddress, ChannelBuffer buf) { DeviceSession deviceSession = getDeviceSession(channel, remoteAddress); if (deviceSession == null) { return null; } Position position = new Position(); position.setProtocol(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); getLastLocation(position, null); <START> position.set(Position.KEY_RESULT, buf.readBytes(129).toString(StandardCharsets.UTF_8)); <END> return position; }</code><technical_language>need trim this string. Also, re-use CMD_RESPONSE_SIZE constant here</technical_language>

Target:
private Position parseCommandResponse(Channel channel, SocketAddress remoteAddress, ChannelBuffer buf) { DeviceSession deviceSession = getDeviceSession(channel, remoteAddress); if (deviceSession == null) { return null; } Position position = new Position(); position.setProtocol(getProtocolName()); position.setDeviceId(deviceSession.getDeviceId()); getLastLocation(position, null); int responseTextLength = buf.bytesBefore((byte) 0); if (responseTextLength < 0) { responseTextLength = CMD_RESPONSE_SIZE - 3; } position.set(Position.KEY_RESULT, buf.readBytes(responseTextLength).toString(StandardCharsets.UTF_8)); return position; }
Source:
<code>private void createNewExperimentNameGroup(Composite parent) { Font font = parent.getFont(); Composite folderGroup = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2; folderGroup.setLayout(layout); folderGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); GridData data = new GridData(GridData.FILL_HORIZONTAL); <START> data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; <END> String name = fExperiment.getName(); Label newExperimentLabel = new Label(folderGroup, SWT.NONE); newExperimentLabel.setFont(font); newExperimentLabel.setText(Messages.CopyExperimentDialog_ExperimentNewName); fNewExperimentName = new Text(folderGroup, SWT.BORDER); data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; fNewExperimentName.setLayoutData(data); fNewExperimentName.setFont(font); fNewExperimentName.setFocus(); fNewExperimentName.setText(name); fNewExperimentName.setSelection(0, name.length()); fNewExperimentName.addListener(SWT.Modify, new Listener() { @Override public void handleEvent(Event event) { validateNewExperimentName(); } }); }</code><technical_language>Unused instance</technical_language>

Target:
private void createNewExperimentNameGroup(Composite parent) { Font font = parent.getFont(); Composite folderGroup = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2; folderGroup.setLayout(layout); folderGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); String name = fExperiment.getName(); Label newExperimentLabel = new Label(folderGroup, SWT.NONE); newExperimentLabel.setFont(font); newExperimentLabel.setText(Messages.CopyExperimentDialog_ExperimentNewName); fNewExperimentName = new Text(folderGroup, SWT.BORDER); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; fNewExperimentName.setLayoutData(data); fNewExperimentName.setFont(font); fNewExperimentName.setFocus(); fNewExperimentName.setText(name); fNewExperimentName.setSelection(0, name.length()); fNewExperimentName.addListener(SWT.Modify, new Listener() { @Override public void handleEvent(Event event) { validateNewExperimentName(); } }); }
Source:
<code>public void processRead(InputStream in, OutputStream out, byte frameHeader) throws IOException { WebSocketMessage message = null; int opcode = (frameHeader & 0x0F); String readableOpcode = WebSocketMessage.opcode2string(opcode); logger.debug("Process WebSocket frame: " + opcode + " (" + readableOpcode + ")"); if (WebSocketMessage.isControl(opcode)) { message = createWebSocketMessage(in, frameHeader); <START> if(message.getOpcode() == WebSocketMessage.OPCODE_PING && automaticalyPingPong){ <END> logger.info("I get a ping response"); sendPongResponse(message); } } else { boolean shouldContinueMessage = unfinishedMessages.containsKey(in); if (opcode == WebSocketMessage.OPCODE_CONTINUATION) { if (shouldContinueMessage) { message = unfinishedMessages.remove(in); message.readContinuation(in, frameHeader); } else { handleInvalidContinuation(in, out, frameHeader); return; } } else { message = createWebSocketMessage(in, frameHeader); } if (!message.isFinished()) { unfinishedMessages.put(in, message); } } if (isForwardOnly || notifyMessageObservers(message)) { notifyMessageSenderListeners(message, Initiator.PROXY); message.forward(out); } }</code><technical_language>Do a case for automatically handling pings? If suggest handling this implementation detail send pongs in client mode</technical_language>

Target:
public void processRead(InputStream in, OutputStream out, byte frameHeader) throws IOException { WebSocketMessage message = null; int opcode = (frameHeader & 0x0F); String readableOpcode = WebSocketMessage.opcode2string(opcode); logger.debug("Process WebSocket frame: " + opcode + " (" + readableOpcode + ")"); if (WebSocketMessage.isControl(opcode)) { message = createWebSocketMessage(in, frameHeader); if (!Mode.PROXY.equals(mode) && message.getOpcode() == WebSocketMessage.OPCODE_PING) { sendPongResponse(message); } } else { boolean shouldContinueMessage = unfinishedMessages.containsKey(in); if (opcode == WebSocketMessage.OPCODE_CONTINUATION) { if (shouldContinueMessage) { message = unfinishedMessages.remove(in); message.readContinuation(in, frameHeader); } else { handleInvalidContinuation(in, out, frameHeader); return; } } else { message = createWebSocketMessage(in, frameHeader); } if (!message.isFinished()) { unfinishedMessages.put(in, message); } } if (isForwardOnly || notifyMessageObservers(message)) { notifyMessageSenderListeners(message, Initiator.PROXY); message.forward(out); } }
Source:
<code>private void assureVectorSize() { int requiredVectorLength = min(nextBatchSize, MAX_BATCH_SIZE); if (nullVector.length < requiredVectorLength) { nullVector = new boolean[requiredVectorLength]; scaleVector = new long[requiredVectorLength]; <START> <END> systemMemoryContext.setBytes(requiredVectorLength * 9); } }</code><technical_language>Unnecessary whitespace</technical_language>

Target:
private void assureVectorSize() { int requiredVectorLength = min(nextBatchSize, MAX_BATCH_SIZE); if (nullVector.length < requiredVectorLength) { nullVector = new boolean[requiredVectorLength]; scaleVector = new long[requiredVectorLength]; systemMemoryContext.setBytes(getRetainedSizeInBytes()); } }
Source:
<code>private String formatAmmo(Mounted m) { StringBuffer sb = new StringBuffer(64); int ammoIndex = m.getDesc().indexOf( Messages.getString("MechDisplay.0")); int loc = m.getLocation(); if (!m.getEntity().equals(entity)) { <START> sb.append('['+ "TR] "); END> } else if (loc != Entity.LOC_NONE) { sb.append('[').append(entity.getLocationAbbr(loc)).append("] "); } if (ammoIndex == -1) { sb.append(m.getDesc()); } else { sb.append(m.getDesc().substring(0, ammoIndex)); sb.append(m.getDesc().substring(ammoIndex + 4)); } if (m.isHotLoaded()) { sb.append(Messages.getString("MechDisplay.isHotLoaded")); } return sb.toString(); }</code><technical_language>suggestion sb.append("[TR] "); //$NON-NLS-1$</technical_language>

Target:
private String formatAmmo(Mounted m) { StringBuffer sb = new StringBuffer(64); int ammoIndex = m.getDesc().indexOf( Messages.getString("MechDisplay.0")); int loc = m.getLocation(); if (!m.getEntity().equals(entity)) { sb.append("[TR] "); } else if (loc != Entity.LOC_NONE) { sb.append('[').append(entity.getLocationAbbr(loc)).append("] "); } if (ammoIndex == -1) { sb.append(m.getDesc()); } else { sb.append(m.getDesc().substring(0, ammoIndex)); sb.append(m.getDesc().substring(ammoIndex + 4)); } if (m.isHotLoaded()) { sb.append(Messages.getString("MechDisplay.isHotLoaded")); } return sb.toString(); }
Source:
<code>protected VolumeList addVolumeToOwnerList(VolumeList volumeList, String volume, String owner, long maxUserVolumeCount, long txID) throws IOException { if (volumeList != null && volumeList.getVolumeNamesList().size() >= maxUserVolumeCount) { throw new OMException("Too many volumes for user:" + owner, OMException.ResultCodes.USER_TOO_MANY_VOLUMES); } List<String> prevVolList = new ArrayList<>(); <START> long objectID = 100; <END> if (volumeList != null) { prevVolList.addAll(volumeList.getVolumeNamesList()); objectID = volumeList.getObjectID(); } prevVolList.add(volume); VolumeList newVolList = VolumeList.newBuilder() .setObjectID(objectID) .setUpdateID(txID) .addAllVolumeNames(prevVolList).build(); return newVolList; }</code><technical_language>Is a reason for initialize objectID 100 for new volume</technical_language>

Target:
protected VolumeList addVolumeToOwnerList(VolumeList volumeList, String volume, String owner, long maxUserVolumeCount, long txID) throws IOException { if (volumeList != null && volumeList.getVolumeNamesList().size() >= maxUserVolumeCount) { throw new OMException("Too many volumes for user:" + owner, OMException.ResultCodes.USER_TOO_MANY_VOLUMES); } List<String> prevVolList = new ArrayList<>(); long objectID = txID; if (volumeList != null) { prevVolList.addAll(volumeList.getVolumeNamesList()); objectID = volumeList.getObjectID(); } prevVolList.add(volume); VolumeList newVolList = VolumeList.newBuilder() .setObjectID(objectID) .setUpdateID(txID) .addAllVolumeNames(prevVolList).build(); return newVolList; }
Source:
<code>public static ZkHostDomainPartition create(ZooKeeperPlus zk, String domainPath, int partNum, int initialDomainGroupVersion) throws IOException { try { String hdpPath = domainPath + "/" + partNum; zk.create(hdpPath, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); zk.create(hdpPath + UPDATING_TO_VERSION_PATH_SEGMENT, initialDomainGroupVersion, CreateMode.PERSISTENT); <START> zk.create(hdpPath + "/counters", 0, CreateMode.PERSISTENT); <END> return new ZkHostDomainPartition(zk, hdpPath); } catch (Exception e) { throw new IOException(e); } }</code><technical_language>is a reason setting of this node 0? value</technical_language>

Target:
public static ZkHostDomainPartition create(ZooKeeperPlus zk, String domainPath, int partNum, int initialDomainGroupVersion) throws IOException { try { String hdpPath = domainPath + "/" + partNum; zk.create(hdpPath, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); zk.create(hdpPath + UPDATING_TO_VERSION_PATH_SEGMENT, initialDomainGroupVersion, CreateMode.PERSISTENT); zk.create(hdpPath + "/counters", null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); return new ZkHostDomainPartition(zk, hdpPath); } catch (Exception e) { throw new IOException(e); } }
Source:
<code><START> public static final Map<String, List<String>> getResourceNames(String path) { <END> final HMODULE target = Kernel32.INSTANCE.LoadLibraryEx(path, null, Kernel32.LOAD_LIBRARY_AS_DATAFILE); final List<String> types = new ArrayList<String>(); WinBase.EnumResTypeProc ertp = new WinBase.EnumResTypeProc() { @Override public boolean invoke(HMODULE module, Pointer type, Pointer lParam) { if (Pointer.nativeValue(type) < 65535) { types.add(Pointer.nativeValue(type) + ""); } else { types.add(type.getWideString(0)); } return true; } }; Kernel32.INSTANCE.EnumResourceTypes(target, ertp, null); final Map<String, List<String>> result = new LinkedHashMap<String, List<String>>(); for (final String typeName : types) { result.put(typeName, new ArrayList<String>()); Pointer pointer = null; try { pointer = new Pointer(Long.parseLong(typeName)); } catch (Exception e) { pointer = new Memory(Native.WCHAR_SIZE * (typeName.length() + 1)); pointer.setWideString(0, typeName); } Kernel32.INSTANCE.EnumResourceNames(target, pointer, new WinBase.EnumResNameProc() { @Override public boolean invoke(HMODULE module, Pointer t, Pointer name, Pointer lParam) { if (Pointer.nativeValue(name) < 65535) { result.get(typeName).add(Pointer.nativeValue(name) + ""); } else { result.get(typeName).add(name.getWideString(0)); } return true; } }, null); } return result; }</code><technical_language>Drop _final_ modifier</technical_language>

Target:
public static Map<String, List<String>> getResourceNames(String path) { final HMODULE target = Kernel32.INSTANCE.LoadLibraryEx(path, null, Kernel32.LOAD_LIBRARY_AS_DATAFILE); final List<String> types = new ArrayList<String>(); WinBase.EnumResTypeProc ertp = new WinBase.EnumResTypeProc() { @Override public boolean invoke(HMODULE module, Pointer type, Pointer lParam) { if (Pointer.nativeValue(type) < 65535) { types.add(Pointer.nativeValue(type) + ""); } else { types.add(type.getWideString(0)); } return true; } }; Kernel32.INSTANCE.EnumResourceTypes(target, ertp, null); final Map<String, List<String>> result = new LinkedHashMap<String, List<String>>(); for (final String typeName : types) { result.put(typeName, new ArrayList<String>()); Pointer pointer = null; try { pointer = new Pointer(Long.parseLong(typeName)); } catch (Exception e) { pointer = new Memory(Native.WCHAR_SIZE * (typeName.length() + 1)); pointer.setWideString(0, typeName); } Kernel32.INSTANCE.EnumResourceNames(target, pointer, new WinBase.EnumResNameProc() { @Override public boolean invoke(HMODULE module, Pointer t, Pointer name, Pointer lParam) { if (Pointer.nativeValue(name) < 65535) { result.get(typeName).add(Pointer.nativeValue(name) + ""); } else { result.get(typeName).add(name.getWideString(0)); } return true; } }, null); } return result; }
Source:
<code>private static String reportOnIncompatibility(ConfiguredTarget target) { Preconditions.checkNotNull(target); String message = "\nDependency chain:"; IncompatiblePlatformProvider provider = null; while (target != null) { <START> message += "\n " + target.getLabel().toString(); <END> provider = target.getProvider(IncompatiblePlatformProvider.class); target = provider.getTargetResponsibleForIncompatibility(); } message += " <-- target platform didn't satisfy constraint " + provider.getConstraintResponsibleForIncompatibility().label().toString(); return message; }</code><technical_language>Nit: toString() call line 205 needed</technical_language>

Target:
private static String reportOnIncompatibility(ConfiguredTarget target) { Preconditions.checkNotNull(target); String message = "\nDependency chain:"; IncompatiblePlatformProvider provider = null; while (target != null) { message += "\n " + target.getLabel(); provider = target.getProvider(IncompatiblePlatformProvider.class); ImmutableList<ConfiguredTarget> targetList = provider.targetsResponsibleForIncompatibility(); if (targetList == null) { target = null; } else { target = targetList.get(0); } } message += " <-- target platform didn't satisfy constraint"; if (provider.constraintsResponsibleForIncompatibility().size() == 1) { message += " " + provider.constraintsResponsibleForIncompatibility().get(0).label(); return message; } message += "s ["; boolean first = true; for (ConstraintValueInfo constraintValueInfo : provider.constraintsResponsibleForIncompatibility()) { if (first) { first = false; } else { message += ", "; } message += constraintValueInfo.label(); } message += "]"; return message; }
Source:
<code>public void setItems(Collection<T> value, T selectedItem) { List<T> items = new ArrayList<>(value); <START> if (items.get(0) != null) <END> { items.add(0, null); } super.setItems(items, selectedItem); }</code><technical_language>this fail if "value" is empty collection</technical_language>

Target:
public void setItems(Collection<T> value, T selectedItem) { List<T> items = value == null ? new ArrayList<>() : new ArrayList<>(value); if (items.isEmpty() || items.get(0) != null) { items.add(0, null); } super.setItems(items, selectedItem); }
Source:
<code>public static void proceedToNextStateFrom(InstallState prior) { InstallState next = getNextInstallState(prior); <START> LOGGER.log(Main.isDevelopmentMode ? Level.INFO : Level.FINE, "Install state transitioning from: " + prior + " to: " + next); <END> if (next != null) { Jenkins.getInstance().setInstallState(next); } }</code><technical_language>NIT: parameterized logging java LOGGER.log(Main.isDevelopmentMode ? Level.INFO : Level.FINE, "Install state transitioning from: {0} to: {1}", new Object[] {from, to});</technical_language>

Target:
public static void proceedToNextStateFrom(InstallState prior) { InstallState next = getNextInstallState(prior); if (next != null) { Jenkins.getInstance().setInstallState(next); } }
Source:
<code><START> protected final void lockAndRegisterBackupLock(TxInvocationContext ctx, Object key) throws InterruptedException { <END> if (cll.localNodeOwnsLock(key)) { lockKeyAndCheckOwnership(ctx, key); } else if (cll.localNodeIsOwner(key)) { ctx.getCacheTransaction().addBackupLockForKey(key); } }</code><technical_language>Lock register backup lock</technical_language>

Target:
protected final void lockAndRegisterBackupLock(TxInvocationContext ctx, Object key) throws InterruptedException { if (cdl.localNodeIsPrimaryOwner(key)) { lockKeyAndCheckOwnership(ctx, key); } else if (cdl.localNodeIsOwner(key)) { ctx.getCacheTransaction().addBackupLockForKey(key); } }
Source:
<code>public String get(String macPoolId, String macPoolName) { if (macPoolId != null) { return macPoolId; } if (macPoolName != null) { MacPool macPoolByName = callerResource.getEntity(MacPool.class, VdcQueryType.GetMacPoolByName, new NameQueryParameters(macPoolName), <START> null, <END> true); if (macPoolByName != null) { return macPoolByName.getId().toString(); } } return null; }</code><technical_language>I guess this requestedMacPoolName null, for a failure reporting</technical_language>

Target:
public String get(String macPoolId, String macPoolName) { if (macPoolId != null) { return macPoolId; } if (macPoolName != null) { MacPool macPoolByName = callerResource.getEntity(MacPool.class, VdcQueryType.GetMacPoolByName, new NameQueryParameters(macPoolName), macPoolName, true); if (macPoolByName != null) { return macPoolByName.getId().toString(); } } return null; }
Source:
<code>private void preprocessParameters(StudentProfileAttributes studentProfile) { studentProfile.shortName = StringHelper.trimIfNotNull(studentProfile.shortName); studentProfile.email = StringHelper.trimIfNotNull(studentProfile.email); <START> studentProfile.gender = GenderType.valueOf(String.valueOf(studentProfile.gender)); <END> studentProfile.nationality = StringHelper.trimIfNotNull(studentProfile.nationality); studentProfile.institute = StringHelper.trimIfNotNull(studentProfile.institute); studentProfile.moreInfo = StringHelper.trimIfNotNull(studentProfile.moreInfo); }</code><technical_language>This line is redundant. Remove it</technical_language>

Target:
private void preprocessParameters(StudentProfileAttributes studentProfile) { studentProfile.shortName = StringHelper.trimIfNotNull(studentProfile.shortName); studentProfile.email = StringHelper.trimIfNotNull(studentProfile.email); studentProfile.nationality = StringHelper.trimIfNotNull(studentProfile.nationality); studentProfile.institute = StringHelper.trimIfNotNull(studentProfile.institute); studentProfile.moreInfo = StringHelper.trimIfNotNull(studentProfile.moreInfo); }
Source:
<code>public void declarativeWithSCMEnvVars() throws Exception { WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "job with dir"); p.setDefinition(new CpsFlowDefinition(loadPipelineScript("declarativeWithSCMEnvVars.groovy"), true)); WorkflowRun b = p.scheduleBuild2(0).waitForStart(); assertNotNull(b); r.assertBuildStatusSuccess((r.waitForCompletion(b))); <START> r.assertLogNotContains("GIT_COMMIT is null", b); <END> }</code><technical_language>check log contains GIT_COMMIT is</technical_language>

Target:
public void declarativeWithSCMEnvVars() throws Exception { prepRepoWithJenkinsfile("declarativeWithSCMEnvVars.groovy"); WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "job with dir"); p.setDefinition(new CpsScmFlowDefinition(new GitStep(sampleRepo.toString()).createSCM(), "Jenkinsfile")); WorkflowRun b = p.scheduleBuild2(0).waitForStart(); assertNotNull(b); r.assertBuildStatusSuccess((r.waitForCompletion(b))); r.assertLogNotContains("GIT_COMMIT is null", b); r.assertLogContains("GIT_COMMIT is ", b); }
Source:
<code>public void registerRequest(int type, String path) { if (sampler.nextFloat() <= REQUEST_PREPROCESS_SAMPLE_RATE) { PathStatsQueue pathStatsQueue = immutableRequestsMap.get(Request.op2String(type)); if (pathStatsQueue != null) { pathStatsQueue.registerRequest(path); } else { LOG.error("We should not handle {}", type); <START> } <END> } }</code><technical_language>is this method ? in admin command</technical_language>

Target:
public void registerRequest(int type, String path) { if (!enabled) return; if (sampler.nextFloat() <= REQUEST_PREPROCESS_SAMPLE_RATE) { PathStatsQueue pathStatsQueue = immutableRequestsMap.get(Request.op2String(type)); if (pathStatsQueue != null) { pathStatsQueue.registerRequest(path); } else { LOG.error("We should not handle {}", type); } } }
Source:
<code>public void defaultApplicationIdUserAgentTest() throws Exception { final HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(new NoOpHttpClient() { @Override public Mono<HttpResponse> send(HttpRequest request) { String header = request.getHeaders().getValue("User-Agent"); String expectedHeaderPrefix = "azsdk-java-package.name"; Assertions.assertTrue(header.startsWith(expectedHeaderPrefix)); return Mono.just(new MockHttpResponse(request, 200)); } }) .policies(new UserAgentPolicy( null, "package.name", "package_version", Configuration.NONE, () -> "1.0")) .build(); <START> HttpResponse response = pipeline.send(new HttpRequest(HttpMethod.GET, <END> new URL("http://localhost"))).block(); Assertions.assertEquals(200, response.getStatusCode()); }</code><technical_language>StepVerifier .block()</technical_language>

Target:
public void defaultApplicationIdUserAgentTest() throws Exception { final HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(new NoOpHttpClient() { @Override public Mono<HttpResponse> send(HttpRequest request) { String header = request.getHeaders().getValue("User-Agent"); String expectedHeaderPrefix = "azsdk-java-package.name"; Assertions.assertTrue(header.startsWith(expectedHeaderPrefix)); return Mono.just(new MockHttpResponse(request, 200)); } }) .policies(new UserAgentPolicy( null, "package.name", "package_version", Configuration.NONE, () -> "1.0")) .build(); Mono<HttpResponse> response = pipeline.send(new HttpRequest(HttpMethod.GET, new URL("http://localhost"))); StepVerifier.create(response) .expectNextMatches(httpResponse -> { assertEquals(200, httpResponse.getStatusCode()); assertTrue(httpResponse.getRequest().getHeaders().getValue("User-Agent").startsWith("azsdk")); return true; }) .verifyComplete(); }
Source:
<code>protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == RequestCodes.DO_LOGIN) { if (resultCode == RESULT_OK) { initShareFragment(true); <START> } else { <END> finish(); } } }</code><technical_language>this changeset killed a small shortcut here: if user shares text site, show picker opened editor directly</technical_language>

Target:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == RequestCodes.DO_LOGIN) { if (resultCode == RESULT_OK) { refreshContent(); } else { finish(); } } }