auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public Future<SocketIOTransport> websocket(final AsyncHttpRequest req, String protocol, final WebSocketConnectCallback callback) { <END> WebSocketImpl.addWebSocketUpgradeHeaders(req, protocol); final SimpleFuture<SocketIOTransport> ret = new SimpleFuture<SocketIOTransport>(); Cancellable connect = execute(req, new HttpConnectCallback() { @Override public void onConnectCompleted(Exception ex, AsyncHttpResponse response) { if (ex != null) { if (ret.setComplete(ex)) { if (callback != null) callback.onCompleted(ex, null); } return; } WebSocket ws = WebSocketImpl.finishHandshake(req.getHeaders().getHeaders(), response); if (ws == null) { if (!ret.setComplete(new WebSocketHandshakeException("Unable to complete websocket handshake"))) return; } else { if (!ret.setComplete(new WebSocketTransport(ws))) return; } if (callback != null) callback.onCompleted(ex, ws); } }); ret.setParent(connect); return ret; }</code><technical_language>This breaks usage of plain web sockets in library (ie, non-socketio usage)</technical_language>

Target:
public Future<WebSocket> websocket(final AsyncHttpRequest req, String protocol, final WebSocketConnectCallback callback) { WebSocketImpl.addWebSocketUpgradeHeaders(req, protocol); final SimpleFuture<WebSocket> ret = new SimpleFuture<WebSocket>(); Cancellable connect = execute(req, new HttpConnectCallback() { @Override public void onConnectCompleted(Exception ex, AsyncHttpResponse response) { if (ex != null) { if (ret.setComplete(ex)) { if (callback != null) callback.onCompleted(ex, null); } return; } WebSocket ws = WebSocketImpl.finishHandshake(req.getHeaders().getHeaders(), response); if (ws == null) { if (!ret.setComplete(new WebSocketHandshakeException("Unable to complete websocket handshake"))) return; } else { if (!ret.setComplete(ws)) return; } if (callback != null) callback.onCompleted(ex, ws); } }); ret.setParent(connect); return ret; }
Source:
<code>public void scheduleEmailCheckJob(Integer interval) { MotechEvent event = new MotechEvent(EbodacConstants.EMAIL_CHECK_EVENT); Period period = Period.minutes(interval); <START> DateTime startDate = DateTime.now(); <END> RepeatingPeriodSchedulableJob job = new RepeatingPeriodSchedulableJob(event, startDate.toDate(), null, period, true); motechSchedulerService.safeScheduleRepeatingPeriodJob(job); }</code><technical_language>changed this</technical_language>

Target:
public void scheduleEmailCheckJob(Integer interval) { MotechEvent event = new MotechEvent(EbodacConstants.EMAIL_CHECK_EVENT); Period period = Period.minutes(interval); DateTime startDate = DateTime.now().plusMinutes(1); RepeatingPeriodSchedulableJob job = new RepeatingPeriodSchedulableJob(event, startDate.toDate(), null, period, true); motechSchedulerService.safeScheduleRepeatingPeriodJob(job); }
Source:
<code>public void init() { <START> LOG.debug("Initialising. Owner is: {}", getConfig(OWNER)); <END> super.init(); }</code><technical_language>checkNotNull(getConfig(OWNER), "owner") here, fail fast</technical_language>

Target:
public void init() { LOG.debug("Initialising. Owner is: {}", checkNotNull(getConfig(OWNER), OWNER.getName())); super.init(); }
Source:
<code>private static void storeExpressionHistory(String[] expressions, IDialogSettings dialogSettings) { int length = Math.min(expressions.length, MAX_HISTORY_SIZE); int count = 0; outer: for (int i = 0; i < length; i++) { for (int j = 0; j < i; j++) { if (expressions[i].equals(expressions[j])) { <START> break outer; <END> } } dialogSettings.put(DS_KEY_HISTORY_ENTRY_PREFIX + count, expressions[i]); count = count + 1; } dialogSettings.put(DS_KEY_HISTORY_ENTRY_COUNT, count); }</code><technical_language>This destroys history entering a present in list</technical_language>

Target:
private static void storeExpressionHistory(String[] expressions, IDialogSettings dialogSettings) { List<String> uniqueExpressions = new ArrayList<>(new LinkedHashSet<>(Arrays.asList(expressions))); final int length = Math.min(uniqueExpressions.size(), MAX_HISTORY_SIZE); int count = 0; for (String expression : uniqueExpressions) { dialogSettings.put(DS_KEY_HISTORY_ENTRY_PREFIX + count, expression); count++; if (count >= length) { break; } } dialogSettings.put(DS_KEY_HISTORY_ENTRY_COUNT, count); }
Source:
<code>public TimeLimiterImpl(String name, TimeLimiterConfig timeLimiterConfig) { this.name = name; this.timeLimiterConfig = timeLimiterConfig; <START> this.successes = new LongAdder(); <END> this.errors = new LongAdder(); this.timeouts = new LongAdder(); this.metrics = new TimeLimiterMetrics(); this.eventProcessor = new TimeLimiterEventProcessor(); }</code><technical_language>I prefer implement similar other components register event consumers in Dropwizard Metrics / Micrometer / Prometheus implementations</technical_language>

Target:
public TimeLimiterImpl(String name, TimeLimiterConfig timeLimiterConfig) { this.name = name; this.timeLimiterConfig = timeLimiterConfig; this.eventProcessor = new TimeLimiterEventProcessor(); }
Source:
<code>public void testWithPlaceholdersButNoValues() { attributes.clear(); <START> templateEngine.render("{0} bar", ctx); <END> }</code><technical_language>good assert return value--not throw exception</technical_language>

Target:
public void testWithPlaceholdersButNoValues() { attributes.clear(); assertThatThrownBy(() -> templateEngine.render("{0} bar", ctx)).isInstanceOf(IllegalArgumentException.class); }
Source:
<code>public void configure(Map<String, ?> configs) throws KafkaException { if (sslEngineFactory != null) { throw new IllegalStateException("SslFactory was already configured."); } this.endpointIdentification = (String) configs.get(SslConfigs.SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_CONFIG); Map<String, Object> nextConfigs = new HashMap<>(); <START> copyAllConfigs(nextConfigs, configs); <END> if (clientAuthConfigOverride != null) { nextConfigs.put(BrokerSecurityConfigs.SSL_CLIENT_AUTH_CONFIG, clientAuthConfigOverride); } SslEngineFactory builder = instantiateSslEngineFactory(nextConfigs); if (keystoreVerifiableUsingTruststore) { try { SslEngineValidator.validate(builder, builder); } catch (Exception e) { throw new ConfigException("A client SSLEngine created with the provided settings " + "can't connect to a server SSLEngine created with those settings.", e); } } this.sslEngineFactory = builder; }</code><technical_language>do Map<String, Object> nextConfigs = new HashMap<>(configs);</technical_language>

