auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private API getApi() { API api = new API(); for (DetailedLink link : getLinks()) { <START> api.getLinks().add(LinkHelper.createLink(link.getHref(), link.getRel())); <END> if (link.isSetLinkCapabilities() && link.getLinkCapabilities().isSetSearchable() && link.getLinkCapabilities().isSearchable()) { api.getLinks().add(LinkHelper.createLink(link.getHref(), link.getRel(), link.getUrlParmeters())); } } return api; }</code><technical_language>creating new Link?, Link is a super of DetailedLink ref & rel, (Link)link do job for you. btw: rename /link/ parameter /detailedLink/ a bit confusing</technical_language>

Target:
private API getApi() { API api = new API(); for (DetailedLink detailedLink : getLinks()) { api.getLinks().add(LinkHelper.createLink(detailedLink.getHref(), detailedLink.getRel())); if (detailedLink.isSetLinkCapabilities() && detailedLink.getLinkCapabilities().isSetSearchable() && detailedLink.getLinkCapabilities().isSearchable()) { api.getLinks().add(LinkHelper.createLink(detailedLink.getHref(), detailedLink.getRel(), detailedLink.getUrlParmeters())); } } return api; }
Source:
<code>public AbstractTmfStateProvider(ITmfTrace trace, Class<? extends ITmfEvent> eventType, String id) { this.fTrace = trace; <START> this.fEventType = eventType; <END> fEventsQueue = new ArrayBlockingQueue<>(DEFAULT_EVENTS_QUEUE_SIZE); fStateSystemAssigned = false; fEventHandlerThread = new Thread(new EventProcessor(), id + " Event Handler"); }</code><technical_language>remove "this."</technical_language>

Target:
public AbstractTmfStateProvider(ITmfTrace trace, Class<? extends ITmfEvent> eventType, String id) { fTrace = trace; fEventType = eventType; fEventsQueue = new ArrayBlockingQueue<>(DEFAULT_EVENTS_QUEUE_SIZE); fStateSystemAssigned = false; fEventHandlerThread = new Thread(new EventProcessor(), id + " Event Handler"); }
Source:
<code>private String createStandbyProcess(String type, String title, String tenantId, String tenantName) { Process process = fetchStandbyProcess(type, tenantId).orElse(null); if (process != null) { return process.getIdAsString(); } <START> AtomicReference<String> processId = new AtomicReference<>(""); <END> locks.tryLocked(LOCK_CREATE_STANDBY_PROCESS + "-" + type + "-" + tenantId, Duration.ofSeconds(30), () -> { Wait.millis(1200); Process p = fetchStandbyProcess(type, tenantId).orElse(null); if (p != null) { processId.set(p.getIdAsString()); return; } p = new Process(); p.setTitle(title); p.setProcessType(type); p.setTenantId(tenantId); p.setTenantName(tenantName); p.setState(ProcessState.STANDBY); p.setStarted(LocalDateTime.now()); elastic.update(p); process1stLevelCache.put(p.getId(), p); process2ndLevelCache.put(p.getId(), p); standbyProcessCache.put(type + "-" + tenantId, p); processId.set(p.getIdAsString()); }); return processId.get(); }</code><technical_language>ValueHolder<String></technical_language>

Target:
private String createStandbyProcess(String type, String title, String tenantId, String tenantName) { ValueHolder<String> processId = new ValueHolder<>(""); locks.tryLocked(LOCK_CREATE_STANDBY_PROCESS + "-" + type + "-" + tenantId, Duration.ofSeconds(30), () -> { Process p = fetchStandbyProcess(type, tenantId); if (p != null) { processId.set(p.getIdAsString()); return; } Wait.millis(1200); p = fetchStandbyProcess(type, tenantId); if (p != null) { processId.set(p.getIdAsString()); return; } p = new Process(); p.setTitle(title); p.setProcessType(type); p.setTenantId(tenantId); p.setTenantName(tenantName); p.setState(ProcessState.STANDBY); p.setStarted(LocalDateTime.now()); elastic.update(p); process1stLevelCache.put(p.getId(), p); process2ndLevelCache.put(p.getId(), p); standbyProcessCache.put(type + "-" + tenantId, p); processId.set(p.getIdAsString()); }); return processId.get(); }
Source:
<code>public TransactionManager newTransactionManager() { if (globalTransactionManager == null) { <START> throw new RuntimeException("No transaction manager set nor environemtn provided to loo it up"); <END> } return new KieSpringTransactionManager(globalTransactionManager); }</code><technical_language>A typo: environemtn -> environment, loo -></technical_language>

Target:
public TransactionManager newTransactionManager() { if (globalTransactionManager == null) { throw new RuntimeException("No transaction manager set nor environment provided to look it up"); } return new KieSpringTransactionManager(globalTransactionManager); }
Source:
<code>public ScalarFunctionImplementation specialize(BoundVariables boundVariables, int arity, TypeManager typeManager, FunctionManager functionManager) { Type keyType = boundVariables.getTypeVariable("K"); Type valueType = boundVariables.getTypeVariable("V"); Type mapType = typeManager.getParameterizedType(MAP, ImmutableList.of(TypeSignatureParameter.of(keyType.getTypeSignature()), TypeSignatureParameter.of(valueType.getTypeSignature()))); MethodHandle keyHashCode = functionManager.getScalarFunctionImplementation(functionManager.resolveOperator(OperatorType.HASH_CODE, fromTypes(keyType))).getMethodHandle(); MethodHandle keyEqual = functionManager.getScalarFunctionImplementation(functionManager.resolveOperator(OperatorType.EQUAL, fromTypes(keyType, keyType))).getMethodHandle(); MethodHandle keyIndeterminate = functionManager.getScalarFunctionImplementation( <START> functionManager.resolveOperator(INDETERMINATE, TypeSignatureProvider.fromTypeSignatures((keyType.getTypeSignature())))).getMethodHandle(); <END> MethodHandle instanceFactory = constructorMethodHandle(State.class, MapType.class).bindTo(mapType); return new ScalarFunctionImplementation( false, ImmutableList.of( valueTypeArgumentProperty(RETURN_NULL_ON_NULL), valueTypeArgumentProperty(RETURN_NULL_ON_NULL)), METHOD_HANDLE.bindTo(mapType).bindTo(keyEqual).bindTo(keyHashCode).bindTo(keyIndeterminate), Optional.of(instanceFactory), isDeterministic()); }</code><technical_language>static import</technical_language>

