auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static boolean remuxFile(java.io.File inputFile, java.io.File outputFile, int outputFormat, boolean isTV) { java.io.FileInputStream inputStream = null; java.io.BufferedOutputStream outputStream = null; Remuxer2 remuxer = null; try { inputStream = new java.io.FileInputStream(inputFile); outputStream = new java.io.BufferedOutputStream(new java.io.FileOutputStream(outputFile)); remuxer = openRemuxer(REMUX_TS, outputFormat, isTV ? StreamFormat.ATSC : StreamFormat.FREE, SubFormat.UNKNOWN, TuneStringType.CHANNEL, 0, 0, 0, 0, 0, outputStream); if (remuxer == null) return false; <START> byte[] buf = new byte[8084]; <END> int numRead = 0; while ((numRead = inputStream.read(buf)) != -1) { if (remuxer.pushInitData(buf, 0, numRead)) break; } inputStream.close(); inputStream = new java.io.FileInputStream(inputFile); while ((numRead = inputStream.read(buf)) != -1) { remuxer.pushRemuxData(buf, 0, numRead); } } catch (Exception e) { System.out.println("ERROR with remuxing of: " + e); e.printStackTrace(System.out); return false; } finally { if (inputStream != null) { try { inputStream.close(); } catch (Exception e) { } } if (outputStream != null) { try { outputStream.close(); } catch (Exception e) { } } if (remuxer != null) remuxer.close(); } return true; }</code><technical_language>a of odd large sizes in code; want include match for is this size (when relating 188, clear; some other random power of 2; 8084 curious)</technical_language>

Target:
public static boolean remuxFile(java.io.File inputFile, java.io.File outputFile, int outputFormat, boolean isTV) { java.io.FileInputStream inputStream = null; java.io.BufferedOutputStream outputStream = null; Remuxer2 remuxer = null; try { inputStream = new java.io.FileInputStream(inputFile); outputStream = new java.io.BufferedOutputStream(new java.io.FileOutputStream(outputFile)); remuxer = openRemuxer(REMUX_TS, outputFormat, isTV ? StreamFormat.ATSC : StreamFormat.FREE, SubFormat.UNKNOWN, TuneStringType.CHANNEL, 0, 0, 0, 0, 0, outputStream); if (remuxer == null) return false; byte[] buf = new byte[43 * 188]; int numRead = 0; while ((numRead = inputStream.read(buf)) != -1) { if (remuxer.pushInitData(buf, 0, numRead)) break; } inputStream.close(); inputStream = new java.io.FileInputStream(inputFile); while ((numRead = inputStream.read(buf)) != -1) { remuxer.pushRemuxData(buf, 0, numRead); } } catch (Exception e) { System.out.println("ERROR with remuxing of: " + e); e.printStackTrace(System.out); return false; } finally { if (inputStream != null) { try { inputStream.close(); } catch (Exception e) { } } if (outputStream != null) { try { outputStream.close(); } catch (Exception e) { } } if (remuxer != null) remuxer.close(); } return true; }
Source:
<code>public PageFunctionCompiler(Metadata metadata, int expressionCacheSize) { this.metadata = requireNonNull(metadata, "metadata is null"); this.determinismEvaluator = new DeterminismEvaluator(metadata.getFunctionRegistry()); if (expressionCacheSize > 0) { projectionCache = CacheBuilder.newBuilder().recordStats().maximumSize(expressionCacheSize).build( <START> new CacheLoader<RowExpression, Supplier<PageProjection>>() <END> { @Override public Supplier<PageProjection> load(RowExpression projection) throws Exception { return compileProjectionInternal(projection, Optional.empty()); } }); projectionCacheStats = new CacheStatsMBean(projectionCache); } else { projectionCache = null; projectionCacheStats = null; } if (expressionCacheSize > 0) { filterCache = CacheBuilder.newBuilder().recordStats().maximumSize(expressionCacheSize).build( new CacheLoader<RowExpression, Supplier<PageFilter>>() { @Override public Supplier<PageFilter> load(RowExpression projection) throws Exception { return compileFilterInternal(projection, Optional.empty()); } }); filterCacheStats = new CacheStatsMBean(filterCache); } else { filterCache = null; filterCacheStats = null; } }</code><technical_language>write this java projectionCache = CacheBuilder.newBuilder() .recordStats() .maximumSize(expressionCacheSize) .build(CacheLoader.from(projection -> compileProjectionInternal(projection, Optional.empty())); I learned CacheLoader.from()</technical_language>

Target:
public PageFunctionCompiler(Metadata metadata, int expressionCacheSize) { this.metadata = requireNonNull(metadata, "metadata is null"); this.determinismEvaluator = new DeterminismEvaluator(metadata.getFunctionRegistry()); if (expressionCacheSize > 0) { projectionCache = CacheBuilder.newBuilder() .recordStats() .maximumSize(expressionCacheSize) .build(CacheLoader.from(projection -> compileProjectionInternal(projection, Optional.empty()))); projectionCacheStats = new CacheStatsMBean(projectionCache); } else { projectionCache = null; projectionCacheStats = null; } if (expressionCacheSize > 0) { filterCache = CacheBuilder.newBuilder() .recordStats() .maximumSize(expressionCacheSize) .build(CacheLoader.from(filter -> compileFilterInternal(filter, Optional.empty()))); filterCacheStats = new CacheStatsMBean(filterCache); } else { filterCache = null; filterCacheStats = null; } }
Source:
<code>public void testSendAndReceiveNoOriginalContentType() throws Exception { Binder binder = getBinder(); BindingProperties producerBindingProperties = createProducerBindingProperties(createProducerProperties()); DirectChannel moduleOutputChannel = createBindableChannel("output", producerBindingProperties); QueueChannel moduleInputChannel = new QueueChannel(); Binding<MessageChannel> producerBinding = binder.bindProducer("bar.0", moduleOutputChannel, producerBindingProperties.getProducer()); Binding<MessageChannel> consumerBinding = binder.bindConsumer("bar.0", "testSendAndReceiveNoOriginalContentType", moduleInputChannel, createConsumerProperties()); binderBindUnbindLatency(); Message<?> message = MessageBuilder.withPayload("foo").setHeader(MessageHeaders.CONTENT_TYPE,MimeTypeUtils.TEXT_PLAIN).build(); moduleOutputChannel.send(message); Message<?> inbound = receive(moduleInputChannel); assertThat(inbound).isNotNull(); assertThat(inbound.getPayload()).isEqualTo("foo".getBytes()); <START> assertThat(inbound.getHeaders().get(BinderHeaders.BINDER_ORIGINAL_CONTENT_TYPE)).isNull(); <END> assertThat(inbound.getHeaders().get(MessageHeaders.CONTENT_TYPE).toString()).isEqualTo(MimeTypeUtils.TEXT_PLAIN_VALUE); producerBinding.unbind(); consumerBinding.unbind(); }</code><technical_language>I guess is good check if originalContentType is null (at check if support is dropped). But, I remove BinderHeaders.BINDER_ORIGINAL_CONTENT_TYPE reference dropping support for it</technical_language>

Target:
public void testSendAndReceiveNoOriginalContentType() throws Exception { Binder binder = getBinder(); BindingProperties producerBindingProperties = createProducerBindingProperties( createProducerProperties()); DirectChannel moduleOutputChannel = createBindableChannel("output", producerBindingProperties); QueueChannel moduleInputChannel = new QueueChannel(); Binding<MessageChannel> producerBinding = binder.bindProducer("bar.0", moduleOutputChannel, producerBindingProperties.getProducer()); Binding<MessageChannel> consumerBinding = binder.bindConsumer("bar.0", "testSendAndReceiveNoOriginalContentType", moduleInputChannel, createConsumerProperties()); binderBindUnbindLatency(); Message<?> message = MessageBuilder.withPayload("foo") .setHeader(MessageHeaders.CONTENT_TYPE, MimeTypeUtils.TEXT_PLAIN).build(); moduleOutputChannel.send(message); Message<?> inbound = receive(moduleInputChannel); assertThat(inbound).isNotNull(); assertThat(inbound.getPayload()).isEqualTo("foo".getBytes()); assertThat(inbound.getHeaders().get(MessageHeaders.CONTENT_TYPE).toString()) .isEqualTo(MimeTypeUtils.TEXT_PLAIN_VALUE); producerBinding.unbind(); consumerBinding.unbind(); }
Source:
<code>public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) { DMNModelInstrumentedBase obj = createModelObject(); assignAttributes(reader, obj); if (extensionRegisters.size() == 0) { while (reader.hasMoreChildren()) { reader.moveDown(); String nodeName = reader.getNodeName(); reader.moveUp(); } } else { while (reader.hasMoreChildren()) { reader.moveDown(); String nodeName = reader.getNodeName(); <START> if (EXTERNAL_LINKS.equals(nodeName)) { <END> while (reader.hasMoreChildren()) { reader.moveDown(); nodeName = reader.getNodeName(); Object object = getObject(reader, context, obj); reader.moveUp(); assignChildElement(obj, nodeName, object); } } else { try { Object object = getObject(reader, context, obj); assignChildElement(obj, nodeName, object); } catch (CannotResolveClassException e) { LOG.debug("Tried to convert the extension element child {}, but no converter is registered for this child.", nodeName); } } reader.moveUp(); } } return obj; }</code><technical_language>please Objects.equals</technical_language>