Target:
public void configure(Map<String, ?> configs) throws KafkaException { if (sslEngineFactory != null) { throw new IllegalStateException("SslFactory was already configured."); } this.endpointIdentification = (String) configs.get(SslConfigs.SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_CONFIG); Map<String, Object> nextConfigs = new HashMap<>(configs); if (clientAuthConfigOverride != null) { nextConfigs.put(BrokerSecurityConfigs.SSL_CLIENT_AUTH_CONFIG, clientAuthConfigOverride); } SslEngineFactory builder = instantiateSslEngineFactory(nextConfigs); if (keystoreVerifiableUsingTruststore) { try { SslEngineValidator.validate(builder, builder); } catch (Exception e) { throw new ConfigException("A client SSLEngine created with the provided settings " + "can't connect to a server SSLEngine created with those settings.", e); } } this.sslEngineFactory = builder; }
Source:
<code>public void testLimit() { ContentResolver cr = getMockContentResolver(); final String stopId = "1_11060-TEST"; ContentValues values = new ContentValues(); values.put(ObaContract.Stops._ID, stopId); values.put(ObaContract.Stops.CODE, "11060"); values.put(ObaContract.Stops.NAME, "Broadway & E Denny Way"); values.put(ObaContract.Stops.DIRECTION, "S"); values.put(ObaContract.Stops.USE_COUNT, 0); values.put(ObaContract.Stops.LATITUDE, 47.617676); values.put(ObaContract.Stops.LONGITUDE, -122.314523); Uri uri = cr.insert(ObaContract.Stops.CONTENT_URI, values); assertNotNull(uri); final String stopId2 = "1_1010101"; values.put(ObaContract.Stops._ID, stopId2); uri = cr.insert(ObaContract.Stops.CONTENT_URI, values); assertNotNull(uri); Cursor c = cr.query(ObaContract.Stops.CONTENT_URI, new String[]{ObaContract.Stops._COUNT}, null, null, null); assertNotNull(c); assertEquals(1, c.getCount()); c.moveToNext(); assertTrue(c.getInt(0) == 2); c.close(); c = cr.query(ObaContract.Stops.CONTENT_URI .buildUpon() .appendQueryParameter("limit", "1") .build(), new String[]{ObaContract.Stops._ID}, null, null, null ); assertNotNull(c); assertEquals(1, c.getCount()); c.close(); int result = cr.delete(uri, null, null); <START> assertEquals(1, result); <END> result = cr.delete(uri, null, null); assertEquals(0, result); }</code><technical_language>stop_Id2 in line 121 changed 1_1010101-TEST avoid a collision a real stop (I change this, fix while here)</technical_language>

Target:
public void testLimit() { ContentResolver cr = getMockContentResolver(); final String stopId = "1_11060-TEST"; ContentValues values = new ContentValues(); values.put(ObaContract.Stops._ID, stopId); values.put(ObaContract.Stops.CODE, "11060"); values.put(ObaContract.Stops.NAME, "Broadway & E Denny Way"); values.put(ObaContract.Stops.DIRECTION, "S"); values.put(ObaContract.Stops.USE_COUNT, 0); values.put(ObaContract.Stops.LATITUDE, 47.617676); values.put(ObaContract.Stops.LONGITUDE, -122.314523); Uri uri = cr.insert(ObaContract.Stops.CONTENT_URI, values); assertNotNull(uri); final String stopId2 = "1_1010101-TEST"; values.put(ObaContract.Stops._ID, stopId2); uri = cr.insert(ObaContract.Stops.CONTENT_URI, values); assertNotNull(uri); Cursor c = cr.query(ObaContract.Stops.CONTENT_URI, new String[]{ObaContract.Stops._COUNT}, null, null, null); assertNotNull(c); assertEquals(1, c.getCount()); c.moveToNext(); assertTrue(c.getInt(0) == 2); c.close(); c = cr.query(ObaContract.Stops.CONTENT_URI .buildUpon() .appendQueryParameter("limit", "1") .build(), new String[]{ObaContract.Stops._ID}, null, null, null ); assertNotNull(c); assertEquals(1, c.getCount()); c.close(); }
Source:
<code>public @Nullable TmfResolvedSymbol getSymbol(int pid, long timestamp, long address) { BinaryCallsite bc = UstDebugInfoBinaryAspect.getBinaryCallsite(getTrace(), pid, timestamp, address); if (bc == null) { return null; } FunctionLocation loc = UstDebugInfoFunctionAspect.getFunctionFromBinaryLocation(bc); if (loc != null) { return new TmfResolvedSymbol(bc.getOffset(), loc.getFunctionName()); } for (org.eclipse.tracecompass.tmf.core.symbols.ISymbolProvider provider : <START> fOtherProviders) { <END> TmfResolvedSymbol symbol = provider.getSymbol(pid, timestamp, bc.getOffset()); if (symbol != null) { return symbol; } } return null; }</code><technical_language>This iteration is protected ConcurrentModificationException. 3 solutions: 1. synchronize fOtherProviders 2. iterate if fIsLoaded is true (the list change anymore) 3. a CopyOnWriteArrayList (iterate copy if changed concurrently)</technical_language>

Target:
public @Nullable TmfResolvedSymbol getSymbol(int pid, long timestamp, long address) { BinaryCallsite bc = UstDebugInfoBinaryAspect.getBinaryCallsite(getTrace(), pid, timestamp, address); if (bc == null) { return null; } FunctionLocation loc = UstDebugInfoFunctionAspect.getFunctionFromBinaryLocation(bc); if (loc != null) { return new TmfResolvedSymbol(bc.getOffset(), loc.getFunctionName()); } if (!fIsLoaded) { return null; } for (org.eclipse.tracecompass.tmf.core.symbols.ISymbolProvider provider : fOtherProviders) { TmfResolvedSymbol symbol = provider.getSymbol(pid, timestamp, bc.getOffset()); if (symbol != null) { return symbol; } } return null; }
Source:
<code><START> public void bitreserveClientWithTokenShouldReturnTokenAndRestAdapter() { <END> BitreserveClient bitreserveClient = new BitreserveClient("foobar"); Assert.assertEquals(bitreserveClient.getToken().getToken(), "foobar"); Assert.assertTrue(bitreserveClient.getToken().getBitreserveRestAdapter() != null); }</code><technical_language>constructor "return" token, a naming scheme here. is a suggestion for this method: public void bitreserveClientWithTokenShouldSetTokenAndRestAdapter</technical_language>

