auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static ServiceName resolveDeploymentUnitServiceName(OperationContext context, ModelNode operation) { PathAddress address = PathAddress.pathAddress(operation.require(ModelDescriptionConstants.OP_ADDR)); if (address.getElement(1).getKey().equals(ModelDescriptionConstants.SUBDEPLOYMENT)) { return Services.deploymentUnitName( resolveRuntimeName(context, address.getElement(0)), address.getElement(1).getValue() ); } else { return Services.deploymentUnitName( resolveRuntimeName(context, address.getElement(0)) ); } }

Target:
private static ServiceName resolveDeploymentUnitServiceName(OperationContext context, ModelNode operation) { PathAddress address = context.getCurrentAddress(); if (address.getElement(1).getKey().equals(ModelDescriptionConstants.SUBDEPLOYMENT)) { return Services.deploymentUnitName( resolveRuntimeName(context, address.getElement(0)), address.getElement(1).getValue() ); } else { return Services.deploymentUnitName( resolveRuntimeName(context, address.getElement(0)) ); } }
Source:
public void add(Replica replica) { assert begin == 0; if (size == contents.length) { int newSize; if (size < 3) newSize = 3; else if (size < 9) newSize = 9; else newSize = size * 2; contents = Arrays.copyOf(contents, newSize); } contents[size++] = replica; }

Target:
public void add(Replica replica) { if (begin != 0) throw new IllegalStateException(); if (size == contents.length) { int newSize; if (size < 3) newSize = 3; else if (size < 9) newSize = 9; else newSize = size * 2; contents = Arrays.copyOf(contents, newSize); } contents[size++] = replica; }
Source:
public void testRemoveForced() throws Exception { setUpGetEntityExpectations(); setUriInfo(setUpActionExpectations(VdcActionType.RemoveVds, RemoveVdsParameters.class, new String[] { "VdsId", "ForceAction" }, new Object[] { GUIDS[0], Boolean.TRUE }, true, true)); Action action = new Action(); action.setForce(true); verifyRemove(collection.remove(GUIDS[0].toString(), new Action(){{setForce(true);}})); }

Target:
public void testRemoveForced() throws Exception { setUpGetEntityExpectations(); setUriInfo(setUpActionExpectations(VdcActionType.RemoveVds, RemoveVdsParameters.class, new String[] { "VdsId", "ForceAction" }, new Object[] { GUIDS[0], Boolean.TRUE }, true, true)); Action action = new Action(); action.setForce(true); verifyRemove(collection.remove(GUIDS[0].toString(), action)); }
Source:
protected void stopping() { if (mementos != null) { for (CacheMemento memento : mementos) { memento.restore(); } } }

Target:
protected void stopping() { Arrays.stream(mementos).forEach(CacheMemento::restore); }
Source:
public void testDiscoverDevicesNoDevices() throws Exception { List<String> list = new ArrayList<String>(); list.add("id"); byte[] deviceTimeoutByteArray = new byte[]{0x01}; long deviceTimeout = ByteUtils.byteArrayToLong(deviceTimeoutByteArray) * 100; PowerMockito.when(deviceMock.getParameter("NT")).thenReturn(deviceTimeoutByteArray); long start = System.currentTimeMillis(); List<RemoteXBeeDevice> remotes = nd.discoverDevices(list); long end = System.currentTimeMillis(); assertThat("The 'discoverDevices' should block for " + deviceTimeout + " ms", end - start > deviceTimeout, is(equalTo(true))); assertThat("The discovered devices list should be empty", remotes.size(), is(equalTo(0))); PowerMockito.verifyPrivate(nd, Mockito.times(1)).invoke(SEND_NODE_DISCOVERY_COMMAND_METHOD, Mockito.anyString()); Mockito.verify(deviceMock, Mockito.times(1)).addPacketListener(packetListener); Mockito.verify(deviceMock, Mockito.times(1)).removePacketListener(packetListener); PowerMockito.verifyPrivate(nd, Mockito.times(1)).invoke(DISCOVER_DEVICES_API_METHOD, null, null); Mockito.verify(networkMock, Mockito.never()).addRemoteDevices(Mockito.anyListOf(RemoteXBeeDevice.class)); }

Target:
public void testDiscoverDevicesNoDevices() throws Exception { List<String> list = new ArrayList<String>(); list.add("id"); byte[] deviceTimeoutByteArray = new byte[]{0x01}; long deviceTimeout = ByteUtils.byteArrayToLong(deviceTimeoutByteArray) * 100; PowerMockito.when(deviceMock.getParameter("NT")).thenReturn(deviceTimeoutByteArray); long start = System.currentTimeMillis(); List<RemoteXBeeDevice> remotes = nd.discoverDevices(list); long end = System.currentTimeMillis(); assertThat("The 'discoverDevices' should block for " + deviceTimeout + " ms", end - start > deviceTimeout, is(equalTo(true))); assertThat("The discovered devices list should be empty", remotes.size(), is(equalTo(0))); PowerMockito.verifyPrivate(nd, Mockito.times(1)).invoke(SEND_NODE_DISCOVERY_COMMAND_METHOD, Mockito.anyString()); Mockito.verify(deviceMock, Mockito.times(1)).addPacketListener(packetListener); Mockito.verify(deviceMock, Mockito.times(1)).removePacketListener(packetListener); PowerMockito.verifyPrivate(nd, Mockito.times(1)).invoke(DISCOVER_DEVICES_API_METHOD, null, null); Mockito.verify(networkMock, Mockito.never()).addRemoteDevices(Mockito.anyListOf(RemoteXBeeDevice.class)); Mockito.verify(networkMock, Mockito.never()).addRemoteDevice(Mockito.any(RemoteXBeeDevice.class)); }
Source:
public void evaluate(Evaluation evaluation) { EvaluationContext context = evaluation.getContext(); String[] clientIds = getClients(this.policy); if (clientIds.length > 0) { for (String clientId : clientIds) { if (context.getIdentity().getId().equals(clientId)) { evaluation.grant(); return; } } } }