Target:
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) { DMNModelInstrumentedBase obj = createModelObject(); assignAttributes(reader, obj); if (extensionRegisters.size() == 0) { while (reader.hasMoreChildren()) { reader.moveDown(); String nodeName = reader.getNodeName(); reader.moveUp(); } } else { while (reader.hasMoreChildren()) { reader.moveDown(); String nodeName = reader.getNodeName(); if (Objects.equals(EXTERNAL_LINKS, nodeName)) { while (reader.hasMoreChildren()) { reader.moveDown(); nodeName = reader.getNodeName(); Object object = getObject(reader, context, obj); reader.moveUp(); assignChildElement(obj, nodeName, object); } } else { try { Object object = getObject(reader, context, obj); assignChildElement(obj, nodeName, object); } catch (CannotResolveClassException e) { LOG.debug("Tried to convert the extension element child {}, but no converter is registered for this child.", nodeName); } } reader.moveUp(); } } return obj; }
Source:
<code>public void testFullGroupItem() { Item baseItem = mock(Item.class); GroupFunction mockFunction = mock(GroupFunction.class); <START> Item resItem = itemRegistry.newItemBuilder("Group", "test") END> .withCategory("category") .withGroups("a", "b") .withLabel("label") .withBaseItem(baseItem) .withGroupFunction(mockFunction) .build(); assertEquals(GroupItem.class, resItem.getClass()); GroupItem res = (GroupItem) resItem; verifyNoMoreInteractions(mockFactory); assertEquals("category", res.getCategory()); assertEquals(Arrays.asList("a", "b"), res.getGroupNames()); assertEquals("label", res.getLabel()); assertSame(mockFunction, res.getFunction()); assertSame(baseItem, res.getBaseItem()); }</code><technical_language>GroupItem.TYPE instead of "Group" tests a good example people copy</technical_language>

Target:
public void testFullGroupItem() { Item baseItem = mock(Item.class); GroupFunction mockFunction = mock(GroupFunction.class); Item resItem = itemRegistry.newItemBuilder("Group", "test") .withCategory("category") .withGroups(Arrays.asList("a", "b")) .withLabel("label") .withBaseItem(baseItem) .withGroupFunction(mockFunction) .build(); assertEquals(GroupItem.class, resItem.getClass()); GroupItem res = (GroupItem) resItem; verifyNoMoreInteractions(mockFactory); assertEquals("category", res.getCategory()); assertEquals(Arrays.asList("a", "b"), res.getGroupNames()); assertEquals("label", res.getLabel()); assertSame(mockFunction, res.getFunction()); assertSame(baseItem, res.getBaseItem()); }
Source:
<code>private void updateMainList(List<AppInfo> apps) { if (apps != null) { if (apps.size() > 0) { footer.setVisibility(View.VISIBLE); } adapter.setAppInfos(apps); adapter.notifyDataSetChanged(); Date lastUpdateDate = null; for (int i = 0; i < apps.size(); i++) { Date dateObject = apps.get(i).getLastUpdate(); if (lastUpdateDate == null || lastUpdateDate.before(dateObject)) { lastUpdateDate = dateObject; } } if (lastUpdateDate != null) { statusText.setText(Preferences.getDateFormatLong(this).format(lastUpdateDate) + " " + timeFormat.format(lastUpdateDate)); } <START> if (swipeRefresh != null) { <END> swipeRefresh.setRefreshing(false); } } if (!(R.id.swipeRefresh == mainViewSwitcher.getCurrentView().getId())) { mainViewSwitcher.showNext(); } }</code><technical_language>tabs</technical_language>

