auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testExpiration() { cache.put("k", "v0"); CompletableFuture<?> expirationFuture = executorService.submit(() -> { while (!terminated) { expirationManager.processExpiration(); checkDataContainer(); } }); CompletableFuture<?> updateFuture = executorService.submit(() -> { for (int i = 1; !terminated; ++i) { assertEquals("v" + (i - 1), cache.remove("k")); timeService.advance(1000 + ThreadLocalRandom.current().nextInt(1000)); assertEquals(null, cache.put("k", "v" + i)); timeService.advance(1000 + ThreadLocalRandom.current().nextInt(1000)); checkDataContainer(); } }); CompletableFuture<?> timeout = executorService.submit(() -> { LockSupport.parkNanos(TimeUnit.SECONDS.toNanos(30)); terminated = true; }); CompletableFuture.anyOf(expirationFuture, updateFuture, timeout).join(); }

Target:
public void testExpiration() throws Exception { cache.put("k", "v0"); CompletableFuture<?> expirationFuture = CompletableFuture.runAsync(() -> { while (!terminated) { expirationManager.processExpiration(); checkDataContainer(); } }, executorService); CompletableFuture<?> updateFuture = CompletableFuture.runAsync(() -> { for (int i = 1; !terminated; ++i) { assertEquals("v" + (i - 1), cache.remove("k")); timeService.advance(1000 + ThreadLocalRandom.current().nextInt(1000)); assertEquals(null, cache.put("k", "v" + i)); timeService.advance(1000 + ThreadLocalRandom.current().nextInt(1000)); checkDataContainer(); } }, executorService); CompletableFuture.anyOf(expirationFuture, updateFuture).get(30, TimeUnit.SECONDS); terminated = true; }
Source:
void resolveChanges() { Set<Object> selectedKeys = selectedSet.keySet(); List<Object> visibleKeys = new ArrayList<Object>(); for (T visible : dataDisplay.getVisibleItems()) { visibleKeys.add(getKey(visible)); } if (!visibleKeys.containsAll(selectedKeys)) { for (Map.Entry<Object, T> objectTEntry : selectedSet.entrySet()) { if (!visibleKeys.contains(objectTEntry.getKey())) selectionChanges.put(objectTEntry.getValue(), false); } } if (selectionChanges.isEmpty()) { return; } boolean changed = false; for (Map.Entry<T, Boolean> entry : selectionChanges.entrySet()) { T object = entry.getKey(); boolean selected = entry.getValue(); Object key = getKey(object); T oldValue = selectedSet.get(key); if (selected) { if (oldValue == null || !oldValue.equals(object)) { selectedSet.put(getKey(object), object); changed = true; } } else { if (oldValue != null) { selectedSet.remove(key); changed = true; } } } selectionChanges.clear(); if (changed) { SelectionChangeEvent.fire(this); } }

Target:
void resolveChanges() { Set<Object> selectedKeys = selectedSet.keySet(); List<Object> visibleKeys = new ArrayList<Object>(); for (T visible : dataDisplay.getVisibleItems()) { visibleKeys.add(getKey(visible)); } if (!visibleKeys.containsAll(selectedKeys)) { for (Map.Entry<Object, T> selectedEntry : selectedSet.entrySet()) { if (!visibleKeys.contains(selectedEntry.getKey())) { selectionChanges.put(selectedEntry.getValue(), false); } } } if (selectionChanges.isEmpty()) { return; } boolean changed = false; for (Map.Entry<T, Boolean> entry : selectionChanges.entrySet()) { T object = entry.getKey(); boolean selected = entry.getValue(); Object key = getKey(object); T oldValue = selectedSet.get(key); if (selected) { if (oldValue == null || !oldValue.equals(object)) { selectedSet.put(getKey(object), object); changed = true; } } else { if (oldValue != null) { selectedSet.remove(key); changed = true; } } } selectionChanges.clear(); if (changed) { SelectionChangeEvent.fire(this); } }
Source:
public static ResponseBodySerializer getResponseBodySerializer(final String contentType) { ResponseBodySerializer serializer = RESPONSE_BODY_SERIALIZERS.get(contentType); if (null == serializer) { synchronized (ResponseBodySerializerFactory.class) { if (null == RESPONSE_BODY_SERIALIZERS.get(contentType)) { instantiateResponseBodySerializerFromFactories(contentType); } serializer = RESPONSE_BODY_SERIALIZERS.get(contentType); } } if (MISSING_SERIALIZER == serializer) { throw new ResponseBodySerializerNotFoundException(contentType); } return serializer; }

Target:
public static ResponseBodySerializer getResponseBodySerializer(final String contentType) { ResponseBodySerializer result = RESPONSE_BODY_SERIALIZERS.get(contentType); if (null == result) { synchronized (ResponseBodySerializerFactory.class) { if (null == RESPONSE_BODY_SERIALIZERS.get(contentType)) { instantiateResponseBodySerializerFromFactories(contentType); } result = RESPONSE_BODY_SERIALIZERS.get(contentType); } } if (MISSING_SERIALIZER == result) { throw new ResponseBodySerializerNotFoundException(contentType); } return result; }
Source:
public void write_string_resource_json_instance() throws InterruptedException { Map<Integer, Object> map = new HashMap<>(); map.put(0, "newValue"); String valueToWrite = "newValue"; WriteResponse response = helper.server.send(helper.getCurrentRegistration(), new WriteRequest(ContentFormat.JSON, TEST_OBJECT_ID, 0, STRING_RESOURCE_INSTANCE_ID, 0, valueToWrite, Type.STRING), 1000000); assertEquals(CHANGED, response.getCode()); assertNotNull(response.getCoapResponse()); assertThat(response.getCoapResponse(), is(instanceOf(Response.class))); ReadResponse readResponse = helper.server.send(helper.getCurrentRegistration(), new ReadRequest(ContentFormat.JSON, TEST_OBJECT_ID, 0, STRING_RESOURCE_INSTANCE_ID, 0), 1000000); LwM2mResourceInstance resource = (LwM2mResourceInstance) readResponse.getContent(); assertEquals(valueToWrite, resource.getValue()); }

Target:
public void write_string_resource_json_instance() throws InterruptedException { assertStringResourceInstance(ContentFormat.JSON); }
Source:
public void postProcessBeanFactory(final ConfigurableListableBeanFactory beanFactory) throws BeansException { for (String beanName : beanFactory.getBeanDefinitionNames()) { if (!beanName.equalsIgnoreCase(getPdxDiskStoreName())) { BeanDefinition beanDefinition = beanFactory.getBeanDefinition(beanName); if (isPersistentRegion(beanDefinition) || isDiskStore(beanDefinition)) { addPdxDiskStoreDependency(beanDefinition); } } } }

