auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected IStructuredSelection getSelection(ExecutionEvent event) throws ExecutionException { if (event == null) throw new IllegalArgumentException("event must not be NULL"); Object selection = ((EvaluationContext) event.getApplicationContext()) <START> .getVariable(ISources.ACTIVE_MENU_SELECTION_NAME); <END> if (selection == null) selection = ((EvaluationContext) event.getApplicationContext()) .getVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME); if (selection instanceof IStructuredSelection) return (IStructuredSelection) selection; if (selection instanceof TextSelection) { try { IEditorInput input = HandlerUtil.getActiveEditorChecked(event) .getEditorInput(); if (input == null) return StructuredSelection.EMPTY; IResource resource = ResourceUtil.getResource(input); if (resource != null) return new StructuredSelection(resource); } catch (ExecutionException e) { } } return StructuredSelection.EMPTY; }</code><technical_language>Please downcast. pretty this result in a CCE in 4.x. HandlerUtil's getActiveMenuSelection(ExecutionEvent) method instead</technical_language>

Target:
protected IStructuredSelection getSelection(ExecutionEvent event) throws ExecutionException { if (event == null) throw new IllegalArgumentException("event must not be NULL"); Object selection = HandlerUtil.getActiveMenuSelectionChecked(event); if (selection == null) selection = HandlerUtil.getCurrentSelectionChecked(event); if (selection instanceof IStructuredSelection) return (IStructuredSelection) selection; if (selection instanceof TextSelection) { IEditorInput input = (IEditorInput) HandlerUtil.getVariable(event, ISources.ACTIVE_EDITOR_INPUT_NAME); if (input == null) return StructuredSelection.EMPTY; IResource resource = ResourceUtil.getResource(input); if (resource != null) return new StructuredSelection(resource); } return StructuredSelection.EMPTY; }
Source:
<code>private ValueExtractorDescriptor getMostSpecific(Class<?> valueType, List<ValueExtractorDescriptor> extractors) { Set<ValueExtractorDescriptor> candidates = CollectionHelper.newHashSet( extractors.size() ); for ( ValueExtractorDescriptor descriptor : extractors ) { <START> if ( candidates.size() == 0 ) { <END> candidates.add( descriptor ); continue; } Iterator<ValueExtractorDescriptor> candidatesIterator = candidates.iterator(); boolean isNewRoot = true; while ( candidatesIterator.hasNext() ) { ValueExtractorDescriptor candidate = candidatesIterator.next(); if ( TypeHelper.isAssignable( candidate.getExtractedType(), descriptor.getExtractedType() ) ) { candidatesIterator.remove(); } else if ( TypeHelper.isAssignable( descriptor.getExtractedType(), candidate.getExtractedType() ) ) { isNewRoot = false; } } if ( isNewRoot ) { candidates.add( descriptor ); } } if ( candidates.size() == 0 ) { return null; } else if ( candidates.size() == 1 ) { return candidates.iterator().next(); } else { throw LOG.unableToGetMostSpecificValueExtractorDueToSeveralValueExtractorsDefinedForParallelHierarchies( valueType, candidates ); } }</code><technical_language>isEmpty()</technical_language>

Target:
private ValueExtractorDescriptor getMostSpecific(Class<?> valueType, List<ValueExtractorDescriptor> extractors) { Set<ValueExtractorDescriptor> candidates = CollectionHelper.newHashSet( extractors.size() ); for ( ValueExtractorDescriptor descriptor : extractors ) { if ( candidates.isEmpty() ) { candidates.add( descriptor ); continue; } Iterator<ValueExtractorDescriptor> candidatesIterator = candidates.iterator(); boolean isNewRoot = true; while ( candidatesIterator.hasNext() ) { ValueExtractorDescriptor candidate = candidatesIterator.next(); if ( TypeHelper.isAssignable( candidate.getExtractedType(), descriptor.getExtractedType() ) ) { candidatesIterator.remove(); } else if ( TypeHelper.isAssignable( descriptor.getExtractedType(), candidate.getExtractedType() ) ) { isNewRoot = false; } } if ( isNewRoot ) { candidates.add( descriptor ); } } if ( candidates.isEmpty() ) { return null; } else if ( candidates.size() == 1 ) { return candidates.iterator().next(); } else { @SuppressWarnings("rawtypes") List<Class<? extends ValueExtractor>> valueExtractorCandidates = candidates.stream() .map( valueExtractorDescriptor -> valueExtractorDescriptor.getValueExtractor().getClass() ) .collect( Collectors.toList() ); throw LOG.unableToGetMostSpecificValueExtractorDueToSeveralValueExtractorsDefinedForParallelHierarchies( valueType, valueExtractorCandidates ); } }
Source:
<code>public void testCronExpressionForWeekly() { StorageSyncSchedule schedule = new StorageSyncSchedule(); schedule.setFrequency(Frequency.WEEKLY); schedule.setHour(12); schedule.setMins(50); Day[] days = {Day.FRI, Day.SAT}; schedule.setDays(days); String expectedExpression = "0 50 12 ? * <START> FRI,SAT *"; <END> assertEquals(expectedExpression, schedule.toCronExpression()); List<Class<?>> validationGroup = new ArrayList<>(); List<String> result = ValidationUtils.validateInputs(validationGroup, schedule); assertEquals(true, result.isEmpty()); }</code><technical_language>Is order of days sorted care of building expression</technical_language>

Target:
public void testCronExpressionForWeekly() { StorageSyncSchedule schedule = new StorageSyncSchedule(); schedule.setFrequency(Frequency.WEEKLY); schedule.setHour(12); schedule.setMins(50); Day[] days = {Day.SAT, Day.FRI}; schedule.setDays(days); String expectedExpression = "0 50 12 ? * FRI,SAT *"; assertEquals(expectedExpression, schedule.toCronExpression()); List<Class<?>> validationGroup = new ArrayList<>(); List<String> result = ValidationUtils.validateInputs(validationGroup, schedule); assertTrue(result.isEmpty()); }
Source:
<code>void onPositionObserverUpdate() { if (controller == null || txtvPosition == null || txtvLength == null) { return; } TimeSpeedConverter timeSpeedConverter = new TimeSpeedConverter( UserPreferences.isTimeRespectSpeed(), Float.parseFloat(UserPreferences.getPlaybackSpeed())); int currentPosition = timeSpeedConverter.convert(controller.getPosition()); int duration = timeSpeedConverter.convert(controller.getDuration()); <START> int remainingTime = timeSpeedConverter.convert(controller.getDuration()); <END> Log.d(TAG, "currentPosition " + Converter.getDurationStringLong(currentPosition)); if (currentPosition == PlaybackService.INVALID_TIME || duration == PlaybackService.INVALID_TIME) { Log.w(TAG, "Could not react to position observer update because of invalid time"); return; } txtvPosition.setText(Converter.getDurationStringLong(currentPosition)); if (showTimeLeft) { txtvLength.setText("-" + Converter.getDurationStringLong(remainingTime)); } else { txtvLength.setText(Converter.getDurationStringLong(duration)); } updateProgressbarPosition(currentPosition, duration); }</code><technical_language>remaining time duration - currentPosition? Currently, is a copy of duration</technical_language>