Target:
private void updateMainList(List<AppInfo> apps) { if (apps != null) { if (apps.size() > 0) { footer.setVisibility(View.VISIBLE); } adapter.setAppInfos(apps); adapter.notifyDataSetChanged(); Date lastUpdateDate = null; for (int i = 0; i < apps.size(); i++) { Date dateObject = apps.get(i).getLastUpdate(); if (lastUpdateDate == null || lastUpdateDate.before(dateObject)) { lastUpdateDate = dateObject; } } if (lastUpdateDate != null) { statusText.setText(Preferences.getDateFormatLong(this).format(lastUpdateDate) + " " + timeFormat.format(lastUpdateDate)); } } if (!(R.id.main_app_list == mainViewSwitcher.getCurrentView().getId())) { mainViewSwitcher.showNext(); } }
Source:
<code>public static Map<String, String> load(final File secretsDir) throws DotRuntimeException { <START> if (!secretsDir.exists()) { <END> throw new DotRuntimeException("Unable to find any secrets under [" + SECRETS_DIR + "]"); } final File[] secretFiles = secretsDir.listFiles(); if (secretFiles == null || secretFiles.length == 0) { throw new DotRuntimeException("Unable to find any secrets under [" + SECRETS_DIR + "]"); } final Map<String, String> secrets = new HashMap<>(); for (final File file : secretFiles) { try { final String secret = new String(Files.readAllBytes(file.toPath())); final int index = secret.indexOf("="); if (index > 0){ secrets.put(file.getName(), secret.substring(index + 1)); } else { secrets.put(file.getName(), secret); } } catch (IOException e) { throw new DotRuntimeException( "Unable to load secret from file [" + file.getName() + "]", e); } } return secrets; }</code><technical_language>I do secretsDir.canRead()</technical_language>

Target:
public static Map<String, String> load(final File secretsDir) throws DotRuntimeException { if (!secretsDir.exists() || !secretsDir.canRead()) { throw new DotRuntimeException("Unable to find any secrets under [" + SECRETS_DIR + "]"); } final File[] secretFiles = secretsDir.listFiles(); if (secretFiles == null || secretFiles.length == 0) { throw new DotRuntimeException("Unable to find any secrets under [" + SECRETS_DIR + "]"); } final Map<String, String> secrets = new HashMap<>(); for (final File file : secretFiles) { try { secrets.put(file.getName(), new String(Files.readAllBytes(file.toPath()))); } catch (IOException e) { throw new DotRuntimeException( "Unable to load secret from file [" + file.getName() + "]", e); } } return secrets; }
Source:
<code>public Injector getInjector(IClass iClass) { <START> Annotation annotation = AnnotationHelper.findAnnotationSuperClasses(Guice.class, iClass.getRealClass()); <END> if (annotation == null) { return null; } if (iClass instanceof TestClass) { iClass = ((TestClass)iClass).getIClass(); } if (!(iClass instanceof ClassImpl)) { return null; } Injector parentInjector = ((ClassImpl)iClass).getParentInjector(); Guice guice = (Guice) annotation; List<Module> moduleInstances = Lists.newArrayList(getModules(guice, parentInjector, iClass.getRealClass())); Injector injector = context.getInjector(moduleInstances); if (injector == null) { injector = parentInjector.createChildInjector(moduleInstances); context.addInjector(moduleInstances, injector); } return injector; }</code><technical_language>AnnotationHelper#findAnnotationSuperClasses(Class, IClass); a good idea</technical_language>

Target:
Injector getInjector(IClass iClass) { Annotation annotation = AnnotationHelper.findAnnotationSuperClasses(Guice.class, iClass.getRealClass()); if (annotation == null) { return null; } if (iClass instanceof TestClass) { iClass = ((TestClass)iClass).getIClass(); } if (!(iClass instanceof ClassImpl)) { return null; } Injector parentInjector = ((ClassImpl)iClass).getParentInjector(); Guice guice = (Guice) annotation; List<Module> moduleInstances = Lists.newArrayList(getModules(guice, parentInjector, iClass.getRealClass())); Injector injector = context.getInjector(moduleInstances); if (injector == null) { injector = parentInjector.createChildInjector(moduleInstances); context.addInjector(moduleInstances, injector); } return injector; }
Source:
<code>public void grabCliJar() throws IOException { jar = tmp.newFile("jenkins-cli.jar"); <START> FileUtils.copyURLToFile(j.jenkins.getJnlpJars("jenkins-cli.jar").getURL(), jar); <END> }</code><technical_language>I if worth a constant for lines. compiler refactor, easier for reader "it's thing"</technical_language>

Target:
public void grabCliJar() throws IOException { String jenkinsCLI = "jenkins-cli.jar"; jar = tmp.newFile(jenkinsCLI); FileUtils.copyURLToFile(j.jenkins.getJnlpJars(jenkinsCLI).getURL(), jar); }
Source:
<code>private void analyzeReplDump(ASTNode ast) throws SemanticException { LOG.debug("ReplicationSemanticAnalyzer.analyzeReplDump: " + String.valueOf(dbNameOrPattern) + "." + String.valueOf(tblNameOrPattern) + " from " + String.valueOf(eventFrom) + " to " + String.valueOf(eventTo) + " maxEventLimit " + String.valueOf(maxEventLimit)); try { ctx.setResFile(ctx.getLocalTmpPath()); Task<ReplDumpWork> replDumpWorkTask = TaskFactory .get(new ReplDumpWork( dbNameOrPattern, tblNameOrPattern, eventFrom, eventTo, ErrorMsg.INVALID_PATH.getMsg(ast), maxEventLimit, ctx.getResFile().toUri().toString(), <START> txnManager <END> ), conf); rootTasks.add(replDumpWorkTask); if (dbNameOrPattern != null) { for (String dbName : Utils.matchesDb(db, dbNameOrPattern)) { if (tblNameOrPattern != null) { for (String tblName : Utils.matchesTbl(db, dbName, tblNameOrPattern)) { inputs.add(new ReadEntity(db.getTable(dbName, tblName))); } } else { inputs.add(new ReadEntity(db.getDatabase(dbName))); } } } setFetchTask(createFetchTask(dumpSchema)); } catch (Exception e) { LOG.warn("Error during analyzeReplDump", e); throw new SemanticException(e); } }</code><technical_language>get txnManager replDumpTask SessionState</technical_language>