Target:
public void bitreserveClientWithTokenShouldReturnTokenAndRestAdapter() { BitreserveClient bitreserveClient = new BitreserveClient("foobar"); Assert.assertEquals(bitreserveClient.getToken().getBearerToken(), "foobar"); Assert.assertNotNull(bitreserveClient.getToken().getBitreserveRestAdapter()); }
Source:
<code>public void start(Job<?, ?> project, boolean newInstance) { super.start(project, newInstance); String name = project.getFullName(); if (!project.isBuildable()) { logger.log(Level.FINE, "Project is disabled, not starting trigger for job " + name); return; } if (project.getProperty(GithubProjectProperty.class) == null) { logger.log(Level.INFO, "GitHub project property is missing the URL, cannot start ghprb trigger for job " + name); return; } try { initState(); } catch (Exception ex) { logger.log(Level.SEVERE, "Can't start ghprb trigger", ex); return; } logger.log(Level.INFO, "Starting the ghprb trigger for the {0} job; newInstance is {1}", new String[] { name, String.valueOf(newInstance) }); helper = new Ghprb(this); if (getUseGitHubHooks()) { <START> boolean disable_register_on_startup = SystemProperties.getBoolean(getClass().getName() + ".disableRegisterOnStartup", false); <END> logger.log(Level.FINEST, "Disable registering hooks on startup: {0}", new String[] { String.valueOf(disable_register_on_startup) }); if (GhprbTrigger.getDscp().getManageWebhooks() && (newInstance || !disable_register_on_startup)) { logger.log(Level.FINEST, "Registering hook with GitHub. Thread pool size: {0}", new String[] { String.valueOf(SystemProperties.getInteger(GhprbTrigger.class.getName() + ".poolSize", 5)) }); pool.submit(new StartHookRunnable(this.repository)); } DESCRIPTOR.addRepoTrigger(getRepository().getName(), super.job); } }</code><technical_language>I suggest move this class level (next pool definition) rename disabletoRegisterOnStartUp, more in line rest</technical_language>

Target:
public void start(Job<?, ?> project, boolean newInstance) { super.start(project, newInstance); String name = project.getFullName(); if (!project.isBuildable()) { logger.log(Level.FINE, "Project is disabled, not starting trigger for job " + name); return; } if (project.getProperty(GithubProjectProperty.class) == null) { logger.log(Level.INFO, "GitHub project property is missing the URL, cannot start ghprb trigger for job " + name); return; } try { initState(); } catch (Exception ex) { logger.log(Level.SEVERE, "Can't start ghprb trigger", ex); return; } logger.log(Level.INFO, "Starting the ghprb trigger for the {0} job; newInstance is {1}", new String[] { name, String.valueOf(newInstance) }); helper = new Ghprb(this); if (getUseGitHubHooks()) { logger.log(Level.FINEST, "Disable registering hooks on startup: {0}", new String[] { String.valueOf(disableRegisterOnStartup) }); if (GhprbTrigger.getDscp().getManageWebhooks() && (newInstance || !disableRegisterOnStartup)) { logger.log(Level.FINEST, "Registering hook with GitHub. Thread pool size: {0}", new String[] { String.valueOf(SystemProperties.getInteger(GhprbTrigger.class.getName() + ".poolSize", 5)) }); pool.submit(new StartHookRunnable(this.repository)); } DESCRIPTOR.addRepoTrigger(getRepository().getName(), super.job); } }
Source:
<code>protected IStatus run(IProgressMonitor monitor) { try { runnable.run(monitor); } catch (CoreException e) { IStatus st = e.getStatus(); return new Status(st.getSeverity(), st.getPlugin(), st.getCode(), st.getMessage(), e); <START> } finally { monitor.done(); <END> } return Status.OK_STATUS; }</code><technical_language>'finally' block is needed calling monitor.done() is required</technical_language>

Target:
protected IStatus run(IProgressMonitor monitor) { try { runnable.run(monitor); } catch (CoreException e) { IStatus st = e.getStatus(); return new Status(st.getSeverity(), st.getPlugin(), st.getCode(), st.getMessage(), e); } return Status.OK_STATUS; }
Source:
<code>protected void runInContext() { try { final List<DomainRouterVO> routers = _routerDao.listByStateAndManagementServer(VirtualMachine.State.Running, mgmtSrvrId); s_logger.debug("Found " + routers.size() + " running routers. "); for (final DomainRouterVO router : routers) { GetRouterMonitorResultsAnswer answer = fetchAndUpdateRouterHealthChecks(router, false); String checkFailsToRestartVr = RouterHealthChecksFailuresToRestartVr.valueIn(router.getDataCenterId()); if (answer == null) { s_logger.warn("Unable to fetch monitor results for router " + router); updateRouterConnectivityHealthCheck(router.getId(), false, "Communication failed"); } else if (!answer.getResult()) { s_logger.warn("Failed to fetch monitor results from router " + router + " with details: " + answer.getDetails()); updateRouterConnectivityHealthCheck(router.getId(), false, "Failed to fetch results with details: " + answer.getDetails()); } else { updateRouterConnectivityHealthCheck(router.getId(), true, "Successfully fetched data"); parseAndMergeDbHealthChecks(router.getId(), answer.getMonitoringResults()); if (answer.getFailingChecks().size() > 0 && StringUtils.isNotBlank(checkFailsToRestartVr)) { s_logger.info("Checking failed health checks to see if router needs reboot"); for (String failedCheck : answer.getFailingChecks()) { if (checkFailsToRestartVr.contains(failedCheck)) { <START> s_logger.info("Found failing health check " + failedCheck + " so restarting router."); <END> rebootRouter(router.getId(), true); } } } } } } catch (final Exception ex) { s_logger.error("Fail to complete the FetchRouterHealthChecksResultTask! ", ex); ex.printStackTrace(); } }</code><technical_language>this a warning instead of info? rebooting a customer network here</technical_language>