Target:
void onPositionObserverUpdate() { if (controller == null || txtvPosition == null || txtvLength == null) { return; } int currentPosition = TimeSpeedConverter.convert(controller.getPosition()); int duration = TimeSpeedConverter.convert(controller.getDuration()); int remainingTime = TimeSpeedConverter.convert( controller.getDuration() - controller.getPosition()); Log.d(TAG, "currentPosition " + Converter.getDurationStringLong(currentPosition)); if (currentPosition == PlaybackService.INVALID_TIME || duration == PlaybackService.INVALID_TIME) { Log.w(TAG, "Could not react to position observer update because of invalid time"); return; } txtvPosition.setText(Converter.getDurationStringLong(currentPosition)); if (showTimeLeft) { txtvLength.setText("-" + Converter.getDurationStringLong(remainingTime)); } else { txtvLength.setText(Converter.getDurationStringLong(duration)); } updateProgressbarPosition(currentPosition, duration); }
Source:
<code>public void configure_withComponentsDefinedInTheBuilderContext_shouldBeAccessibleThroughDomainContext() { final SpringDomainBundle springDomainBundle = new SpringDomainBundle( new MyCustomDomainBox.MyCustomDomain(), <START> Lists.<Class>newArrayList() <END> ); ExecutorService workers = Executors.newFixedThreadPool(2); Map<Platform.ExtraComponentKey, Object> extraComponents = Maps.newHashMap(); extraComponents.put(new Platform.ExtraComponentKey("workers", ExecutorService.class), workers); KasperPlatformConfiguration platformConfiguration = new KasperPlatformConfiguration(); final Platform.BuilderContext builderContext = new Platform.BuilderContext( platformConfiguration.configuration(), platformConfiguration.eventBus(), platformConfiguration.commandGateway(), platformConfiguration.queryGateway(), platformConfiguration.metricRegistry(), extraComponents ); springDomainBundle.configure(builderContext); assertEquals(workers, springDomainBundle.get(ExecutorService.class).get()); assertEquals(platformConfiguration.eventBus(), springDomainBundle.get(KasperEventBus.class).get()); assertEquals(platformConfiguration.commandGateway(), springDomainBundle.get(KasperCommandGateway.class).get()); assertEquals(platformConfiguration.queryGateway(), springDomainBundle.get(KasperQueryGateway.class).get()); assertEquals(platformConfiguration.configuration(), springDomainBundle.get(Config.class).get()); assertEquals(platformConfiguration.metricRegistry(), springDomainBundle.get(MetricRegistry.class).get()); }</code><technical_language>a specific constructor handle this case</technical_language>

Target:
public void configure_withComponentsDefinedInTheBuilderContext_shouldBeAccessibleThroughDomainContext() { final SpringDomainBundle springDomainBundle = new SpringDomainBundle( new MyCustomDomainBox.MyCustomDomain(), Lists.<Class>newArrayList() ); final ExecutorService workers = Executors.newFixedThreadPool(2); final Map<Platform.ExtraComponentKey, Object> extraComponents = Maps.newHashMap(); extraComponents.put(new Platform.ExtraComponentKey("workers", ExecutorService.class), workers); final KasperPlatformConfiguration platformConfiguration = new KasperPlatformConfiguration(); final Platform.BuilderContext builderContext = new Platform.BuilderContext( platformConfiguration, extraComponents ); springDomainBundle.configure(builderContext); assertEquals(workers, springDomainBundle.get(ExecutorService.class).get()); assertEquals(platformConfiguration.eventBus(), springDomainBundle.get(KasperEventBus.class).get()); assertEquals(platformConfiguration.commandGateway(), springDomainBundle.get(KasperCommandGateway.class).get()); assertEquals(platformConfiguration.queryGateway(), springDomainBundle.get(KasperQueryGateway.class).get()); assertEquals(platformConfiguration.configuration(), springDomainBundle.get(Config.class).get()); assertEquals(platformConfiguration.metricRegistry(), springDomainBundle.get(MetricRegistry.class).get()); }
Source:
<code>protected void itemAdded(AddRemoveProperty prop, ValueWithId item) { if (prop == NChild.PENALTY) { Penalty p = (Penalty)item; if (FO_EXP_ID.equals(p.getProviderId())) { updateEligibility(); <START> } else if (!p.isServed() && getRole() == Role.JAMMER && getCurrentFielding() != null <END> && !getCurrentFielding().getTeamJam().getOtherTeam().isLead()) { getTeam().set(Team.Value.LOST, true); } else if (!p.isServed() && !getScoreBoard().isInJam()) { getTeam().field(this, getRole(getTeam().getRunningOrEndedTeamJam()), getTeam().getRunningOrUpcomingTeamJam()); } } else if (prop == Child.FIELDING) { Fielding f = (Fielding)item; if (f.isCurrent()) { set(Value.CURRENT_FIELDING, item, Flag.INTERNAL); } else if (team.hasFieldingAdvancePending() && f.getTeamJam().isRunningOrEnded()) { setRole(f.getCurrentRole()); } } }</code><technical_language>This is making work for Jammers</technical_language>