Target:
private void analyzeReplDump(ASTNode ast) throws SemanticException { LOG.debug("ReplicationSemanticAnalyzer.analyzeReplDump: " + String.valueOf(dbNameOrPattern) + "." + String.valueOf(tblNameOrPattern) + " from " + String.valueOf(eventFrom) + " to " + String.valueOf(eventTo) + " maxEventLimit " + String.valueOf(maxEventLimit)); try { ctx.setResFile(ctx.getLocalTmpPath()); Task<ReplDumpWork> replDumpWorkTask = TaskFactory .get(new ReplDumpWork( dbNameOrPattern, tblNameOrPattern, eventFrom, eventTo, ErrorMsg.INVALID_PATH.getMsg(ast), maxEventLimit, ctx.getResFile().toUri().toString() ), conf); rootTasks.add(replDumpWorkTask); if (dbNameOrPattern != null) { for (String dbName : Utils.matchesDb(db, dbNameOrPattern)) { if (tblNameOrPattern != null) { for (String tblName : Utils.matchesTbl(db, dbName, tblNameOrPattern)) { inputs.add(new ReadEntity(db.getTable(dbName, tblName))); } } else { inputs.add(new ReadEntity(db.getDatabase(dbName))); } } } setFetchTask(createFetchTask(dumpSchema)); } catch (Exception e) { LOG.warn("Error during analyzeReplDump", e); throw new SemanticException(e); } }
Source:
<code>public SSLEngine wrapSslEngine(SSLEngine engine, ByteBufAllocator alloc, JdkApplicationProtocolNegotiator applicationNegotiator, boolean isServer) { if (Conscrypt.isEngineSupported(engine)) { return isServer ? ConscryptAlpnSslEngine.newServerEngine(engine, alloc, applicationNegotiator) : ConscryptAlpnSslEngine.newClientEngine(engine, alloc, applicationNegotiator); } if (jdkAlpnSupported()) { return new Java9SslEngine(engine, applicationNegotiator, isServer); } if (JettyAlpnSslEngine.isAvailable()) { return isServer ? JettyAlpnSslEngine.newServerEngine(engine, applicationNegotiator) : JettyAlpnSslEngine.newClientEngine(engine, applicationNegotiator); } throw new UnsupportedOperationException("ALPN not supported (used java version: " <START> + PlatformDependent.javaVersion() + ", min java version: 9). Unable to wrap SSLEngine of type '" <END> + engine.getClass().getName() + "')"); }</code><technical_language>So, jdkAlpnSupported method updated handle this "new feature"</technical_language>

Target:
public SSLEngine wrapSslEngine(SSLEngine engine, ByteBufAllocator alloc, JdkApplicationProtocolNegotiator applicationNegotiator, boolean isServer) { if (Conscrypt.isEngineSupported(engine)) { return isServer ? ConscryptAlpnSslEngine.newServerEngine(engine, alloc, applicationNegotiator) : ConscryptAlpnSslEngine.newClientEngine(engine, alloc, applicationNegotiator); } if (JdkAlpnSslUtils.supportsAlpn()) { return new JdkAlpnSslEngine(engine, applicationNegotiator, isServer); } if (JettyAlpnSslEngine.isAvailable()) { return isServer ? JettyAlpnSslEngine.newServerEngine(engine, applicationNegotiator) : JettyAlpnSslEngine.newClientEngine(engine, applicationNegotiator); } throw new UnsupportedOperationException("ALPN not supported. Unable to wrap SSLEngine of type '" + engine.getClass().getName() + "')"); }
Source:
<code>private static List<Pair> hopWindows(long tsMillis, long periodMillis, long sizeMillis) { <START> ArrayList<Pair> ret = new ArrayList<>((int) (sizeMillis / periodMillis)); <END> long lastStart = tsMillis - ((tsMillis + periodMillis) % periodMillis); for (long start = lastStart; start > tsMillis - sizeMillis; start -= periodMillis) { ret.add(new Pair(start, start + sizeMillis)); } return ret; }</code><technical_language>Math.toIntExact</technical_language>

Target:
private static List<Pair> hopWindows(long tsMillis, long periodMillis, long sizeMillis) { ArrayList<Pair> ret = new ArrayList<>(Math.toIntExact(sizeMillis / periodMillis)); long lastStart = tsMillis - ((tsMillis + periodMillis) % periodMillis); for (long start = lastStart; start > tsMillis - sizeMillis; start -= periodMillis) { ret.add(new Pair(start, start + sizeMillis)); } return ret; }
Source:
<code>public void setupSearch() { new TeamWorldSearchItem("", getSelectedTeamDefinitions(), isIncludeCompletedCheckbox(), isIncludeCancelledCheckbox(), false, false, getSelectedVersionArtifact(), getSelectedUser(), <START> getSelectedReleased(), getSelectedState()); <END> }</code><technical_language>this searchItem = new TeamWorldSearchItem.....? removal purpose</technical_language>

Target:
public void setupSearch() { searchItem = new TeamWorldSearchItem("", getSelectedTeamDefinitions(), isIncludeCompletedCheckbox(), isIncludeCancelledCheckbox(), false, false, getSelectedVersionArtifact(), getSelectedUser(), getSelectedReleased(), getSelectedState()); }
Source:
<code>public boolean isBelowGuaranteedConsumption() { <START> return ResAllocsUtil.isLess(totals.asResAllocs(), totalResAllocs); <END> }</code><technical_language>totalResAllocs is totals for tier. Comparing right if this bucket is guaranteed consumption. This bucket's share total is in TierSlas object</technical_language>

Target:
public boolean isBelowGuaranteedConsumption() { return tierSlas.getTierSla(tierNumber) .flatMap(tierSla -> tierSla.getResAllocs(name)) .map(bucketRes -> ResAllocsUtil.isLess(totals.asResAllocs(), bucketRes)) .orElse(true); }
Source:
<code>public void checkHttpProxy() { { String host = "my_host"; Map<String, Object> httpProxyMap = ImmutableMap.<String, Object>of("host", host); ConfigSource conf = config.deepCopy().set("http_proxy", httpProxyMap); S3PluginTask task = conf.loadConfig(S3PluginTask.class); <START> assertHttpProxy(new HttpProxy(host, Optional.<Integer>absent(), Optional.<Boolean>absent(), Optional.<String>absent(), Optional.<String>absent()), <END> task.getHttpProxy().get()); } { String host = "my_host"; int port = 8080; boolean useSsl = true; Map<String, Object> httpProxyMap = ImmutableMap.<String, Object>of( "host", host, "port", 8080, "https", true); ConfigSource conf = config.deepCopy().set("http_proxy", httpProxyMap); S3PluginTask task = conf.loadConfig(S3PluginTask.class); assertHttpProxy(new HttpProxy(host, Optional.of(port), Optional.of(true), Optional.<String>absent(), Optional.<String>absent()), task.getHttpProxy().get()); } { String host = "my_host"; int port = 8080; boolean useSsl = true; String user = "my_user"; String password = "my_pass"; Map<String, Object> httpProxyMap = ImmutableMap.<String, Object>of( "host", host, "port", 8080, "https", true, "user", user, "password", password); ConfigSource conf = config.deepCopy().set("http_proxy", httpProxyMap); S3PluginTask task = conf.loadConfig(S3PluginTask.class); assertHttpProxy(new HttpProxy(host, Optional.of(port), Optional.of(true), Optional.of(user), Optional.of(password)), task.getHttpProxy().get()); } }</code><technical_language>test false case</technical_language>