Target:
public void postProcessBeanFactory(final ConfigurableListableBeanFactory beanFactory) throws BeansException { postProcessPdxDiskStoreDependencies(beanFactory, AsyncEventQueue.class, DiskStore.class, Region.class); }
Source:
public ShellLauncher() throws IOException { moduleDir = DirUtils.findModuleDir(); String kbaseYml = TextUtils.readFileText(new File(moduleDir, "kbase.yml")); @SuppressWarnings("unchecked") Map<String,Object> config = (Map<String, Object>)new Yaml().load(kbaseYml); moduleName = (String)config.get("module-name"); workDir = Paths.get(moduleDir.toPath().toString(), "test_local", "workdir").toString(); }

Target:
public ShellLauncher() throws IOException { moduleInfo = new ModuleInfo(); }
Source:
private static String cleanseEndtime(String jsonld) { return jsonld.replaceFirst( "\"endTime\":\"\\d\\d\\d\\d-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d\"", "\"endTime\":\"0001-01-01T00:00:00\""); }

Target:
private static String cleanseEndtime(String jsonld) { return jsonld.replaceFirst( "\"endTime\":\"\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\"", "\"endTime\":\"0001-01-01T00:00:00\""); }
Source:
public final ActionResult execute(ActionExecutionContext actionExecutionContext) throws ActionExecutionException, InterruptedException { Actions.prefetchInputs(getInputs(), actionExecutionContext, this); try { actionExecutionContext .getActionInputPrefetcher() .prefetchFiles(getInputs(), actionExecutionContext.getMetadataProvider()); } catch (IOException e) { throw new ActionExecutionException("Failed to fetch remote input file.", e, this, false); } ActionResult actionResult; try { DeterministicWriter deterministicWriter; try { deterministicWriter = newDeterministicWriter(actionExecutionContext); } catch (IOException e) { throw new EnvironmentalExecException("failed to create file '" + getPrimaryOutput().prettyPrint() + "' due to I/O error: " + e.getMessage(), e); } actionResult = ActionResult.create( getStrategy(actionExecutionContext) .writeOutputToFile( this, actionExecutionContext, deterministicWriter, makeExecutable, isRemotable())); } catch (ExecException e) { throw e.toActionExecutionException( "Writing file for rule '" + Label.print(getOwner().getLabel()) + "'", actionExecutionContext.getVerboseFailures(), this); } afterWrite(actionExecutionContext); return actionResult; }

Target:
public final ActionResult execute(ActionExecutionContext actionExecutionContext) throws ActionExecutionException, InterruptedException { Actions.prefetchInputs(getInputs(), actionExecutionContext, this); ActionResult actionResult; try { DeterministicWriter deterministicWriter; try { deterministicWriter = newDeterministicWriter(actionExecutionContext); } catch (IOException e) { throw new EnvironmentalExecException("failed to create file '" + getPrimaryOutput().prettyPrint() + "' due to I/O error: " + e.getMessage(), e); } actionResult = ActionResult.create( getStrategy(actionExecutionContext) .writeOutputToFile( this, actionExecutionContext, deterministicWriter, makeExecutable, isRemotable())); } catch (ExecException e) { throw e.toActionExecutionException( "Writing file for rule '" + Label.print(getOwner().getLabel()) + "'", actionExecutionContext.getVerboseFailures(), this); } afterWrite(actionExecutionContext); return actionResult; }
Source:
protected ListenableFuture<Long> ping(long nonce) throws ProtocolException { final VersionMessage ver = vPeerVersionMessage; if (!ver.isPingPongSupported()) throw new ProtocolException("Peer version is too low for measurable pings: " + ver); if (pendingPings.size() > 50) { log.info("{}: Too many pending pings, disconnecting", this); close(); } PendingPing pendingPing = new PendingPing(nonce); pendingPings.add(pendingPing); sendMessage(new Ping(pendingPing.nonce)); return pendingPing.future; }

Target:
protected ListenableFuture<Long> ping(long nonce) throws ProtocolException { final VersionMessage ver = vPeerVersionMessage; if (!ver.isPingPongSupported()) throw new ProtocolException("Peer version is too low for measurable pings: " + ver); if (pendingPings.size() > PENDING_PINGS_LIMIT) { log.info("{}: Too many pending pings, disconnecting", this); close(); } PendingPing pendingPing = new PendingPing(nonce); pendingPings.add(pendingPing); sendMessage(new Ping(pendingPing.nonce)); return pendingPing.future; }
Source:
public DataContext createDataContext(final JavaTypeFactory typeFactory) { class DruidDataContext implements DataContext { private final Map<String, Object> context = ImmutableMap.<String, Object>of( DataContext.Variable.UTC_TIMESTAMP.camelName, localNow.getMillis(), DataContext.Variable.CURRENT_TIMESTAMP.camelName, localNow.getMillis(), DataContext.Variable.LOCAL_TIMESTAMP.camelName, new Interval( new DateTime("1970-01-01T00:00:00.000", localNow.getZone()), localNow ).toDurationMillis(), DataContext.Variable.TIME_ZONE.camelName, localNow.getZone().toTimeZone().clone(), CTX_AUTHENTICATION_RESULT, authenticationResult ); @Override public SchemaPlus getRootSchema() { throw new UnsupportedOperationException(); } @Override public JavaTypeFactory getTypeFactory() { return typeFactory; } @Override public QueryProvider getQueryProvider() { throw new UnsupportedOperationException(); } @Override public Object get(final String name) { return context.get(name); } } return new DruidDataContext(); }