Target:
public void evaluate(Evaluation evaluation) { EvaluationContext context = evaluation.getContext(); String[] clients = getClients(this.policy); if (clients.length > 0) { for (String client : clients) { ClientModel clientModel = getCurrentRealm().getClientById(client); if (context.getAttributes().containsValue("kc.client.id", clientModel.getClientId())) { evaluation.grant(); return; } } } }
Source:
private ActiveResourceManager<ResourceID> createAndStartResourceManager( Configuration configuration, ResourceManagerDriver<ResourceID> driver, SlotManager slotManager) throws Exception { final TestingRpcService rpcService = new TestingRpcService(configuration); final MockResourceManagerRuntimeServices rmServices = new MockResourceManagerRuntimeServices(rpcService, TIMEOUT_TIME, slotManager); final ActiveResourceManager<ResourceID> activeResourceManager = new ActiveResourceManager<>( driver, configuration, rpcService, ResourceID.generate(), rmServices.highAvailabilityServices, rmServices.heartbeatServices, rmServices.slotManager, NoOpResourceManagerPartitionTracker::get, rmServices.jobLeaderIdService, new ClusterInformation("localhost", 1234), fatalErrorHandler, UnregisteredMetricGroups.createUnregisteredResourceManagerMetricGroup()); activeResourceManager.start(); rmServices.grantLeadership(); return activeResourceManager; }

Target:
private ActiveResourceManager<ResourceID> createAndStartResourceManager( Configuration configuration, ResourceManagerDriver<ResourceID> driver, SlotManager slotManager) throws Exception { final TestingRpcService rpcService = RPC_SERVICE_RESOURCE.getTestingRpcService(); final MockResourceManagerRuntimeServices rmServices = new MockResourceManagerRuntimeServices(rpcService, TIMEOUT_TIME, slotManager); final ActiveResourceManager<ResourceID> activeResourceManager = new ActiveResourceManager<>( driver, configuration, rpcService, ResourceID.generate(), rmServices.highAvailabilityServices, rmServices.heartbeatServices, rmServices.slotManager, NoOpResourceManagerPartitionTracker::get, rmServices.jobLeaderIdService, new ClusterInformation("localhost", 1234), fatalErrorHandler, UnregisteredMetricGroups.createUnregisteredResourceManagerMetricGroup()); activeResourceManager.start(); rmServices.grantLeadership(); return activeResourceManager; }
Source:
private List<String> getFilesToAdd(Iterable<File> includeFiles, BuildToolInfo buildToolInfo, File outInputListFolder) throws IOException { List<String> filePathList = Lists.newArrayList(); for (File f : includeFiles) { if (f != null && f.exists()) { filePathList.add(f.getAbsolutePath()); } } if (filePathList.isEmpty()) { mLogger.verbose("No Dex inputs."); return Lists.newArrayList(); } FullRevision minBuildToolRevision = new FullRevision(21, 0, 0); if (buildToolInfo.getRevision().compareTo(minBuildToolRevision) >= 0) { if (!outInputListFolder.exists()) { outInputListFolder.mkdirs(); } File inputListFile = new File(outInputListFolder, "libraryList.txt"); Files.asCharSink(inputListFile, Charsets.UTF_8).writeLines(filePathList); mLogger.verbose("Dex inputs passed via --input-list: " + filePathList); return Lists.newArrayList("--input-list", inputListFile.getAbsolutePath()); } else { mLogger.verbose("Dex inputs passed as command line arguments: " + filePathList); return filePathList; } }

Target:
private List<String> getFilesToAdd(Iterable<File> includeFiles, BuildToolInfo buildToolInfo, File outInputListFolder) throws IOException { List<String> filePathList = Lists.newArrayList(); for (File f : includeFiles) { if (f != null && f.exists()) { filePathList.add(f.getAbsolutePath()); } } if (filePathList.isEmpty()) { throw new IOException("No files to pass to dex."); } if (buildToolInfo.getRevision().compareTo(MIN_BUILD_TOOLS_REVISION_FOR_DEX_INPUT_LIST) >= 0) { File inputListFile = new File(outInputListFolder, "libraryList.txt"); Files.asCharSink(inputListFile, Charsets.UTF_8).writeLines(filePathList); return Lists.newArrayList("--input-list=" + inputListFile.getAbsolutePath()); } else { return filePathList; } }
Source:
public String toString() { return String.format("The firmware update progress for thing %s changed. State: %s Progress: %d.", thingUID, progressInfo.getProgressStep().name(), progressInfo.getProgress()); }

Target:
public String toString() { String stepName = progressInfo.getProgressStep() == null ? null : progressInfo.getProgressStep().name(); return String.format("The firmware update progress for thing %s changed. Step: %s Progress: %d.", thingUID, stepName, progressInfo.getProgress()); }
Source:
public List<Task<? extends Serializable>> handle(Context context) throws SemanticException { OpenTxnMessage msg = deserializer.getOpenTxnMessage(context.dmd.getPayload()); Task<OpenTxnWork> openTxnTask = TaskFactory.get( new OpenTxnWork(context.dbName, context.tableName, msg.getTxnId()), context.hiveConf ); context.log.debug("Added Open txn task : {}", openTxnTask.getId()); return Collections.singletonList(openTxnTask); }

Target:
public List<Task<? extends Serializable>> handle(Context context) throws SemanticException { OpenTxnMessage msg = deserializer.getOpenTxnMessage(context.dmd.getPayload()); Task<ReplTxnWork> openTxnTask = TaskFactory.get( new ReplTxnWork(context.dbName, context.tableName, msg.getTxnIdItr(), ReplTxnWork.OperationType.REPL_OPEN_TXN), context.hiveConf ); updatedMetadata.set(context.dmd.getEventTo().toString(), context.dbName, context.tableName, null); context.log.debug("Added Open txn task : {}", openTxnTask.getId()); return Collections.singletonList(openTxnTask); }
Source:
public String getJsonPlan(Session session, Statement statement, Type planType, List<Expression> parameters, WarningCollector warningCollector) { DataDefinitionTask<?> task = dataDefinitionTask.get(statement.getClass()); if (task != null) { return explainTask(statement, task, parameters); } Plan plan; switch (planType) { case IO: plan = getLogicalPlan(session, statement, parameters, warningCollector); return textIOPlan(plan.getRoot(), metadata, session); case LOGICAL: plan = getLogicalPlan(session, statement, parameters, warningCollector); return PlanPrinter.jsonLogicalPlan(plan.getRoot(), plan.getTypes(), metadata.getFunctionManager(), plan.getStatsAndCosts(), session); case DISTRIBUTED: SubPlan subPlan = getDistributedPlan(session, statement, parameters, warningCollector); return PlanPrinter.jsonDistributedPlan(subPlan); default: throw new PrestoException(NOT_SUPPORTED, format("Unsupported explain plan type %s for JSON format", planType)); } }