Target:
public void checkHttpProxy() { { String host = "my_host"; ConfigSource conf = config.deepCopy().set("host", host); HttpProxy httpProxy = conf.loadConfig(HttpProxy.class); assertHttpProxy(host, Optional.<Integer>absent(), true, Optional.<String>absent(), Optional.<String>absent(), httpProxy); } { String host = "my_host"; ConfigSource conf = config.deepCopy() .set("host", host) .set("https", true); HttpProxy httpProxy = conf.loadConfig(HttpProxy.class); assertHttpProxy(host, Optional.<Integer>absent(), true, Optional.<String>absent(), Optional.<String>absent(), httpProxy); } { String host = "my_host"; ConfigSource conf = config.deepCopy() .set("host", host) .set("https", false); HttpProxy httpProxy = conf.loadConfig(HttpProxy.class); assertHttpProxy(host, Optional.<Integer>absent(), false, Optional.<String>absent(), Optional.<String>absent(), httpProxy); } { String host = "my_host"; int port = 8080; ConfigSource conf = config.deepCopy() .set("host", host) .set("port", port); HttpProxy httpProxy = conf.loadConfig(HttpProxy.class); assertHttpProxy(host, Optional.of(port), true, Optional.<String>absent(), Optional.<String>absent(), httpProxy); } { String host = "my_host"; int port = 8080; String user = "my_user"; String password = "my_pass"; ConfigSource conf = config.deepCopy() .set("host", host) .set("port", port) .set("user", user) .set("password", password); HttpProxy httpProxy = conf.loadConfig(HttpProxy.class); assertHttpProxy(host, Optional.of(port), true, Optional.of(user), Optional.of(password), httpProxy); } }
Source:
<code>protected void setInitialCheckedState() { try { for (IDebugTarget <START> target2 : <END> getDebugTargets()) { IJavaDebugTarget target = target2.getAdapter(IJavaDebugTarget.class); if (target != null) { IJavaThread filteredThread= fPage.getBreakpoint().getThreadFilter(target); if (filteredThread != null) { fCheckHandler.checkThread(filteredThread, true); } } } } catch (CoreException e) { JDIDebugUIPlugin.log(e); } }</code><technical_language>rename debugTarget</technical_language>

Target:
protected void setInitialCheckedState() { try { for (IDebugTarget debugTarget : getDebugTargets()) { IJavaDebugTarget target = debugTarget.getAdapter(IJavaDebugTarget.class); if (target != null) { IJavaThread filteredThread= fPage.getBreakpoint().getThreadFilter(target); if (filteredThread != null) { fCheckHandler.checkThread(filteredThread, true); } } } } catch (CoreException e) { JDIDebugUIPlugin.log(e); } }
Source:
<code>private void removeNotesView(Card[] cards) { List<Integer> posList = new ArrayList<>(); long reviewerCardId = getReviewerCardId(); for (Card card : cards) { <START> int pos = getPosition(getCards(), card.getId()); <END> if (card.getId() == reviewerCardId) { mReloadRequired = true; } if (pos >= 0 && pos < getCards().size()) { posList.add(pos); } } Collections.sort(posList, Collections.reverseOrder()); for (int delPos : posList) { getCards().remove(delPos); } updateList(); }</code><technical_language>Optional: This function iterates list everytime, in worst case iterate list cards.length times. sense a cache of HashMap<Long, Integer> number of cards is "large". I benchmark this if block GUI thread though. Please a if interested</technical_language>

Target:
private void removeNotesView(Card[] cards) { List<Integer> posList = new ArrayList<>(); long reviewerCardId = getReviewerCardId(); Map<Long, Integer> idToPos = getPositionMap(getCards()); for (Card card : cards) { int pos = idToPos.containsKey(card.getId()) ? idToPos.get(card.getId()) : -1; if (card.getId() == reviewerCardId) { mReloadRequired = true; } if (pos >= 0 && pos < getCards().size()) { posList.add(pos); } } Collections.sort(posList, Collections.reverseOrder()); for (int delPos : posList) { getCards().remove(delPos); } updateList(); }
Source:
<code>public String getCredentials(String serviceName, String accountName) { String credential; if (Platform.isWindows()) { WindowsCredentialAccessor winCredAccessor = new WindowsCredentialAccessor(serviceName, accountName); credential = winCredAccessor.read(); } else if (Platform.isMac()) { KeyChainAccessor keyChainAccessor = new KeyChainAccessor(null, serviceName, accountName); byte[] readCreds = keyChainAccessor.read(); credential = new String(readCreds, StandardCharsets.UTF_8); } else if (Platform.isLinux()) { LinuxKeyRingAccessor keyRingAccessor = new LinuxKeyRingAccessor( "org.freedesktop.Secret.Generic", "service", serviceName, "account", accountName); byte[] readCreds = keyRingAccessor.read(); credential = new String(readCreds, StandardCharsets.UTF_8); } else { throw logger.logExceptionAsError( new CredentialUnavailableException("Platform could not be determined for VsCode" <START> + " Credential authentication.")); <END> } if (!isRefreshTokenString(credential)) { throw logger.logExceptionAsError( new CredentialUnavailableException("Please authenticate via Azure Tools plugin in VSCode IDE.")); } return credential; }</code><technical_language>suggestion + " credential authentication."));</technical_language>