Target:
public ScalarFunctionImplementation specialize(BoundVariables boundVariables, int arity, TypeManager typeManager, FunctionManager functionManager) { Type keyType = boundVariables.getTypeVariable("K"); Type valueType = boundVariables.getTypeVariable("V"); Type mapType = typeManager.getParameterizedType(MAP, ImmutableList.of(TypeSignatureParameter.of(keyType.getTypeSignature()), TypeSignatureParameter.of(valueType.getTypeSignature()))); MethodHandle keyHashCode = functionManager.getScalarFunctionImplementation(functionManager.resolveOperator(OperatorType.HASH_CODE, fromTypes(keyType))).getMethodHandle(); MethodHandle keyEqual = functionManager.getScalarFunctionImplementation(functionManager.resolveOperator(OperatorType.EQUAL, fromTypes(keyType, keyType))).getMethodHandle(); MethodHandle keyIndeterminate = functionManager.getScalarFunctionImplementation( functionManager.resolveOperator(INDETERMINATE, fromTypeSignatures((keyType.getTypeSignature())))).getMethodHandle(); MethodHandle instanceFactory = constructorMethodHandle(State.class, MapType.class).bindTo(mapType); return new ScalarFunctionImplementation( false, ImmutableList.of( valueTypeArgumentProperty(RETURN_NULL_ON_NULL), valueTypeArgumentProperty(RETURN_NULL_ON_NULL)), METHOD_HANDLE.bindTo(mapType).bindTo(keyEqual).bindTo(keyHashCode).bindTo(keyIndeterminate), Optional.of(instanceFactory), isDeterministic()); }
Source:
<code>public ResponseEntity<?> create(@PathVariable("name") final String name, @Valid @RequestBody final EventTypeSchemaBase schema, final Errors errors) { if (errors.hasErrors()) { throw new ValidationException(errors); } final EventType eventType = eventTypeService.get(name); <START> schemaService.addSchema(eventType, schema); <END> return status(HttpStatus.OK).build(); }</code><technical_language>sense pass event type name addSchema call, instead of event type, is takes cache, database (or find another solution)</technical_language>

Target:
public ResponseEntity<?> create(@PathVariable("name") final String name, @Valid @RequestBody final EventTypeSchemaBase schema, final Errors errors) { if (errors.hasErrors()) { throw new ValidationException(errors); } schemaService.addSchema(name, schema); return status(HttpStatus.OK).build(); }
Source:
<code>RepositoryCache() { new Closer(queue).start(); ListenerList global = Repository.getGlobalListenerList(); global.addConfigChangedListener(event -> { Repository repo = getRepository( event.getRepository().getDirectory()); if (repo == null || repo == event.getRepository()) { globalListeners.dispatch(event); } else { ConfigChangedEvent newEvent = new ConfigChangedEvent(); newEvent.setRepository(repo); globalListeners.dispatch(newEvent); } }); global.addIndexChangedListener(event -> { Repository repo = getRepository( event.getRepository().getDirectory()); if (repo == null || repo == event.getRepository()) { globalListeners.dispatch(event); } else { IndexChangedEvent newEvent = new IndexChangedEvent( event.isInternal()); newEvent.setRepository(repo); globalListeners.dispatch(newEvent); } }); global.addRefsChangedListener(event -> { Repository repo = getRepository( event.getRepository().getDirectory()); if (repo == null || repo == event.getRepository()) { globalListeners.dispatch(event); } else { RefsChangedEvent newEvent = new RefsChangedEvent(); newEvent.setRepository(repo); globalListeners.dispatch(newEvent); } }); global.addWorkingTreeModifiedListener(event -> { Repository repo = getRepository( event.getRepository().getDirectory()); if (repo == null || repo == event.getRepository()) { globalListeners.dispatch(event); } else { WorkingTreeModifiedEvent newEvent = new WorkingTreeModifiedEvent( event.getModified(), event.getDeleted()); newEvent.setRepository( <START> getRepository(event.getRepository().getDirectory())); <END> globalListeners.dispatch(newEvent); } }); }</code><technical_language>repo</technical_language>

Target:
RepositoryCache() { new Closer(queue).start(); ListenerList global = Repository.getGlobalListenerList(); global.addConfigChangedListener(event -> { Repository repo = getRepository( event.getRepository().getDirectory()); if (repo == null || repo == event.getRepository()) { globalListeners.dispatch(event); } else { ConfigChangedEvent newEvent = new ConfigChangedEvent(); newEvent.setRepository(repo); globalListeners.dispatch(newEvent); } }); global.addIndexChangedListener(event -> { Repository repo = getRepository( event.getRepository().getDirectory()); if (repo == null || repo == event.getRepository()) { globalListeners.dispatch(event); } else { IndexChangedEvent newEvent = new IndexChangedEvent( event.isInternal()); newEvent.setRepository(repo); globalListeners.dispatch(newEvent); } }); global.addRefsChangedListener(event -> { Repository repo = getRepository( event.getRepository().getDirectory()); if (repo == null || repo == event.getRepository()) { globalListeners.dispatch(event); } else { RefsChangedEvent newEvent = new RefsChangedEvent(); newEvent.setRepository(repo); globalListeners.dispatch(newEvent); } }); global.addWorkingTreeModifiedListener(event -> { Repository repo = getRepository( event.getRepository().getDirectory()); if (repo == null || repo == event.getRepository()) { globalListeners.dispatch(event); } else { WorkingTreeModifiedEvent newEvent = new WorkingTreeModifiedEvent( event.getModified(), event.getDeleted()); newEvent.setRepository(repo); globalListeners.dispatch(newEvent); } }); }
Source:
<code>public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.upload_files_menu, menu); getMenuInflater().inflate(R.menu.sort_menu, menu.findItem(R.id.action_sort).getSubMenu()); mMainMenu = menu; <START> mItemSelectAll = (MenuItem) menu.findItem(R.id.action_select_all); <END> mItemSelectInverse = (MenuItem) menu.findItem(R.id.action_select_inverse); recoverSortMenuState(menu); setSelectAllMenuItemState(); setSelectInverseMenuItemState(); return true; }</code><technical_language>Casting MenuItem is redundant</technical_language>