Target:
public String getJsonPlan(Session session, Statement statement, Type planType, List<Expression> parameters, WarningCollector warningCollector) { DataDefinitionTask<?> task = dataDefinitionTask.get(statement.getClass()); if (task != null) { return explainTask(statement, task, parameters); } Plan plan; switch (planType) { case IO: plan = getLogicalPlan(session, statement, parameters, warningCollector); return textIOPlan(plan.getRoot(), metadata, session); case LOGICAL: plan = getLogicalPlan(session, statement, parameters, warningCollector); return jsonLogicalPlan(plan.getRoot(), plan.getTypes(), metadata.getFunctionManager(), plan.getStatsAndCosts(), session); case DISTRIBUTED: SubPlan subPlan = getDistributedPlan(session, statement, parameters, warningCollector); return jsonDistributedPlan(subPlan); default: throw new PrestoException(NOT_SUPPORTED, format("Unsupported explain plan type %s for JSON format", planType)); } }
Source:
public void run() { while (spaceUsed.running()) { try { long refreshInterval = spaceUsed.refreshInterval; if (spaceUsed.jitter > 0) { long jitter = spaceUsed.jitter; refreshInterval += ThreadLocalRandom.current() .nextLong(-jitter, jitter); } refreshInterval = Math.max(refreshInterval, 1); Thread.sleep(refreshInterval); spaceUsed.refresh(); } catch (InterruptedException e) { LOG.warn("Thread Interrupted waiting to refresh disk information. " + "Ignoring."); } } }

Target:
public void run() { while (spaceUsed.running()) { try { long refreshInterval = spaceUsed.refreshInterval; if (spaceUsed.jitter > 0) { long jitter = spaceUsed.jitter; refreshInterval += ThreadLocalRandom.current() .nextLong(-jitter, jitter); } refreshInterval = Math.max(refreshInterval, 1); Thread.sleep(refreshInterval); spaceUsed.refresh(); } catch (InterruptedException e) { LOG.warn("Thread Interrupted waiting to refresh disk information. " + "Ignoring."); LOG.debug("Thread interrupted", e); } } }
Source:
private List<?> getRemoteChildrenList(Resource resource, ValueMap valueMap, Field field, String propertyName) { final Class<?> fieldType = field.getType(); Object value = valueMap.get(propertyName); if (value == null) { if (LOG.isDebugEnabled()) { LOG.debug( "the property [{}/{}] is undefined, assigning null value for [{}#{}]", new Object[] { resource.getPath(), propertyName, fieldType.getCanonicalName(), field.getName() }); } return Collections.EMPTY_LIST; } if (!(value instanceof String)) { if (LOG.isDebugEnabled()) { LOG.debug( "the property [{}/{}] annotated is not of String type as required by " + "@JcrProperty(..., follow = true) in the model, assigning null " + "value for [{}#{}]", new Object[] { resource.getPath(), propertyName, fieldType.getCanonicalName(), field.getName() }); } return Collections.EMPTY_LIST; } String nestedResourcePath = (String) value; Resource followUpResource = resource.getResourceResolver().getResource(nestedResourcePath); if (followUpResource == null) { if (LOG.isDebugEnabled()) { LOG.debug( "the nested resource [{}/{}] expected under path doesn't exist, " + "assigning null value for [{}#{}]", new Object[] { resource.getPath(), propertyName, nestedResourcePath, fieldType.getCanonicalName(), field.getName() }); } return Collections.EMPTY_LIST; } return getChildrenList(followUpResource, field); }

Target:
private List<?> getRemoteChildrenList(Resource resource, ValueMap valueMap, Field field, String propertyName) { Resource followUpResource = FollowUpProcessorUtil.getFollowUpResource(resource, valueMap, field, propertyName); if (followUpResource == null) { return Collections.EMPTY_LIST; } return getChildrenList(followUpResource, field); }
Source:
public void testStringChannelTimeZoneUpdate() { final String expectedTimeZonePDT = "PDT"; final String expectedTimeZonePST = "PST"; Configuration configuration = new Configuration(); configuration.put(NtpBindingConstants.PROPERTY_TIMEZONE, TEST_TIME_ZONE_ID); configuration.put(NtpBindingConstants.PROPERTY_NTP_SERVER_HOST, TEST_HOSTNAME); configuration.put(NtpBindingConstants.PROPERTY_NTP_SERVER_PORT, TEST_PORT); Configuration channelConfig = new Configuration(); channelConfig.put(NtpBindingConstants.PROPERTY_DATE_TIME_FORMAT, TEST_DATE_TIME_FORMAT); initialize(configuration, NtpBindingConstants.CHANNEL_STRING, ACCEPTED_ITEM_TYPE_STRING, channelConfig); String timeZoneFromItemRegistry = getStringChannelTimeZoneFromItemRegistry(); assertThat("The string channel was not updated with the right timezone", timeZoneFromItemRegistry, is(anyOf(equalTo(expectedTimeZonePDT), equalTo(expectedTimeZonePST)))); }

Target:
public void testStringChannelTimeZoneUpdate() { final String expectedTimeZonePDT = "PDT"; final String expectedTimeZonePST = "PST"; Configuration configuration = new Configuration(); configuration.put(NtpBindingConstants.PROPERTY_TIMEZONE, TEST_TIME_ZONE_ID); Configuration channelConfig = new Configuration(); channelConfig.put(NtpBindingConstants.PROPERTY_DATE_TIME_FORMAT, TEST_DATE_TIME_FORMAT); initialize(configuration, NtpBindingConstants.CHANNEL_STRING, ACCEPTED_ITEM_TYPE_STRING, channelConfig, null); String timeZoneFromItemRegistry = getStringChannelTimeZoneFromItemRegistry(); assertThat("The string channel was not updated with the right timezone", timeZoneFromItemRegistry, is(anyOf(equalTo(expectedTimeZonePDT), equalTo(expectedTimeZonePST)))); }
Source:
public boolean shouldExecute() { if (this.runDelay < 0) { this.hasDrone = hasBeeType(EnumBeeType.DRONE); this.hasPrincess = hasBeeType(EnumBeeType.PRINCESS); } return super.shouldExecute(); }

Target:
public boolean shouldExecute() { if (this.runDelay <= 0) { this.hasDrone = hasBeeType(EnumBeeType.DRONE); this.hasPrincess = hasBeeType(EnumBeeType.PRINCESS); } return super.shouldExecute(); }
Source:
public void required_spec201_blackbox_mustSignalDemandViaSubscriptionRequest() throws Throwable { blackboxSubscriberTest(new BlackboxTestStageTestRun() { @Override public void run(BlackboxTestStage stage) throws InterruptedException { triggerRequest(stage.subProxy().sub()); final long requested = stage.expectRequest(); final long signalsToEmit = Math.min(requested, 512); for (int i = 0; i < signalsToEmit; i++) stage.signalNext(); stage.sendCompletion(); } }); }