Target:
public DataContext createDataContext(final JavaTypeFactory typeFactory) { class DruidDataContext implements DataContext { private final Map<String, Object> context = ImmutableMap.<String, Object>of( DataContext.Variable.UTC_TIMESTAMP.camelName, localNow.getMillis(), DataContext.Variable.CURRENT_TIMESTAMP.camelName, localNow.getMillis(), DataContext.Variable.LOCAL_TIMESTAMP.camelName, new Interval( new DateTime("1970-01-01T00:00:00.000", localNow.getZone()), localNow ).toDurationMillis(), DataContext.Variable.TIME_ZONE.camelName, localNow.getZone().toTimeZone().clone(), DATA_CTX_AUTHENTICATION_RESULT, authenticationResult ); @Override public SchemaPlus getRootSchema() { throw new UnsupportedOperationException(); } @Override public JavaTypeFactory getTypeFactory() { return typeFactory; } @Override public QueryProvider getQueryProvider() { throw new UnsupportedOperationException(); } @Override public Object get(final String name) { return context.get(name); } } return new DruidDataContext(); }
Source:
private ParametricScalarImplementation( Signature signature, List<Optional<Class<?>>> argumentNativeContainerTypes, Map<String, Class<?>> specializedTypeParameters, List<ParametricScalarImplementationChoice> choices, Class<?> returnContainerType) { this.signature = requireNonNull(signature, "signature is null"); this.argumentNativeContainerTypes = ImmutableList.copyOf(requireNonNull(argumentNativeContainerTypes, "argumentNativeContainerTypes is null")); this.specializedTypeParameters = ImmutableMap.copyOf(requireNonNull(specializedTypeParameters, "specializedTypeParameters is null")); this.choices = requireNonNull(choices, "choices is null"); this.returnNativeContainerType = requireNonNull(returnContainerType, "return native container type is null"); for (int i = 1; i < choices.size(); i++) { checkArgument(Objects.equals(choices.get(i).getDependencies(), choices.get(0).getDependencies())); checkArgument(Objects.equals(choices.get(i).getConstructorDependencies(), choices.get(0).getConstructorDependencies())); checkArgument(Objects.equals(choices.get(i).getConstructor(), choices.get(0).getConstructor())); } }

Target:
private ParametricScalarImplementation( Signature signature, List<Optional<Class<?>>> argumentNativeContainerTypes, Map<String, Class<?>> specializedTypeParameters, List<ParametricScalarImplementationChoice> choices, Class<?> returnContainerType) { this.signature = requireNonNull(signature, "signature is null"); this.argumentNativeContainerTypes = ImmutableList.copyOf(requireNonNull(argumentNativeContainerTypes, "argumentNativeContainerTypes is null")); this.specializedTypeParameters = ImmutableMap.copyOf(requireNonNull(specializedTypeParameters, "specializedTypeParameters is null")); this.choices = requireNonNull(choices, "choices is null"); this.returnNativeContainerType = requireNonNull(returnContainerType, "return native container type is null"); for (int i = 1; i < choices.size(); i++) { checkCondition(Objects.equals(choices.get(i).getDependencies(), choices.get(0).getDependencies()), FUNCTION_IMPLEMENTATION_ERROR, "Implementations for the same function signature must have matching dependencies: %s", signature); checkCondition(Objects.equals(choices.get(i).getConstructorDependencies(), choices.get(0).getConstructorDependencies()), FUNCTION_IMPLEMENTATION_ERROR, "Implementations for the same function signature must have matching constructor dependencies: %s", signature); checkCondition(Objects.equals(choices.get(i).getConstructor(), choices.get(0).getConstructor()), FUNCTION_IMPLEMENTATION_ERROR, "Implementations for the same function signature must have matching constructors: %s", signature); } }
Source:
public void showResizeFactorDialog(final Attachment attachment){ final CharSequence[] resizeOptions = { getString(R.string.account_settings_attachments_resize_factor_entry_original), getString(R.string.account_settings_attachments_resize_factor_entry_half), getString(R.string.account_settings_attachments_resize_factor_entry_one_fourth)}; int selectedChoice = -1; if(attachment.overrideDefault){ if(attachment.resizeFactor == 1.0f){ selectedChoice = 0; } else if (attachment.resizeFactor == 0.5f){ selectedChoice = 1; } else { selectedChoice = 2; } } AlertDialog.Builder builder = new AlertDialog.Builder(this) .setTitle(getString(R.string.account_settings_attachment_resize_factor_label)) .setSingleChoiceItems(resizeOptions, selectedChoice, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { switch(which) { case 0: attachment.updateResizeInfo(1.0f, true); attachmentPresenter.updateAttachmentsList(attachment); break; case 1: attachment.updateResizeInfo(0.5f, true); attachmentPresenter.updateAttachmentsList(attachment); break; case 2: attachment.updateResizeInfo(0.25f, true); attachmentPresenter.updateAttachmentsList(attachment); break; } dialog.dismiss(); } }); builder.create().show(); }

Target:
public void showResizeFactorDialog(final Attachment attachment){ final CharSequence[] resizeOptions = { getString(R.string.account_settings_attachments_resize_factor_entry_original), getString(R.string.account_settings_attachments_resize_factor_entry_half), getString(R.string.account_settings_attachments_resize_factor_entry_one_fourth)}; int selectedChoice = Account.RESIZE_FACTOR_NONE_SELECTED; if (attachment.overrideDefault) { if (attachment.resizeFactor == 1.0f) { selectedChoice = Account.RESIZE_FACTOR_ORIGINAL_SIZE_SELECTED; } else if (attachment.resizeFactor == 0.5f) { selectedChoice = Account.RESIZE_FACTOR_HALF_SIZE_SELECTED; } else { selectedChoice = Account.RESIZE_FACTOR_ONE_FOURTH_SIZE_SELECTED; } } AlertDialog.Builder builder = new AlertDialog.Builder(this) .setTitle(getString(R.string.account_settings_attachment_resize_factor_label)) .setSingleChoiceItems(resizeOptions, selectedChoice, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Account.ResizeFactor factor = Account.ResizeFactor.values()[which]; switch(factor) { case FULL_SIZE: attachment.updateResizeInfo(1.0f, true); attachmentPresenter.updateAttachmentsList(attachment); break; case HALF_SIZE: attachment.updateResizeInfo(0.5f, true); attachmentPresenter.updateAttachmentsList(attachment); break; case QUARTER_SIZE: attachment.updateResizeInfo(0.25f, true); attachmentPresenter.updateAttachmentsList(attachment); break; } dialog.dismiss(); } }); builder.create().show(); }
Source:
private Clusters mapCollection(List<VDSGroup> entities) { ApplicationMode appMode = getCurrent().get(ApplicationMode.class); Clusters collection = new Clusters(); for (org.ovirt.engine.core.common.businessentities.VDSGroup entity : entities) { if (appMode == ApplicationMode.VirtOnly) { collection.getClusters().add(addLinks(map(entity), "glusterVolumes")); } else { collection.getClusters().add(addLinks(map(entity))); } } return collection; }