Target:
public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.upload_files_menu, menu); getMenuInflater().inflate(R.menu.sort_menu, menu.findItem(R.id.action_sort).getSubMenu()); mMainMenu = menu; mItemSelectAll = menu.findItem(R.id.action_select_all); mItemSelectInverse = menu.findItem(R.id.action_select_inverse); recoverSortMenuState(menu); setSelectAllMenuItemState(); setSelectInverseMenuItemState(); return true; }
Source:
<code>public boolean login(HttpServletRequest request, HttpServletResponse response, Scope... scopes) throws IOException { if (isLoggedIn()) { return true; } LOG.debug("Login " + this); if (OAuthProtocol.isOAuthFinal(request)) { log.debug("Login-FINAL " + this); AccessToken loginAccessToken = oauth.loginPhase2(request, response); <START> if(loginAccessToken <END> != null && !loginAccessToken.isError()) { login(loginAccessToken); } if (isLoggedIn()) { LOG.debug("Login-SUCCESS " + this); response.sendRedirect(OAuthProtocol.getTargetUrl(request)); return true; } else { response.sendError(HttpStatus.SC_UNAUTHORIZED); return false; } } else { this.loginScopes = getScopes(getScopesKey(request, response), scopes); LOG.debug("Login-PHASE1 " + this); oauth.loginPhase1(request, response, loginScopes); return false; } }</code><technical_language>Nit: missing blank</technical_language>

Target:
public boolean login(HttpServletRequest request, HttpServletResponse response, Scope... scopes) throws IOException { if (isLoggedIn()) { return true; } LOG.debug("Login " + this); if (OAuthProtocol.isOAuthFinal(request)) { LOG.debug("Login-FINAL " + this); AccessToken loginAccessToken = oauth.loginPhase2(request, response); if(loginAccessToken != null && !loginAccessToken.isError()) { login(loginAccessToken); } if (isLoggedIn()) { LOG.debug("Login-SUCCESS " + this); response.sendRedirect(OAuthProtocol.getTargetUrl(request)); return true; } else { response.sendError(HttpStatus.SC_UNAUTHORIZED); return false; } } else { this.loginScopes = getScopes(getScopesKey(request, response), scopes); LOG.debug("Login-PHASE1 " + this); oauth.loginPhase1(request, response, loginScopes); return false; } }
Source:
<code>protected void updateLightmap(float[] normal, float[] lightmap, float x, float y, float z) { float e1 = 1 - 1e-2f; float e2 = 0.95f; boolean full = blockInfo.isFullCube(); EnumFacing side = null; if((full || y < -e1) && normal[1] < -e2) side = EnumFacing.DOWN; <START> else if((full || y > e1) && normal[1] > e2) side = EnumFacing.UP; <END> else if((full || z < -e1) && normal[2] < -e2) side = EnumFacing.NORTH; else if((full || z > e1) && normal[2] > e2) side = EnumFacing.SOUTH; else if((full || x < -e1) && normal[0] < -e2) side = EnumFacing.WEST; else if((full || x > e1) && normal[0] > e2) side = EnumFacing.EAST; int i = side == null ? 0 : side.ordinal() + 1; int brightness = blockInfo.getPackedLight()[i]; lightmap[0] = ((float)((brightness >> 0x04) & 0xF) * 0x20) / 0xFFFF; lightmap[1] = ((float)((brightness >> 0x14) & 0xF) * 0x20) / 0xFFFF; }</code><technical_language>if...else transformation is correct here? I hold true for axis, have, say, moving position in Y Z axis</technical_language>

Target:
protected void updateLightmap(float[] normal, float[] lightmap, float x, float y, float z) { final float e1 = 1f - 1e-2f; final float e2 = 0.95f; boolean full = blockInfo.isFullCube(); EnumFacing side = null; if((full || y < -e1) && normal[1] < -e2) side = EnumFacing.DOWN; else if((full || y > e1) && normal[1] > e2) side = EnumFacing.UP; else if((full || z < -e1) && normal[2] < -e2) side = EnumFacing.NORTH; else if((full || z > e1) && normal[2] > e2) side = EnumFacing.SOUTH; else if((full || x < -e1) && normal[0] < -e2) side = EnumFacing.WEST; else if((full || x > e1) && normal[0] > e2) side = EnumFacing.EAST; int i = side == null ? 0 : side.ordinal() + 1; int brightness = blockInfo.getPackedLight()[i]; lightmap[0] = ((float)((brightness >> 0x04) & 0xF) * 0x20) / 0xFFFF; lightmap[1] = ((float)((brightness >> 0x14) & 0xF) * 0x20) / 0xFFFF; }
Source:
<code>public void updated(Provider<E> provider, E oldElement, E element) { final K uidOld = oldElement.getUID(); final K uid = element.getUID(); if (!uidOld.equals(uid)) { logger.warn("Received update event for elements that UID differ (old: {}, new: {}). Ignore event.", uidOld, uid); return; } final E existingElement; elementWriteLock.lock(); try { existingElement = identifierToElement.get(uid); if (existingElement == null) { logger.debug("{} with key '{}' could not be updated for provider because it does not exist!", element.getClass().getSimpleName(), uid, provider.getClass().getSimpleName()); return; } try { beforeUpdateElement(existingElement); onUpdateElement(oldElement, element); } catch (final RuntimeException ex) { <START> logger.warn("Could not update element: {}", ex.getMessage(), ex); <END> return; } identifierToElement.put(uid, element); elementToProvider.remove(existingElement); elementToProvider.put(element, provider); final Collection<E> providerElements = providerToElements.get(provider); providerElements.remove(existingElement); providerElements.add(element); elements.remove(existingElement); elements.add(element); } finally { elementWriteLock.unlock(); } notifyListenersAboutUpdatedElement(oldElement, element); }</code><technical_language>suggestion logger.warn("Could update key '{}': {}", element.getClass().getSimpleName(), uid, ex.getMessage(), ex);</technical_language>