Target:
public void required_spec201_blackbox_mustSignalDemandViaSubscriptionRequest() throws Throwable { blackboxSubscriberTest(new BlackboxTestStageTestRun() { @Override public void run(BlackboxTestStage stage) throws InterruptedException { triggerRequest(stage.subProxy().sub()); final long requested = stage.expectRequest(); final long signalsToEmit = Math.min(requested, 512); for (int i = 0; i < signalsToEmit && sampleIsCancelled(stage, i, 10); i++) stage.signalNext(); stage.sendCompletion(); } private boolean sampleIsCancelled(BlackboxTestStage stage, int i, int checkInterval) throws InterruptedException { if (i % checkInterval == 0) return stage.isCancelled(); else return false; } }); }
Source:
protected void run() throws Exception { if (localName != null && gitdir != null) throw die(CLIText.get().conflictingUsageOf_git_dir_andArguments); final URIish uri = new URIish(sourceUri); if (localName == null) { try { localName = uri.getHumanishName(); } catch (IllegalArgumentException e) { throw die(MessageFormat.format(CLIText.get().cannotGuessLocalNameFrom, sourceUri)); } } if (gitdir == null) gitdir = new File(localName, Constants.DOT_GIT).getAbsolutePath(); dst = new FileRepository(gitdir); dst.create(); final FileBasedConfig dstcfg = dst.getConfig(); dstcfg.setBoolean("core", null, "bare", false); dstcfg.save(); db = dst; outw.print(MessageFormat.format( CLIText.get().initializedEmptyGitRepositoryIn, gitdir)); outw.println(); outw.flush(); saveRemote(uri); final FetchResult r = runFetch(); final Ref checkoutRef; if (branch == null) checkoutRef = guessHEAD(r); else checkoutRef = r.getAdvertisedRef(Constants.R_HEADS + branch); doCheckout(checkoutRef); }

Target:
protected void run() throws Exception { if (localName != null && gitdir != null) throw die(CLIText.get().conflictingUsageOf_git_dir_andArguments); final URIish uri = new URIish(sourceUri); if (localName == null) { try { localName = uri.getHumanishName(); } catch (IllegalArgumentException e) { throw die(MessageFormat.format(CLIText.get().cannotGuessLocalNameFrom, sourceUri)); } } if (gitdir == null) gitdir = new File(localName, Constants.DOT_GIT).getAbsolutePath(); dst = new FileRepository(gitdir); dst.create(); final FileBasedConfig dstcfg = dst.getConfig(); dstcfg.setBoolean("core", null, "bare", false); dstcfg.save(); db = dst; outw.print(MessageFormat.format( CLIText.get().initializedEmptyGitRepositoryIn, gitdir)); outw.println(); outw.flush(); saveRemote(uri); final FetchResult r = runFetch(); final Ref checkoutRef; if (branch == null) checkoutRef = guessHEAD(r); else { checkoutRef = r.getAdvertisedRef(Constants.R_HEADS + branch); if (checkoutRef == null) throw die(MessageFormat.format(CLIText.get().noSuchRemoteRef, branch)); } doCheckout(checkoutRef); }
Source:
private void releaseSavePoint(boolean autosave, int flags) throws SQLException { if (autosave && (flags & QueryExecutor.QUERY_SUPPRESS_BEGIN) == 1 && getAutoSave() == AutoSave.ALWAYS && getTransactionState() == TransactionState.OPEN) { try { sendOneQuery(releaseAutoSave, SimpleQuery.NO_PARAMETERS, 1, 0, QUERY_NO_RESULTS | QUERY_NO_METADATA | QUERY_EXECUTE_AS_SIMPLE); } catch (IOException ex) { throw new PSQLException(GT.tr("Error releasing savepoint"), PSQLState.IO_ERROR); } } }

Target:
private void releaseSavePoint(boolean autosave, int flags) throws SQLException { if ( autosave && getAutoSave() == AutoSave.ALWAYS && getTransactionState() == TransactionState.OPEN) { try { sendOneQuery(releaseAutoSave, SimpleQuery.NO_PARAMETERS, 1, 0, QUERY_NO_RESULTS | QUERY_NO_METADATA | QUERY_EXECUTE_AS_SIMPLE); } catch (IOException ex) { throw new PSQLException(GT.tr("Error releasing savepoint"), PSQLState.IO_ERROR); } } }
Source:
public static void start(String key) { MeasurementSeries measurementSeries = SERIES_MAP.get(key); if (measurementSeries == null) { measurementSeries = new MeasurementSeries(); SERIES_MAP.put(key, measurementSeries); } if (measurementSeries.currentStart > 0) { L.w("Overwriting currentStart of " + measurementSeries.currentStart); } L.v("Start(" + key + ")"); measurementSeries.currentStart = System.nanoTime(); }

Target:
public static void start(String key) { MeasurementSeries measurementSeries = SERIES_MAP.get(key); if (measurementSeries == null) { measurementSeries = new MeasurementSeries(); SERIES_MAP.put(key, measurementSeries); } if (measurementSeries.currentStart > 0) { L.w("Overwriting currentStart of " + measurementSeries.currentStart); } L.v("Start(" + key + ")"); measurementSeries.currentStart = SystemClock.elapsedRealtime(); }
Source:
public BlockRegion union(int x, int y, int z, BlockRegion dest) { dest.aabb.minX = this.aabb.minX < x ? this.aabb.minX : x; dest.aabb.minY = this.aabb.minY < y ? this.aabb.minY : y; dest.aabb.minZ = this.aabb.minZ < z ? this.aabb.minZ : z; dest.aabb.maxX = this.aabb.maxX > (x + 1) ? this.aabb.maxX : (x + 1); dest.aabb.maxY = this.aabb.maxY > (y + 1) ? this.aabb.maxY : (y + 1); dest.aabb.maxZ = this.aabb.maxZ > (z + 1) ? this.aabb.maxZ : (z + 1); return dest; }

Target:
public BlockRegion union(int x, int y, int z, BlockRegion dest) { dest.aabb.minX = Math.min(this.aabb.minX, x); dest.aabb.minY = Math.min(this.aabb.minY, y); dest.aabb.minZ = Math.min(this.aabb.minZ, z); dest.aabb.maxX = Math.max(this.aabb.maxX, (x + 1)); dest.aabb.maxY = Math.max(this.aabb.maxY, (y + 1)); dest.aabb.maxZ = Math.max(this.aabb.maxZ, (z + 1)); return dest; }
Source:
public String toString() { return code() + " " + reasonText(); }

