auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private TypeDefinition parseType( String typeName ) throws IOException, ParserException { <START> TypeDefinition currentType = null; <END> NativeType nativeType = readNativeType(); if ( nativeType == null ) { currentType = new TypeDefinitionLink( getContext(), typeName, Constants.RANGE_ONE_TO_ONE, token.content() ); getToken(); } else { getToken(); if ( nativeType.equals(NativeType.NativeTypeEnum.STRING) && token.is(Scanner.TokenType.LPAREN) ) { getToken(); currentType = new TypeInlineDefinition(getContext(), typeName, nativeType, token.content(), Constants.RANGE_ONE_TO_ONE); getToken(); eat(Scanner.TokenType.RPAREN, "expected right parenthesis"); } else { currentType = new TypeInlineDefinition( getContext(), typeName, nativeType, Constants.RANGE_ONE_TO_ONE); } if ( token.is( Scanner.TokenType.LCURLY ) ) { parseSubTypes((TypeInlineDefinition) currentType); } } if ( token.is( Scanner.TokenType.PARALLEL ) ) { getToken(); final TypeDefinition secondType = parseType( typeName ); final TypeChoiceDefinition choiceDefinition = new TypeChoiceDefinition( getContext(), typeName, Constants.RANGE_ONE_TO_ONE, currentType, secondType ); return choiceDefinition; } return currentType; }</code><technical_language>add = null</technical_language>

Target:
private TypeDefinition parseType( String typeName ) throws IOException, ParserException { TypeDefinition currentType; NativeType nativeType = readNativeType(); if ( nativeType == null ) { currentType = new TypeDefinitionLink( getContext(), typeName, Constants.RANGE_ONE_TO_ONE, token.content() ); getToken(); } else { getToken(); if ( nativeType.equals(NativeType.NativeTypeEnum.STRING) && token.is(Scanner.TokenType.LPAREN) ) { getToken(); currentType = new TypeInlineDefinition(getContext(), typeName, (StringType) nativeType, token.content(), Constants.RANGE_ONE_TO_ONE); getToken(); eat(Scanner.TokenType.RPAREN, "expected right parenthesis"); } else { currentType = new TypeInlineDefinition( getContext(), typeName, nativeType, Constants.RANGE_ONE_TO_ONE); } if ( token.is( Scanner.TokenType.LCURLY ) ) { parseSubTypes( (TypeInlineDefinition) currentType ); } } if ( token.is( Scanner.TokenType.PARALLEL ) ) { getToken(); final TypeDefinition secondType = parseType( typeName ); final TypeChoiceDefinition choiceDefinition = new TypeChoiceDefinition( getContext(), typeName, Constants.RANGE_ONE_TO_ONE, currentType, secondType ); return choiceDefinition; } return currentType; }
Source:
<code>protected String[] customCommandLineValidation() { if (PROGRAM.isEmpty()) { return new String[]{"No programs specified with PROGRAM"}; } programsToRun = new LinkedHashSet<>(PROGRAM); <START> checkRInstallation(true); <END> return super.customCommandLineValidation(); }</code><technical_language>is this true</technical_language>

Target:
protected String[] customCommandLineValidation() { final List<String> errorMsgs = new ArrayList<String>(); if (PROGRAM.isEmpty()) { errorMsgs.add("No programs specified with PROGRAM"); } programsToRun = new LinkedHashSet<>(PROGRAM); if (!checkRInstallation(true)) { errorMsgs.add("R is not installed on this machine. It is required for creating the chart."); } return errorMsgs.isEmpty() ? null : errorMsgs.toArray(new String[errorMsgs.size()]); }
Source:
<code>public void defineMappings(Cache cache, SearchMapping searchMapping) { searchMapping.entity(ProtobufValueWrapper.class) .indexed() <START> .indexName(cache.getName() + "--" + ProtobufValueWrapperAnalyzerDiscriminator.class.getName()) <END> .analyzerDiscriminator(ProtobufValueWrapperAnalyzerDiscriminator.class) .classBridgeInstance(new ProtobufValueWrapperFieldBridge(cache)) .norms(Norms.NO) .analyze(Analyze.NO) .store(Store.NO); }</code><technical_language>simply .indexName(cache.getName())? index name is stored in of entries of lucene caches, a bit worried large strings</technical_language>

Target:
public void defineMappings(Cache cache, SearchMapping searchMapping) { searchMapping.entity(ProtobufValueWrapper.class) .indexed() .indexName(cache.getName() + INDEX_NAME_SUFFIX) .analyzerDiscriminator(ProtobufValueWrapperAnalyzerDiscriminator.class) .classBridgeInstance(new ProtobufValueWrapperFieldBridge(cache)) .norms(Norms.NO) .analyze(Analyze.NO) .store(Store.NO); }
Source:
<code>public boolean checkAndMaintain(final long hostId) { boolean hostInMaintenance = false; final HostVO host = _hostDao.findById(hostId); try { if (host.getType() != Host.Type.Storage) { final List<VMInstanceVO> vos = _vmDao.listByHostId(hostId); final List<VMInstanceVO> vosMigrating = _vmDao.listVmsMigratingFromHost(hostId); final List<VMInstanceVO> failedMigratedVms = _vmDao.listRunningVmsByHostAndLastHostSameId(hostId); <START> if (vos.isEmpty() && vosMigrating.isEmpty() && failedMigratedVms.isEmpty()) { <END> resourceStateTransitTo(host, ResourceState.Event.InternalEnterMaintenance, _nodeId); hostInMaintenance = true; ActionEventUtils.onCompletedActionEvent(CallContext.current().getCallingUserId(), CallContext.current().getCallingAccountId(), EventVO.LEVEL_INFO, EventTypes.EVENT_MAINTENANCE_PREPARE, "completed maintenance for host " + hostId, 0); } } } catch (final NoTransitionException e) { s_logger.debug("Cannot transmit host " + host.getId() + "to Maintenance state", e); } return hostInMaintenance; }</code><technical_language>this condition means private boolean allMigrationWorkDone(){ final List<VMInstanceVO> vos = _vmDao.listByHostId(hostId); final List<VMInstanceVO> vosMigrating = _vmDao.listVmsMigratingFromHost(hostId); final List<VMInstanceVO> failedMigratedVms = _vmDao.listRunningVmsByHostAndLastHostSameId(hostId); return vos.isEmpty() && vosMigrating.isEmpty() && failedMigratedVms.isEmpty(); } create method</technical_language>