Target:
public void updated(Provider<E> provider, E oldElement, E element) { final K uidOld = oldElement.getUID(); final K uid = element.getUID(); if (!uidOld.equals(uid)) { logger.warn("Received update event for elements that UID differ (old: \"{}\", new: \"{}\"). Ignore event.", uidOld, uid); return; } final E existingElement; elementWriteLock.lock(); try { existingElement = identifierToElement.get(uid); if (existingElement == null) { logger.debug("Cannot update \"{}\" with key \"{}\" for provider \"{}\" because it does not exist!", element.getClass().getSimpleName(), uid, provider.getClass().getSimpleName()); return; } try { beforeUpdateElement(existingElement); onUpdateElement(oldElement, element); } catch (final RuntimeException ex) { logger.warn("Cannot update \"{}\" with key \"{}\": {}", element.getClass().getSimpleName(), uid, ex.getMessage(), ex); return; } identifierToElement.put(uid, element); elementToProvider.remove(existingElement); elementToProvider.put(element, provider); final Collection<E> providerElements = providerToElements.get(provider); providerElements.remove(existingElement); providerElements.add(element); elements.remove(existingElement); elements.add(element); } finally { elementWriteLock.unlock(); } notifyListenersAboutUpdatedElement(oldElement, element); }
Source:
<code>public String toString() { String ifaceName = (mIfaceName == null ? "" : "InterfaceName: " + mIfaceName + " "); String linkAddresses = "LinkAddresses: ["; for (LinkAddress addr : mLinkAddresses) linkAddresses += addr.toString() + ","; linkAddresses += "] "; String dns = "DnsAddresses: ["; for (InetAddress addr : mDnses) dns += addr.getHostAddress() + ","; dns += "] "; String domainName = "Domains: " + mDomains; String mtu = "MTU: " + mMtu; String routes = " Routes: ["; for (RouteInfo route : mRoutes) routes += route.toString() + ","; routes += "] "; String proxy = (mHttpProxy == null ? "" : "HttpProxy: " + mHttpProxy.toString() + " "); String stacked = ""; if (mStackedLinks.values().size() > 0) { stacked += " Stacked: ["; for (LinkProperties link: mStackedLinks.values()) { stacked += " [" + link.toString() + " ],"; } stacked += "] "; } <START> return "{" + ifaceName + linkAddresses + routes + dns + domainName + mMtu <END> + proxy + stacked + "}"; }</code><technical_language>mtu, mMtu</technical_language>

Target:
public String toString() { String ifaceName = (mIfaceName == null ? "" : "InterfaceName: " + mIfaceName + " "); String linkAddresses = "LinkAddresses: ["; for (LinkAddress addr : mLinkAddresses) linkAddresses += addr.toString() + ","; linkAddresses += "] "; String dns = "DnsAddresses: ["; for (InetAddress addr : mDnses) dns += addr.getHostAddress() + ","; dns += "] "; String domainName = "Domains: " + mDomains; String mtu = "MTU: " + mMtu; String routes = " Routes: ["; for (RouteInfo route : mRoutes) routes += route.toString() + ","; routes += "] "; String proxy = (mHttpProxy == null ? "" : "HttpProxy: " + mHttpProxy.toString() + " "); String stacked = ""; if (mStackedLinks.values().size() > 0) { stacked += " Stacked: ["; for (LinkProperties link: mStackedLinks.values()) { stacked += " [" + link.toString() + " ],"; } stacked += "] "; } return "{" + ifaceName + linkAddresses + routes + dns + domainName + mtu + proxy + stacked + "}"; }
Source:
<code>public void onInsertRowBelow() { assertNotReadOnly(); final Set<Integer> selectedRowIndexes = getSelectedRowIndexes(); if ( selectedRowIndexes.size() != 1 ) { return; } final int rowIndex = selectedRowIndexes.iterator().next(); insertRow( rowIndex + 1 ); <START> } <END></code><technical_language>onInsertRow*(..) methods differ in index line.. extract common code</technical_language>