Target:
protected void runInContext() { try { final List<DomainRouterVO> routers = _routerDao.listByStateAndManagementServer(VirtualMachine.State.Running, mgmtSrvrId); s_logger.info("Found " + routers.size() + " running routers. Fetching, analysing and updating DB for the health checks."); if (!RouterHealthChecksEnabled.value()) { s_logger.debug("Skipping fetching of router health check results as router.health.checks.enabled is disabled"); return; } for (final DomainRouterVO router : routers) { GetRouterMonitorResultsAnswer answer = fetchAndUpdateRouterHealthChecks(router, false); List<String> failingChecks = getFailingChecks(router, answer); handleFailingChecks(router, failingChecks); } } catch (final Exception ex) { s_logger.error("Fail to complete the FetchRouterHealthChecksResultTask! ", ex); ex.printStackTrace(); } }
Source:
<code>public IValueProperty getValueProperty() { return new WidgetValueProperty() { @Override public Object getValueType() { return String.class; } @Override protected Object doGetValue(Object source) { return <START> null; <END> } @Override protected void doSetValue(Object source, Object value) { } @Override public IObservableValue observe(Object source) { return super.observe(parent); } }; }</code><technical_language>return a representation of shown value, e.g. formated string</technical_language>

Target:
public IValueProperty getValueProperty() { return new WidgetValueProperty() { @Override public Object getValueType() { return String.class; } @Override protected Object doGetValue(Object source) { return getFormatedString(source); } @Override protected void doSetValue(Object source, Object value) { } @Override public IObservableValue observe(Object source) { return super.observe(parent); } }; }
Source:
<code>private void append(StringBuilder buf, ModelNode node, int level) { for (int i = 0; i < level; i++) { buf.append('\t'); } buf.append(node); buf.append('\n'); ModelNode[] childrenNodes = node.getChildrenNodes(); if (childrenNodes != null) { for (ModelNode <START> childrenNode : <END> childrenNodes) { append(buf, childrenNode, level + 1); } } }</code><technical_language>rename childNode</technical_language>