Target:
private Clusters mapCollection(List<VDSGroup> entities) { Clusters collection = new Clusters(); for (org.ovirt.engine.core.common.businessentities.VDSGroup entity : entities) { collection.getClusters().add(addLinks(map(entity))); } return collection; }
Source:
public KieServerInstance addKieServerInstance(KieServerInfo kieServerInfo) throws KieServerControllerException { ServerTemplate serverTemplate = this.templateStorage.load(kieServerInfo.getServerId()); if (serverTemplate != null) { throw new KieServerControllerException("KieServerInstance is already registered with id: " + kieServerInfo.getServerId()); } KieServerInstance kieServerInstance = new KieServerInstance(); kieServerInstance.setIdentifier(kieServerInfo.getServerId()); kieServerInstance.setVersion(kieServerInfo.getVersion()); kieServerInstance.setName(kieServerInfo.getName()); kieServerInstance.setKieServerSetup(new KieServerSetup()); kieServerInstance.setStatus(KieServerStatus.UP); kieServerInstance.setManagedInstances(new HashSet<KieServerInstanceInfo>()); if (kieServerInfo.getLocation() != null && !kieServerInfo.getLocation().isEmpty()) { KieServerInstanceInfo instanceInfo = new KieServerInstanceInfo(kieServerInfo.getLocation(), KieServerStatus.UP, kieServerInfo.getCapabilities()); kieServerInstance.getManagedInstances().add(instanceInfo); } serverTemplate = new ServerTemplate(); serverTemplate.setId(kieServerInfo.getServerId()); serverTemplate.setName(kieServerInfo.getName()); serverTemplate.setCapabilities(kieServerInfo.getCapabilities()); if (kieServerInfo.getLocation() != null && !kieServerInfo.getLocation().isEmpty()) { serverTemplate.addServerInstance(ModelFactory.newServerInstanceKey(serverTemplate.getId(), kieServerInfo.getLocation())); } templateStorage.store(serverTemplate); return kieServerInstance; }

Target:
public KieServerInstance addKieServerInstance(KieServerInfo kieServerInfo) throws KieServerControllerException { ServerTemplate serverTemplate = this.templateStorage.load(kieServerInfo.getServerId()); if (serverTemplate != null) { throw new KieServerControllerException("KieServerInstance is already registered with id: " + kieServerInfo.getServerId()); } KieServerInstance kieServerInstance = new KieServerInstance(kieServerInfo.getServerId(), kieServerInfo.getName(), kieServerInfo.getVersion(), new HashSet<KieServerInstanceInfo>(), KieServerStatus.UP, new KieServerSetup()); if (kieServerInfo.getLocation() != null && !kieServerInfo.getLocation().isEmpty()) { KieServerInstanceInfo instanceInfo = new KieServerInstanceInfo(kieServerInfo.getLocation(), KieServerStatus.UP, kieServerInfo.getCapabilities()); kieServerInstance.getManagedInstances().add(instanceInfo); } serverTemplate = new ServerTemplate(kieServerInfo.getServerId(), kieServerInfo.getName(), kieServerInfo.getCapabilities(), new HashMap<Capability, ServerConfig>(), new ArrayList<ContainerSpec>()); if (kieServerInfo.getLocation() != null && !kieServerInfo.getLocation().isEmpty()) { serverTemplate.addServerInstance(ModelFactory.newServerInstanceKey(serverTemplate.getId(), kieServerInfo.getLocation())); } templateStorage.store(serverTemplate); return kieServerInstance; }
Source:
public Boolean getBooleanProperty(final String key) throws ActiveMQPropertyConversionException { return getOrCreateProperties().getBooleanProperty(key(key)); }

Target:
public Boolean getBooleanProperty(final String key) throws ActiveMQPropertyConversionException { return getBooleanProperty(key(key)); }
Source:
public GDBLearningStrategy withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder) { this.envBuilder = envBuilder; this.environment = envBuilder.buildForTrainer(); return this; }

Target:
public GDBLearningStrategy withEnvironmentBuilder(LearningEnvironmentBuilder envBuilder) { this.envBuilder = envBuilder; this.trainerEnvironment = envBuilder.buildForTrainer(); return this; }
Source:
CloseableTribbleIterator<T> iterator() throws IOException; @Override void close() throws IOException; List<String> getSequenceNames(); Object getHeader(); default boolean hasIndex() { return false; }

Target:
CloseableTribbleIterator<T> iterator() throws IOException; @Override void close() throws IOException; List<String> getSequenceNames(); Object getHeader(); default boolean isQueryable() { return false; }
Source:
public void run() { try { while (!shutdown) { synchronized (this) { long idleTime = getIdleTime(); wait(getSleepTime()); PoolingHttpClientConnectionManager poolConnMgr = (PoolingHttpClientConnectionManager) connMgr; System.out.println("before closing expired and idl conn, stats is "+poolConnMgr.getTotalStats()); connMgr.closeExpiredConnections(); connMgr.closeIdleConnections(idleTime, TimeUnit.MILLISECONDS); System.out.println("after closing expired and idl conn, stats is "+poolConnMgr.getTotalStats()); } } } catch (InterruptedException ex) { shutdown(); } }

Target:
public void run() { try { while (!shutdown) { synchronized (this) { long idleTime = getIdleTime(); wait(getSleepTime()); PoolingHttpClientConnectionManager poolConnMgr = (PoolingHttpClientConnectionManager) connMgr; connMgr.closeExpiredConnections(); connMgr.closeIdleConnections(idleTime, TimeUnit.MILLISECONDS); } } } catch (InterruptedException ex) { shutdown(); } }
Source:
public EscapePods(Aero originalRide, int nPods, boolean isEscapePod) { super(); setCrew(new Crew(CrewType.CREW)); setChassis(POD_EJECT_NAME); setModel(originalRide.getDisplayName()); StringBuffer newName = new StringBuffer(POD_EJECT_NAME); newName.append(originalRide.getDisplayName()); displayName = newName.toString(); initializeSI(nPods); if (isEscapePod) { setFuel(10); setOriginalWalkMP(4); } setMovementMode(EntityMovementMode.AERODYNE); for (int i = 0; i < 4; i++) { initializeArmor(nPods, i); } setOriginalRideId(originalRide.getId()); setOriginalRideExternalId(originalRide.getExternalIdAsString()); }