Target:
public void onInsertRowBelow() { doInsertRow( ( index ) -> insertRow( index + 1 ) ); }
Source:
<code>private Object invoke(Method recovery, Throwable throwable) throws IllegalAccessException, InvocationTargetException { if (!recovery.isAccessible()) { <START> ReflectionUtils.makeAccessible(recovery); <END> } if (args.length != 0) { Object[] newArgs = Arrays.copyOf(args, args.length + 1); newArgs[args.length] = throwable; return recovery.invoke(target, newArgs); } else { return recovery.invoke(target, throwable); } }</code><technical_language>need undo accessible in finally block : boolean methodAccessible = method.isAccessible(); try { ReflectionUtils.makeAccessible(method); // ur recovery logic } finally { if (methodAccessible != method.isAccessible()) { method.setAccessible(methodAccessible); } }</technical_language>

Target:
private Object invoke(Method recovery, Throwable throwable) throws IllegalAccessException, InvocationTargetException { boolean accessible = recovery.isAccessible(); try { if (!accessible) { ReflectionUtils.makeAccessible(recovery); } if (args.length != 0) { Object[] newArgs = Arrays.copyOf(args, args.length + 1); newArgs[args.length] = throwable; return recovery.invoke(target, newArgs); } else { return recovery.invoke(target, throwable); } } finally { if (!accessible) { recovery.setAccessible(false); } } }
Source:
<code>public void addNotify() { super.addNotify(); IngestManager.getInstance().addIngestModuleEventListener(INGEST_MODULE_EVENTS_OF_INTEREST, ingestListener); IngestManager.getInstance().addIngestJobEventListener(INGEST_JOB_EVENTS_OF_INTEREST, ingestJobListener); Case.addEventTypeSubscriber(EnumSet.of(CURRENT_CASE), evt -> { devicesMap.clear(); devicesListPane.removeAll(); accountTypeMap.clear(); accountTypeListPane.removeAll(); <START> CheckBoxIconPanel panel = createAccoutTypeCheckBoxPanel(Account.Type.DEVICE, true); <END> accountTypeMap.put(Account.Type.DEVICE, panel.getCheckBox()); accountTypeListPane.add(panel); }); }</code><technical_language>this init/reset method called initialization time reset</technical_language>

Target:
public void addNotify() { super.addNotify(); IngestManager.getInstance().addIngestModuleEventListener(INGEST_MODULE_EVENTS_OF_INTEREST, ingestListener); IngestManager.getInstance().addIngestJobEventListener(INGEST_JOB_EVENTS_OF_INTEREST, ingestJobListener); Case.addEventTypeSubscriber(EnumSet.of(CURRENT_CASE), evt -> { devicesMap.clear(); devicesListPane.removeAll(); accountTypeMap.clear(); accountTypeListPane.removeAll(); initalizeDeviceAccountType(); }); }
Source:
<code>public void updateAssetsPath(String pluginId, String assetPath) { AnalyticsPluginInfo pluginInfo = getPluginInfo(pluginId); <START> if (pluginInfo != null) { <END> pluginInfo.setStaticAssetsPath(assetPath); } }</code><technical_language>fatal if pluginInfo is null? chance set static assets. silently fail</technical_language>

Target:
public void updateAssetsPath(String pluginId, String assetPath) { AnalyticsPluginInfo pluginInfo = getPluginInfo(pluginId); pluginInfo.setStaticAssetsPath(assetPath); }
Source:
<code>private static JsonParserIterator<DataSegment> getMetadataSegments( DruidLeaderClient coordinatorClient, ObjectMapper jsonMapper, BytesAccumulatingResponseHandler responseHandler ) { Request request; try { request = coordinatorClient.makeRequest( HttpMethod.GET, StringUtils.format("/druid/coordinator/v1/metadata/segments") ); } catch (IOException e) { throw new RuntimeException(e); } ListenableFuture<InputStream> future = coordinatorClient.goStream( request, responseHandler ); try { future.get(); } catch (InterruptedException | ExecutionException e) { throw new RuntimeException(e); } if (responseHandler.getStatus() != HttpServletResponse.SC_OK) { throw new ISE( "Error while fetching metadata segments status[%s] description[%s]", responseHandler.status, responseHandler.description ); } final JavaType typeRef = jsonMapper.getTypeFactory().constructType(new TypeReference<DataSegment>() { }); <START> JsonParserIterator<DataSegment> iterator = new JsonParserIterator<>( <END> typeRef, future, request.getUrl().toString(), null, request.getUrl().getHost(), jsonMapper ); return iterator; }</code><technical_language>return directly</technical_language>

Target:
private static JsonParserIterator<DataSegment> getMetadataSegments( DruidLeaderClient coordinatorClient, ObjectMapper jsonMapper, BytesAccumulatingResponseHandler responseHandler ) { Request request; try { request = coordinatorClient.makeRequest( HttpMethod.GET, StringUtils.format("/druid/coordinator/v1/metadata/segments") ); } catch (IOException e) { throw new RuntimeException(e); } ListenableFuture<InputStream> future = coordinatorClient.goAsync( request, responseHandler ); final JavaType typeRef = jsonMapper.getTypeFactory().constructType(new TypeReference<DataSegment>() { }); return new JsonParserIterator<>( typeRef, future, request.getUrl().toString(), null, request.getUrl().getHost(), jsonMapper ); }
Source:
<code>protected void endVmCommand() { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { final boolean taskGroupSucceeded = getParameters().getTaskGroupSuccess(); Guid createdSnapshotId = getSnapshotDao().getId(getVmId(), getParameters().getSnapshotType(), SnapshotStatus.LOCKED); if (taskGroupSucceeded) { getSnapshotDao().updateStatus(createdSnapshotId, SnapshotStatus.OK); if (getParameters().getParentCommand() != VdcActionType.RunVm && getVm() != null && getVm().isStatusUp() && getVm().getRunOnVds() != null) { performLiveSnapshot(createdSnapshotId); } } else { revertToActiveSnapshot(createdSnapshotId); } getVmStaticDAO().incrementDbGeneration(getVm().getId()); endActionOnDisks(); setSucceeded(taskGroupSucceeded); getReturnValue().setEndActionTryAgain(false); return null; } }); <START> if (isVmDownUnexpectedly() && getVm().isAutoStartup() && wasVmUpInitially()) { <END> Backend.getInstance().runInternalAction(VdcActionType.RunVm, new RunVmParams(getVmId()), ExecutionHandler.createInternalJobContext()); } }</code><technical_language>perform getVm().isAutoStartup()</technical_language>

Target:
protected void endVmCommand() { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { final boolean taskGroupSucceeded = getParameters().getTaskGroupSuccess(); Guid createdSnapshotId = getSnapshotDao().getId(getVmId(), getParameters().getSnapshotType(), SnapshotStatus.LOCKED); if (taskGroupSucceeded) { getSnapshotDao().updateStatus(createdSnapshotId, SnapshotStatus.OK); if (getParameters().getParentCommand() != VdcActionType.RunVm && getVm() != null && getVm().isStatusUp() && getVm().getRunOnVds() != null) { performLiveSnapshot(createdSnapshotId); } } else { revertToActiveSnapshot(createdSnapshotId); } getVmStaticDAO().incrementDbGeneration(getVm().getId()); endActionOnDisks(); setSucceeded(taskGroupSucceeded); getReturnValue().setEndActionTryAgain(false); return null; } }); if (getVm().isAutoStartup() && isVmDownUnintentionally() && getParameters().getInitialVmStatus() != VMStatus.Down) { Backend.getInstance().runInternalAction(VdcActionType.RunVm, new RunVmParams(getVmId()), ExecutionHandler.createInternalJobContext()); } }
Source:
<code>public void test_verifySignedCertificateTimestamps_failInvalidTimestamp() throws Exception { OpenSSLX509Certificate[] chain = new OpenSSLX509Certificate[] { CERT, CA }; <START> byte[] tlsExtension = readTestFile("ct-signed-timestamp-list-invalid"); <END> CTResults results = CT_VERIFIER.verifySignedCertificateTimestamps(chain, tlsExtension, null); assertEquals(0, results.getValidSCTs().size()); assertEquals(1, results.getInvalidSCTs().size()); }</code><technical_language>simpler read valid file modify a single byte, making SCT invalid signature</technical_language>

Target:
public void test_verifySignedCertificateTimestamps_failInvalidTimestamp() throws Exception { OpenSSLX509Certificate[] chain = new OpenSSLX509Certificate[] { CERT, CA }; byte[] tlsExtension = readTestFile("ct-signed-timestamp-list-invalid"); CTResults results = CT_VERIFIER.verifySignedCertificateTimestamps(chain, tlsExtension, null); assertEquals(0, results.getValidSCTs().size()); assertEquals(1, results.getInvalidSCTs().size()); assertEquals(SCTVerificationResult.Status.INVALID_SIGNATURE, results.getInvalidSCTs().get(0).status); }
Source:
<code>public boolean equals(Object obj) { <START> if (!super.equals(obj)) { <END> return false; } final ListResponseModel lObj = (ListResponseModel) obj; if (delegate.equals(lObj.delegate)) { return delegate.equals(lObj.delegate); } return false; }</code><technical_language>be: java public boolean equals(Object obj) { return this.delegate.equals(obj); } Indeed, this class is a delegation design pattern attributes delegate</technical_language>