Target:
private void append(StringBuilder buf, ModelNode node, int level) { for (int i = 0; i < level; i++) { buf.append('\t'); } buf.append(node); buf.append('\n'); ModelNode[] childrenNodes = node.getChildrenNodes(); if (childrenNodes != null) { for (ModelNode childNode : childrenNodes) { append(buf, childNode, level + 1); } } }
Source:
<code><START> private com.hp.hpl.jena.rdf.model.Bag getFolderBag(com.hp.hpl.jena.rdf.model.Bag top, String basepath, String filepath) { <END> Model model = top.getModel(); String[] pathSegments = filepath.split("/"); if (pathSegments.length <= 2) { return top; } Property labelProp = dprop(model, DepositRelationship.label); Property hasModelProp = model.createProperty(FedoraProperty.hasModel.getURI().toString()); Resource containerResource = model.createResource(CONTAINER.getURI().toString()); com.hp.hpl.jena.rdf.model.Bag currentNode = top; segmentLoop: for (int i = 1; i < pathSegments.length - 1; i++) { String segment = pathSegments[i]; NodeIterator nodeIt = currentNode.iterator(); while (nodeIt.hasNext()) { Resource child = nodeIt.nextNode().asResource(); String label = child.getProperty(labelProp).getString(); if (label.equals(segment) && child.hasProperty(hasModelProp, containerResource)) { currentNode = model.getBag(child); nodeIt.close(); continue segmentLoop; } } nodeIt.close(); PID pid = new PID("uuid:" + UUID.randomUUID().toString()); com.hp.hpl.jena.rdf.model.Bag childBag = model.createBag(pid.getURI()); currentNode.add(childBag); model.add(childBag, labelProp, segment); model.add(childBag, hasModelProp, containerResource); currentNode = childBag; } return currentNode; }</code><technical_language>more recursion? :(</technical_language>

Target:
private com.hp.hpl.jena.rdf.model.Bag getFolderBag(com.hp.hpl.jena.rdf.model.Bag top, String basepath, String filepath) { Model model = top.getModel(); String[] pathSegments = filepath.split("/"); if (pathSegments.length <= 2) { return top; } Property labelProp = dprop(model, DepositRelationship.label); Property hasModelProp = model.createProperty(FedoraProperty.hasModel.getURI().toString()); Resource containerResource = model.createResource(CONTAINER.getURI().toString()); com.hp.hpl.jena.rdf.model.Bag currentNode = top; segmentLoop: for (int i = 1; i < pathSegments.length - 1; i++) { String segment = pathSegments[i]; NodeIterator nodeIt = currentNode.iterator(); while (nodeIt.hasNext()) { Resource child = nodeIt.nextNode().asResource(); String label = child.getProperty(labelProp).getString(); if (label.equals(segment)) { currentNode = model.getBag(child); nodeIt.close(); continue segmentLoop; } } nodeIt.close(); PID pid = new PID("uuid:" + UUID.randomUUID().toString()); com.hp.hpl.jena.rdf.model.Bag childBag = model.createBag(pid.getURI()); currentNode.add(childBag); model.add(childBag, labelProp, segment); model.add(childBag, hasModelProp, containerResource); currentNode = childBag; } return currentNode; }
Source:
<code>protected void preConsumerPollHook() { <START> for (PausedSourcePartitionMetadata metadata : _autoPausedSourcePartitions.values()) { <END> if (metadata.shouldResume()) { _taskUpdates.add(DatastreamConstants.UpdateType.PAUSE_RESUME_PARTITIONS); break; } } for (DatastreamConstants.UpdateType updateType : _taskUpdates) { _taskUpdates.remove(updateType); if (updateType != null) { switch (updateType) { case PAUSE_RESUME_PARTITIONS: pausePartitions(); break; default: String msg = String.format("Unknown update type for task {}.", updateType, _taskName); _logger.error(msg); throw new DatastreamRuntimeException(msg); } } } }</code><technical_language>nit: want move this a separate method call here</technical_language>

Target:
protected void preConsumerPollHook() { checkForPartitionsToAutoResume(); for (DatastreamConstants.UpdateType updateType : _taskUpdates) { _taskUpdates.remove(updateType); if (updateType != null) { switch (updateType) { case PAUSE_RESUME_PARTITIONS: pausePartitions(); break; default: String msg = String.format("Unknown update type for task {}.", updateType, _taskName); _logger.error(msg); throw new DatastreamRuntimeException(msg); } } else { throw new IllegalStateException("Found null update type in task updates set."); } } }
Source:
<code>private void createDependency(JCas aJCas, Map<Integer, String> tokens, Map<Integer, String> dependencyFunction, Map<Integer, Integer> dependencyDependent, Map<String, Token> tokensStored) { for (int i = 1; i <= tokens.size(); i++) { if (dependencyFunction.get(i) != null) { Dependency outDependency = new Dependency(aJCas); outDependency.setDependencyType(dependencyFunction.get(i)); <START> int begin, end; <END> if (dependencyDependent.get(i) != 0) { begin = tokensStored.get("t_" + i).getBegin() > tokensStored.get( "t_" + dependencyDependent.get(i)).getBegin() ? tokensStored.get( "t_" + dependencyDependent.get(i)).getBegin() : tokensStored.get( "t_" + i).getBegin(); end = tokensStored.get("t_" + i).getEnd() < tokensStored.get( "t_" + dependencyDependent.get(i)).getEnd() ? tokensStored.get( "t_" + dependencyDependent.get(i)).getEnd() : tokensStored .get("t_" + i).getEnd(); } else { begin = tokensStored.get("t_" + i).getBegin(); end = tokensStored.get("t_" + i).getEnd(); } outDependency.setBegin(begin); outDependency.setEnd(end); outDependency.setDependent(tokensStored.get("t_" + i)); if (dependencyDependent.get(i) == 0) { outDependency.setGovernor(tokensStored.get("t_" + i)); } else { outDependency.setGovernor(tokensStored.get("t_" + dependencyDependent.get(i))); } outDependency.addToIndexes(); } } }</code><technical_language>I prefer explicit initalizers for primitive variables, if initialize JVM use</technical_language>

Target:
private void createDependency(JCas aJCas, Map<Integer, String> tokens, Map<Integer, String> dependencyFunction, Map<Integer, Integer> dependencyDependent, Map<String, Token> tokensStored) { for (int i = 1; i <= tokens.size(); i++) { if (dependencyFunction.get(i) != null) { Dependency outDependency = new Dependency(aJCas); outDependency.setDependencyType(dependencyFunction.get(i)); int begin = 0, end = 0; if (dependencyDependent.get(i) != 0) { begin = tokensStored.get("t_" + i).getBegin() > tokensStored.get( "t_" + dependencyDependent.get(i)).getBegin() ? tokensStored.get( "t_" + dependencyDependent.get(i)).getBegin() : tokensStored.get( "t_" + i).getBegin(); end = tokensStored.get("t_" + i).getEnd() < tokensStored.get( "t_" + dependencyDependent.get(i)).getEnd() ? tokensStored.get( "t_" + dependencyDependent.get(i)).getEnd() : tokensStored .get("t_" + i).getEnd(); } else { begin = tokensStored.get("t_" + i).getBegin(); end = tokensStored.get("t_" + i).getEnd(); } outDependency.setBegin(begin); outDependency.setEnd(end); outDependency.setDependent(tokensStored.get("t_" + i)); if (dependencyDependent.get(i) == 0) { outDependency.setGovernor(tokensStored.get("t_" + i)); } else { outDependency.setGovernor(tokensStored.get("t_" + dependencyDependent.get(i))); } outDependency.addToIndexes(); } } }
Source:
<code>public final void validateMapElementsNotNull(Supplier<? extends Map<?, ?>> getter1, Supplier<? extends Map<?, ?>> getter2, Supplier<? extends Map<?, ?>> getter3, Supplier<? extends Map<?, ?>>... getters) { validateMapElementsNotNull(getter1, getter2, getter3); <START> for (Supplier<? extends Map<?, ?>> getter : getters) { <END> Map<?, ?> map = getter.get(); if (isMapInvalid(map)) { throw new IllegalArgumentException("map contains null elements"); } } }</code><technical_language>deal here: this version base, extended versions call arg</technical_language>

Target:
public final void validateMapElementsNotNull(Supplier<? extends Map<?, ?>> getter1, Supplier<? extends Map<?, ?>> getter2, Supplier<? extends Map<?, ?>> getter3, Supplier<? extends Map<?, ?>>... getters) { validateMapElementsNotNull(getter1, getter2, getter3); for (Supplier<? extends Map<?, ?>> getter : getters) { validateMapElementsNotNull(getter); } }
Source:
<code><START> public void publishSurveyInOtherStudy() { <END> Survey survey = Survey.create(); survey.setStudyIdentifier(TestConstants.TEST_STUDY_IDENTIFIER); try { service.publishSurvey(OTHER_STUDY, survey, true); fail("Should have thrown exception"); } catch(EntityNotFoundException e) { } verify(mockSurveyDao, never()).publishSurvey(any(), any(), anyBoolean()); }</code><technical_language>This is a bug in test. This getSurvey(), updateSurvey(). Similarly for publish, version, delete</technical_language>

Target:
public void publishSurveyInOtherStudy() { Survey survey = Survey.create(); survey.setStudyIdentifier(TestConstants.TEST_STUDY_IDENTIFIER); when(mockSurveyDao.getSurvey((GuidCreatedOnVersionHolder)survey, true)).thenReturn(survey); try { service.publishSurvey(OTHER_STUDY, survey, true); fail("Should have thrown exception"); } catch(EntityNotFoundException e) { } verify(mockSurveyDao, never()).publishSurvey(any(), any(), anyBoolean()); }
Source:
<code>public CompletionStage<RestResponse> removeLogger(String name) { Request.Builder builder = new Request.Builder(); <START> builder.url(baseLoggingURL + "/" + sanitize(name)).delete(); <END> return client.execute(builder); }</code><technical_language>"/loggers/" missing</technical_language>

Target:
public CompletionStage<RestResponse> removeLogger(String name) { Request.Builder builder = new Request.Builder(); builder.url(baseLoggingURL + "/loggers/" + sanitize(name)).delete(); return client.execute(builder); }
Source:
<code>protected NodeFilter sharedNodesFilter() { return new NodeFilter() { private final Set<NodeKey> shareableNodeKeys = new HashSet<>(); @Override public boolean includeNode( CachedNode node, NodeCache cache ) { if (node.getMixinTypes(cache).contains(JcrMixLexicon.SHAREABLE)) { NodeKey key = node.getKey(); if (shareableNodeKeys.contains(key)) { return false; } shareableNodeKeys.add(key); return true; } else { return true; } } }; <START> } <END></code><technical_language>Actually, I re-read spec, in Section 14.16 "If a query matches more nodes in a shared set, of nodes is returned in query result is implementation issue." including 3.x, returned of nodes in shared set easiest do implementation. IMO, behavior is hardest for clients deal with, get of nodes in shared set (and know). time change this in 4.0, return nodes in shared set</technical_language>

Target:
protected NodeFilter sharedNodesFilter() { return new NodeFilter() { private final Set<NodeKey> shareableNodeKeys = new HashSet<>(); @Override public boolean includeNode( CachedNode node, NodeCache cache ) { if (isShareable(node, cache)) { NodeKey key = node.getKey(); if (shareableNodeKeys.contains(key)) { return false; } shareableNodeKeys.add(key); return true; } else { return true; } } }; }
Source:
<code>public void execute(OutboundDocSubmissionDeferredRequestOrchestratable message) { <START> LOG.debug("Begin OutboundDocSubmissionOrchestratableImpl_g0.process"); <END> NhinDocSubmissionDeferredRequestProxy nhincDocSubmission = getNhinDocSubmissionDeferredRequestProxy(); XDRAcknowledgementType response = nhincDocSubmission.provideAndRegisterDocumentSetBRequest11( message.getRequest(), message.getAssertion(), message.getTarget()); message.setResponse(response); LOG.debug("End OutboundDocSubmissionDeferredRequestStrategyImpl_g0.process"); }</code><technical_language>touching this code base, remove this logging statement beginning exiting method</technical_language>

Target:
public void execute(OutboundDocSubmissionDeferredRequestOrchestratable message) { NhinDocSubmissionDeferredRequestProxy nhincDocSubmission = getNhinDocSubmissionDeferredRequestProxy(); XDRAcknowledgementType response = nhincDocSubmission.provideAndRegisterDocumentSetBRequest11( message.getRequest(), message.getAssertion(), message.getTarget()); message.setResponse(response); }
Source:
<code>protected void doStop() { topicPoller.setRunning(false); try { if (topicPoller.getShutdownLatch().await(30, TimeUnit.SECONDS)) { log.info("Expired waiting on topicPoller to shut down"); } } catch (InterruptedException e) { log.info("Interrupted waiting on latch: {}", e.getMessage()); } <START> executorService.shutdown(); <END> try { consumer.close(); } finally { producer.close(); } }</code><technical_language>camel context -> executor service manager -> api shutdown thread pool more safely</technical_language>

Target:
protected void doStop() { topicPoller.setRunning(false); try { if (topicPoller.getShutdownLatch().await(30, TimeUnit.SECONDS)) { log.info("Expired waiting on topicPoller to shut down"); } } catch (InterruptedException e) { log.info("Interrupted waiting on latch: {}", e.getMessage()); } camelContext.getExecutorServiceManager().shutdown(executorService); IOHelper.close(consumer, "consumer", log); IOHelper.close(producer, "producer", log); }
Source:
<code>protected RMDBManagerBuffer(RMDBManager rmdbManager) { this.rmdbManager = rmdbManager; delayEqualsToZero = RM_NODES_DB_OPERATIONS_DELAY.getValueAsInt() == 0; databaseTransactionExecutor = Executors.newSingleThreadScheduledExecutor(); pendingNodeSourceUpdates = new HashSet<>(); <START> recentlyRemovedNodeSources = new CopyOnWriteArraySet<>(); <END> pendingNodesOperations = new LinkedList<>(); }</code><technical_language>nice reduce number of collections in this class. Consider LinkedListMultimap a map view insertion order iteration. create internal class avoid Map.Entry things</technical_language>

Target:
protected RMDBManagerBuffer(RMDBManager rmdbManager) { this.rmdbManager = rmdbManager; delayEqualsToZero = RM_NODES_DB_OPERATIONS_DELAY.getValueAsInt() == 0; databaseTransactionExecutor = Executors.newSingleThreadScheduledExecutor(); pendingNodeSourceUpdates = new HashMap<>(); pendingNodesOperations = new LinkedList<>(); knownNodeSources = new HashSet<>(); Collection<NodeSourceData> nodeSources = rmdbManager.getNodeSources(); for (NodeSourceData nodeSource : nodeSources) { knownNodeSources.add(nodeSource.getName()); } }
Source:
<code>protected void updateColors() { super.updateColors(); if (contentMergeViewer != null) { <START> contentMergeViewer.refresh(); <END> } }</code><technical_language>feels strange for color handler refresh view. I expect opposite: i.e. view listen colors refresh color changed. This require add CompareColorImpl EMFCompareColor able nofity listener change (please discuss EventBus Listener)</technical_language>

Target:
protected void updateColors() { Color oldColorRequiredDiffColor = getRequiredDiffColor(); Color oldColorRequiredBoderDiffColor = getUnmergeableDiffBorderColor(); Color oldColorUnmergeableDiffColor = getUnmergeableDiffColor(); Color oldColorUnmergeableBorderDiffColor = getUnmergeableDiffBorderColor(); Color oldColorIncomingChangeColor = getIncomingChangeColor(); Color oldColorOutgoingDiffColor = getOutgoingChangeColor(); Color oldColorConflictingDiffColor = getConflictingChangeColor(); Color oldColorResolvedDiffColor = getResolvedChangeColor(); super.updateColors(); ColorChangeEvent colorEvent = new ColorChangeEvent(); colorEvent.addColorChange(REQUIRED_DIFF_COLOR_THEME_KEY, oldColorRequiredDiffColor, getRequiredDiffColor()); colorEvent.addColorChange(REQUIRED_DIFF_BORDER_COLOR, oldColorRequiredBoderDiffColor, getRequiredChangeBorderColor()); colorEvent.addColorChange(UNMERGEABLE_DIFF_COLOR_THEME_KEY, oldColorUnmergeableDiffColor, getUnmergeableDiffColor()); colorEvent.addColorChange(UNMERGEABLE_DIFF_BORDER_COLOR, oldColorUnmergeableBorderDiffColor, getUnmergeableDiffBorderColor()); colorEvent.addColorChange(INCOMING_CHANGE_COLOR_THEME_KEY, oldColorIncomingChangeColor, getIncomingChangeColor()); colorEvent.addColorChange(OUTGOING_CHANGE_COLOR_THEME_KEY, oldColorOutgoingDiffColor, getOutgoingChangeColor()); colorEvent.addColorChange(CONFLICTING_CHANGE_COLOR_THEME_KEY, oldColorConflictingDiffColor, getConflictingChangeColor()); colorEvent.addColorChange(RESOLVED_CHANGE_COLOR_THEME_KEY, oldColorResolvedDiffColor, getResolvedChangeColor()); if (colorEvent.isAffectingEvent()) { if (eventBus != null) { eventBus.post(colorEvent); } } }
Source:
<code>private Optional<Currency> reportingCurrency() { <START> if (reportingCurrency.getCurrency().isPresent()) { <END> return reportingCurrency.getCurrency(); } return function.naturalCurrency(target); }</code><technical_language>this return reportingCurrency.getCurrency().flatMap(function.naturalCurrency(target));</technical_language>

Target:
private Optional<Currency> reportingCurrency() { if (reportingCurrency.isSpecific()) { return Optional.of(reportingCurrency.getCurrency()); } return function.naturalCurrency(target); }
Source:
<code><START> public void setExcelFileName(String fileName) { <END> if (StringUtils.endsWith(fileName, ".xls")) { reportFileName = fileName; } else { throw new IllegalArgumentException("Excel file should end with '.xls'."); } }</code><technical_language>Minor observation : leveraged Preconditions.checkArgument</technical_language>

Target:
public void setExcelFileName(String fileName) { Preconditions.checkArgument(StringUtils.endsWith(fileName, ".xls"), "Excel file name must end with '.xls'."); reportFileName = fileName; }
Source:
<code>public void checkAgainstAccidentalTableAPIChanges() throws IOException { Schema schema = ApiTestSchema.getSchema(); schema.renderTables(testFolder.getRoot()); String generatedTestTableName = "SchemaApiTestTable"; String generatedFilePath = String.format("com/palantir/atlasdb/table/description/generated/%s.java", generatedTestTableName); <START> File expectedFile = new File("src/test/java", generatedFilePath); <END> File actualFile = new File(testFolder.getRoot(), generatedFilePath); assertThat(actualFile).hasSameContentAs(expectedFile); }</code><technical_language>expected file path is long contains generated making difficult realise file is. Generally want files in resources folder generateFilePath "/resources/generatedCodeForTest" + generatedTestTableName</technical_language>

Target:
public void checkAgainstAccidentalTableAPIChanges() throws IOException { Schema schema = ApiTestSchema.getSchema(); schema.renderTables(testFolder.getRoot()); String generatedTestTableName = "SchemaApiTestTable"; String generatedFilePath = String.format("com/palantir/atlasdb/table/description/generated/%s.java", generatedTestTableName); File expectedFile = new File("src/integrationInput/java", generatedFilePath); File actualFile = new File(testFolder.getRoot(), generatedFilePath); assertThat(actualFile).hasSameContentAs(expectedFile); }
Source:
<code>public Object execute(ExecutionEvent event) throws ExecutionException { Shell activeShell= HandlerUtil.getActiveShell(event); Object newNameValue= HandlerUtil.getVariable(event, LTK_RENAME_COMMAND_NEWNAME_PARAMETER_KEY); String newName= null; if (newNameValue instanceof String) { newName= (String) newNameValue; } else if (newNameValue != null) { RefactoringUIPlugin.logErrorMessage(NLS.bind(RefactoringUIMessages.RenameResourceHandler_ERROR_EXPECTED_STRING, newNameValue.getClass().getName())); } ISelection sel= HandlerUtil.getCurrentSelection(event); if (sel instanceof IStructuredSelection) { IResource resource= getCurrentResource((IStructuredSelection) sel); if (resource != null) { RenameResourceWizard refactoringWizard; if (newName != null) { refactoringWizard= new RenameResourceWizard(resource, newName); fProcessor= ((ProcessorBasedRefactoring) refactoringWizard.getRefactoring()).getProcessor(); fChange= getChange(refactoringWizard); } else { refactoringWizard= new RenameResourceWizard(resource); } try { <START> if (newName == null || isCompositeChange(fChange) || !(fProcessor instanceof RenameResourceProcessor)) { <END> refactoringWizard= newName == null ? new RenameResourceWizard(resource) : new RenameResourceWizard(resource, newName); RefactoringWizardOpenOperation op= new RefactoringWizardOpenOperation(refactoringWizard); op.run(activeShell, RefactoringUIMessages.RenameResourceHandler_title); } else { fChange.perform(new NullProgressMonitor()); } } catch (InterruptedException | CoreException e) { RefactoringUIPlugin.log(e); } } } return null; }</code><technical_language>change null here</technical_language>

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { Shell activeShell= HandlerUtil.getActiveShell(event); Object newNameValue= HandlerUtil.getVariable(event, LTK_RENAME_COMMAND_NEWNAME_PARAMETER_KEY); String newName= null; if (newNameValue instanceof String) { newName= (String) newNameValue; } else if (newNameValue != null) { RefactoringUIPlugin.logErrorMessage(NLS.bind(RefactoringUIMessages.RenameResourceHandler_ERROR_EXPECTED_STRING, newNameValue.getClass().getName())); } ISelection sel= HandlerUtil.getCurrentSelection(event); if (sel instanceof IStructuredSelection) { IResource resource= getCurrentResource((IStructuredSelection) sel); if (resource != null) { RenameResourceWizard refactoringWizard; if (newName != null) { refactoringWizard= new RenameResourceWizard(resource, newName); fProcessor= ((ProcessorBasedRefactoring) refactoringWizard.getRefactoring()).getProcessor(); fChange= getChange(refactoringWizard); refactoringWizard= new RenameResourceWizard(resource, newName); } else { refactoringWizard= new RenameResourceWizard(resource); } try { if (newName == null || isCompositeChange(fChange) || !(fProcessor instanceof RenameResourceProcessor)) { RefactoringWizardOpenOperation op= new RefactoringWizardOpenOperation(refactoringWizard); op.run(activeShell, RefactoringUIMessages.RenameResourceHandler_title); } else { fChange.perform(new NullProgressMonitor()); } } catch (InterruptedException | CoreException e) { RefactoringUIPlugin.log(e); } } } return null; }
Source:
<code>public void start(final Deployment dep) { final DeploymentUnit unit = dep.getAttachment(DeploymentUnit.class); if (unit instanceof WSEndpointDeploymentUnit) return; final DeploymentResourceSupport deploymentResourceSupport = unit.getAttachment(Attachments.DEPLOYMENT_RESOURCE_SUPPORT); for (final Endpoint endpoint : dep.getService().getEndpoints()) { <START> ModelNode op = null; <END> try { op = deploymentResourceSupport.getDeploymentSubModel(WSExtension.SUBSYSTEM_NAME, PathElement.pathElement(ENDPOINT, URLEncoder.encode(getId(endpoint), "UTF-8"))); } catch (final UnsupportedEncodingException e) { throw new RuntimeException(e); } op.get(ENDPOINT_NAME).set(getName(endpoint)); op.get(ENDPOINT_CONTEXT).set(getContext(endpoint)); op.get(ENDPOINT_CLASS).set(endpoint.getTargetBeanName()); op.get(ENDPOINT_TYPE).set(endpoint.getType().toString()); op.get(ENDPOINT_WSDL).set(endpoint.getAddress() + "?wsdl"); } }</code><technical_language>OT: this is a poorly named variable</technical_language>

Target:
public void start(final Deployment dep) { final DeploymentUnit unit = dep.getAttachment(DeploymentUnit.class); if (unit instanceof WSEndpointDeploymentUnit) return; final DeploymentResourceSupport deploymentResourceSupport = unit.getAttachment(Attachments.DEPLOYMENT_RESOURCE_SUPPORT); for (final Endpoint endpoint : dep.getService().getEndpoints()) { final ModelNode endpointModel; try { endpointModel = deploymentResourceSupport.getDeploymentSubModel(WSExtension.SUBSYSTEM_NAME, PathElement.pathElement(ENDPOINT, URLEncoder.encode(getId(endpoint), "UTF-8"))); } catch (final UnsupportedEncodingException e) { throw new RuntimeException(e); } endpointModel.get(ENDPOINT_NAME).set(getName(endpoint)); endpointModel.get(ENDPOINT_CONTEXT).set(getContext(endpoint)); endpointModel.get(ENDPOINT_CLASS).set(endpoint.getTargetBeanName()); endpointModel.get(ENDPOINT_TYPE).set(endpoint.getType().toString()); endpointModel.get(ENDPOINT_WSDL).set(endpoint.getAddress() + "?wsdl"); } }
Source:
<code>public static void updateVmGuestAgentVersion(final VM vm) { if (vm.getAppList() != null) { final String[] parts = vm.getAppList().split("[,]", -1); <START> if (parts.length != 0) { <END> final List<String> possibleAgentAppNames = Config.<List<String>> getValue(ConfigValues.AgentAppName); final Map<String, String> spiceDriversInGuest = Config.<Map<String, String>> getValue(ConfigValues.SpiceDriverNameInGuest); final String spiceDriverInGuest = spiceDriversInGuest.get(osRepository.getOsFamily(vm.getOs()).toLowerCase()); for (final String part : parts) { for (String agentName : possibleAgentAppNames) { if (StringUtils.containsIgnoreCase(part, agentName)) { vm.setGuestAgentVersion(getApplicationVersion(part, agentName)); } if (StringUtils.containsIgnoreCase(part, spiceDriverInGuest)) { vm.setSpiceDriverVersion(getApplicationVersion(part, spiceDriverInGuest)); } } } } } }</code><technical_language>a nice change, unrelated this patch in a separate one</technical_language>

Target:
public static void updateVmGuestAgentVersion(final VM vm) { if (vm.getAppList() != null) { final String[] parts = vm.getAppList().split("[,]", -1); if (parts != null && parts.length != 0) { final List<String> possibleAgentAppNames = Config.<List<String>> getValue(ConfigValues.AgentAppName); final Map<String, String> spiceDriversInGuest = Config.<Map<String, String>> getValue(ConfigValues.SpiceDriverNameInGuest); final String spiceDriverInGuest = spiceDriversInGuest.get(osRepository.getOsFamily(vm.getOs()).toLowerCase()); for (final String part : parts) { for (String agentName : possibleAgentAppNames) { if (StringUtils.containsIgnoreCase(part, agentName)) { vm.setGuestAgentVersion(getApplicationVersion(part, agentName)); } if (StringUtils.containsIgnoreCase(part, spiceDriverInGuest)) { vm.setSpiceDriverVersion(getApplicationVersion(part, spiceDriverInGuest)); } } } } } }
Source:
<code>public static void install() { <START> final NetRCCredentialsProvider c = new NetRCCredentialsProvider(); <END> CredentialsProvider.setDefault(c); }</code><technical_language>is need for this variable, instead inline this</technical_language>

Target:
public static void install() { CredentialsProvider.setDefault(new NetRCCredentialsProvider()); }
Source:
<code>public String getModelPluginId(EPackage ePackage, ResourceSet set) { if (getProvidedMetamodels().contains(ePackage.getNsURI())) { GenPackage genPackage = getGenmodelRegistry().findGenPackage(ePackage.getNsURI(), set); getModelPluginId(genPackage); } <START> return null; <END> }</code><technical_language>this method return null? 'if' is return statement..</technical_language>

Target:
public String getModelPluginId(EPackage ePackage, ResourceSet set) { if (getProvidedMetamodels().contains(ePackage.getNsURI())) { GenPackage genPackage = getGenmodelRegistry().findGenPackage(ePackage.getNsURI(), set); return getModelPluginId(genPackage); } return null; }
Source:
<code>private void addAllToCommentList(JsArray<CommentInfo> in, boolean toDrafts) { if (toDrafts && drafts == null) { drafts = in; <START> } else if (published == null) { <END> published = in; } else { JsArray<CommentInfo> dest = toDrafts ? drafts : published; for (int i = 0; i < in.length(); i++) { dest.push(in.get(i)); } } }</code><technical_language>if drafts != null published == null store drafts in published</technical_language>

Target:
private void addAllToCommentList(JsArray<CommentInfo> in, boolean toDrafts) { if (toDrafts && drafts == null) { drafts = in; } else if (!toDrafts && published == null) { published = in; } else { JsArray<CommentInfo> dest = toDrafts ? drafts : published; for (int i = 0; i < in.length(); i++) { dest.push(in.get(i)); } } }
Source:
<code>private void assertRuntimeConfiguredAccordingToRuntime() { jbossWsRuntimeDialog.finish(); <START> new WaitWhile(new ShellIsActive( <END> NEW_JBOSS_WS_RUNTIME_DIALOG_TITLE)); assertThat(jbossWSRuntimePreferencePage. getAllJBossWSRuntimes().size(), Is.is(1)); JBossWSRuntimeItem item = jbossWSRuntimePreferencePage. getAllJBossWSRuntimes().iterator().next(); assertRuntimeName(item, runtimeName); assertRuntimeVersion(item, runtimeVersion); assertRuntimePath(item, runtimePath); }</code><technical_language>ShellIsAvailable</technical_language>

Target:
private void assertRuntimeConfiguredAccordingToRuntime() { jbossWsRuntimeDialog.finish(); new WaitWhile(new ShellIsAvailable( NEW_JBOSS_WS_RUNTIME_DIALOG_TITLE)); assertThat(jbossWSRuntimePreferencePage. getAllJBossWSRuntimes().size(), Is.is(1)); JBossWSRuntimeItem item = jbossWSRuntimePreferencePage. getAllJBossWSRuntimes().iterator().next(); assertRuntimeName(item, runtimeName); assertRuntimeVersion(item, runtimeVersion); assertRuntimePath(item, runtimePath); }