Target:
public String toString() { String text = this.text; if (text == null) { this.text = text = code() + " " + reasonText(); } return text; }
Source:
private void createSynchronizationBehaviorContent(Composite parent) { Group synchronizationGroup = new Group(parent, SWT.NONE); GridData layoutData = new GridData(SWT.FILL, SWT.BOTTOM, true, false); RowLayout layout = new RowLayout(SWT.HORIZONTAL); layout.marginTop = 10; layout.marginBottom = 10; synchronizationGroup.setLayout(layout); synchronizationGroup.setLayoutData(layoutData); synchronizationGroup.setText(EMFCompareRCPUIMessages .getString("InteractiveFilterUIContent.SYNC_BEHAVIOR_GROUP_LABEL")); Label label = new Label(synchronizationGroup, SWT.WRAP); label.setText(EMFCompareRCPUIMessages.getString("InteractiveFilterUIContent.SYNC_BEHAVIOR_LABEL")); combo = new Combo(synchronizationGroup, SWT.WRAP); for (String comboLabel : comboLabels) { combo.add(comboLabel); } combo.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { if (combo.equals(e.getSource())) { synchronizationBehaviorValue = comboValues[combo.getSelectionIndex()]; } } public void widgetDefaultSelected(SelectionEvent e) { } }); }

Target:
private void createSynchronizationBehaviorContent(Composite parent) { Group synchronizationGroup = new Group(parent, SWT.NONE); GridData layoutData = new GridData(SWT.FILL, SWT.BOTTOM, true, false); RowLayout layout = new RowLayout(SWT.HORIZONTAL); layout.marginTop = 10; layout.marginBottom = 10; synchronizationGroup.setLayout(layout); synchronizationGroup.setLayoutData(layoutData); synchronizationGroup.setText(EMFCompareRCPUIMessages .getString("InteractiveFilterUIContent.sync.behavior.group.label")); Label label = new Label(synchronizationGroup, SWT.WRAP); label.setText(EMFCompareRCPUIMessages.getString("InteractiveFilterUIContent.sync.behavior.label")); combo = new Combo(synchronizationGroup, SWT.DROP_DOWN | SWT.READ_ONLY); for (String comboLabel : comboValues) { combo.add(comboLabel); } combo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (combo.equals(e.getSource())) { synchronizationBehaviorValue = combo.getItem(combo.getSelectionIndex()); } } }); }
Source:
public String getFormattedValue() { if (formattedValue == null) { List<String> strings = new ArrayList<String>(); for (CtfTmfEventField element : getValue()) { strings.add(element.getFormattedValue()); } formattedValue = strings.toString(); } return formattedValue; }

Target:
public synchronized String getFormattedValue() { if (formattedValue == null) { List<String> strings = new ArrayList<String>(); for (CtfTmfEventField element : getValue()) { strings.add(element.getFormattedValue()); } formattedValue = strings.toString(); } return formattedValue; }
Source:
public void writeTo(WritableByteChannel channel, FileSmoosher smoosher) throws IOException { channel.write(ByteBuffer.wrap(Ints.toByteArray((int) writer.getSerializedSize()))); writer.writeTo(channel, smoosher); if (!nullRowsBitmap.isEmpty()) { nullValueBitmapWriter.writeTo(channel, smoosher); } }

Target:
public void writeTo(WritableByteChannel channel, FileSmoosher smoosher) throws IOException { SerializerUtils.writeInt(channel, Ints.checkedCast(writer.getSerializedSize())); writer.writeTo(channel, smoosher); if (!nullRowsBitmap.isEmpty()) { nullValueBitmapWriter.writeTo(channel, smoosher); } }
Source:
public List<Folder> findSubFolders(final Host host, final User user, final boolean respectFrontEndPermissions) throws DotDataException, DotSecurityException { if (!permissionAPI.doesUserHavePermission(host, PermissionAPI.PERMISSION_READ, user, respectFrontEndPermissions)) { throw new DotSecurityException("User " + user.getUserId() != null?user.getUserId():"" + " does not have permission to read Host " + host.getHostname()); } final List<Folder> allFolders = folderFactory.findFoldersByHost(host); final List<Folder> subFolders = new ArrayList<Folder>(allFolders.size()); for(Folder folder : allFolders) if(permissionAPI.doesUserHavePermission(folder, PermissionAPI.PERMISSION_READ, user, respectFrontEndPermissions)) subFolders.add(folder); return subFolders; }

Target:
public List<Folder> findSubFolders(final Host host, final User user, final boolean respectFrontEndPermissions) throws DotDataException, DotSecurityException { if (!this.permissionAPI.doesUserHavePermission(host, PermissionAPI.PERMISSION_READ, user, respectFrontEndPermissions)) { throw new DotSecurityException("User " + user.getUserId() != null?user.getUserId():"" + " does not have permission to read Host " + host.getHostname()); } final List<Folder> allFolders = folderFactory.findFoldersByHost(host); return allFolders.stream().filter ((Folder folder) -> doesUserHavePermissions(folder, PermissionAPI.PERMISSION_READ, user, respectFrontEndPermissions) ).collect(CollectionsUtils.toImmutableList()); }
Source:
public void handleDataValue(MotechEvent event) { Map<String, Object> params = event.getParameters(); DataElement dataElement = dataElementService.findByName((String) params.get(EventParams.DATA_ELEMENT)); if (dataElement == null) { throw new DataElementNotFoundException("The data element that was sent did not " + "match any values imported from DHIS2. Please make sure that the data element field matches " + "a data element name in the DHIS2 module"); } String orgUnitId = (String) params.get(EventParams.LOCATION); String period = (String) params.get(EventParams.PERIOD); String value = (String) params.get(EventParams.VALUE); String categoryOptionCombo = (String) params.get(EventParams.CATEGORY_OPTION_COMBO); String comment = (String) params.get(EventParams.COMMENT); DataValueDto dataValueDto = new DataValueDto(); dataValueDto.setDataElement(dataElement.getUuid()); dataValueDto.setValue(value); dataValueDto.setOrgUnit(orgUnitId); dataValueDto.setPeriod(period); dataValueDto.setCategoryOptionCombo(categoryOptionCombo); dataValueDto.setComment(comment); DataValueSetDto dataValueSetDto = new DataValueSetDto(); List<DataValueDto> dataValueDtos = new ArrayList<>(); dataValueDtos.add(dataValueDto); dataValueSetDto.setDataValues(dataValueDtos); dhisWebService.sendDataValueSet(dataValueSetDto); }