Target:
public EscapePods(Aero originalRide, int nPods, boolean isEscapePod) { super(); setCrew(new Crew(CrewType.CREW)); setChassis(POD_EJECT_NAME); setModel(originalRide.getDisplayName()); String newName = new String(POD_EJECT_NAME + originalRide.getDisplayName()); displayName = newName; initializeSI(nPods); if (isEscapePod) { setFuel(ESCAPE_POD_FUEL); setOriginalWalkMP(ESCAPE_POD_SAFE_THRUST); } setMovementMode(EntityMovementMode.AERODYNE); for (int i = 0; i < 4; i++) { initializeArmor(nPods, i); } setOriginalRideId(originalRide.getId()); setOriginalRideExternalId(originalRide.getExternalIdAsString()); }
Source:
private DBNote getNoteFromCursor(long accountId, @NonNull Cursor cursor, boolean pruneContent) { validateAccountId(accountId); Calendar modified = Calendar.getInstance(); modified.setTimeInMillis(cursor.getLong(4) * 1000); return new DBNote( cursor.getLong(0), cursor.getLong(1), modified, cursor.getString(3), pruneContent ? "" : cursor.getString(9), cursor.getInt(5) > 0, getTitleByCategoryId(accountId, cursor.getInt(6)), cursor.getString(7), DBStatus.parse(cursor.getString(2)), accountId, cursor.getString(8) ); }

Target:
private DBNote getNoteFromCursor(long accountId, @NonNull Cursor cursor, boolean pruneContent) { validateAccountId(accountId); Calendar modified = Calendar.getInstance(); modified.setTimeInMillis(cursor.getLong(4) * 1000); return new DBNote( cursor.getLong(0), cursor.getLong(1), modified, cursor.getString(3), pruneContent ? "" : cursor.getString(9), cursor.getInt(5) > 0, cursor.getString(6), cursor.getString(7), DBStatus.parse(cursor.getString(2)), accountId, cursor.getString(8) ); }
Source:
public void testYieldProjection() { int rows = 128; int columns = 20; DriverYieldSignal yieldSignal = new DriverYieldSignal(); PageProcessor pageProcessor = new PageProcessor( Optional.empty(), Collections.nCopies(columns, new YieldPageProjection(new InputPageProjection(0, VARCHAR)))); Slice[] slices = new Slice[rows]; Arrays.fill(slices, Slices.allocate(rows)); Page inputPage = new Page(createSlicesBlock(slices)); AggregatedMemoryContext memoryContext = newSimpleAggregatedMemoryContext(); Iterator<Optional<Page>> output = pageProcessor.process(SESSION, yieldSignal, memoryContext, inputPage); for (int i = 0; i < columns - 1; i++) { assertTrue(output.hasNext()); assertNull(output.next().orElse(null)); assertTrue(yieldSignal.isSet()); yieldSignal.reset(); } assertTrue(output.hasNext()); Page actualPage = output.next().orElse(null); assertNotNull(actualPage); assertTrue(yieldSignal.isSet()); yieldSignal.reset(); Block[] blocks = new Block[columns]; Arrays.fill(blocks, createSlicesBlock(Arrays.copyOfRange(slices, 0, rows))); Page expectedPage = new Page(blocks); assertPageEquals(Collections.nCopies(columns, VARCHAR), actualPage, expectedPage); assertFalse(output.hasNext()); }

Target:
public void testYieldProjection() { int rows = 128; int columns = 20; DriverYieldSignal yieldSignal = new DriverYieldSignal(); PageProcessor pageProcessor = new PageProcessor( Optional.empty(), Collections.nCopies(columns, new YieldPageProjection(new InputPageProjection(0, VARCHAR))), OptionalInt.of(MAX_BATCH_SIZE)); Slice[] slices = new Slice[rows]; Arrays.fill(slices, Slices.allocate(rows)); Page inputPage = new Page(createSlicesBlock(slices)); Iterator<Optional<Page>> output = processAndAssertRetainedPageSize(pageProcessor, yieldSignal, inputPage); for (int i = 0; i < columns - 1; i++) { assertTrue(output.hasNext()); assertNull(output.next().orElse(null)); assertTrue(yieldSignal.isSet()); yieldSignal.reset(); } assertTrue(output.hasNext()); Page actualPage = output.next().orElse(null); assertNotNull(actualPage); assertTrue(yieldSignal.isSet()); yieldSignal.reset(); Block[] blocks = new Block[columns]; Arrays.fill(blocks, createSlicesBlock(Arrays.copyOfRange(slices, 0, rows))); Page expectedPage = new Page(blocks); assertPageEquals(Collections.nCopies(columns, VARCHAR), actualPage, expectedPage); assertFalse(output.hasNext()); }
Source:
public void updatePartitionStatistics(String databaseName, String tableName, String partitionName, Function<PartitionStatistics, PartitionStatistics> update) { PartitionStatistics currentStatistics = requireNonNull(getPartitionStatistics(databaseName, tableName, ImmutableSet.of(partitionName)).get(partitionName), "currentStatistics is null"); PartitionStatistics updatedStatistics = update.apply(currentStatistics); verify(updatedStatistics.getColumnStatistics().isEmpty(), "glue metastore does not support column level statistics"); List<String> partitionValues = toPartitionValues(partitionName); Partition partition = getPartition(databaseName, tableName, partitionValues) .orElseThrow(() -> new PartitionNotFoundException(new SchemaTableName(databaseName, tableName), partitionValues)); try { PartitionInput partitionInput = GlueInputConverter.convertPartition(partition); partitionInput.setParameters(updateStatisticParameters(partition.getParameters(), updatedStatistics.getBasicStatistics())); glueClient.updatePartition(new UpdatePartitionRequest() .withDatabaseName(databaseName) .withTableName(tableName) .withPartitionValueList(partition.getValues()) .withPartitionInput(partitionInput)); } catch (EntityNotFoundException e) { throw new PartitionNotFoundException(new SchemaTableName(databaseName, tableName), partition.getValues()); } catch (AmazonServiceException e) { throw new PrestoException(HIVE_METASTORE_ERROR, e); } }