Target:
protected void itemAdded(AddRemoveProperty prop, ValueWithId item) { if (prop == NChild.PENALTY) { Penalty p = (Penalty)item; if (FO_EXP_ID.equals(p.getProviderId())) { updateEligibility(); } if (!p.isServed() && getRole() == Role.JAMMER && getCurrentFielding() != null && !getCurrentFielding().getTeamJam().getOtherTeam().isLead() && scoreBoard.isInJam()) { getTeam().set(Team.Value.LOST, true); } if (!p.isServed() && !getScoreBoard().isInJam()) { getTeam().field(this, getRole(getTeam().getRunningOrEndedTeamJam()), getTeam().getRunningOrUpcomingTeamJam()); } } else if (prop == Child.FIELDING) { Fielding f = (Fielding)item; if (f.isCurrent()) { set(Value.CURRENT_FIELDING, item, Flag.INTERNAL); } } }
Source:
<code>public void start() { <START> logger.debug("start()"); <END> for (final Class<?> stepDefinitionType : cachedStepsInstances.keySet()) { cachedStepsInstances.put(stepDefinitionType, createStepsInstance(stepDefinitionType)); } }</code><technical_language>logging statements needed</technical_language>

Target:
public void start() { logger.trace("start()"); for (final Class<?> stepDefinitionType : cachedStepsInstances.keySet()) { cachedStepsInstances.put(stepDefinitionType, createStepsInstance(stepDefinitionType)); } }
Source:
<code>public String getScript(String inMoovServiceName) { <START> return String.format((Locale)null,"%s.moveArm(\"%s\",%.2f,%.2f,%.2f,%.2f)\n", inMoovServiceName, side, bicep.getPos(), rotate.getPos(), shoulder.getPos(), omoplate.getPos()); <END> }</code><technical_language>casting a null a locale object sense. Also, limiting resolution 2 decimal places for move command</technical_language>

Target:
public String getScript(String inMoovServiceName) { return String.format(Locale.ENGLISH,"%s.moveArm(\"%s\",%.2f,%.2f,%.2f,%.2f)\n", inMoovServiceName, side, bicep.getPos(), rotate.getPos(), shoulder.getPos(), omoplate.getPos()); }
Source:
<code><START> public void testNullValues() throws JsonProcessingException { <END> ObjectMapper mapper = new ObjectMapper(); ChatGrant grant = new ChatGrant() .setDeploymentRoleSid("RL123") .setPushCredentialSid("CR123") .setServiceSid("IS123"); String payload = mapper.writeValueAsString(grant); Assert.assertFalse(payload.contains("endpoint_id")); Assert.assertTrue(payload.contains("deployment_role_sid")); Assert.assertTrue(payload.contains("push_credential_sid")); Assert.assertTrue(payload.contains("service_sid")); }</code><technical_language>Changes fine, a lot of duplicated code in this test class. refactor obvious bits? Also, other tests a JWT parser validate payload object mapper. I prefer making this uniform others payload conforms object mapper produces</technical_language>

Target:
public void testNullValues() { ChatGrant cg = new ChatGrant().setDeploymentRoleSid("RL123"); Jwt token = new AccessToken.Builder(ACCOUNT_SID, SIGNING_KEY_SID, SECRET) .grant(cg) .build(); Claims claims = getClaimFromJwtToken(token); validateToken(claims); Map<String, Object> decodedGrants = (Map<String, Object>) claims.get("grants"); Map<String, Object> grant = (Map<String, Object>) decodedGrants.get("chat"); Assert.assertEquals("RL123", grant.get("deployment_role_sid")); Assert.assertFalse(grant.containsKey("endpoint_id")); }
Source:
<code>public XBeePacket parsePacket() throws PacketParsingException { try { readBytes = 0; lengthRead = false; errorMessage = ""; checksum = new XBeeChecksum(); int hSize = readByte(); int lSize = readByte(); length = hSize << 8 | lSize; lengthRead = true; int apiID = readByte(); XBeeAPIType apiType = XBeeAPIType.get(apiID); XBeePacket packet = null; if (apiType == null) { byte[] payload = readBytes(length - 1); packet = new UnknownXBeePacket(apiID, payload); } else { switch (apiType) { case AT_COMMAND: <START> packet = parseATCommandPacket(); <END> break; case AT_COMMAND_RESPONSE: packet = parseATCommandResponsePacket(); break; case RX_64: packet = parseRX64Packet(); break; case RX_16: packet = parseRX16Packet(); break; case RECEIVE_PACKET: packet = parseZigBeeReceivePacket(); break; case GENERIC: default: packet = parseGenericPacket(); } } readByte(); return packet; } catch (IOException e) { throw new PacketParsingException("Error parsing packet: " + e.getMessage()); } }</code><technical_language>discuss move packet pasing packet class</technical_language>

Target:
public XBeePacket parsePacket() throws PacketParsingException { try { readBytes = 0; lengthRead = false; checksum = new XBeeChecksum(); int hSize = readByte(); int lSize = readByte(); length = hSize << 8 | lSize; lengthRead = true; int apiID = readByte(); APIFrameType apiType = APIFrameType.get(apiID); XBeePacket packet = null; if (apiType == null) { byte[] payload = readBytes(length - 1); packet = new UnknownXBeePacket(apiID, payload); } else { switch (apiType) { case AT_COMMAND: packet = parseATCommandPacket(); break; case AT_COMMAND_RESPONSE: packet = parseATCommandResponsePacket(); break; case RX_64: packet = parseRX64Packet(); break; case RX_16: packet = parseRX16Packet(); break; case RECEIVE_PACKET: packet = parseZigBeeReceivePacket(); break; case GENERIC: default: packet = parseGenericPacket(); } } readByte(); return packet; } catch (IOException e) { throw new PacketParsingException("Error parsing packet: " + e.getMessage()); } }
Source:
<code><START> public Described copy() { <END> Segment copy = new Segment(); this.copyTo(this, copy); copy.setDuration(this.duration); copy.setDescription(this.description); copy.setSegmentType(this.segmentType); copy.setTitle(this.title); return copy; }</code><technical_language>this return a segment</technical_language>

Target:
public Segment copy() { Segment copy = new Segment(); this.copyTo(copy); copy.setDescription(this.getDescription()); copy.setDuration(this.getDuration()); copy.setTitle(this.title); copy.setSegmentType(this.segmentType); return copy; }
Source:
<code><START> public Map<String, LocalResource> getResourceMap() { <END> return localResourceMap; }</code><technical_language>1. I if this class instead util / a function. 2. return Immutable collection a copy here? way, external callers mutate map, this class is immune changes</technical_language>