Target:
public String getCredentials(String serviceName, String accountName) { String credential; if (Platform.isWindows()) { try { WindowsCredentialAccessor winCredAccessor = new WindowsCredentialAccessor(serviceName, accountName); credential = winCredAccessor.read(); } catch (RuntimeException e) { throw logger.logExceptionAsError(new CredentialUnavailableException( "Failed to read Vs Code credentials from Windows Credential API.", e)); } } else if (Platform.isMac()) { try { KeyChainAccessor keyChainAccessor = new KeyChainAccessor(null, serviceName, accountName); byte[] readCreds = keyChainAccessor.read(); credential = new String(readCreds, StandardCharsets.UTF_8); } catch (RuntimeException e) { throw logger.logExceptionAsError(new CredentialUnavailableException( "Failed to read Vs Code credentials from Mac Native Key Chain.", e)); } } else if (Platform.isLinux()) { try { LinuxKeyRingAccessor keyRingAccessor = new LinuxKeyRingAccessor( "org.freedesktop.Secret.Generic", "service", serviceName, "account", accountName); byte[] readCreds = keyRingAccessor.read(); credential = new String(readCreds, StandardCharsets.UTF_8); } catch (RuntimeException e) { throw logger.logExceptionAsError(new CredentialUnavailableException( "Failed to read Vs Code credentials from Linux Key Ring.", e)); } } else { throw logger.logExceptionAsError( new CredentialUnavailableException(PLATFORM_NOT_SUPPORTED_ERROR)); } if (CoreUtils.isNullOrEmpty(credential) || !isRefreshTokenString(credential)) { throw logger.logExceptionAsError( new CredentialUnavailableException("Please authenticate via Azure Tools plugin in VS Code IDE.")); } return credential; }
Source:
<code>void convertToReftable(boolean writeLogs, boolean backup) throws IOException { File newRefs = new File(getDirectory(), "refs.new"); File reftableDir = new File(getDirectory(), Constants.REFTABLE); if (reftableDir.exists() && reftableDir.listFiles().length > 0) { <START> throw new IOException("reftable dir exists and is nonempty"); <END> } FileReftableDatabase.convertFrom(this, newRefs, writeLogs); File refsFile = new File(getDirectory(), "refs"); File packedRefs = new File(getDirectory(), Constants.PACKED_REFS); File logsDir = new File(getDirectory(), Constants.LOGS); if (backup) { FileUtils.rename(refsFile, new File(getDirectory(), "refs.old")); if (packedRefs.exists()) { FileUtils.rename(packedRefs, new File(getDirectory(), Constants.PACKED_REFS + ".old")); } if (logsDir.exists()) { FileUtils.rename(logsDir, new File(getDirectory(), Constants.LOGS + ".old")); } } else { packedRefs.delete(); FileUtils.delete(logsDir, FileUtils.RECURSIVE); FileUtils.delete(refsFile, FileUtils.RECURSIVE); } FileUtils.rename(newRefs, refsFile); refs.close(); refs = new FileReftableDatabase(this, refsFile); }</code><technical_language>this text needs i18n</technical_language>

Target:
void convertToReftable(boolean writeLogs, boolean backup) throws IOException { File newRefs = new File(getDirectory(), "refs.new"); File reftableDir = new File(getDirectory(), Constants.REFTABLE); if (reftableDir.exists() && reftableDir.listFiles().length > 0) { throw new IOException(JGitText.get().refTableDirExistsNonEmpty); } FileReftableDatabase.convertFrom(this, newRefs, writeLogs); File refsFile = new File(getDirectory(), "refs"); File packedRefs = new File(getDirectory(), Constants.PACKED_REFS); File logsDir = new File(getDirectory(), Constants.LOGS); if (backup) { FileUtils.rename(refsFile, new File(getDirectory(), "refs.old")); if (packedRefs.exists()) { FileUtils.rename(packedRefs, new File(getDirectory(), Constants.PACKED_REFS + ".old")); } if (logsDir.exists()) { FileUtils.rename(logsDir, new File(getDirectory(), Constants.LOGS + ".old")); } } else { packedRefs.delete(); FileUtils.delete(logsDir, FileUtils.RECURSIVE); FileUtils.delete(refsFile, FileUtils.RECURSIVE); } FileUtils.rename(newRefs, refsFile); refs.close(); refs = new FileReftableDatabase(this, refsFile); }
Source:
<code>public void setUpLanguageScrollTabData(@NonNull List<String> languageCodes, int position, @Nullable Callback callback) { if (this.callback != null) { this.callback = null; } this.callback = callback; this.languageCodes = languageCodes; if (horizontalLanguageScroll.getChildCount() > 0) { horizontalLanguageScroll.removeAllTabs(); } for (int i = 0; i < languageCodes.size(); i++) { TabLayout.Tab tab = horizontalLanguageScroll.newTab(); tab.setCustomView(createLanguageTab(languageCodes.get(i))); horizontalLanguageScroll.addTab(tab); updateTabView(false, tab); } if (horizontalLanguageScroll != null && horizontalLanguageScroll.getTabAt(position) != null) { <START> horizontalLanguageScroll.postDelayed(() -> horizontalLanguageScroll.getTabAt(position).select(), 100); <END> } }</code><technical_language>This is asking for a crash happen. check view is attachedToWindow() this</technical_language>

Target:
public void setUpLanguageScrollTabData(@NonNull List<String> languageCodes, int position, @Nullable Callback callback) { if (this.callback != null) { this.callback = null; } this.callback = callback; this.languageCodes = languageCodes; if (horizontalLanguageScroll.getChildCount() > 0) { horizontalLanguageScroll.removeAllTabs(); } for (int i = 0; i < languageCodes.size(); i++) { TabLayout.Tab tab = horizontalLanguageScroll.newTab(); tab.setCustomView(createLanguageTab(languageCodes.get(i))); horizontalLanguageScroll.addTab(tab); updateTabView(false, tab); } if (horizontalLanguageScroll != null && horizontalLanguageScroll.getTabAt(position) != null) { horizontalLanguageScroll.post(() -> { if (!isAttachedToWindow()) { return; } horizontalLanguageScroll.getTabAt(position).select(); }); } }
Source:
<code>public PullRequestSCMHead migrate(@NonNull GitHubSCMSource source, @NonNull FixMetadata head) { PullRequestSource src = source.retrievePullRequestSource(head.getNumber()); GitHubSCMSourceHelper helper = GitHubSCMSourceHelper.build(source); return new PullRequestSCMHead(head.getName(), src == null ? null : src.getSourceOwner(), src == null ? null : src.getSourceRepo(), src == null ? null : src.getSourceBranch(), <START> head.getNumber(), head.getTarget(), src != null && helper.owner.equalsIgnoreCase(src.getSourceOwner()) <END> ? SCMHeadOrigin.DEFAULT : new SCMHeadOrigin.Fork(head.getSourceOwner()), head.getCheckoutStrategy()); }</code><technical_language>fact change existing calls getters helper able handle possibilities of null/empty values is a bit worrisome me. getters in GitHubSCMSource compute return values methods in helper nullability is unchanged other calls modified? boolean isURLRepo() version of UI show users, approach work</technical_language>