Target:
public boolean equals(Object obj) { return this.delegate.equals(obj); }
Source:
<code>public Set<String> call() throws NoWorkTreeException, GitAPIException { Set<String> files = new TreeSet<>(); try { StatusCommand command = new StatusCommand(repo); Status status = command.call(); Set<String> untrackedFiles = new TreeSet<>( status.getUntracked()); Set<String> untrackedDirs = new TreeSet<>( status.getUntrackedFolders()); FS fs = getRepository().getFS(); for (String p : status.getIgnoredNotInIndex()) { File f = new File(repo.getWorkTree(), p); <START> if (fs.isFile(f) || fs.isSymLink(f)) <END> untrackedFiles.add(p); else if (fs.isDirectory(f)) { untrackedDirs.add(p); } } Set<String> filtered = filterFolders(untrackedFiles, untrackedDirs); Set<String> notIgnoredFiles = filterIgnorePaths(filtered, status.getIgnoredNotInIndex(), true); Set<String> notIgnoredDirs = filterIgnorePaths( untrackedDirs, status.getIgnoredNotInIndex(), false); for (String file : notIgnoredFiles) if (paths.isEmpty() || paths.contains(file)) { files = cleanPath(file, files); } for (String dir : notIgnoredDirs) if (paths.isEmpty() || paths.contains(dir)) { files = cleanPath(dir, files); } } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } finally { if (!files.isEmpty()) { repo.fireEvent(new WorkingTreeModifiedEvent(null, files)); } } return files; }</code><technical_language>add braces here, end a strange mix of braces in adjacent lines</technical_language>

Target:
public Set<String> call() throws NoWorkTreeException, GitAPIException { Set<String> files = new TreeSet<>(); try { StatusCommand command = new StatusCommand(repo); Status status = command.call(); Set<String> untrackedFiles = new TreeSet<>(status.getUntracked()); Set<String> untrackedDirs = new TreeSet<>( status.getUntrackedFolders()); FS fs = getRepository().getFS(); for (String p : status.getIgnoredNotInIndex()) { File f = new File(repo.getWorkTree(), p); if (fs.isFile(f) || fs.isSymLink(f)) { untrackedFiles.add(p); } else if (fs.isDirectory(f)) { untrackedDirs.add(p); } } Set<String> filtered = filterFolders(untrackedFiles, untrackedDirs); Set<String> notIgnoredFiles = filterIgnorePaths(filtered, status.getIgnoredNotInIndex(), true); Set<String> notIgnoredDirs = filterIgnorePaths(untrackedDirs, status.getIgnoredNotInIndex(), false); for (String file : notIgnoredFiles) if (paths.isEmpty() || paths.contains(file)) { files = cleanPath(file, files); } for (String dir : notIgnoredDirs) if (paths.isEmpty() || paths.contains(dir)) { files = cleanPath(dir, files); } } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } finally { if (!files.isEmpty()) { repo.fireEvent(new WorkingTreeModifiedEvent(null, files)); } } return files; }
Source:
<code>public void throwsAnExceptionWhenEnvironmentNotFound() { String uuid = "A Consumer"; EnvironmentDTO changedEnvironment = new EnvironmentDTO(); changedEnvironment.setId("42"); changedEnvironment.setName("environment"); <START> <END> ConsumerDTO updated = new ConsumerDTO(); updated.setUuid(uuid); updated.setEnvironment(changedEnvironment); Consumer existing = getFakeConsumer(); existing.setUuid(updated.getUuid()); when(consumerCurator.verifyAndLookupConsumer( existing.getUuid())).thenReturn(existing); when(environmentCurator.find(changedEnvironment.getId())).thenReturn(null); resource.updateConsumer(existing.getUuid(), updated, principal); }</code><technical_language>this place chain attriubte setting? changedEnvironment.setId("42").setName("environment");</technical_language>

Target:
public void throwsAnExceptionWhenEnvironmentNotFound() { String uuid = "A Consumer"; EnvironmentDTO changedEnvironment = new EnvironmentDTO() .setId("42") .setName("environment"); ConsumerDTO updated = new ConsumerDTO(); updated.setUuid(uuid); updated.setEnvironment(changedEnvironment); Consumer existing = getFakeConsumer(); existing.setUuid(updated.getUuid()); when(consumerCurator.verifyAndLookupConsumer(existing.getUuid())).thenReturn(existing); when(environmentCurator.find(changedEnvironment.getId())).thenReturn(null); resource.updateConsumer(existing.getUuid(), updated, principal); }
Source:
<code>private ConstraintValidator<A, ?> getInitializedConstraintValidator(ValidationContext<?> validationContext) { ConstraintValidator<A, ?> validator = validationContext.getConstraintValidatorManager().getInitializedValidator( validatedValueType, descriptor, validationContext.getConstraintValidatorFactory(), <START> HibernateConstraintValidatorInitializationContextImpl.from( validationContext ) <END> ); if ( validator != null ) { return validator; } else { return (ConstraintValidator<A, ?>) DUMMY_CONSTRAINT_VALIDATOR; } }</code><technical_language>pass ValidationContext ConstraintValidatorManager allowing delay context creation need it. avoiding creating context if strictly required (i.e. create context if new initialize() method)</technical_language>

Target:
private ConstraintValidator<A, ?> getInitializedConstraintValidator(ValidationContext<?> validationContext) { ConstraintValidator<A, ?> validator = validationContext.getConstraintValidatorManager().getInitializedValidator( validatedValueType, descriptor, validationContext.getConstraintValidatorFactory(), validationContext.getConstraintValidatorInitializationContext() ); if ( validator != null ) { return validator; } else { return (ConstraintValidator<A, ?>) DUMMY_CONSTRAINT_VALIDATOR; } }
Source:
<code>Set<String> getFileNames() { readLock.lock(); try { return filenames; } finally { <START> readLock.unlock(); <END> } }</code><technical_language>caller is collection lock field is final, lock do anything. I this needs a custom MessageMarshaller</technical_language>