Target:
public Map<String, LocalResource> getResourceMap() { return ImmutableMap.copyOf(localResourceMap); }
Source:
<code>private ConvolutionalLayer(@Parameter(LayerIndex.class) final int index, @Parameter(LayerInputShape.class) final String inputShape, @Parameter(PaddingHeight.class) final int paddingHeight, @Parameter(PaddingWidth.class) final int paddingWidth, @Parameter(StrideHeight.class) final int strideHeight, @Parameter(StrideWidth.class) final int strideWidth, @Parameter(KernelHeight.class) final int kernelHeight, @Parameter(KernelWidth.class) final int kernelWidth, final LayerParameterInitializer layerParameterInitializer, final MatrixFactory matrixFactory) { super(index, inputShape); this.paddingHeight = paddingHeight; this.paddingWidth = paddingWidth; this.strideHeight = strideHeight; this.strideWidth = strideWidth; this.kernelHeight = kernelHeight; this.kernelWidth = kernelWidth; this.outputShape = layerParameterInitializer.getOutputShape(); this.matrixFactory = matrixFactory; <START> this.output = null; <END> this.layerError = null; if (getInputShape().length == 2) { this.inputChannel = 1; this.inputHeight = getInputShape()[0]; this.inputWidth = getInputShape()[1]; } else { this.inputChannel = getInputShape()[0]; this.inputHeight = getInputShape()[1]; this.inputWidth = getInputShape()[2]; } this.weightGradient = matrixFactory.create(kernelHeight * kernelWidth * inputChannel, outputShape[0]); }</code><technical_language>)</technical_language>

Target:
private ConvolutionalLayer(@Parameter(LayerIndex.class) final int index, @Parameter(LayerInputShape.class) final String inputShape, @Parameter(PaddingHeight.class) final int paddingHeight, @Parameter(PaddingWidth.class) final int paddingWidth, @Parameter(StrideHeight.class) final int strideHeight, @Parameter(StrideWidth.class) final int strideWidth, @Parameter(KernelHeight.class) final int kernelHeight, @Parameter(KernelWidth.class) final int kernelWidth, final LayerParameterInitializer layerParameterInitializer, final MatrixFactory matrixFactory) { super(index, inputShape); this.paddingHeight = paddingHeight; this.paddingWidth = paddingWidth; this.strideHeight = strideHeight; this.strideWidth = strideWidth; this.kernelHeight = kernelHeight; this.kernelWidth = kernelWidth; this.outputShape = layerParameterInitializer.getOutputShape(); this.matrixFactory = matrixFactory; if (getInputShape().length == 2) { this.inputChannel = 1; this.inputHeight = getInputShape()[0]; this.inputWidth = getInputShape()[1]; } else { this.inputChannel = getInputShape()[0]; this.inputHeight = getInputShape()[1]; this.inputWidth = getInputShape()[2]; } }
Source:
<code>protected INDArray preOutput(boolean training, boolean forBackprop, LayerWorkspaceMgr workspaceMgr) { assertInputSet(false); applyDropOutIfNecessary(training, workspaceMgr); if (input.rank() != 2) { throw new DL4JInvalidInputException("Got rank " + input.rank() + " array as input to RepeatVector with shape " + Arrays.toString(input.shape()) + ". Expected rank 2 array with shape [minibatchSize, size]. " + layerId()); } if (preOutput != null && forBackprop) { return preOutput; } long miniBatch = input.shape()[0]; long size = input.shape()[1]; INDArray output = input.reshape(miniBatch, size, 1); output = output.repeat(2, (long)getN()); output = output.detach(); <START> return output; <END> }</code><technical_language>existing return output.repeat(2, (long) getN()); replaced by: try(MemoryWorkspace ws = workspaceMgr.notifyScopeBorrowed(ArrayType.ACTIVATIONS)) { return output.repeat(2, (long) getN()); } want this detached instead</technical_language>

Target:
protected INDArray preOutput(boolean training, boolean forBackprop, LayerWorkspaceMgr workspaceMgr) { assertInputSet(false); applyDropOutIfNecessary(training, workspaceMgr); if (input.rank() != 2) { throw new DL4JInvalidInputException("Got rank " + input.rank() + " array as input to RepeatVector with shape " + Arrays.toString(input.shape()) + ". Expected rank 2 array with shape [minibatchSize, size]. " + layerId()); } if (preOutput != null && forBackprop) { return preOutput; } long miniBatch = input.shape()[0]; long size = input.shape()[1]; INDArray output = input.reshape(miniBatch, size, 1); try(MemoryWorkspace ws = workspaceMgr.notifyScopeBorrowed(ArrayType.ACTIVATIONS)) { return output.repeat(2, (long) getN()); } }
Source:
<code>private RpslObject convertToRpslObject(final WhoisResources whoisResources, final ObjectType objectType) { <START> for (WhoisObject whoisObject : whoisResources.getWhoisObjects()) { <END> if (objectType == ObjectType.getByName(whoisObject.getType())) { return whoisObjectMapper.map(whoisObject, FormattedServerAttributeMapper.class); } } setErrorMessage(whoisResources, "Unable to find " + objectType + " in WhoisResources"); throw new ReferenceUpdateFailedException(Response.Status.BAD_REQUEST, whoisResources); }</code><technical_language>final</technical_language>

Target:
private RpslObject convertToRpslObject(final WhoisResources whoisResources, final ObjectType objectType) { for (final WhoisObject whoisObject : whoisResources.getWhoisObjects()) { if (objectType == ObjectType.getByName(whoisObject.getType())) { return whoisObjectMapper.map(whoisObject, FormattedServerAttributeMapper.class); } } setErrorMessage(whoisResources, "Unable to find " + objectType + " in WhoisResources"); throw new ReferenceUpdateFailedException(Response.Status.BAD_REQUEST, whoisResources); }
Source:
<code><START> public Message<?> receive() { <END> return messages.poll(); }</code><technical_language>I BlockingQueue poll(timeout) block testing thread for message async internals. is guarantee tests direct sync. WDYT</technical_language>