Target:
public PullRequestSCMHead migrate(@NonNull GitHubSCMSource source, @NonNull FixMetadata head) { PullRequestSource src = source.retrievePullRequestSource(head.getNumber()); return new PullRequestSCMHead(head.getName(), src == null ? null : src.getSourceOwner(), src == null ? null : src.getSourceRepo(), src == null ? null : src.getSourceBranch(), head.getNumber(), head.getTarget(), src != null && source.getRepoOwner().equalsIgnoreCase(src.getSourceOwner()) ? SCMHeadOrigin.DEFAULT : new SCMHeadOrigin.Fork(head.getSourceOwner()), head.getCheckoutStrategy()); }
Source:
<code>public Future<VdcReturnValueBase> executeAsyncCommand(final VdcActionType actionType, final VdcActionParametersBase parameters, final CommandContext cmdContext) { final CommandBase<?> command = CommandsFactory.createCommand(actionType, parameters, cmdContext); CommandCallBack callBack = command.getCallBack(); command.persistCommand(command.getParameters().getParentCommand(), cmdContext, callBack != null); if (callBack != null) { cmdCallBackMap.put(command.getCommandId(), callBack); <START> } <END> if (callBack != null) { cmdCallBackMap.put(command.getCommandId(), callBack); } Future<VdcReturnValueBase> retVal; try { retVal = executor.submit(new Callable<VdcReturnValueBase>() { @Override public VdcReturnValueBase call() throws Exception { return executeCommand(command, cmdContext); } }); } catch(RejectedExecutionException ex) { command.setCommandStatus(CommandStatus.FAILED); log.errorFormat("Failed to submit command to executor service, command {0} status has been set to FAILED", command.getCommandId().toString()); retVal = new RejectedExecutionFuture(); } return retVal; }</code><technical_language>rebase issue? appears twice</technical_language>

Target:
public Future<VdcReturnValueBase> executeAsyncCommand(final VdcActionType actionType, final VdcActionParametersBase parameters, final CommandContext cmdContext) { final CommandBase<?> command = CommandsFactory.createCommand(actionType, parameters, cmdContext); CommandCallBack callBack = command.getCallBack(); command.persistCommand(command.getParameters().getParentCommand(), cmdContext, callBack != null); if (callBack != null) { cmdCallBackMap.put(command.getCommandId(), callBack); } Future<VdcReturnValueBase> retVal; try { retVal = executor.submit(new Callable<VdcReturnValueBase>() { @Override public VdcReturnValueBase call() throws Exception { return executeCommand(command, cmdContext); } }); } catch(RejectedExecutionException ex) { command.setCommandStatus(CommandStatus.FAILED); log.errorFormat("Failed to submit command to executor service, command {0} status has been set to FAILED", command.getCommandId().toString()); retVal = new RejectedExecutionFuture(); } return retVal; }
Source:
<code>public void onResume() { super.onResume(); setShowProgressBar(false); adapter.items.get(0).subtitle = Utils.getCurrentProjectName(getActivity()); adapter.notifyDataSetChanged(); String projectName = getActivity().getIntent().getStringExtra(StatusBarNotificationManager.EXTRA_PROJECT_NAME); if (projectName != null) { loadDownloadedProject(projectName); <START> getActivity().getIntent().removeExtra(StatusBarNotificationManager.EXTRA_PROJECT_NAME); <END> } }</code><technical_language>remove this line please</technical_language>

Target:
public void onResume() { super.onResume(); setShowProgressBar(false); adapter.items.get(0).subtitle = Utils.getCurrentProjectName(getActivity()); adapter.notifyDataSetChanged(); String projectName = getActivity().getIntent().getStringExtra(StatusBarNotificationManager.EXTRA_PROJECT_NAME); if (projectName != null) { loadDownloadedProject(projectName); } }
Source:
<code>private Integer getQosBandwidth(Guid clusterId) { final HostNetworkQos migrationHostNetworkQos = dbFacade.getHostNetworkQosDao() <START> .getHostNetworkQosOfMigrationNetworkByClusterId(clusterId); <END> if (migrationHostNetworkQos == null) { return null; } if (migrationHostNetworkQos.getOutAverageRealtime() != null) { return migrationHostNetworkQos.getOutAverageRealtime(); } return migrationHostNetworkQos.getOutAverageUpperlimit(); }</code><technical_language>reason inject HostNetworkQosDao directly</technical_language>

Target:
private Integer getQosBandwidth(Guid clusterId) { final HostNetworkQos migrationHostNetworkQos = hostNetworkQosDao .getHostNetworkQosOfMigrationNetworkByClusterId(clusterId); if (migrationHostNetworkQos == null) { return null; } if (migrationHostNetworkQos.getOutAverageRealtime() != null) { return migrationHostNetworkQos.getOutAverageRealtime(); } return migrationHostNetworkQos.getOutAverageUpperlimit(); }
Source:
<code>public FindSliceProvider( MapperContext context, EntityHelper<SensorReading> sensorReadingHelper) { this.session = context.getSession(); this.sensorReadingHelper = sensorReadingHelper; <START> this.selectStart = <END> sensorReadingHelper.selectStart().whereColumn("sensor_id").isEqualTo(bindMarker()); }</code><technical_language>consider approach of implementing SensorDao custom query provider logic instead of annotation a provider? PagingIterable<SensorReading> findSlice(int id, Integer month, Integer day); needs signature in FindSliceProvider SensorDao is verified in a client code compile time. (I wondering pros cons of solutions)</technical_language>

Target:
public FindSliceProvider( MapperContext context, EntityHelper<SensorReading> sensorReadingHelper) { this.session = context.getSession(); this.sensorReadingHelper = sensorReadingHelper; this.selectStart = sensorReadingHelper.selectStart().whereColumn("id").isEqualTo(bindMarker()); }
Source:
<code>private void reportAnalytics(ObaSituation situation) { ObaSituation.AllAffects[] allAffects = situation.getAllAffects(); <START> List<String> agencyIds = new ArrayList<>(); <END> for (int i=0; i< allAffects.length; i++) { ObaSituation.AllAffects affect = allAffects[i]; if (!agencyIds.contains(affect.getAgencyId())){ agencyIds.add(affect.getAgencyId()); } } for (String agencyId: agencyIds) { ObaAnalytics.reportEventWithCategory(ObaAnalytics.ObaEventCategory.UI_ACTION.toString(), getString(R.string.analytics_action_service_alerts), getString(R.string.analytics_label_service_alerts) + agencyId); } }</code><technical_language>change agencyIds a HashSet instead of a List? I doubt enough agencies in a region for iterating list in .contains() method problematic performance-wise, sure... :)</technical_language>