Target:
public void handleDataValue(MotechEvent event) { Map<String, Object> params = event.getParameters(); DataElement dataElement = dataElementService.findByName((String) params.get(EventParams.DATA_ELEMENT)); if (dataElement == null) { throw new DataElementNotFoundException("The data element " + params.get(EventParams.DATA_ELEMENT) + " that was sent did not match any values imported from DHIS2. Please make sure that the " + "data element field matches a data element name in the DHIS2 module"); } String orgUnitId = (String) params.get(EventParams.LOCATION); String period = (String) params.get(EventParams.PERIOD); String value = (String) params.get(EventParams.VALUE); String categoryOptionCombo = (String) params.get(EventParams.CATEGORY_OPTION_COMBO); String comment = (String) params.get(EventParams.COMMENT); DataValueDto dataValueDto = new DataValueDto(); dataValueDto.setDataElement(dataElement.getUuid()); dataValueDto.setValue(value); dataValueDto.setOrgUnit(orgUnitId); dataValueDto.setPeriod(period); dataValueDto.setCategoryOptionCombo(categoryOptionCombo); dataValueDto.setComment(comment); DataValueSetDto dataValueSetDto = new DataValueSetDto(); List<DataValueDto> dataValueDtos = new ArrayList<>(); dataValueDtos.add(dataValueDto); dataValueSetDto.setDataValues(dataValueDtos); dhisWebService.sendDataValueSet(dataValueSetDto); }
Source:
public static Pair<ImmutableList<String>, ImmutableList<String>> removeStarlarkOptions( List<String> list) { ImmutableList.Builder<String> keep = ImmutableList.builder(); ImmutableList.Builder<String> remove = ImmutableList.builder(); for (String name : list) { (name.matches("--(no)?(@.*)? } return Pair.of(remove.build(), keep.build()); }

Target:
public static Pair<ImmutableList<String>, ImmutableList<String>> removeStarlarkOptions( List<String> list) { ImmutableList.Builder<String> keep = ImmutableList.builder(); ImmutableList.Builder<String> remove = ImmutableList.builder(); for (String name : list) { if (!name.startsWith("--")) { keep.add(name); continue; } String potentialStarlarkFlag = name.substring(2); if (name.startsWith("no")) { potentialStarlarkFlag = potentialStarlarkFlag.substring(2); } try { LabelValidator.validateAbsoluteLabel(potentialStarlarkFlag); remove.add(name); } catch (BadLabelException e) { keep.add(name); } } return Pair.of(remove.build(), keep.build()); }
Source:
private Image getImageForBuildStatus(String status) { ISharedImages images = PlatformUI.getWorkbench().getSharedImages(); if (status.equals(BuildStatus.SUCCESS.toString())) { return CommonImages.CHECKBOX_SELECTED.createImage(); } else if (status.equals(BuildStatus.STARTED.toString())) { return CommonImages.DISCOVERY.createImage(); } return CommonImages.ERROR.createImage(); }

Target:
private Image getImageForBuildStatus(String status) { if (status.equals(BuildStatus.SUCCESS.toString())) { return CommonImages.getImage(CommonImages.CHECKBOX_SELECTED); } else if (status.equals(BuildStatus.STARTED.toString())) { return CommonImages.getImage(CommonImages.DISCOVERY); } return CommonImages.getImage(CommonImages.ERROR); }
Source:
public void before() { testExtensionContext = mock(TestExtensionContext.class); isClosed = false; context = new JupiterEngineExecutionContext(null, null).extend().withThrowableCollector( new ThrowableCollector()).withExtensionContext(testExtensionContext).build(); }

Target:
void before() { testExtensionContext = mock(TestExtensionContext.class); isClosed = false; context = new JupiterEngineExecutionContext(null, null).extend().withThrowableCollector( new ThrowableCollector()).withExtensionContext(testExtensionContext).build(); }
Source:
public void xgroup() { Map<String,String> map = new HashMap<String, String>(); map.put("f1", "v1"); StreamEntryID id1 = jedis.xadd("xgroup-stream", null, map); String status = jedis.xgroupCreate("xgroup-stream", "consumer-group-name", null, false); assertTrue(Keyword.OK.name().equalsIgnoreCase(status)); status = jedis.xgroupSetID("xgroup-stream", "consumer-group-name", id1); assertTrue(Keyword.OK.name().equalsIgnoreCase(status)); status = jedis.xgroupCreate("xgroup-stream", "consumer-group-name1", StreamEntryID.LAST_ENTRY, false); assertTrue(Keyword.OK.name().equalsIgnoreCase(status)); jedis.xgroupDestroy("xgroup-stream", "consumer-group-name"); Long pendingMessageNum = jedis.xgroupDelConsumer("xgroup-stream", "consumer-group-name1", "myconsumer1"); assertNotNull(pendingMessageNum); }

Target:
public void xgroup() { Map<String,String> map = new HashMap<String, String>(); map.put("f1", "v1"); StreamEntryID id1 = jedis.xadd("xgroup-stream", null, map); String status = jedis.xgroupCreate("xgroup-stream", "consumer-group-name", null, false); assertTrue(Keyword.OK.name().equalsIgnoreCase(status)); status = jedis.xgroupSetID("xgroup-stream", "consumer-group-name", id1); assertTrue(Keyword.OK.name().equalsIgnoreCase(status)); status = jedis.xgroupCreate("xgroup-stream", "consumer-group-name1", StreamEntryID.LAST_ENTRY, false); assertTrue(Keyword.OK.name().equalsIgnoreCase(status)); jedis.xgroupDestroy("xgroup-stream", "consumer-group-name"); Long pendingMessageNum = jedis.xgroupDelConsumer("xgroup-stream", "consumer-group-name1", "myconsumer1"); assertEquals(0L, pendingMessageNum.longValue()); }
Source:
public void testProcessSingleConsumerWithNoInteractionIdNoProducers() { Trace trace = new Trace(); trace.setId("traceId"); trace.setBusinessTransaction("traceName"); trace.setStartTime(100); Consumer c = new Consumer(); c.setUri("uri"); c.setBaseTime(1); c.setDuration(200000000); c.getProperties().add(new Property(Constants.PROP_FAULT, "myFault")); c.setEndpointType("HTTP"); trace.getNodes().add(c); TraceCompletionInformationInitiator initiator = new TraceCompletionInformationInitiator(); TraceCompletionInformation ci = null; try { ci = initiator.processOneToOne(null, trace); } catch (Exception e) { fail("Failed: " + e); } assertNotNull(ci); assertEquals(1, ci.getCommunications().size()); assertTrue(ci.getCommunications().get(0).getIds().contains("traceId:0")); assertEquals(trace.getId(), ci.getCompletionTime().getId()); assertEquals(trace.getBusinessTransaction(), ci.getCompletionTime().getBusinessTransaction()); assertEquals(c.getEndpointType(), ci.getCompletionTime().getEndpointType()); assertFalse(ci.getCompletionTime().isInternal()); assertEquals(trace.getStartTime(), ci.getCompletionTime().getTimestamp()); assertEquals(c.getUri(), ci.getCompletionTime().getUri()); assertEquals(200000000, ci.getCompletionTime().getDuration()); assertEquals(1, ci.getCompletionTime().getProperties(Constants.PROP_FAULT).size()); assertEquals(c.getProperties(Constants.PROP_FAULT), ci.getCompletionTime().getProperties(Constants.PROP_FAULT)); }

Target:
public void testProcessSingleConsumerWithNoInteractionIdNoProducers() { Trace trace = new Trace(); trace.setId("traceId"); trace.setBusinessTransaction("traceName"); trace.setStartTime(100000); Consumer c = new Consumer(); c.setUri("uri"); c.setBaseTime(1); c.setDuration(200000); c.getProperties().add(new Property(Constants.PROP_FAULT, "myFault")); c.setEndpointType("HTTP"); trace.getNodes().add(c); TraceCompletionInformationInitiator initiator = new TraceCompletionInformationInitiator(); TraceCompletionInformation ci = null; try { ci = initiator.processOneToOne(null, trace); } catch (Exception e) { fail("Failed: " + e); } assertNotNull(ci); assertEquals(1, ci.getCommunications().size()); assertTrue(ci.getCommunications().get(0).getIds().contains("traceId:0")); assertEquals(trace.getId(), ci.getCompletionTime().getId()); assertEquals(trace.getBusinessTransaction(), ci.getCompletionTime().getBusinessTransaction()); assertEquals(c.getEndpointType(), ci.getCompletionTime().getEndpointType()); assertFalse(ci.getCompletionTime().isInternal()); assertEquals(trace.getStartTime(), ci.getCompletionTime().getTimestamp()); assertEquals(c.getUri(), ci.getCompletionTime().getUri()); assertEquals(200000, ci.getCompletionTime().getDuration()); assertEquals(1, ci.getCompletionTime().getProperties(Constants.PROP_FAULT).size()); assertEquals(c.getProperties(Constants.PROP_FAULT), ci.getCompletionTime().getProperties(Constants.PROP_FAULT)); }
Source:
public void verifyRestartable() throws RestartNotSupportedException { if (EXIT_ON_RESTART == null) { if (Platform.isDarwin() && !Platform.isSnowLeopardOrLater()) throw new RestartNotSupportedException("Restart is not supported on Mac OS X"); if (args==null) throw new RestartNotSupportedException("Failed to obtain the command line arguments of the process",failedToObtainArgs); } }

Target:
public void verifyRestartable() throws RestartNotSupportedException { if (Platform.isDarwin() && !Platform.isSnowLeopardOrLater()) throw new RestartNotSupportedException("Restart is not supported on Mac OS X"); if (args==null) throw new RestartNotSupportedException("Failed to obtain the command line arguments of the process",failedToObtainArgs); }
Source:
public HttpFileUploadIntegrationTest(SmackIntegrationTestEnvironment<?> environment) throws XMPPErrorException, NotConnectedException, NoResponseException, InterruptedException, TestNotPossibleException { super(environment); if (Security.getProvider("BC") == null) { Security.addProvider(new BouncyCastleProvider()); } hfumOne = HttpFileUploadManager.getInstanceFor(conOne); if (!hfumOne.discoverUploadService()) { throw new TestNotPossibleException( "HttpFileUploadManager was unable to discover a HTTP File Upload service"); } UploadService uploadService = hfumOne.getDefaultUploadService(); if (!uploadService.acceptsFileOfSize(FILE_SIZE)) { throw new TestNotPossibleException("The upload service at " + uploadService.getAddress() + " does not accept files of size " + FILE_SIZE + ". It only accepts files with a maximum size of " + uploadService.getMaxFileSize()); } hfumOne.setTlsContext(environment.configuration.tlsContext); }

Target:
public HttpFileUploadIntegrationTest(SmackIntegrationTestEnvironment<?> environment) throws XMPPErrorException, NotConnectedException, NoResponseException, InterruptedException, TestNotPossibleException { super(environment); hfumOne = HttpFileUploadManager.getInstanceFor(conOne); if (!hfumOne.discoverUploadService()) { throw new TestNotPossibleException( "HttpFileUploadManager was unable to discover a HTTP File Upload service"); } UploadService uploadService = hfumOne.getDefaultUploadService(); if (!uploadService.acceptsFileOfSize(FILE_SIZE)) { throw new TestNotPossibleException("The upload service at " + uploadService.getAddress() + " does not accept files of size " + FILE_SIZE + ". It only accepts files with a maximum size of " + uploadService.getMaxFileSize()); } hfumOne.setTlsContext(environment.configuration.tlsContext); }
Source:
private void logMetrics() { try { Thread.sleep(METRIC_INIT_DELAY_MS); while (true) { Thread.sleep(metricsWindowMs); final double processingUnit = getProcessingUnit(); if (processingUnit != Double.POSITIVE_INFINITY) { final ServerMetrics metricsMessage = ServerMetrics.newBuilder() .setWindowIndex(windowIndex) .setNumPartitionBlocks(0) .setMetricWindowMs(metricsWindowMs) .setAvgProcessingTime(processingUnit) .build(); LOG.log(Level.INFO, "ServerMetrics {0}", metricsMessage); } windowIndex++; } } catch (final InterruptedException e) { LOG.log(Level.SEVERE, "Exception Occurred", e); throw new RuntimeException(e); } }

Target:
private void logMetrics() { try { Thread.sleep(METRIC_INIT_DELAY_MS); while (true) { Thread.sleep(metricsWindowMs); final double avgPullTime = getAvgProcTimePerReq(pullStats); final double avgPushTime = getAvgProcTimePerReq(pushStats); final double avgReqProcTime = getAvgProcTimePerReq(requestStats); resetStats(); if (avgPullTime != Double.POSITIVE_INFINITY && avgPushTime != Double.POSITIVE_INFINITY) { final ServerMetrics metricsMessage = ServerMetrics.newBuilder() .setWindowIndex(windowIndex) .setNumPartitionBlocks(0) .setMetricWindowMs(metricsWindowMs) .setAvgPullProcessingTime(avgPullTime) .setAvgPushProcessingTime(avgPushTime) .setAvgReqProcessingTime(avgReqProcTime) .build(); LOG.log(Level.FINE, "ServerMetrics {0}", metricsMessage); } windowIndex++; } } catch (final InterruptedException e) { LOG.log(Level.SEVERE, "Exception Occurred", e); throw new RuntimeException(e); } }
Source:
public boolean doCheckAndSend() throws JobEmailNotificationException { String jobStatus = jobState.getGenericInformation().get(GENERIC_INFORMATION_KEY_NOTIFICATION_EVENT); List<String> jobStatusList = new ArrayList<>(); if(jobStatus != null){ jobStatusList = Arrays.asList(jobStatus.toLowerCase().split("\\s*,\\s*")); } switch (eventType) { case JOB_CHANGE_PRIORITY: case JOB_IN_ERROR: case JOB_PAUSED: case JOB_PENDING_TO_FINISHED: case JOB_PENDING_TO_RUNNING: case JOB_RESTARTED_FROM_ERROR: case JOB_RESUMED: case JOB_RUNNING_TO_FINISHED: case JOB_SUBMITTED: break; default: logger.trace("Event not in the list of email notification, doing nothing"); return false; } if (!PASchedulerProperties.EMAIL_NOTIFICATIONS_ENABLED.getValueAsBoolean()) { logger.debug("Notification emails disabled, doing nothing"); return false; } if(jobStatusList!=null && !jobStatusList.contains(eventType.toString().toLowerCase())){ return false; } try { sender.sender(getTo(), getSubject(), getBody()); return true; } catch (AddressException e) { throw new JobEmailNotificationException("Malformed email address", e); } catch (MessagingException e) { throw new JobEmailNotificationException("Error sending email: " + e.getMessage(), e); } }

Target:
public boolean doCheckAndSend() throws JobEmailNotificationException { String jobStatus = jobState.getGenericInformation().get(GENERIC_INFORMATION_KEY_NOTIFICATION_EVENT); List<String> jobStatusList = new ArrayList<>(); if(jobStatus != null){ jobStatusList = Arrays.asList(jobStatus.toLowerCase().split("\\s*,\\s*")); } switch (eventType) { case JOB_CHANGE_PRIORITY: case JOB_IN_ERROR: case JOB_PAUSED: case JOB_PENDING_TO_FINISHED: case JOB_PENDING_TO_RUNNING: case JOB_RESTARTED_FROM_ERROR: case JOB_RESUMED: case JOB_RUNNING_TO_FINISHED: case JOB_SUBMITTED: break; default: logger.trace("Event not in the list of email notification, doing nothing"); return false; } if (!PASchedulerProperties.EMAIL_NOTIFICATIONS_ENABLED.getValueAsBoolean()) { logger.debug("Notification emails disabled, doing nothing"); return false; } if(!jobStatusList.contains(eventType.toString().toLowerCase())){ return false; } try { sender.sender(getTo(), getSubject(), getBody()); return true; } catch (AddressException e) { throw new JobEmailNotificationException("Malformed email address", e); } catch (MessagingException e) { throw new JobEmailNotificationException("Error sending email: " + e.getMessage(), e); } }
Source:
public void drained( BoltConnection from, Collection<Job> batch ) { checkLimitsOnDequeue( from, counters.compute( from.id(), ( k, v ) -> v == null ? new AtomicInteger( 0 ) : v ).addAndGet( -batch.size() ) ); }

Target:
public void drained( BoltConnection from, Collection<Job> batch ) { checkLimitsOnDequeue( from, counters.computeIfAbsent( from.id(), k -> new AtomicInteger( 0 ) ).addAndGet( -batch.size() ) ); }
Source:
public static void main(final String[] args) throws Exception { LauncherStatus run = run(args); LOGGER.info("Exit with status " + run); }

Target:
public static void main(final String[] args) throws Exception { LauncherStatus status = run(args); LOGGER.info("Exit with status " + status); }
Source:
public Description matchTry (TryTree tree, VisitorState state) { if (badEmptyCatchBlock(tree, state)) { BlockTree bt = tree.getFinallyBlock(); if (bt == null || bt.getStatements().size() == 0) { CatchTree lastCatch = tree.getCatches().get(tree.getCatches().size() - 1); LineMap lineMap = state.getPath().getCompilationUnit().getLineMap(); return describeMatch(lastCatch); } } return Description.NO_MATCH; }

Target:
public Description matchTry (TryTree tree, VisitorState state) { if (badEmptyCatchBlock(tree, state)) { BlockTree bt = tree.getFinallyBlock(); if (bt == null || bt.getStatements().size() == 0) { CatchTree lastCatch = tree.getCatches().get(tree.getCatches().size() - 1); return describeMatch(lastCatch); } } return Description.NO_MATCH; }
Source:
protected Void run() throws Exception { SlackNotifier.DescriptorImpl slackDesc = Jenkins.getInstance().getDescriptorByType(SlackNotifier.DescriptorImpl.class); String team = step.teamDomain != null ? step.teamDomain : slackDesc.getTeamDomain(); String token = step.token != null ? step.token : slackDesc.getToken(); String channel = step.channel != null ? step.channel : slackDesc.getRoom(); String color = step.color != null ? step.color : ""; listener.getLogger().println(Messages.SlackSendStepConfig(step.teamDomain == null, step.token == null, step.channel == null, step.color == null)); SlackService testSlackService = new StandardSlackService(team, token, channel); boolean publishSuccess = testSlackService.publish(step.message, color); if(!publishSuccess && step.failOnError) { throw new AbortException(Messages.NotificationFailed()); } else if(!publishSuccess) { listener.error(Messages.NotificationFailed()); } return null; }

Target:
protected Void run() throws Exception { Jenkins jenkins; try { jenkins = Jenkins.getInstance(); } catch (NullPointerException ne) { listener.error(Messages.NotificationFailedWithException(ne)); return null; } SlackNotifier.DescriptorImpl slackDesc = jenkins.getDescriptorByType(SlackNotifier.DescriptorImpl.class); String team = step.teamDomain != null ? step.teamDomain : slackDesc.getTeamDomain(); String token = step.token != null ? step.token : slackDesc.getToken(); String channel = step.channel != null ? step.channel : slackDesc.getRoom(); String color = step.color != null ? step.color : ""; listener.getLogger().println(Messages.SlackSendStepConfig(step.teamDomain == null, step.token == null, step.channel == null, step.color == null)); SlackService slackService = getSlackService(team, token, channel); boolean publishSuccess = slackService.publish(step.message, color); if (!publishSuccess && step.failOnError) { throw new AbortException(Messages.NotificationFailed()); } else if (!publishSuccess) { listener.error(Messages.NotificationFailed()); } return null; }