Target:
public void updatePartitionStatistics(String databaseName, String tableName, String partitionName, Function<PartitionStatistics, PartitionStatistics> update) { PartitionStatistics currentStatistics = requireNonNull( getPartitionStatistics(databaseName, tableName, ImmutableSet.of(partitionName)).get(partitionName), "getPartitionStatistics() returned null"); PartitionStatistics updatedStatistics = update.apply(currentStatistics); if (!updatedStatistics.getColumnStatistics().isEmpty()) { throw new PrestoException(NOT_SUPPORTED, "glue metastore does not support column level statistics"); } List<String> partitionValues = toPartitionValues(partitionName); Partition partition = getPartition(databaseName, tableName, partitionValues) .orElseThrow(() -> new PartitionNotFoundException(new SchemaTableName(databaseName, tableName), partitionValues)); try { PartitionInput partitionInput = GlueInputConverter.convertPartition(partition); partitionInput.setParameters(updateStatisticParameters(partition.getParameters(), updatedStatistics.getBasicStatistics())); glueClient.updatePartition(new UpdatePartitionRequest() .withDatabaseName(databaseName) .withTableName(tableName) .withPartitionValueList(partition.getValues()) .withPartitionInput(partitionInput)); } catch (EntityNotFoundException e) { throw new PartitionNotFoundException(new SchemaTableName(databaseName, tableName), partitionValues); } catch (AmazonServiceException e) { throw new PrestoException(HIVE_METASTORE_ERROR, e); } }
Source:
public boolean executeAttack(ServerSideAttack serverSideAttack) { this.serverSideAttack = serverSideAttack; try { return this.executeCustomPrivateKeySignedJWTTokenAttack() || this.executeAlgoKeyConfusionAttack() || this.executeNullByteAttack(); } catch (JWTException e) { LOGGER.error("error occurred while getting signed manipulated tokens", e); } return false; }

Target:
public boolean executeAttack(ServerSideAttack serverSideAttack) { this.serverSideAttack = serverSideAttack; try { return this.executeCustomPrivateKeySignedJWTTokenAttack() || this.executeAlgoKeyConfusionAttack() || this.executeNullByteAttack(); } catch (JWTException e) { LOGGER.error("An error occurred while getting signed manipulated tokens", e); } return false; }
Source:
protected int doStartTagInternal() throws Exception { pageContext.getOut().append(String.format( "<br/><h1>%2$s</h1><table id='ajaxlist%1$d' class='display no-border ui-widget-content'></table><script type='text/javascript'>jQuery(document).ready(function () { ListUtils.createTable('ajaxlist%1$d', ListTarget.%3$s, null, %4$s);});</script>", uniqueId++, name, target, config)); return SKIP_BODY; }

Target:
protected int doStartTagInternal() throws Exception { pageContext.getOut().append(String.format( "<br/><h1>%2$s</h1><table id='%1$s' class='display no-border ui-widget-content'></table><script type='text/javascript'>jQuery(document).ready(function () { ListUtils.createTable('%1$s', ListTarget.%3$s, null, %4$s);});</script>", getId(), name, target, config)); return SKIP_BODY; }
Source:
public static Map<String, Object> getEnvironmentAttributesWithApplicationHostname() { Map<String, Object> attributes = new HashMap<>(); try { if (!TestProperties.TEAMMATES_URL.contains("localhost")) { attributes.put("com.google.appengine.runtime.default_version_hostname", new URL(TestProperties.TEAMMATES_URL).getAuthority().substring(10)); return attributes; } attributes.put("com.google.appengine.runtime.default_version_hostname", new URL(TestProperties.TEAMMATES_URL).getAuthority()); } catch (MalformedURLException e) { throw new RuntimeException(e); } return attributes; }

Target:
public static Map<String, Object> getEnvironmentAttributesWithApplicationHostname() { Map<String, Object> attributes = new HashMap<>(); try { attributes.put("com.google.appengine.runtime.default_version_hostname", new URL(TestProperties.TEAMMATES_URL).getAuthority()); } catch (MalformedURLException e) { throw new RuntimeException(e); } return attributes; }
Source:
public void remove(Session session) { this.removeSuper(session); try { store.remove(session.getId()); } catch (IOException e) { log.error("An error occurred while removing session" + e.getMessage()); } }

Target:
public void remove(Session session) { this.removeSuper(session); try { store.remove(session.getId()); } catch (IOException e) { log.error("An error occurred while removing session with id: " + session.getId(), e); } }
Source:
public void testMetricSystemRestart() { MetricsSystemImpl ms = new MetricsSystemImpl("msRestartTestSystem"); TestSink ts = new TestSink(); String sinkName = "restartTestSink"; try { ms.start(); ms.register(sinkName, "", ts); assertNotNull("an adapter should exist for each sink", ms.getSinkAdapter(sinkName)); ms.stop(); ms.start(); assertNotNull("an adapter should exist for each sink", ms.getSinkAdapter(sinkName)); } finally { ms.stop(); } }

Target:
public void testMetricSystemRestart() { MetricsSystemImpl ms = new MetricsSystemImpl("msRestartTestSystem"); TestSink ts = new TestSink(); String sinkName = "restartTestSink"; try { ms.start(); ms.register(sinkName, "", ts); assertNotNull("no adapter exists for " + sinkName, ms.getSinkAdapter(sinkName)); ms.stop(); ms.start(); assertNotNull("no adapter exists for " + sinkName, ms.getSinkAdapter(sinkName)); } finally { ms.stop(); } }
Source:
public synchronized boolean waitForState(Processor processor, int state) { processor.addControllerListener(this); setFailed(false); if (state == Processor.Configured) processor.configure(); else if (state == Processor.Realized) processor.realize(); boolean interrupted = false; Object stateLock = getStateLock(); synchronized (stateLock) { while ((processor.getState() < state) && !failed) { try { stateLock.wait(10000); if (processor.getState() < state) { setFailed(true); } } catch (InterruptedException ie) { logger.warn( "Interrupted while waiting on Processor " + processor + " for state " + state, ie); interrupted = true; } } } if (interrupted) Thread.currentThread().interrupt(); processor.removeControllerListener(this); return !failed; }

Target:
public synchronized boolean waitForState(Processor processor, int state) { processor.addControllerListener(this); setFailed(false); if (state == Processor.Configured) processor.configure(); else if (state == Processor.Realized) processor.realize(); boolean interrupted = false; Object stateLock = getStateLock(); synchronized (stateLock) { while ((processor.getState() < state) && !failed) { try { Instant startTime = Instant.now(); stateLock.wait(WAIT_TIMEOUT*1000); if (Duration.between(startTime, Instant.now()) .getSeconds() >= WAIT_TIMEOUT) { setFailed(true); } } catch (InterruptedException ie) { logger.warn( "Interrupted while waiting on Processor " + processor + " for state " + state, ie); interrupted = true; } } } if (interrupted) Thread.currentThread().interrupt(); processor.removeControllerListener(this); return !failed; }
Source:
public void testPartialPerTypeStatsCancel() throws TmfAnalysisException { StubSegmentStatisticsAnalysis fixture = getValidSegmentStats(); NullProgressMonitor monitor = new NullProgressMonitor(); monitor.setCanceled(true); Map<@NonNull String, @NonNull SegmentStoreStatistics> perTypeStats = fixture.getPerSegmentTypeStatsForRange(100, 1100, monitor); assertNull(perTypeStats); }