Target:
public boolean checkAndMaintain(final long hostId) { boolean hostInMaintenance = false; final HostVO host = _hostDao.findById(hostId); try { if (host.getType() != Host.Type.Storage) { final List<VMInstanceVO> vos = _vmDao.listByHostId(hostId); final List<VMInstanceVO> vosMigrating = _vmDao.listVmsMigratingFromHost(hostId); final List<VMInstanceVO> failedVmMigrations = _vmDao.listNonMigratingVmsByHostEqualsLastHost(hostId); hostInMaintenance = isHostInMaintenance(host, vos, vosMigrating, failedVmMigrations); } } catch (final NoTransitionException e) { s_logger.debug("Cannot transmit host " + host.getId() + "to Maintenance state", e); } return hostInMaintenance; }
Source:
<code>public void messageReceived(UPBMessage message) { <START> if (message.getType() == Type.MESSAGE_REPORT) { <END> String sourceName = getItemName(message.getSource(), false); String destinationName = getItemName(message.getDestination(), message.getControlWord().isLink()); UPBBindingConfig sourceConfig = getConfig(sourceName); UPBBindingConfig destinationConfig = getConfig(destinationName); String itemName = isValidId(message.getDestination()) ? destinationName : sourceName; UPBBindingConfig config = isValidId(message.getDestination()) ? destinationConfig : sourceConfig; if (itemName != null && config != null) { State newState = null; byte level = 100; switch (message.getCommand()) { case GOTO: case DEVICE_STATE: case ACTIVATE: if (message.getArguments() != null && message.getArguments().length > 0) { level = message.getArguments()[0]; } else { level = (byte) (message.getCommand() == UPBMessage.Command.ACTIVATE ? 100 : 0); } if (level == -1 || level >= 100 || (level > 0 && !config.isDimmable())) { newState = OnOffType.ON; } else if (level == 0) { newState = OnOffType.OFF; } else { newState = new PercentType(level); } break; case DEACTIVATE: newState = OnOffType.OFF; break; default: break; } if (newState != null) { logger.debug("Posting update: {},{}", itemName, newState); eventPublisher.postUpdate(itemName, newState); } } else { logger.debug("Received message for unknown with id {}.", message.getControlWord().isLink() ? "Link" : "Device", message.getDestination() & 0xff); } } }</code><technical_language>a good idea invert this if statement. critical, of course</technical_language>

Target:
public void messageReceived(UPBMessage message) { if (message.getType() != Type.MESSAGE_REPORT) { return; } String sourceName = getItemName(message.getSource(), false); String destinationName = getItemName(message.getDestination(), message.getControlWord().isLink()); UPBBindingConfig sourceConfig = getConfig(sourceName); UPBBindingConfig destinationConfig = getConfig(destinationName); String itemName = isValidId(message.getDestination()) ? destinationName : sourceName; UPBBindingConfig config = isValidId(message.getDestination()) ? destinationConfig : sourceConfig; if (itemName == null || config == null) { logger.debug("Received message for unknown with id {}.", message.getControlWord().isLink() ? "Link" : "Device", message.getDestination() & 0xff); return; } State newState = null; byte level = 100; switch (message.getCommand()) { case GOTO: case DEVICE_STATE: case ACTIVATE: if (message.getArguments() != null && message.getArguments().length > 0) { level = message.getArguments()[0]; } else { level = (byte) (message.getCommand() == UPBMessage.Command.ACTIVATE ? 100 : 0); } if (level == -1 || level >= 100 || (level > 0 && !config.isDimmable())) { newState = OnOffType.ON; } else if (level == 0) { newState = OnOffType.OFF; } else { newState = new PercentType(level); } break; case DEACTIVATE: newState = OnOffType.OFF; break; default: break; } if (newState != null) { logger.debug("Posting update: {},{}", itemName, newState); eventPublisher.postUpdate(itemName, newState); } }
Source:
<code><START> public String[] getSupportedAbis() { <END> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && Build.SUPPORTED_ABIS.length > 0) { return Build.SUPPORTED_ABIS; } else { return new String[] { Build.CPU_ABI, Build.CPU_ABI2 }; } }</code><technical_language>static</technical_language>

Target:
public static String[] getSupportedAbis() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && Build.SUPPORTED_ABIS.length > 0) { return Build.SUPPORTED_ABIS; } else { return new String[] { Build.CPU_ABI, Build.CPU_ABI2 }; } }
Source:
<code>public void runMultipleActionFailed(VdcActionType action, List<VdcReturnValueBase> returnValues, List<VdcFault> faults) { String actionStr = EnumTranslator.createAndTranslate(action); List<Message> errors = new ArrayList<Message>(); int actionNum = 0; for (VdcReturnValueBase v : returnValues) { ++actionNum; if (isRaiseErrorModalPanel(action, v.getFault())) { for (String canDo : v.getCanDoActionMessages()) { String description = <START> (v.getDescription() != null && !"".equals(v.getDescription().trim())) || returnValues.size() == 1 ? v.getDescription() : "Action " + actionNum; END> Message msg = new Message(description, canDo); errors.add(msg); } } } for (VdcFault fault : faults) { if (isRaiseErrorModalPanel(action, fault)) { Message msg = new Message(actionStr, fault.getMessage()); errors.add(msg); } } errorPopupManager.show(ErrorMessageFormatter.formatMessages(errors)); }</code><technical_language>"Action" localized</technical_language>

Target:
public void runMultipleActionFailed(VdcActionType action, List<VdcReturnValueBase> returnValues, List<VdcFault> faults) { String actionStr = EnumTranslator.createAndTranslate(action); List<Message> errors = new ArrayList<Message>(); int actionNum = 0; for (VdcReturnValueBase v : returnValues) { ++actionNum; if (isRaiseErrorModalPanel(action, v.getFault())) { for (String canDo : v.getCanDoActionMessages()) { String description = (v.getDescription() != null && !"".equals(v.getDescription().trim())) || returnValues.size() == 1 ? v.getDescription() : ConstantsManager.getInstance().getConstants().action() + " " + actionNum; Message msg = new Message(description, canDo); errors.add(msg); } } } for (VdcFault fault : faults) { if (isRaiseErrorModalPanel(action, fault)) { Message msg = new Message(actionStr, fault.getMessage()); errors.add(msg); } } errorPopupManager.show(ErrorMessageFormatter.formatMessages(errors)); }
Source:
<code>private static synchronized Session session() { final Properties properties = new Properties(); <START> final ConfigurationProperties conf = EmailDispatchConfiguration.getConfiguration(); <END> properties.put("mail.smtp.host", conf.mailSmtpHost()); properties.put("mail.smtp.name", conf.mailSmtpName()); properties.put("mail.smtp.port", conf.mailSmtpPort()); properties.put("mailSender.max.recipients", conf.mailSenderMaxRecipients()); SESSION = Session.getDefaultInstance(properties, null); return SESSION; }</code><technical_language>spam final keywords in code is part of changeset</technical_language>