Target:
private void reportAnalytics(ObaSituation situation) { ObaSituation.AllAffects[] allAffects = situation.getAllAffects(); Set<String> agencyIds = new HashSet<>(); for (int i = 0; i < allAffects.length; i++) { agencyIds.add(allAffects[i].getAgencyId()); } for (String agencyId : agencyIds) { ObaAnalytics.reportEventWithCategory(ObaAnalytics.ObaEventCategory.UI_ACTION.toString(), getString(R.string.analytics_action_service_alerts), getString(R.string.analytics_label_service_alerts) + agencyId); } }
Source:
<code>protected ErlangVisitor buildErlangVisitor(@NotNull final ProblemsHolder holder, @NotNull LocalInspectionToolSession session) { return new ErlangVisitor() { @Override public void visitFunctionCallExpression(@NotNull ErlangFunctionCallExpression o) { if (o.getParent() instanceof ErlangGlobalFunctionCallExpression) return; if (o.getQAtom().getMacros() != null) return; PsiReference reference = o.getReference(); if (!(reference instanceof ErlangFunctionReferenceImpl) || reference.resolve() == null) return; ErlangFunctionReferenceImpl r = (ErlangFunctionReferenceImpl) reference; String name = r.getName(); int arity = r.getArity(); ErlangBifDescriptor bifDescriptor = ErlangBifTable.getBif("erlang", name, arity); <START> if (((ErlangFile)o.getContainingFile()).getFunction(name, arity) == null <END> || bifDescriptor == null || !bifDescriptor.isAutoImported() || ((ErlangFile)o.getContainingFile()).isNoAutoImport(name, arity)) return; holder.registerProblem(o.getNameIdentifier(), "Ambiguous call of overridden pre R14 auto-imported BIF " + "'" + r.getSignature() + "'", ProblemHighlightType.GENERIC_ERROR_OR_WARNING, new ErlangSpecifyModulePrefixFix("erlang")); } }; }</code><technical_language>Please reorder</technical_language>

Target:
protected ErlangVisitor buildErlangVisitor(@NotNull final ProblemsHolder holder, @NotNull LocalInspectionToolSession session) { return new ErlangVisitor() { @Override public void visitFunctionCallExpression(@NotNull ErlangFunctionCallExpression o) {if (o.getParent() instanceof ErlangGlobalFunctionCallExpression) return; if (o.getQAtom().getMacros() != null) return; String name = o.getName(); int arity = o.getArgumentList().getExpressionList().size(); ErlangBifDescriptor bifDescriptor = ErlangBifTable.getBif("erlang", name, arity); if (bifDescriptor == null || !bifDescriptor.isAutoImported() || ((ErlangFile)o.getContainingFile()).isNoAutoImport(name, arity) || ((ErlangFile)o.getContainingFile()).getFunction(name, arity) == null) return; holder.registerProblem(o.getNameIdentifier(), "Ambiguous call of overridden pre R14 auto-imported BIF " + "'" + name + "/" + arity + "'", ProblemHighlightType.GENERIC_ERROR_OR_WARNING, new ErlangSpecifyModulePrefixFix("erlang")); } }; }
Source:
<code>public void setMulePlugins(SortedMap<Dependency, SortedSet<Dependency>> mulePlugins) { validatePlugins(mulePlugins.keySet()); <START> this.mulePlugins = mulePlugins; <END> }</code><technical_language>Is a reason do .putAll</technical_language>

Target:
public void setMulePlugins(SortedMap<Dependency, SortedSet<Dependency>> mulePlugins) { validatePlugins(mulePlugins.keySet()); this.mulePlugins.putAll(mulePlugins); }
Source:
<code><START> public static List<CloudBlobMetadata> capMetadataListBySize(List<CloudBlobMetadata> originalList, long size) { <END> long totalSize = 0; List<CloudBlobMetadata> cappedList = new ArrayList<>(); for (CloudBlobMetadata metadata : originalList) { if (totalSize + metadata.getSize() > size) { if (cappedList.size() == 0) { cappedList.add(metadata); } break; } cappedList.add(metadata); totalSize += metadata.getSize(); } return cappedList; }</code><technical_language>prefer CloudBlobMetadata a pojo class move this method a utility class prod test code call</technical_language>

Target:
public static List<CloudBlobMetadata> capMetadataListBySize(List<CloudBlobMetadata> originalList, long size) { long totalSize = 0; List<CloudBlobMetadata> cappedList = new ArrayList<>(); for (CloudBlobMetadata metadata : originalList) { if (totalSize + metadata.getSize() > size) { if (cappedList.isEmpty()) { cappedList.add(metadata); } break; } cappedList.add(metadata); totalSize += metadata.getSize(); } return cappedList; }
Source:
<code>public Object execute(ExecutionEvent event) throws ExecutionException { Connection connection = null; IProject project = null; ISelection selection = HandlerUtil.getCurrentSelection(event); final IDockerImage image = UIUtils.getFirstElement(selection, IDockerImage.class); if (image != null) { selection = OpenShiftUIUtils.getOpenShiftExplorerSelection(); project = ResourceUtils.getProject(UIUtils.getFirstElement(selection, IResource.class)); <START> connection = OpenShiftUIUtils.getConnectionForExplorerSelection(Connection.class); <END> } if(connection == null) { connection = OpenShiftUIUtils.getExplorerDefaultConnection(Connection.class); } runWizard(HandlerUtil.getActiveWorkbenchWindow(event).getShell(), image, project,connection); return null; }</code><technical_language>for connection project object</technical_language>

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { Connection connection = null; IProject project = null; ISelection selection = HandlerUtil.getCurrentSelection(event); final IDockerImage image = UIUtils.getFirstElement(selection, IDockerImage.class); if (image != null) { selection = OpenShiftUIUtils.getOpenShiftExplorerSelection(); project = ResourceUtils.getProject(UIUtils.getFirstElement(selection, IResource.class)); connection = ConnectionsRegistryUtil.getConnectionFor(project); } if(connection == null) { connection = OpenShiftUIUtils.getExplorerDefaultConnection(Connection.class); } runWizard(HandlerUtil.getActiveWorkbenchWindow(event).getShell(), image, project,connection); return null; }