Target:
Set<String> getFileNames() { readLock.lock(); try { return new HashSet<>(filenames); } finally { readLock.unlock(); } }
Source:
<code>public static JSONArray jsonForCodes(List<? extends Barcode> codes, BarcodePicker picker) { JSONArray array = new JSONArray(); for (Barcode code : codes) { JSONObject object = new JSONObject(); try { object.put("symbology", code.getSymbologyName()); object.put("gs1DataCarrier", code.isGs1DataCarrier()); object.put("recognized", code.isRecognized()); object.put("data", code.getData()); object.put("location", jsonForQuadrilateral(code.getLocation())); object.put("compositeFlag", code.getCompositeFlag()); if (code instanceof TrackedBarcode) { object.put("uniqueId", ((TrackedBarcode) code).getId()); object.put("predictedLocation", jsonForQuadrilateral(((TrackedBarcode) code).getPredictedLocation())); <START> object.put("convertedLocation", jsonForQuadrilateral(convertQuadrilateral(picker, code.getLocation()))); <END> object.put("convertedPredictedLocation", jsonForQuadrilateral(convertQuadrilateral(picker, ((TrackedBarcode) code).getPredictedLocation()))); } else { object.put("uniqueId", code.getHandle()); } if (code.isRecognized()) { JSONArray bytes = new JSONArray(); byte[] rawData = code.getRawData(); for (byte theByte : rawData) { bytes.put((int) theByte); } object.put("rawData", bytes); } array.put(object); } catch (JSONException e) { e.printStackTrace(); } } return array; }</code><technical_language>convertedLocation is dependent this a tracked barcode, computed for normal barcodes</technical_language>

Target:
public static JSONArray jsonForCodes(List<? extends Barcode> codes, BarcodePicker picker) { JSONArray array = new JSONArray(); for (Barcode code : codes) { JSONObject object = new JSONObject(); try { object.put("symbology", code.getSymbologyName()); object.put("gs1DataCarrier", code.isGs1DataCarrier()); object.put("recognized", code.isRecognized()); object.put("data", code.getData()); object.put("location", jsonForQuadrilateral(code.getLocation())); object.put("convertedLocation", jsonForQuadrilateral(convertQuadrilateral(picker, code.getLocation()))); object.put("compositeFlag", code.getCompositeFlag()); if (code instanceof TrackedBarcode) { object.put("uniqueId", ((TrackedBarcode) code).getId()); object.put("predictedLocation", jsonForQuadrilateral(((TrackedBarcode) code).getPredictedLocation())); object.put("convertedPredictedLocation", jsonForQuadrilateral(convertQuadrilateral(picker, ((TrackedBarcode) code).getPredictedLocation()))); } else { object.put("uniqueId", code.getHandle()); } if (code.isRecognized()) { JSONArray bytes = new JSONArray(); byte[] rawData = code.getRawData(); for (byte theByte : rawData) { bytes.put((int) theByte); } object.put("rawData", bytes); } array.put(object); } catch (JSONException e) { e.printStackTrace(); } } return array; }
Source:
<code><START> public boolean isStandAlonePrimitive() { <END> if (jjtGetNumChildren() != 1) { return false; } ASTPrimaryExpression primaryExpression = getFirstChildOfType(ASTPrimaryExpression.class); if (primaryExpression == null || primaryExpression.jjtGetNumChildren() != 1) { return false; } ASTPrimaryPrefix primaryPrefix = primaryExpression.getFirstChildOfType(ASTPrimaryPrefix.class); if (primaryPrefix == null || primaryPrefix.jjtGetNumChildren() != 1) { return false; } ASTLiteral literal = primaryPrefix.getFirstChildOfType(ASTLiteral.class); if (literal == null || literal.jjtGetNumChildren() != 0) { return false; } return true; }</code><technical_language>a confused this method.... is named recognized primitives, recognize literals, necessarily primitives (ie: a String literal). Also, check literal.jjtGetNumChildren() != 0 means considering primitive booleans (true false) stand primitives. null recognized a primitive, is in line method name. of name changed implementation, needs some rework</technical_language>

Target:
public boolean isStandAlonePrimitive() { if (jjtGetNumChildren() != 1) { return false; } ASTPrimaryExpression primaryExpression = getFirstChildOfType(ASTPrimaryExpression.class); if (primaryExpression == null || primaryExpression.jjtGetNumChildren() != 1) { return false; } ASTPrimaryPrefix primaryPrefix = primaryExpression.getFirstChildOfType(ASTPrimaryPrefix.class); if (primaryPrefix == null || primaryPrefix.jjtGetNumChildren() != 1) { return false; } ASTLiteral literal = primaryPrefix.getFirstChildOfType(ASTLiteral.class); if (literal == null || literal.isStringLiteral() || (literal.jjtGetNumChildren() != 0 && literal.jjtGetChild(0) instanceof ASTNullLiteral)) { return false; } return true; }
Source:
<code>boolean allocate(PooledByteBuf<T> buf, int reqCapacity, int normCapacity) { final long handle; if ((normCapacity & subpageOverflowMask) != 0) { handle = allocateRun(normCapacity); } else { handle = allocateSubpage(normCapacity); } <START> if (handle > 0) { <END> ByteBuffer nioBuffer = cachedNioBuffers != null ? cachedNioBuffers.pollLast() : null; initBuf(buf, nioBuffer, handle, reqCapacity); return true; } return false; }</code><technical_language>This effectively >= 0 before, if a difference. read slightly simpler if inverted i.e. initBuf if block</technical_language>

Target:
boolean allocate(PooledByteBuf<T> buf, int reqCapacity, int normCapacity) { final long handle; if ((normCapacity & subpageOverflowMask) != 0) { handle = allocateRun(normCapacity); } else { handle = allocateSubpage(normCapacity); } if (handle < 0) { return false; } ByteBuffer nioBuffer = cachedNioBuffers != null ? cachedNioBuffers.pollLast() : null; initBuf(buf, nioBuffer, handle, reqCapacity); return true; }
Source:
<code>public boolean isRepresentationsResource() { boolean isRepresentationsResource = false; <START> try { isRepresentationsResource = resource.getURI() != null; isRepresentationsResource = isRepresentationsResource && new FileQuery(resource.getURI().fileExtension()).isSessionResourceFile(); } catch (IllegalStateException e) { } <END> isRepresentationsResource = isRepresentationsResource || resource instanceof AirdResource; if (!isRepresentationsResource && !resource.getContents().isEmpty()) { for (EObject contentEObject : resource.getContents()) { if (contentEObject instanceof DAnalysis) { isRepresentationsResource = true; break; } } } return isRepresentationsResource; }</code><technical_language>URI uri = null; try { uri = resource.getURi(); } catch (IllegalStateException){ ... } isRepresentationResource = uri != null && new FileQuery(uri.fileExtension())...</technical_language>