Target:
private static synchronized Session session() { final Properties properties = new Properties(); ConfigurationProperties conf = EmailDispatchConfiguration.getConfiguration(); properties.put("mail.smtp.host", conf.mailSmtpHost()); properties.put("mail.smtp.name", conf.mailSmtpName()); properties.put("mail.smtp.port", conf.mailSmtpPort()); properties.put("mailSender.max.recipients", conf.mailSenderMaxRecipients()); SESSION = Session.getDefaultInstance(properties, null); return SESSION; }
Source:
<code>public static void fetchUsers(String siteID, final int localTableBlogId, final PeopleUtils.Callback callback) { com.wordpress.rest.RestRequest.Listener listener = new RestRequest.Listener() { @Override public void onResponse(JSONObject jsonObject) { if (jsonObject != null) { try { JSONArray jsonArray = jsonObject.getJSONArray("users"); List<Person> people = peopleListFromJSON(jsonArray, localTableBlogId); <START> PeopleTable.savePeople(people); <END> if (callback != null) { callback.onSuccess(); } } catch (JSONException e) { AppLog.e(T.API, "JSON exception occurred while parsing the response for sites/%s/users: " + e); } } } }; RestRequest.ErrorListener errorListener = new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError volleyError) { AppLog.e(T.API, volleyError); if (callback != null) { callback.onError(volleyError); } } }; String path = String.format("sites/%s/users", siteID); WordPress.getRestClientUtilsV1_1().get(path, listener, errorListener); }</code><technical_language>fetchUsers() step fetching data backend continues saving in DB. I recommend unbundling extra step perform in callback instead. way, fetchUsers responsibility is simpler more testable</technical_language>

Target:
public static void fetchUsers(String siteID, final int localTableBlogId, final PeopleUtils.Callback callback) { com.wordpress.rest.RestRequest.Listener listener = new RestRequest.Listener() { @Override public void onResponse(JSONObject jsonObject) { if (jsonObject != null && callback != null) { try { JSONArray jsonArray = jsonObject.getJSONArray("users"); List<Person> people = peopleListFromJSON(jsonArray, localTableBlogId); callback.onSuccess(people); } catch (JSONException e) { AppLog.e(T.API, "JSON exception occurred while parsing the response for sites/%s/users: " + e); callback.onJSONException(e); } } } }; RestRequest.ErrorListener errorListener = new RestRequest.ErrorListener() { @Override public void onErrorResponse(VolleyError volleyError) { AppLog.e(T.API, volleyError); if (callback != null) { callback.onError(volleyError); } } }; String path = String.format("sites/%s/users", siteID); WordPress.getRestClientUtilsV1_1().get(path, listener, errorListener); }
Source:
<code>public boolean filterLogs(ActivityLogEntry logEntry){ if(!logEntry.toShow()){ return false; } if(q == null){ if (this.queryMessage == null){ this.queryMessage = "Error parsing the query. QueryParameters not created."; } return true; } if(q.toDate){ if(logEntry.getTime() > q.toDateValue){ return false; } } if(q.fromDate){ if(logEntry.getTime() < q.fromDateValue){ return false; } } if(q.request){ if(!arrayContains(q.requestValues, logEntry.getServletName())){ return false; } } if(q.response){ if(!arrayContains(q.responseValues, logEntry.getAction())){ return false; } } if(q.person){ if(!logEntry.getName().toLowerCase().contains(q.personValue) && !logEntry.getId().toLowerCase().contains(q.personValue) && !logEntry.getEmail().toLowerCase().contains(q.personValue)){ return false; } } if(q.role){ if(!arrayContains(q.roleValues, logEntry.getRole())){ return false; } } <START> if(q.timeTaken){ <END> if(logEntry.getTimeTaken() < q.timeTakenValue){ return false; } } if(shouldExcludeLogEntry(logEntry)){ return false; } return true; }</code><technical_language>q.timeTaken is a misleading name. Is time q</technical_language>

Target:
public boolean filterLogs(ActivityLogEntry logEntry){ if(!logEntry.toShow()){ return false; } if(q == null){ if (this.queryMessage == null){ this.queryMessage = "Error parsing the query. QueryParameters not created."; } return true; } if(q.isToDateInQuery){ if(logEntry.getTime() > q.toDateValue){ return false; } } if(q.isFromDateInQuery){ if(logEntry.getTime() < q.fromDateValue){ return false; } } if(q.isRequestInQuery){ if(!arrayContains(q.requestValues, logEntry.getServletName())){ return false; } } if(q.isResponseInQuery){ if(!arrayContains(q.responseValues, logEntry.getAction())){ return false; } } if(q.isPersonInQuery){ if(!logEntry.getName().toLowerCase().contains(q.personValue) && !logEntry.getId().toLowerCase().contains(q.personValue) && !logEntry.getEmail().toLowerCase().contains(q.personValue)){ return false; } } if(q.isRoleInQuery){ if(!arrayContains(q.roleValues, logEntry.getRole())){ return false; } } if(q.isCutoffInQuery){ if(logEntry.getTimeTaken() < q.cutoffValue){ return false; } } if(shouldExcludeLogEntry(logEntry)){ return false; } return true; }
Source:
<code>public static <T> Constructor<T> findConstructorFor(Class<T> type) { @SuppressWarnings("unchecked") final Constructor<T>[] constructors = (Constructor<T>[]) type.getDeclaredConstructors(); List<Constructor<T>> annotatedConstructors = Stream.of(constructors) .filter(c -> c.isAnnotationPresent(JdbiConstructor.class)) .collect(Collectors.toList()); if (annotatedConstructors.size() > 1) { throw new IllegalArgumentException(type + " must have at most one constructor annotated @JdbiConstructor"); } else if (annotatedConstructors.size() == 1) { return annotatedConstructors.get(0); } annotatedConstructors = Stream.of(constructors) .filter(c -> c.isAnnotationPresent(ConstructorProperties.class)) .collect(Collectors.toList()); if (annotatedConstructors.size() > 1) { throw new IllegalArgumentException(type + " must have at most one constructor annotated @ConstructorProperties"); } else if (annotatedConstructors.size() == 1) { return annotatedConstructors.get(0); } if (constructors.length != 1) { <START> throw new IllegalArgumentException(type + " must have exactly one constructor, or specify it with @JdbiConstructor"); <END> } return constructors[0]; }</code><technical_language>This message change too, e.g. @JdbiConstructor @ConstructorProperties</technical_language>