Target:
public void testPartialPerTypeStatsCancel() throws TmfAnalysisException { StubSegmentStatisticsAnalysis fixture = getValidSegmentStats(); NullProgressMonitor monitor = new NullProgressMonitor(); monitor.setCanceled(true); Map<@NonNull String, @NonNull SegmentStoreStatistics> perTypeStats = fixture.getPerSegmentTypeStatsForRange(100, 1100, monitor); assertNull(perTypeStats); perTypeStats = fixture.getPerSegmentTypeStatsForRange(TmfTimeRange.ETERNITY.getStartTime().toNanos(), TmfTimeRange.ETERNITY.getEndTime().toNanos(), monitor); assertNotNull(perTypeStats); }
Source:
public WALPrettyPrinter() { outputValues = false; outputJSON = false; sequence = -1; tableList = new HashSet<>(); region = null; row = null; outputOnlyRowKey = false; persistentOutput = false; firstTxn = true; out = System.out; }

Target:
public WALPrettyPrinter() { outputValues = false; outputJSON = false; sequence = -1; tableSet = new HashSet<>(); region = null; row = null; outputOnlyRowKey = false; persistentOutput = false; firstTxn = true; out = System.out; }
Source:
private boolean canReadFrom(Job<?, ?> job, Run<?, ?> build) { if ((job instanceof AbstractProject) && (build instanceof AbstractBuild) && CopyArtifactPermissionProperty.canCopyArtifact( ((AbstractBuild)build).getProject().getRootProject(), ((AbstractProject<?,?>)job).getRootProject() )) { return true; } Authentication a = Jenkins.getAuthentication(); if (!ACL.SYSTEM.equals(a)) { boolean b = job.getACL().hasPermission(Item.READ); if (!b) LOGGER.fine(String.format("Refusing to copy artifact from %s to %s because %s lacks Item.READ access",job,build, a)); return b; } boolean b = job.getACL().hasPermission( new UsernamePasswordAuthenticationToken("authenticated", "", new GrantedAuthority[]{ SecurityRealm.AUTHENTICATED_AUTHORITY }), Item.READ); if (!b) LOGGER.fine(String.format("Refusing to copy artifact from %s to %s because 'authenticated' lacks Item.READ access",job,build)); return b; }

Target:
private boolean canReadFrom(Job<?, ?> job, Run<?, ?> build) { Job<?, ?> fromJob = job; Job<?, ?> toJob = build.getParent(); if (CopyArtifactPermissionProperty.canCopyArtifact(getRootProject(toJob), getRootProject(fromJob))) { return true; } Authentication a = Jenkins.getAuthentication(); if (!ACL.SYSTEM.equals(a)) { boolean b = job.getACL().hasPermission(Item.READ); if (!b) LOGGER.fine(String.format("Refusing to copy artifact from %s to %s because %s lacks Item.READ access",job,build, a)); return b; } boolean b = job.getACL().hasPermission( new UsernamePasswordAuthenticationToken("authenticated", "", new GrantedAuthority[]{ SecurityRealm.AUTHENTICATED_AUTHORITY }), Item.READ); if (!b) LOGGER.fine(String.format("Refusing to copy artifact from %s to %s because 'authenticated' lacks Item.READ access",job,build)); return b; }
Source:
protected LoadCreator(PerfConfig perfConfig, PerfNioServerMetrics perfNioServerMetrics, RestRequestHandler restRequestHandler) { this.perfConfig = perfConfig; this.perfNioServerMetrics = perfNioServerMetrics; this.restRequestHandler = restRequestHandler; chunk = new byte[perfConfig.perfNioServerChunkSize]; byte[] um = new byte[perfConfig.perfUserMetadataSize]; Random random = new Random(); random.nextBytes(chunk); random.nextBytes(um); usermetadata = new String(um); slots = new LinkedBlockingQueue<Boolean>(perfConfig.perfNioServerConcurrency); logger.trace("Instantiated LoadCreator"); }

Target:
protected LoadCreator(PerfConfig perfConfig, PerfNioServerMetrics perfNioServerMetrics, RestRequestHandler restRequestHandler) { this.perfConfig = perfConfig; this.perfNioServerMetrics = perfNioServerMetrics; this.restRequestHandler = restRequestHandler; chunk = new byte[perfConfig.perfNioServerChunkSize]; byte[] umBytes = new byte[perfConfig.perfUserMetadataSize]; Random random = new Random(); random.nextBytes(chunk); random.nextBytes(umBytes); usermetadata = new String(umBytes); slots = new LinkedBlockingQueue<Boolean>(perfConfig.perfNioServerConcurrency); logger.trace("Instantiated LoadCreator"); }
Source:
void testCommand() { Category category = TestUtilities.getCategory(plugin, "rechargeable"); final SlimefunItemStack RECHARGEABLE_ITEM = new SlimefunItemStack("RECHARGEABLE_ITEM", Material.REDSTONE_BLOCK, "Rechargeable Item", "This isn't real", LoreBuilder.powerCharged(0, 100)); new RechargeableMock(category, RECHARGEABLE_ITEM, RecipeType.NULL, new ItemStack[9]).register(plugin); Player player = server.addPlayer(); player.setOp(true); player.getInventory().setItemInMainHand(RECHARGEABLE_ITEM.clone()); server.execute("slimefun", player, "charge"); ItemStack chargedItemStack = player.getInventory().getItemInMainHand(); Rechargeable chargedItem = (Rechargeable) SlimefunItem.getByItem(chargedItemStack); Assertions.assertEquals(chargedItem.getItemCharge(chargedItemStack), chargedItem.getMaxItemCharge(chargedItemStack)); }