Target:
public boolean isRepresentationsResource() { boolean isRepresentationsResource = false; try { isRepresentationsResource = resource.getURI() != null; isRepresentationsResource = isRepresentationsResource && new FileQuery(resource.getURI().fileExtension()).isSessionResourceFile(); } catch (IllegalStateException e) { } isRepresentationsResource = isRepresentationsResource || resource instanceof AirdResource; if (!isRepresentationsResource && !resource.getContents().isEmpty()) { EObject contentEObject = resource.getContents().get(0); if (contentEObject instanceof DAnalysis) { isRepresentationsResource = true; } } return isRepresentationsResource; }
Source:
<code>public static void bootstrap() { parserPool = new BasicParserPool(); <START> parserPool.setMaxPoolSize(100); <END> parserPool.setCoalescing(true); parserPool.setIgnoreComments(true); parserPool.setNamespaceAware(true); Map<String, Object> builderAttributes = new HashMap<String, Object>(); SecurityManager secMgmr = new SecurityManager(); builderAttributes.put("<LINK_2>", secMgmr); parserPool.setBuilderAttributes(builderAttributes); Map<String, Boolean> features = new HashMap<String, Boolean>(); features.put("<LINK_1>", Boolean.TRUE); features.put("<LINK_0>", Boolean.FALSE); features.put("<LINK_3>", Boolean.TRUE); parserPool.setBuilderFeatures(features); try { parserPool.initialize(); } catch (ComponentInitializationException e) { throw new RuntimeException("Exception initializing parserPool", e); } try { InitializationService.initialize(); } catch (InitializationException e) { throw new RuntimeException("Exception initializing OpenSAML", e); } XMLObjectProviderRegistry registry; synchronized(ConfigurationService.class) { registry = ConfigurationService.get(XMLObjectProviderRegistry.class); if (registry == null) { registry = new XMLObjectProviderRegistry(); ConfigurationService.register(XMLObjectProviderRegistry.class, registry); } } registry.setParserPool(parserPool); }</code><technical_language>pool for? For SAML responses parsing? I guess settable</technical_language>

Target:
private static void bootstrap() { parserPool = new BasicParserPool(); parserPool.setMaxPoolSize(100); parserPool.setCoalescing(true); parserPool.setIgnoreComments(true); parserPool.setNamespaceAware(true); final Map<String, Object> builderAttributes = new HashMap<String, Object>(); parserPool.setBuilderAttributes(builderAttributes); final Map<String, Boolean> features = new HashMap<String, Boolean>(); features.put("<LINK_1>", Boolean.TRUE); features.put("<LINK_0>", Boolean.FALSE); features.put("<LINK_3>", Boolean.TRUE); parserPool.setBuilderFeatures(features); try { parserPool.initialize(); } catch (final ComponentInitializationException e) { throw new RuntimeException("Exception initializing parserPool", e); } try { InitializationService.initialize(); } catch (final InitializationException e) { throw new RuntimeException("Exception initializing OpenSAML", e); } XMLObjectProviderRegistry registry; synchronized(ConfigurationService.class) { registry = ConfigurationService.get(XMLObjectProviderRegistry.class); if (registry == null) { registry = new XMLObjectProviderRegistry(); ConfigurationService.register(XMLObjectProviderRegistry.class, registry); } } registry.setParserPool(parserPool); }
Source:
<code>public synchronized int getFirst() { <START> if (data.isEmpty()) { <END> return -1; } return data.get(0); }</code><technical_language>return data.isEmpty() ? -1 : data.get(0);</technical_language>

Target:
public synchronized int getFirst() { return data.isEmpty() ? -1 : data.get(0); }
Source:
<code>public ContainerInfo inspectContainer(String containerId) throws IOException { Pod pod = getChePodByContainerId(containerId); if (pod == null ) { LOG.warn("No Pod found by container ID {}", containerId); return null; } <START> String podPullSpec = pod.getSpec().getContainers().get(0).getImage(); <END> String tagName = KubernetesStringUtils.getTagNameFromPullSpec(podPullSpec); ImageStreamTag tag = getImageStreamTagFromRepo(tagName); ImageInfo imageInfo = getImageInfoFromTag(tag); String deploymentName = pod.getMetadata().getLabels().get(OPENSHIFT_DEPLOYMENT_LABEL); if (deploymentName == null ) { LOG.warn("No label found for Pod {}", OPENSHIFT_DEPLOYMENT_LABEL, pod.getMetadata().getName()); return null; } Service svc = getCheServiceBySelector(OPENSHIFT_DEPLOYMENT_LABEL, deploymentName); if (svc == null) { LOG.warn("No Service found by selector {}={}", OPENSHIFT_DEPLOYMENT_LABEL, deploymentName); return null; } return createContainerInfo(svc, imageInfo, pod, containerId); }</code><technical_language>I more defensive here. I check if num of containers returned getContainers() is > 0 if returned getImage() is nullOrEmpty</technical_language>

Target:
public ContainerInfo inspectContainer(String containerId) throws IOException { Pod pod = getChePodByContainerId(containerId); if (pod == null ) { LOG.warn("No Pod found by container ID {}", containerId); return null; } List<Container> podContainers = pod.getSpec().getContainers(); if (podContainers.size() > 1) { throw new OpenShiftException("Multiple Containers found in Pod."); } else if (podContainers.size() < 1 || isNullOrEmpty(podContainers.get(0).getImage())) { throw new OpenShiftException(String.format("Container %s not found", containerId)); } String podPullSpec = podContainers.get(0).getImage(); String tagName = KubernetesStringUtils.getTagNameFromPullSpec(podPullSpec); ImageStreamTag tag = getImageStreamTagFromRepo(tagName); ImageInfo imageInfo = getImageInfoFromTag(tag); String deploymentName = pod.getMetadata().getLabels().get(OPENSHIFT_DEPLOYMENT_LABEL); if (deploymentName == null ) { LOG.warn("No label found for Pod {}", OPENSHIFT_DEPLOYMENT_LABEL, pod.getMetadata().getName()); return null; } Service svc = getCheServiceBySelector(OPENSHIFT_DEPLOYMENT_LABEL, deploymentName); if (svc == null) { LOG.warn("No Service found by selector {}={}", OPENSHIFT_DEPLOYMENT_LABEL, deploymentName); return null; } return createContainerInfo(svc, imageInfo, pod, containerId); }