Target:
public static <T> Constructor<T> findConstructorFor(Class<T> type) { @SuppressWarnings("unchecked") final Constructor<T>[] constructors = (Constructor<T>[]) type.getDeclaredConstructors(); List<Constructor<T>> annotatedConstructors = Stream.of(constructors) .filter(c -> c.isAnnotationPresent(JdbiConstructor.class)) .collect(Collectors.toList()); if (annotatedConstructors.size() > 1) { throw new IllegalArgumentException(type + " must have at most one constructor annotated @JdbiConstructor"); } else if (annotatedConstructors.size() == 1) { return annotatedConstructors.get(0); } annotatedConstructors = Stream.of(constructors) .filter(c -> c.isAnnotationPresent(ConstructorProperties.class)) .collect(Collectors.toList()); if (annotatedConstructors.size() > 1) { throw new IllegalArgumentException(type + " must have at most one constructor annotated @ConstructorProperties"); } else if (annotatedConstructors.size() == 1) { return annotatedConstructors.get(0); } if (constructors.length != 1) { throw new IllegalArgumentException(type + " must have exactly one constructor, or specify it with @JdbiConstructor or @ConstructorProperties"); } return constructors[0]; }
Source:
<code>public IMarkerResolution[] getResolutions(IMarker marker) { if (!resolutionsLoaded) { readExtensions(); } String id = marker.getAttribute(ICodanProblemMarker.ID, null); if (id == null && conditionalResolutions.get(id) == null) return new IMarkerResolution[0]; Collection<ConditionalResolution> candidates = conditionalResolutions.get(id); ArrayList<IMarkerResolution> resolutions = new ArrayList<IMarkerResolution>(); if (candidates != null) { candidates.stream() .filter(candidate -> candidate.isApplicableFor(marker)) <START> .peek(candidate -> candidate.setMarkerArguments(marker)) <END> .map(ConditionalResolution::getResolution) .forEach(resolution -> { if(resolution instanceof ICodanMarkerResolution2) { ((ICodanMarkerResolution2) resolution).prepareFor(marker); } resolutions.add(resolution); }); } universalResolutions.stream() .map(elem -> instantiateResolution(elem)) .filter(res -> !(res instanceof ICodanMarkerResolution) || ((ICodanMarkerResolution) res).isApplicable(marker)) .forEach(resolution -> { if(resolution instanceof ICodanMarkerResolution2) { ((ICodanMarkerResolution2) resolution).prepareFor(marker); } resolutions.add(resolution); }); return resolutions.stream().toArray(IMarkerResolution[]::new); }</code><technical_language>I if sense AbstractCodanCMarkerResolution implement ICodanMarkerResolution2, call setMarkerArguments() in prepareFor() implementation? all, setting marker arguments is kind of a specific preparation resolution generator explicitly, feels resolution's responsibility</technical_language>

Target:
public IMarkerResolution[] getResolutions(IMarker marker) { if (!resolutionsLoaded) { readExtensions(); } String id = marker.getAttribute(ICodanProblemMarker.ID, null); if (id == null && conditionalResolutions.get(id) == null) return new IMarkerResolution[0]; Collection<ConditionalResolution> candidates = conditionalResolutions.get(id); ArrayList<IMarkerResolution> resolutions = new ArrayList<IMarkerResolution>(); if (candidates != null) { candidates.stream() .filter(candidate -> candidate.isApplicableFor(marker)) .peek(candidate -> candidate.setMarkerArguments(marker)) .map(ConditionalResolution::getResolution) .forEach(resolutions::add); } universalResolutions.stream() .filter(res -> !(res instanceof ICodanMarkerResolution) || ((ICodanMarkerResolution) res).isApplicable(marker)) .forEach(resolutions::add); return resolutions.stream().peek(res -> { if(res instanceof ICodanMarkerResolutionExtension) { ((ICodanMarkerResolutionExtension) res).prepareFor(marker); } }).toArray(IMarkerResolution[]::new); }
Source:
<code>public void setOwner(final Path path, final String owner, final String group) throws AzureBlobFileSystemException { try (AbfsPerfInfo tracker = startTracking("setOwner", "setOwner")) { <START> if (!getIsNamespaceEnabled()) { <END> throw new UnsupportedOperationException( "This operation is only valid for storage accounts with the hierarchical namespace enabled."); } LOG.debug( "setOwner filesystem: path: owner: group: {}", client.getFileSystem(), path.toString(), owner, group); final String transformedOwner = identityTransformer.transformUserOrGroupForSetRequest(owner); final String transformedGroup = identityTransformer.transformUserOrGroupForSetRequest(group); final AbfsRestOperation op = client.setOwner(AbfsHttpConstants.FORWARD_SLASH + getRelativePath(path, true), transformedOwner, transformedGroup); tracker.registerResult(op.getResult()).registerSuccess(true); } }</code><technical_language>tracker need instantiated this is XNS enabled account? move namespace account check try block</technical_language>