Target:
void testCommand() { Category category = TestUtilities.getCategory(plugin, "rechargeable"); SlimefunItemStack RECHARGEABLE_ITEM = new SlimefunItemStack("SF_CHARGE_TEST_ITEM", Material.REDSTONE_BLOCK, "Rechargeable Item", "This isn't real", LoreBuilder.powerCharged(0, 100)); new RechargeableMock(category, RECHARGEABLE_ITEM, RecipeType.NULL, new ItemStack[9]).register(plugin); Player player = server.addPlayer(); player.setOp(true); player.getInventory().setItemInMainHand(RECHARGEABLE_ITEM.clone()); ItemStack chargedItemStack = player.getInventory().getItemInMainHand(); Rechargeable chargedItem = (Rechargeable) SlimefunItem.getByItem(chargedItemStack); Assertions.assertEquals(chargedItem.getItemCharge(chargedItemStack), 0); server.execute("slimefun", player, "charge"); chargedItemStack = player.getInventory().getItemInMainHand(); chargedItem = (Rechargeable) SlimefunItem.getByItem(chargedItemStack); Assertions.assertEquals(chargedItem.getItemCharge(chargedItemStack), chargedItem.getMaxItemCharge(chargedItemStack)); }
Source:
private Criterion getCriterionForLongName(String name, boolean includeVoided) { MatchMode matchMode = getMatchMode(); if (includeVoided) { return Restrictions.disjunction().add(Restrictions.like("name.givenName", name, matchMode)).add( Restrictions.like("name.middleName", name, matchMode)).add( Restrictions.like("name.familyName", name, matchMode)).add( Restrictions.like("name.familyName2", name, matchMode)); } else { return Restrictions.conjunction().add(Restrictions.eq("name.voided", false)).add( Restrictions.disjunction().add(Restrictions.like("name.givenName", name, matchMode)).add( Restrictions.like("name.middleName", name, matchMode)).add( Restrictions.like("name.familyName", name, matchMode)).add( Restrictions.like("name.familyName2", name, matchMode))); } }

Target:
private Criterion getCriterionForLongName(String name, boolean includeVoided) { MatchMode matchMode = getMatchMode(); Criterion criterion = Restrictions.disjunction().add(Restrictions.like("name.givenName", name, matchMode)).add( Restrictions.like("name.middleName", name, matchMode)) .add(Restrictions.like("name.familyName", name, matchMode)).add( Restrictions.like("name.familyName2", name, matchMode)); if (!includeVoided) { return Restrictions.conjunction().add(Restrictions.eq("name.voided", false)).add(criterion); } return criterion; }
Source:
private void printPrincipalRecord(ExtMap extMap) { logger.info("============================== Principal ==============================="); if (extMap != null) { logger.info( String.format( "PrincipalRecord: ID '%s', name: '%s', principal: '%s', namespace: '%s', display name: '%s', email: '%s', first name: '%s', last name: '%s', department: '%s', title: '%s'", extMap.get(Authz.PrincipalRecord.ID, ""), extMap.get(Authz.PrincipalRecord.NAME, ""), extMap.get(Authz.PrincipalRecord.PRINCIPAL, ""), extMap.get(Authz.PrincipalRecord.NAMESPACE, ""), extMap.get(Authz.PrincipalRecord.DISPLAY_NAME, ""), extMap.get(Authz.PrincipalRecord.EMAIL, ""), extMap.get(Authz.PrincipalRecord.FIRST_NAME, ""), extMap.get(Authz.PrincipalRecord.LAST_NAME, ""), extMap.get(Authz.PrincipalRecord.DEPARTMENT, ""), extMap.get(Authz.PrincipalRecord.TITLE, "") ) ); if(getFlags() != 0) { logger.info("Groups of PrincipalRecord"); for (ExtMap group : extMap.get(Authz.PrincipalRecord.GROUPS, Collections.<ExtMap>emptyList())) { printGroupRecord(group); } logger.info("End of groups of PrincipalRecord"); } } logger.info("========================================================================"); }

Target:
private void printPrincipalRecord(ExtMap extMap) { if (extMap != null) { log.info("============================== Principal ==============================="); log.info( "PrincipalRecord: ID '{}', name: '{}', principal: '{}', namespace: '{}', display name: '{}', email: '{}', first name: '{}', last name: '{}', department: '{}', title: '{}'", extMap.get(Authz.PrincipalRecord.ID, ""), extMap.get(Authz.PrincipalRecord.NAME, ""), extMap.get(Authz.PrincipalRecord.PRINCIPAL, ""), extMap.get(Authz.PrincipalRecord.NAMESPACE, ""), extMap.get(Authz.PrincipalRecord.DISPLAY_NAME, ""), extMap.get(Authz.PrincipalRecord.EMAIL, ""), extMap.get(Authz.PrincipalRecord.FIRST_NAME, ""), extMap.get(Authz.PrincipalRecord.LAST_NAME, ""), extMap.get(Authz.PrincipalRecord.DEPARTMENT, ""), extMap.get(Authz.PrincipalRecord.TITLE, "") ); log.info("Groups of PrincipalRecord"); flatGroups(extMap); log.info("End of groups of PrincipalRecord"); log.info("========================================================================"); } }
Source:
public List<Container> getContainers() throws UnrecoverableKeyException, CertificateEncodingException, NoSuchAlgorithmException, KeyStoreException, IOException { if(!Jenkins.get().hasPermission(Jenkins.ADMINISTER)) { LOGGER.log(Level.FINE, " Computer {0} getContainers, lack of admin permission, returning empty list", this); return new ArrayList<>(); } KubernetesSlave slave = getNode(); if(slave == null) { return new ArrayList<>(); } KubernetesCloud cloud = slave.getKubernetesCloud(); KubernetesClient client = cloud.connect(); String namespace = StringUtils.defaultIfBlank(slave.getNamespace(), client.getNamespace()); Pod pod = client.pods().inNamespace(namespace).withName(getName()).get(); return pod.getSpec().getContainers(); }

Target:
public List<Container> getContainers() throws UnrecoverableKeyException, CertificateEncodingException, NoSuchAlgorithmException, KeyStoreException, IOException { if(!Jenkins.get().hasPermission(Jenkins.ADMINISTER)) { LOGGER.log(Level.FINE, " Computer {0} getContainers, lack of admin permission, returning empty list", this); return Collections.emptyList(); } KubernetesSlave slave = getNode(); if(slave == null) { return Collections.emptyList(); } KubernetesCloud cloud = slave.getKubernetesCloud(); KubernetesClient client = cloud.connect(); String namespace = StringUtils.defaultIfBlank(slave.getNamespace(), client.getNamespace()); Pod pod = client.pods().inNamespace(namespace).withName(getName()).get(); return pod.getSpec().getContainers(); }