Target:
public Message<?> receive() { return this.receive(0); }
Source:
<code>protected void executeCommand() { setReturnValue(new VdcReturnValueBase()); VDSStatus lastStatus = getVds().getStatus(); try { if (!(getParameters().getAction() == FenceActionType.Start && lastStatus == VDSStatus.Maintenance)) { setStatus(); } setSucceeded(fence(getParameters().getAction())); } finally { if (!getSucceeded()) { setStatus(lastStatus); if (!skippedDueToFencingPolicy) { AlertIfPowerManagementOperationFailed(); } } <START> else if ((getParameters().getAction() == FenceActionType.Restart <END> || getParameters().getAction() == FenceActionType.Stop) && getParameters().getKeepPolicyPMEnabled() == false) { getVds().setPowerManagementControlledByPolicy(false); getDbFacade().getVdsDynamicDao().updateVdsDynamicPowerManagementPolicyFlag( getVdsId(), getVds().getDynamicData().isPowerManagementControlledByPolicy()); } } }</code><technical_language>Please reformat: else if ((getParameters().getAction() == FenceActionType.Restart || getParameters().getAction() == FenceActionType.Stop) && getParameters().getKeepPolicyPMEnabled() == false) {</technical_language>

Target:
protected void executeCommand() { auditFenceOperation(); log.info("Power-Management: " + getActionString() + " host " + getVdsName()); setReturnValue(new VdcReturnValueBase()); VDSStatus lastStatus = getVds().getStatus(); try { if (!(getParameters().getAction() == FenceActionType.Start && lastStatus == VDSStatus.Maintenance)) { setStatus(); } setSucceeded(fence(getParameters().getAction())); if (getSucceeded()) { log.info("Power-Management: " + getActionString() + " host " + getVdsName() + " succeeded."); } else { log.info("Power-Management: " + getActionString() + " host " + getVdsName() + " failed."); } } finally { if (!getSucceeded()) { setStatus(lastStatus); if (!skippedDueToFencingPolicy) { AlertIfPowerManagementOperationFailed(); } } else if ((getParameters().getAction() == FenceActionType.Restart || getParameters().getAction() == FenceActionType.Stop) && getParameters().getKeepPolicyPMEnabled() == false) { getVds().setPowerManagementControlledByPolicy(false); getDbFacade().getVdsDynamicDao().updateVdsDynamicPowerManagementPolicyFlag( getVdsId(), getVds().getDynamicData().isPowerManagementControlledByPolicy()); } } }
Source:
<code>private void connectToResourceManager() { assert(resourceManagerAddress != null); assert(establishedResourceManagerConnection == null); assert(resourceManagerConnection == null); log.info("Connecting to ResourceManager {}.", resourceManagerAddress); final TaskExecutorRegistration taskExecutorRegistration = new TaskExecutorRegistration( getAddress(), getResourceID(), unresolvedTaskManagerLocation.getDataPort(), <START> JMXService.getPort().orElse(0), <END> hardwareDescription, memoryConfiguration, taskManagerConfiguration.getDefaultSlotResourceProfile(), taskManagerConfiguration.getTotalResourceProfile() ); resourceManagerConnection = new TaskExecutorToResourceManagerConnection( log, getRpcService(), taskManagerConfiguration.getRetryingRegistrationConfiguration(), resourceManagerAddress.getAddress(), resourceManagerAddress.getResourceManagerId(), getMainThreadExecutor(), new ResourceManagerRegistrationListener(), taskExecutorRegistration); resourceManagerConnection.start(); }</code><technical_language>This strikes odd default value, I imagine this misunderstood "running some random port". -1 a choice, better, suggestion of a map, including in map all</technical_language>

Target:
private void connectToResourceManager() { assert(resourceManagerAddress != null); assert(establishedResourceManagerConnection == null); assert(resourceManagerConnection == null); log.info("Connecting to ResourceManager {}.", resourceManagerAddress); final TaskExecutorRegistration taskExecutorRegistration = new TaskExecutorRegistration( getAddress(), getResourceID(), unresolvedTaskManagerLocation.getDataPort(), JMXService.getPort().orElse(-1), hardwareDescription, memoryConfiguration, taskManagerConfiguration.getDefaultSlotResourceProfile(), taskManagerConfiguration.getTotalResourceProfile() ); resourceManagerConnection = new TaskExecutorToResourceManagerConnection( log, getRpcService(), taskManagerConfiguration.getRetryingRegistrationConfiguration(), resourceManagerAddress.getAddress(), resourceManagerAddress.getResourceManagerId(), getMainThreadExecutor(), new ResourceManagerRegistrationListener(), taskExecutorRegistration); resourceManagerConnection.start(); }
Source:
<code>public static VSpherePlannedNode createInstance(final CloudProvisioningState templateState, final String nodeName, final CloudProvisioningRecord whatWeShouldSpinUp) { final vSphereCloudSlaveTemplate template = whatWeShouldSpinUp.getTemplate(); final int numberOfExecutors = template.getNumberOfExecutors(); final Callable<Node> provisionNodeCallable = new Callable<Node>() { @Override public Node call() throws Exception { try { final Node newNode = provisionNewNode(whatWeShouldSpinUp, nodeName); VSLOG.log(Level.INFO, "Provisioned new slave " + nodeName); synchronized (templateState) { templateState.provisionedSlaveNowActive(whatWeShouldSpinUp, nodeName); } return newNode; } catch (Exception ex) { VSLOG.log(Level.WARNING, "Failed to provision new slave " + nodeName, ex); synchronized (templateState) { templateState.provisioningEndedInError(whatWeShouldSpinUp, nodeName); } throw ex; } } }; templateState.provisioningStarted(whatWeShouldSpinUp, nodeName); final Future<Node> provisionNodeTask = Computer.threadPoolForRemoting.submit(provisionNodeCallable); <START> return new VSpherePlannedNode(nodeName, provisionNodeTask, numberOfExecutors); <END> }</code><technical_language>changing "final ... result = .... ; return result" code "return ..." a change keen debugging harder - set a breakpoint returned result be</technical_language>

Target:
public static VSpherePlannedNode createInstance(final CloudProvisioningState templateState, final String nodeName, final CloudProvisioningRecord whatWeShouldSpinUp) { final vSphereCloudSlaveTemplate template = whatWeShouldSpinUp.getTemplate(); final int numberOfExecutors = template.getNumberOfExecutors(); final Callable<Node> provisionNodeCallable = new Callable<Node>() { @Override public Node call() throws Exception { try { final Node newNode = provisionNewNode(whatWeShouldSpinUp, nodeName); VSLOG.log(Level.INFO, "Provisioned new slave " + nodeName); synchronized (templateState) { templateState.provisionedSlaveNowActive(whatWeShouldSpinUp, nodeName); } return newNode; } catch (Exception ex) { VSLOG.log(Level.WARNING, "Failed to provision new slave " + nodeName, ex); synchronized (templateState) { templateState.provisioningEndedInError(whatWeShouldSpinUp, nodeName); } throw ex; } } }; templateState.provisioningStarted(whatWeShouldSpinUp, nodeName); final Future<Node> provisionNodeTask = Computer.threadPoolForRemoting.submit(provisionNodeCallable); final VSpherePlannedNode result = new VSpherePlannedNode(nodeName, provisionNodeTask, numberOfExecutors); return result; }
Source:
<code>public void init(ServerConfiguration conf) { <START> throw new IllegalStateException("Deprecated method, no longer should be used."); <END> }</code><technical_language>override call other method (which do anything, call deprecated in tserver), a deprecated default method in interface throws exception. exception message, deprecation message is scheduled for removal in 3.0.0. default methods need overridden, people safely delete current implementation prepare for eventual removal. However, replacement accepting a ServerContext is safer. a leak of internal type (ServerContext) is subject change, is effectively SPI. some other specific MemoryManagerEnvironment type for this</technical_language>

Target:
public void init(ServerConfiguration conf) { this.config = conf; maxMemory = conf.getSystemConfiguration().getAsBytes(Property.TSERV_MAXMEM); maxConcurrentMincs = conf.getSystemConfiguration().getCount(Property.TSERV_MINC_MAXCONCURRENT); numWaitingMultiplier = TSERV_MINC_MAXCONCURRENT_NUMWAITING_MULTIPLIER; }
Source:
<code>public URI createDirectory(URI parentFolderUri, String directoryName) throws IOException { File directory = new File(parentFolderUri.getPath() + File.separator + directoryName); if (!directory.mkdir()) { <START> throw new IOException(); <END> } return directory.toURI(); }</code><technical_language>Throwing exception a message is a good idea or</technical_language>

Target:
public URI createDirectory(URI parentFolderUri, String directoryName) throws IOException { File directory = new File(parentFolderUri.getPath() + File.separator + directoryName); if (!directory.mkdir()) { throw new IOException("Could not create directory."); } return directory.toURI(); }
Source:
<code>public boolean setNavDrawerLogo(String uri, @Nullable String packageName, @Nullable String intent) { String connectedAppDirPath = IndexConstants.PLUGINS_DIR + packageName; File connectedAppDir = app.getAppPath(connectedAppDirPath); if (TextUtils.isEmpty(uri)) { app.getSettings().NAV_DRAWER_LOGO.resetToDefault(); Algorithms.removeAllFiles(connectedAppDir); } else { try { Uri fileUri = Uri.parse(uri); InputStream is = app.getContentResolver().openInputStream(fileUri); if (is != null) { String iconName = ImportHelper.getNameFromContentUri(app, fileUri); if (!connectedAppDir.exists()) { connectedAppDir.mkdirs(); } OutputStream fout = new FileOutputStream(new File(connectedAppDir, iconName)); try { Algorithms.streamCopy(is, fout); } finally { try { is.close(); } catch (IOException e) { e.printStackTrace(); } try { fout.close(); } catch (IOException e) { e.printStackTrace(); } } JSONObject json = new JSONObject(); json.put("", connectedAppDirPath + "/" + iconName); app.getSettings().NAV_DRAWER_LOGO.set(json.toString()); } } catch (FileNotFoundException e) { return false; <START> } catch (JSONException e) { <END> } catch (IOException e) { } if (packageName != null && intent != null) { navDrawerParams = new ArrayList<>(); navDrawerParams.add(packageName); navDrawerParams.add(intent); } } return true; }</code><technical_language>ignore in logs</technical_language>

Target:
public boolean setNavDrawerLogo(String uri, @Nullable String packageName, @Nullable String intent) { String connectedAppDirPath = IndexConstants.PLUGINS_DIR + packageName; File connectedAppDir = app.getAppPath(connectedAppDirPath); if (TextUtils.isEmpty(uri)) { app.getSettings().NAV_DRAWER_LOGO.resetToDefault(); Algorithms.removeAllFiles(connectedAppDir); } else { try { Uri fileUri = Uri.parse(uri); InputStream is = app.getContentResolver().openInputStream(fileUri); if (is != null) { String iconName = ImportHelper.getNameFromContentUri(app, fileUri); if (!connectedAppDir.exists()) { connectedAppDir.mkdirs(); } OutputStream fout = new FileOutputStream(new File(connectedAppDir, iconName)); try { Algorithms.streamCopy(is, fout); } finally { try { is.close(); } catch (IOException e) { LOG.error(e); } try { fout.close(); } catch (IOException e) { LOG.error(e); } } JSONObject json = new JSONObject(); json.put("", connectedAppDirPath + "/" + iconName); app.getSettings().NAV_DRAWER_LOGO.set(json.toString()); } } catch (FileNotFoundException e) { LOG.error(e); return false; } catch (JSONException e) { LOG.error("Failed to read json", e); } catch (IOException e) { LOG.error("Failed to write file", e); } if (packageName != null && intent != null) { navDrawerParams = new ArrayList<>(); navDrawerParams.add(packageName); navDrawerParams.add(intent); } } return true; }
Source:
<code>public void setReferenceName(final String referenceName) { if (null == referenceName) { throw new IllegalArgumentException( "Reference name must not be null. Use SAMRecord.NO_ALIGNMENT_REFERENCE_NAME to reset the reference name."); } if (null != mHeader) { mReferenceIndex = resolveIndexFromName(referenceName, mHeader, false); mReferenceName = null == mReferenceIndex ? referenceName.intern() : <START> resolveNameFromIndex(mReferenceIndex, mHeader); <END> } else { mReferenceName = referenceName.intern(); mReferenceIndex = null; } }</code><technical_language>do this additional call resolveNameFromIndex() here? this give referenceName had, provided earlier call resolveIndexFromName() returned non-null</technical_language>

Target:
public void setReferenceName(final String referenceName) { if (null == referenceName) { throw new IllegalArgumentException( "Reference name must not be null. Use SAMRecord.NO_ALIGNMENT_REFERENCE_NAME to reset the reference name."); } if (null != mHeader) { mReferenceIndex = resolveIndexFromName(referenceName, mHeader, false); mReferenceName = null == mReferenceIndex ? referenceName.intern() : resolveNameFromIndex(mReferenceIndex, mHeader); } else if (NO_ALIGNMENT_REFERENCE_NAME.equals(referenceName)) { mReferenceName = NO_ALIGNMENT_REFERENCE_NAME; mReferenceIndex = NO_ALIGNMENT_REFERENCE_INDEX; } else { mReferenceName = referenceName.intern(); mReferenceIndex = null; } }
Source:
<code>public List<Column> getColumns() { <START> return Collections.unmodifiableList(new ArrayList<>(columns)); <END> }</code><technical_language>change return type method Collection</technical_language>

Target:
public Set<Column> getColumns() { return Collections.unmodifiableSet(columns); }
Source:
<code>private static void setMetadataRelatedIdentifiers(DepositMetadata depositMetadata, String dockstoreUrl, Workflow workflow) { List<RelatedIdentifier> aliasList = workflow.getAliases().keySet().stream() .map(alias -> { RelatedIdentifier relatedIdentifier = new RelatedIdentifier(); String aliasUrl = dockstoreUrl + "/aliases/workflows/" + alias; <START> relatedIdentifier.setIdentifier(aliasUrl.toString()); <END> relatedIdentifier.setRelation(RelatedIdentifier.RelationEnum.ISIDENTICALTO); return relatedIdentifier; }).collect(Collectors.toList()); depositMetadata.setRelatedIdentifiers(aliasList); }</code><technical_language>aliasUrl is a String; need call toString</technical_language>

Target:
private static void setMetadataRelatedIdentifiers(DepositMetadata depositMetadata, String dockstoreUrl, Workflow workflow) { List<RelatedIdentifier> aliasList = workflow.getAliases().keySet().stream() .map(alias -> { RelatedIdentifier relatedIdentifier = new RelatedIdentifier(); String aliasUrl = dockstoreUrl + "/aliases/workflows/" + alias; relatedIdentifier.setIdentifier(aliasUrl); relatedIdentifier.setRelation(RelatedIdentifier.RelationEnum.ISIDENTICALTO); return relatedIdentifier; }).collect(Collectors.toList()); depositMetadata.setRelatedIdentifiers(aliasList); }
Source:
<code>public List<QuizSubmissionQuestion> answerQuestions(AnswerQuizQuestionOptions options, String answerArrayJson) throws IOException { <START> LOG.debug("answering questions for quiz submission: " + options.getQuizSubmissionid()); <END> String url = buildCanvasUrl("quiz_submissions/" + options.getQuizSubmissionid() + "/questions", options.getOptionsMap()); JsonObject requestBody = new JsonObject(); JsonParser parser = new JsonParser(); JsonArray answerJson = (JsonArray) parser.parse(answerArrayJson); requestBody.add("quiz_questions", answerJson); Response response = canvasMessenger.sendJsonPostToCanvas(oauthToken, url, requestBody); if(response.getErrorHappened() || response.getResponseCode() != 200) { LOG.error("Error answering questions. Returning null"); LOG.debug(response.getContent()); return null; } Type responseType = new TypeToken<QuizSubmissionWrapper>() { }.getType(); Gson responseGson = new GsonBuilder().registerTypeAdapter(responseType, new QuizSubmissionQuestionTypeAdapter()).create(); QuizSubmissionQuestionWrapper wrapper = responseGson.fromJson(response.getContent(), responseType); return wrapper.getQuizSubmissionQuestions(); }</code><technical_language>if options is null, this throws a null pointer</technical_language>

Target:
public List<QuizSubmissionQuestion> answerQuestions(AnswerQuizQuestionOptions options, String answerArrayJson) throws IOException { if(options == null || answerArrayJson == null) { throw new IllegalArgumentException("options and answers must not be null"); } LOG.debug("answering questions for quiz submission: " + options.getQuizSubmissionid()); String url = buildCanvasUrl("quiz_submissions/" + options.getQuizSubmissionid() + "/questions", options.getOptionsMap()); JsonObject requestBody = new JsonObject(); JsonParser parser = new JsonParser(); JsonArray answerJson = (JsonArray) parser.parse(answerArrayJson); requestBody.add("quiz_questions", answerJson); Response response = canvasMessenger.sendJsonPostToCanvas(oauthToken, url, requestBody); if(response.getErrorHappened() || response.getResponseCode() != 200) { LOG.error("Error answering questions. Returning null"); LOG.debug(response.getContent()); return null; } Type responseType = new TypeToken<QuizSubmissionWrapper>() { }.getType(); Gson responseGson = new GsonBuilder().registerTypeAdapter(responseType, new QuizSubmissionQuestionTypeAdapter()).create(); QuizSubmissionQuestionWrapper wrapper = responseGson.fromJson(response.getContent(), responseType); return wrapper.getQuizSubmissionQuestions(); }
Source:
<code>public void testParcelNetworkCapabilities() { final Set<UidRange> uids = new ArraySet<>(); uids.add(new UidRange(50, 100)); uids.add(new UidRange(3000, 4000)); final NetworkCapabilities netCap = new NetworkCapabilities() .addCapability(NET_CAPABILITY_INTERNET) .setUids(uids) .addCapability(NET_CAPABILITY_EIMS) .addCapability(NET_CAPABILITY_NOT_METERED); assertParcelingIsLossless(netCap); netCap.setSSID(TEST_SSID); <START> assertParcelingIsLossless(netCap); <END> }</code><technical_language>assertParcelSane</technical_language>

Target:
public void testParcelNetworkCapabilities() { final Set<UidRange> uids = new ArraySet<>(); uids.add(new UidRange(50, 100)); uids.add(new UidRange(3000, 4000)); final NetworkCapabilities netCap = new NetworkCapabilities() .addCapability(NET_CAPABILITY_INTERNET) .setUids(uids) .addCapability(NET_CAPABILITY_EIMS) .addCapability(NET_CAPABILITY_NOT_METERED); assertParcelingIsLossless(netCap); netCap.setSSID(TEST_SSID); assertParcelSane(netCap, 11); }
Source:
<code>public void givenOAuth2Context_whenAccessTokenIsRequested_ThenAccessTokenValueIsNotNull() { ClientCredentialsResourceDetails resourceDetails = getClientCredentialsResourceDetails("baeldung", singletonList("read")); OAuth2RestTemplate restTemplate = getOAuth2RestTemplate(resourceDetails); OAuth2AccessToken accessToken = restTemplate.getAccessToken(); final String authentication = restTemplate.execute(base.toString() + "/authentication", HttpMethod.GET, clientHttpRequest -> { }, clientHttpResponse -> IOUtils.toString(clientHttpResponse.getBody(), Charset.defaultCharset())); final String principal = restTemplate.execute(base.toString() + "/principal", HttpMethod.GET, clientHttpRequest -> { }, clientHttpResponse -> IOUtils.toString(clientHttpResponse.getBody(), Charset.defaultCharset())); assertNotNull(accessToken); assertEquals(authentication, "baeldung"); <START> assertEquals(principal, "baeldung"); <END> }</code><technical_language>assertions in wrong order. assertEquals(expected, actual)</technical_language>

Target:
public void givenOAuth2Context_whenAccessTokenIsRequested_ThenAccessTokenValueIsNotNull() { ClientCredentialsResourceDetails resourceDetails = getClientCredentialsResourceDetails("baeldung", singletonList("read")); OAuth2RestTemplate restTemplate = getOAuth2RestTemplate(resourceDetails); OAuth2AccessToken accessToken = restTemplate.getAccessToken(); assertNotNull(accessToken); }
Source:
<code><START> void validateText() { <END> if (!funnel.shouldSeeChecks()) { return; } isTextValid = true; String text = pageDescriptionText.getText().toString().toLowerCase(); if (text.length() == 0) { isTextValid = false; setError(null); } else if (text.length() < 2) { isTextValid = false; setError(getContext().getString(R.string.description_too_short)); } else if (pageTitle.getWikiSite().languageCode().equals("en") && StringUtils.endsWithAny(text, ".", ",", "!", "?")) { isTextValid = false; setError(getContext().getString(R.string.description_ends_with_punctuation)); } else if (pageTitle.getWikiSite().languageCode().equals("en") && StringUtils.startsWithAny(text, "a ", "an ", "the ")) { setWarning(getContext().getString(R.string.description_starts_with_article)); } else if (pageTitle.getWikiSite().languageCode().equals("en") && Character.isUpperCase(pageDescriptionText.getText().toString().charAt(0))) { setWarning(getContext().getString(R.string.description_starts_with_uppercase)); } else { setError(null); } updateSaveButtonEnabled(); }</code><technical_language>remove spaces beginning end of text? Users send description if add a space end if text contains invalid format</technical_language>

Target:
void validateText() { if (!funnel.shouldSeeChecks()) { return; } isTextValid = true; String text = pageDescriptionText.getText().toString().toLowerCase().trim(); if (text.length() == 0) { isTextValid = false; setError(null); } else if (text.length() < 2) { isTextValid = false; setError(getContext().getString(R.string.description_too_short)); } else if (pageTitle.getWikiSite().languageCode().equals("en") && StringUtils.endsWithAny(text, ".", ",", "!", "?")) { isTextValid = false; setError(getContext().getString(R.string.description_ends_with_punctuation)); } else if (pageTitle.getWikiSite().languageCode().equals("en") && StringUtils.startsWithAny(text, "a ", "an ", "the ")) { setWarning(getContext().getString(R.string.description_starts_with_article)); } else if (pageTitle.getWikiSite().languageCode().equals("en") && Character.isUpperCase(pageDescriptionText.getText().toString().charAt(0))) { setWarning(getContext().getString(R.string.description_starts_with_uppercase)); } else { setError(null); } updateSaveButtonEnabled(); }
Source:
<code>public void checkContainers() throws InterruptedException { long minIntervalMs = getMinIntervalMs(); getCandidates().stream() .forEach(containerPath -> { long startMs = Time.currentElapsedTime(); ByteBuffer path = ByteBuffer.wrap(containerPath.getBytes()); Request request = new Request(null, 0, 0, ZooDefs.OpCode.deleteContainer, path, null); try { LOG.info("Attempting to delete candidate container: {}", containerPath); postDeleteRequest(request); } catch (Exception e) { LOG.error("Could not delete container: {}", containerPath, e); } long elapsedMs = Time.currentElapsedTime() - startMs; long waitMs = minIntervalMs - elapsedMs; if (waitMs > 0) { try { Thread.sleep(waitMs); } catch (InterruptedException e) { e.printStackTrace(); } } }); <START> } <END></code><technical_language>this change body of forEach fat? a personal aesthetics</technical_language>

Target:
public void checkContainers() throws InterruptedException { long minIntervalMs = getMinIntervalMs(); for (String containerPath : getCandidates()) { long startMs = Time.currentElapsedTime(); ByteBuffer path = ByteBuffer.wrap(containerPath.getBytes()); Request request = new Request(null, 0, 0, ZooDefs.OpCode.deleteContainer, path, null); try { LOG.info("Attempting to delete candidate container: {}", containerPath); postDeleteRequest(request); } catch (Exception e) { LOG.error("Could not delete container: {}", containerPath, e); } long elapsedMs = Time.currentElapsedTime() - startMs; long waitMs = minIntervalMs - elapsedMs; if (waitMs > 0) { Thread.sleep(waitMs); } } }
Source:
<code><START> protected void deactivateTaskInternal(ITask task) { <END> if (task == null) { return; } if (task.isActive() && task == activeTask) { initTaskListeners(); for (ITaskActivationListener listener : new ArrayList<ITaskActivationListener>(activationListeners)) { try { listener.preTaskDeactivated(task); } catch (Throwable t) { StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Notification failed for: " + listener, t)); } } ((AbstractTask) activeTask).setActive(false); activeTask = null; for (ITaskActivationListener listener : new ArrayList<ITaskActivationListener>(activationListeners)) { try { listener.taskDeactivated(task); } catch (Throwable t) { StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Notification failed for: " + listener, t)); } } } else { ((AbstractTask) task).setActive(false); } }</code><technical_language>need this method</technical_language>

Target:
protected void deactivateTaskInternal(ITask task) { if (task.isActive() && task == activeTask) { initTaskListeners(); for (ITaskActivationListener listener : new ArrayList<ITaskActivationListener>(activationListeners)) { try { listener.preTaskDeactivated(task); } catch (Throwable t) { StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Notification failed for: " + listener, t)); } } ((AbstractTask) activeTask).setActive(false); activeTask = null; for (ITaskActivationListener listener : new ArrayList<ITaskActivationListener>(activationListeners)) { try { listener.taskDeactivated(task); } catch (Throwable t) { StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN, "Notification failed for: " + listener, t)); } } } else { ((AbstractTask) task).setActive(false); } }