Target:
public void setOwner(final Path path, final String owner, final String group) throws AzureBlobFileSystemException { if (!getIsNamespaceEnabled()) { throw new UnsupportedOperationException( "This operation is only valid for storage accounts with the hierarchical namespace enabled."); } try (AbfsPerfInfo perfInfo = startTracking("setOwner", "setOwner")) { LOG.debug( "setOwner filesystem: path: owner: group: {}", client.getFileSystem(), path.toString(), owner, group); final String transformedOwner = identityTransformer.transformUserOrGroupForSetRequest(owner); final String transformedGroup = identityTransformer.transformUserOrGroupForSetRequest(group); final AbfsRestOperation op = client.setOwner( AbfsHttpConstants.FORWARD_SLASH + getRelativePath(path, true), transformedOwner, transformedGroup); perfInfo.registerResult(op.getResult()).registerSuccess(true); } }
Source:
<code>public Set<String> getApplicableFilters() { LinkedHashSet<String> filters = new LinkedHashSet<String>(); if (isEnable()) { filters.add(NO_FILTER); <START> filters.addAll(super.getApplicableFilters()); <END> } return filters; }</code><technical_language>this is incorrect (and fail new test. This if disabled output is null, is is expected (we expect list a null value). I realize this is consistent Abi/Language version..</technical_language>

Target:
public Set<String> getApplicableFilters() { LinkedHashSet<String> filters = new LinkedHashSet<String>(); if (isEnable()) { filters.add(NO_FILTER); } filters.addAll(super.getApplicableFilters()); return filters; }
Source:
<code>private void setSortOrder(SortOrder sortOrder) { boolean keepSorted = UserPreferences.isQueueKeepSorted(); if (keepSorted) { <START> UserPreferences.setQueueKeepSortedOrder(sortOrder); <END> } QueueSorter.sort(sortOrder, true); }</code><technical_language>This need conditional anymore. If queue saves order time, support sorting checking "keep sorted"</technical_language>

Target:
private void setSortOrder(SortOrder sortOrder) { UserPreferences.setQueueKeepSortedOrder(sortOrder); QueueSorter.sort(sortOrder, true); }
Source:
<code>private boolean canRemoveVmImageDisk() { setVmId(disk.getvm_guid()); boolean validDisktoDelete = true; List<VM> listVms = getVmsForImageGroup(); int vmCount = 0; while (listVms.size() > vmCount && validDisktoDelete) { VM vm = listVms.get(vmCount++); VmDevice vmDevice = getVmDeviceDAO().get(new VmDeviceId(disk.getId(), vm.getId())); validDisktoDelete = validate(new SnapshotsValidator().vmNotDuringSnapshot(getVmId())) && ImagesHandler.PerformImagesChecks(vm, getReturnValue().getCanDoActionMessages(), vm.getstorage_pool_id(), getParameters().getStorageDomainId(), false, true, false, false, vmDevice.getIsPlugged() && disk.isAllowSnapshot(), vmDevice.getIsPlugged(), false, true, <START> Arrays.asList(disk)); <END> } return validDisktoDelete; }</code><technical_language>break, false</technical_language>

Target:
private boolean canRemoveVmImageDisk() { setVmId(disk.getvm_guid()); boolean validDisktoDelete = true; List<VM> listVms = getVmsForDiskId(); int vmCount = 0; while (listVms.size() > vmCount && validDisktoDelete) { VM vm = listVms.get(vmCount++); VmDevice vmDevice = getVmDeviceDAO().get(new VmDeviceId(disk.getId(), vm.getId())); validDisktoDelete = validate(new SnapshotsValidator().vmNotDuringSnapshot(getVmId())) && ImagesHandler.PerformImagesChecks(vm, getReturnValue().getCanDoActionMessages(), vm.getstorage_pool_id(), getParameters().getStorageDomainId(), false, true, false, false, vmDevice.getIsPlugged() && disk.isAllowSnapshot(), vmDevice.getIsPlugged(), false, true, Arrays.asList(disk)); } return validDisktoDelete; }
Source:
<code>public static ThriftServerType get(String name) { if (StringUtils.isBlank(name)) { <START> return CUSTOM_HS_HA; <END> } return ThriftServerType.valueOf(name.trim().toUpperCase()); }</code><technical_language>this return getDefault(); instead, default in places</technical_language>

Target:
public static ThriftServerType get(String name) { if (StringUtils.isBlank(name)) { return getDefault(); } return ThriftServerType.valueOf(name.trim().toUpperCase()); }
Source:
<code>public void initialise() throws InitialisationException { <START> policyInstance = new LazyValue<>(this.initPolicyInstance()); <END> }</code><technical_language>new LazyValue<>(() -> this.initPolicyInstance()), this is lazy</technical_language>

Target:
public void initialise() throws InitialisationException { if (policyInstance == null && policyContext == null) { initPolicyContext(); } policyInstance = new LazyValue<>(this::initPolicyInstance); }
Source:
<code>public void sendNotification(String message, String id){ <START> if (message == null){ <END> message = MESSAGE_CONTENT; } message = messageFormatter(message, id); send(message); }</code><technical_language>I ignore empty notifications log warning</technical_language>

Target:
public void sendNotification(String message, String id){ if (message == null){ log.warn("empty message has arrived, ignore empty messages"); return; } message = messageFormatter(message, id); send(message); }
Source:
<code>protected Application provideApplication() { return new GuiceApplicationBuilder() .overrides(new AbstractModule() { @Override protected void configure() { bind(SphereClient.class).toInstance(sphereClient); bind(CartInSession.class).toInstance(cartInSession); } <START> }).build(); <END> }</code><technical_language>I realized this PR: pass a list of bindings overrides, need create a Module (only if Play's bind()): java return new GuiceApplicationBuilder() .overrides( bind(SphereClient.class).toInstance(sphereClient), bind(CartInSession.class).toInstance(cartInSession)) .build();</technical_language>

Target:
protected Application provideApplication() { return new GuiceApplicationBuilder() .overrides( bind(SphereClient.class).toInstance(sphereClient), bind(CartInSession.class).toInstance(cartInSession) ).build(); }
Source:
<code>public void base64EncodedPasswordWithAlgorithmShouldWork() { UserDetails ldapUser = ldapUserDetailsService.loadUserByUsername("base64withalgorithm-issue-1840"); assertThat(ldapUser).isInstanceOf(LdapUserDetailsImpl.class); LdapUserDetails ldapUserDetails = (LdapUserDetailsImpl) ldapUser; <START> assertThat(ldapUserDetails.getDn()).isEqualTo( "uid=base64withalgorithm-issue-1840,ou=Users,dc=carlspring,dc=com"); assertThat(ldapUserDetails.getUsername()).isEqualTo("base64withalgorithm-issue-1840"); assertThat(ldapUserDetails.getPassword()).isEqualTo( "{bcrypt}$2a$10$lpwlxyjvXKzN1ccCrw2PBuZx.eVesWbfmTbsrCboMU.gsNWVcZWMi"); assertThat(passwordEncoder.matches("password", ldapUserDetails.getPassword())).isEqualTo(true); assertThat(((List<SimpleGrantedAuthority>) ldapUser.getAuthorities())) .contains( new SimpleGrantedAuthority(SystemRole.REPOSITORY_MANAGER.name()), new SimpleGrantedAuthority("USER_ROLE") ); <END> }</code><technical_language>suggestion assertThat(ldapUserDetails.getDn()).isEqualTo( "uid=base64withalgorithm-issue-1840,ou=Users,dc=carlspring,dc=com"); assertThat(ldapUserDetails.getUsername()).isEqualTo("base64withalgorithm-issue-1840"); assertThat(ldapUserDetails.getPassword()).isEqualTo( "{bcrypt}$2a$10$lpwlxyjvXKzN1ccCrw2PBuZx.eVesWbfmTbsrCboMU.gsNWVcZWMi"); assertThat(passwordEncoder.matches("password", ldapUserDetails.getPassword())).isEqualTo(true); assertThat(((List<SimpleGrantedAuthority>) ldapUser.getAuthorities())) .contains(new SimpleGrantedAuthority(SystemRole.REPOSITORY_MANAGER.name()), new SimpleGrantedAuthority("USER_ROLE"));</technical_language>

Target:
public void base64EncodedPasswordWithAlgorithmShouldWork() { UserDetails ldapUser = ldapUserDetailsService.loadUserByUsername("issue1840-type-2"); assertThat(ldapUser).isInstanceOf(LdapUserDetailsImpl.class); LdapUserDetails ldapUserDetails = (LdapUserDetailsImpl) ldapUser; assertThat(ldapUserDetails.getDn()).isEqualTo( "uid=issue1840-type-2,ou=Users,dc=carlspring,dc=com"); assertThat(ldapUserDetails.getUsername()).isEqualTo("issue1840-type-2"); assertThat(ldapUserDetails.getPassword()).isEqualTo( "{bcrypt}$2a$10$lpwlxyjvXKzN1ccCrw2PBuZx.eVesWbfmTbsrCboMU.gsNWVcZWMi"); assertThat(passwordEncoder.matches("password", ldapUserDetails.getPassword())).isEqualTo(true); assertThat(((List<SimpleGrantedAuthority>) ldapUser.getAuthorities())) .contains(new SimpleGrantedAuthority(SystemRole.REPOSITORY_MANAGER.name()), new SimpleGrantedAuthority("USER_ROLE")); }
Source:
<code>default DataTransactionResult offer(Iterable<H> valueContainers, MergeFunction function) { <START> DataTransactionBuilder builder = DataTransactionBuilder.builder(); <END> for (H valueContainer : valueContainers) { builder.absorbResult(offer(valueContainer, function)); } return builder.build(); }</code><technical_language>here. remove finals</technical_language>

Target:
default DataTransactionResult offer(Iterable<H> valueContainers, MergeFunction function) { final DataTransactionBuilder builder = DataTransactionBuilder.builder(); for (H valueContainer : valueContainers) { builder.absorbResult(offer(valueContainer, function)); } return builder.build(); }
Source:
<code>public void testTotalCount() throws Exception { <START> String pqlQuery = "SELECT count(*) FROM " + getTableName(); String sqlQuery = "SELECT count(*) FROM " + getTableName(); <END> testQuery(pqlQuery, Collections.singletonList(sqlQuery)); }</code><technical_language>(nit) Simplify string? suggestion String query = "SELECT count(*) " + getTableName();</technical_language>

Target:
public void testTotalCount() throws Exception { String query = "SELECT count(*) FROM " + getTableName(); testQuery(query, Collections.singletonList(query)); }
Source:
<code>public static boolean openDeleteWizard( IStructuredSelection structuredSelection) { <START> return runCommand(LTK_DELETE_ID, structuredSelection, new HashMap<>()); <END> }</code><technical_language>Collections.emptyMap() save a bytes of RAM a new empty map</technical_language>

Target:
public static boolean openDeleteWizard( IStructuredSelection structuredSelection) { return runCommand(LTK_DELETE_ID, structuredSelection, Collections.emptyMap()); }
Source:
<code>public Opt<Identity> enter(final Request request) throws IOException { String authorization = ""; String user = ""; String pass = ""; boolean found = false; Opt<Identity> identity = new Opt.Empty<Identity>(); for (final String head : request.head()) { if (head.startsWith(AUTH_HEAD)) { authorization = head.split(AUTH_HEAD)[1].trim(); <START> authorization = new String( <END> DatatypeConverter.parseBase64Binary(authorization) ); user = authorization.split(":")[0]; pass = authorization.substring(user.length() + 1); found = true; break; } } if (found && this.entry.check(user, pass)) { final ConcurrentMap<String, String> props = new ConcurrentHashMap<String, String>(0); identity = new Opt.Single<Identity>( new Identity.Simple( String.format("urn:basic:%s", user), props ) ); } return identity; }</code><technical_language>@antonini assigning multiple times a bad practice me..</technical_language>

Target:
public Opt<Identity> enter(final Request request) throws IOException { final String decoded = new String( DatatypeConverter.parseBase64Binary( new RqHeaders.Smart( new RqHeaders.Base(request) ).single("authorization").split(AUTH_HEAD)[1] ) ).trim(); final String user = decoded.split(":")[0]; final Opt<Identity> identity = this.entry.enter( user, decoded.substring(user.length() + 1) ); if (!identity.has()) { throw new RsForward( new RsWithHeader( new RsFlash("access denied", Level.WARNING), String.format( "WWW-Authenticate: Basic ream=\"%s\"", this.realm ) ), HttpURLConnection.HTTP_UNAUTHORIZED, new RqHref.Base(request).href() ); } return identity; }
Source:
<code>public static String unshorten(String text) { while (true) { try { Matcher m = emoji_pattern.matcher(text); if (m.find()) { String emoji = m.group(1); text = m.replaceFirst(emoji); continue; } } catch (Throwable e) { DAO.severe(e); break; } try { Matcher m = emoji_pattern_span.matcher(text); if (m.find()) { String emoji = m.group(1); text = m.replaceFirst(emoji); continue; } } catch (Throwable e) { DAO.severe(e); break; } try { Matcher m = hashtag_pattern.matcher(text); if (m.find()) { text = m.replaceFirst(" #" + m.group(1) + " "); continue; } } catch (Throwable e) { DAO.severe(e); break; } try { Matcher m = timeline_link_pattern.matcher(text); if (m.find()) { String expanded = RedirectUnshortener.unShorten(m.group(2)); text = m.replaceFirst(" " + expanded); continue; } } catch (Throwable e) { DAO.severe(e); break; } try { Matcher m = timeline_embed_pattern.matcher(text); if (m.find()) { String shorturl = RedirectUnshortener.unShorten(m.group(2)); <START> text = m.replaceFirst(""); <END> continue; } } catch (Throwable e) { DAO.severe(e); break; } break; } text = cleanup_pattern.matcher(text).replaceAll(""); text = MessageEntry.html2utf8(text); text = doublespace_pattern.matcher(text).replaceAll(" "); text = text.trim(); return text; }</code><technical_language>this shorturl line removed,</technical_language>

Target:
public static String unshorten(String text) { while (true) { try { Matcher m = emoji_pattern.matcher(text); if (m.find()) { String emoji = m.group(1); text = m.replaceFirst(emoji); continue; } } catch (Throwable e) { DAO.severe(e); break; } try { Matcher m = emoji_pattern_span.matcher(text); if (m.find()) { String emoji = m.group(1); text = m.replaceFirst(emoji); continue; } } catch (Throwable e) { DAO.severe(e); break; } try { Matcher m = hashtag_pattern.matcher(text); if (m.find()) { text = m.replaceFirst(" #" + m.group(1) + " "); continue; } } catch (Throwable e) { DAO.severe(e); break; } try { Matcher m = timeline_link_pattern.matcher(text); if (m.find()) { String expanded = RedirectUnshortener.unShorten(m.group(2)); text = m.replaceFirst(" " + expanded); continue; } } catch (Throwable e) { DAO.severe(e); break; } try { Matcher m = timeline_embed_pattern.matcher(text); if (m.find()) { text = m.replaceFirst(""); continue; } } catch (Throwable e) { DAO.severe(e); break; } break; } text = cleanup_pattern.matcher(text).replaceAll(""); text = MessageEntry.html2utf8(text); text = doublespace_pattern.matcher(text).replaceAll(" "); text = text.trim(); return text; }
Source:
<code>protected Guid removeMemoryImage(List<Guid> guids) { Guid taskId1 = enclosingCommand.persistAsyncTaskPlaceHolder(VmCommand.DELETE_PRIMARY_IMAGE_TASK_KEY); VDSReturnValue vdsRetValue; try { vdsRetValue = Backend.getInstance().getResourceManager().RunVdsCommand( VDSCommandType.DeleteImageGroup, buildDeleteMemoryImageParams(guids)); if (!vdsRetValue.getSucceeded()) { return null; } } catch(VdcBLLException e) { if (e.getErrorCode() == VdcBllErrors.ImageDoesNotExistInDomainError) { <START> return Guid.Empty; <END> } throw e; } Guid guid1 = enclosingCommand.createTask(taskId1, vdsRetValue.getCreationInfo(), enclosingCommand.getActionType(), VdcObjectType.Storage, guids.get(0)); enclosingCommand.getTaskIdList().add(guid1); return guid1; }</code><technical_language>empty guid null</technical_language>

Target:
protected Guid removeMemoryImage(List<Guid> guids) { return removeImage( VmCommand.DELETE_PRIMARY_IMAGE_TASK_KEY, buildDeleteMemoryImageParams(guids)); }
Source:
<code>public boolean isAlwaysFalse() { <START> return anyFalseLiteralNonEquiConditions; <END> }</code><technical_language>call this isAlwaysFalse? (It else, easier understand meaning of field if named want mean.)</technical_language>

Target:
public boolean isAlwaysFalse() { return isAlwaysFalse; }
Source:
<code>public DayProfile(final Integer dayId, final List<DayProfileAction> dayProfileActionList) { <START> super(); <END> this.dayId = dayId; this.dayProfileActionList = new ArrayList<DayProfileAction>(dayProfileActionList); }</code><technical_language>Please check remark ActivityCalendar, appears apply well</technical_language>

Target:
public DayProfile(final Integer dayId, final List<DayProfileAction> dayProfileActionList) { this.dayId = dayId; this.dayProfileActionList = new ArrayList<DayProfileAction>(dayProfileActionList); }
Source:
<code>public PlanNodeCostEstimate visitUnion(UnionNode node, Void context) { <START> return CostCalculatorUsingExchanges.calculateExchangeCost( <END> numberOfNodes, getStats(node), node.getOutputSymbols(), GATHER, REMOTE, types); }</code><technical_language>I GATHER exchange common union. common partitioned exchange (e.g: plain UNION SQL) arbitrary exchange (distributed UNION ALL). TODO: explicit support for aggregation union (UNION) estimate partitioned exchange in case</technical_language>

Target:
public PlanNodeCostEstimate visitUnion(UnionNode node, Void context) { double inputSizeInBytes = getStats(node).getOutputSizeInBytes(node.getOutputSymbols(), types); return calculateRemoteGatherCost(inputSizeInBytes); }
Source:
<code>protected void internalReceiveCommand(String itemName, Command command) { if (gpio != null) { try { if (registryLock.readLock().tryLock(REGISTRYLOCK_TIMEOUT, REGISTRYLOCK_TIMEOUT_UNITS)) { try { GPIOPin gpioPin = (GPIOPin) registry.get(itemName); if (gpioPin != null) { if (command == OnOffType.ON) { gpioPin.setValue(GPIOPin.VALUE_HIGH); <START> logger.debug("Send command 1 to GPIO " + gpioPin.getPinNumber().toString()); <END> } else { gpioPin.setValue(GPIOPin.VALUE_LOW); logger.debug("Send command 0 to GPIO " + gpioPin.getPinNumber().toString()); } } } catch (IOException e) { logger.error("Error occured while changing pin state for item " + itemName + ", exception: " + e.getMessage()); return; } finally { registryLock.readLock().unlock(); } } else { logger.error("Pin state for item " + itemName + " hasn't been changed, timeout expired while waiting for registry lock"); return; } } catch (InterruptedException e) { logger.error("Pin state for item " + itemName + " hasn't been changed, thread was interrupted while waiting for registry lock"); return; } } super.internalReceiveCommand(itemName, command); }</code><technical_language>GPIOPin.getPinNumber() return int, is a primitive type methods toString()? Also, if parameterized arguments logger.debug(), avoid creating string objects DEBUG logging is enabled, logger.debug("Send command 1 GPIO {}", gpioPin.getPinNumber()); (this work int primitive get autoboxed java.lang.Integer)</technical_language>

Target:
protected void internalReceiveCommand(String itemName, Command command) { if (gpio != null) { try { if (registryLock.readLock().tryLock(REGISTRYLOCK_TIMEOUT, REGISTRYLOCK_TIMEOUT_UNITS)) { try { GPIOPin gpioPin = (GPIOPin) registry.get(itemName); if (gpioPin != null) { if (command == OnOffType.ON) { gpioPin.setValue(GPIOPin.VALUE_HIGH); logger.debug("Send command 1 to GPIO {}", gpioPin.getPinNumber()); } else { gpioPin.setValue(GPIOPin.VALUE_LOW); logger.debug("Send command 0 to GPIO {}", gpioPin.getPinNumber()); } } } catch (IOException e) { logger.error("Error occured while changing pin state for item " + itemName + ", exception: " + e.getMessage()); return; } finally { registryLock.readLock().unlock(); } } else { logger.error("Pin state for item " + itemName + " hasn't been changed, timeout expired while waiting for registry lock"); return; } } catch (InterruptedException e) { logger.error("Pin state for item " + itemName + " hasn't been changed, thread was interrupted while waiting for registry lock"); return; } } super.internalReceiveCommand(itemName, command); }
Source:
<code>public TreeSet<T> scan(T zero, BiFunction<? super T, ? super T, ? extends T> operation) { Objects.requireNonNull(operation, "operation is null"); <START> return Collections.scanLeft(this, zero, operation, it -> TreeSet.ofAll(comparator(), it)); <END> }</code><technical_language>= iterator? if want abbreviation, please consider iter, more commonly for iterator</technical_language>

Target:
public TreeSet<T> scan(T zero, BiFunction<? super T, ? super T, ? extends T> operation) { Objects.requireNonNull(operation, "operation is null"); return Collections.scanLeft(this, zero, operation, iter -> TreeSet.ofAll(comparator(), iter)); }
Source:
<code>public AttributeSensorAndConfigKey(Class<ConfigType> configType, Class<SensorType> sensorType, String name, String description, Object defaultValue) { super(sensorType, name, description); ConfigType defaultValueTyped; try { defaultValueTyped = TypeCoercions.coerce(defaultValue, configType); } catch (Exception e) { log.warn("Invalid default value '"+defaultValue+"' for "+name+" (rethrowing: "+e, e); <START> throw Throwables.propagate(e); <END> } configKey = new BasicConfigKey<ConfigType>(configType, name, description, defaultValueTyped); }</code><technical_language>Exceptions.propagate(e) handles InterruptedException correctly (not expect coerce throw that!)</technical_language>

Target:
public AttributeSensorAndConfigKey(Class<ConfigType> configType, Class<SensorType> sensorType, String name, String description, Object defaultValue) { super(sensorType, name, description); ConfigType defaultValueTyped; try { defaultValueTyped = TypeCoercions.coerce(defaultValue, configType); } catch (Exception e) { log.warn("Invalid default value '"+defaultValue+"' for "+name+" (rethrowing: "+e, e); throw Exceptions.propagate(e); } configKey = new BasicConfigKey<ConfigType>(configType, name, description, defaultValueTyped); }
Source:
<code>private void showNetworkError() { try { if(player!=null){ if (player.isPlayingLocally() || player.isPlaying() ) { hideNetworkError(); } else { if(!isVideoMessageDisplayed){ unlockOrientation(); hideCCPopUp(); hideSettingsPopUp(); player.hideController(); clearAllErrors(); if (NetworkUtil.isConnected(getActivity())) { showVideoNotAvailable(); } else { View errorView = getView().findViewById(R.id.panel_network_error); errorView.setVisibility(View.VISIBLE); } isNetworkMessageDisplayed = true; <START> isShownWifiSettingsMessage = false; <END> resetClosedCaptioning(); } } }else{ if (NetworkUtil.isConnected(getActivity())) { showVideoNotAvailable(); } else { View errorView = getView().findViewById(R.id.panel_network_error); errorView.setVisibility(View.VISIBLE); } } } catch(Exception ex) { logger.error(ex); } }</code><technical_language>is a good practice add flag message. wrap message event something</technical_language>

Target:
private void showNetworkError() { try { if(player!=null){ if (player.isPlayingLocally() || player.isPlaying() ) { hideNetworkError(); } else { if(!curMessageTypes.contains(VideoNotPlayMessageType.IS_VIDEO_MESSAGE_DISPLAYED)){ unlockOrientation(); hideCCPopUp(); hideSettingsPopUp(); player.hideController(); clearAllErrors(); if (NetworkUtil.isConnected(getActivity())) { showVideoNotAvailable(VideoNotPlayMessageType.IS_VIDEO_MESSAGE_DISPLAYED); } else { View errorView = getView().findViewById(R.id.panel_network_error); errorView.setVisibility(View.VISIBLE); } curMessageTypes.add(VideoNotPlayMessageType.IS_NETWORK_MESSAGE_DISPLAYED); resetClosedCaptioning(); } } }else{ if (NetworkUtil.isConnected(getActivity())) { showVideoNotAvailable(VideoNotPlayMessageType.IS_VIDEO_MESSAGE_DISPLAYED); } else { View errorView = getView().findViewById(R.id.panel_network_error); errorView.setVisibility(View.VISIBLE); } } } catch(Exception ex) { logger.error(ex); } }
Source:
<code>public void testOpenSessionEditorByDoubleClick2() { SWTBotPerspective javaPerspective = bot.perspectiveByLabel("Java"); javaPerspective.activate(); SWTBotView packageExplorerView = bot.viewById("org.eclipse.jdt.ui.PackageExplorer"); packageExplorerView.setFocus(); SWTBot packageExplorerViewBot = packageExplorerView.bot(); <START> SWTBotTreeItem expandedNode = packageExplorerViewBot.tree().expandNode("DesignerTestProject", true); SWTBotTreeItem node = expandedNode.getNode("My.aird"); node.doubleClick(); bot.waitUntil(new DefaultCondition() { @Override public boolean test() throws Exception { return PlatformUI.getWorkbench().getWorkbenchWindows()[0].getActivePage().getActiveEditor() != null; } @Override public String getFailureMessage() { return "Wrong Active editor is : " + PlatformUI.getWorkbench().getWorkbenchWindows()[0].getActivePage().getActiveEditor().getEditorSite().getId(); } }); assertEquals("The session editor has not opened.", "org.eclipse.sirius.ui.editor.session", <END> PlatformUI.getWorkbench().getWorkbenchWindows()[0].getActivePage().getActiveEditor().getEditorSite().getId()); }</code><technical_language>mutualize code</technical_language>

Target:
public void testOpenSessionEditorByDoubleClick2() { SWTBotPerspective javaPerspective = bot.perspectiveByLabel("Java"); javaPerspective.activate(); SWTBotView packageExplorerView = bot.viewById("org.eclipse.jdt.ui.PackageExplorer"); packageExplorerView.setFocus(); SWTBot packageExplorerViewBot = packageExplorerView.bot(); assertSessionEditorOpened(packageExplorerViewBot); }