auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testTaskValidation() { final ConsistencyChecker.Task.Builder builder = new ConsistencyChecker.Task.Builder() .setSourceMetricName("my_metric") .setRollupMetricName("my_metric_1h") .setPeriod(RollupPeriod.HOURLY) .setTrigger(ConsistencyChecker.Task.Trigger.HUMAN_REQUESTED); builder.setStartTime(Instant.EPOCH).build(); builder.setStartTime(Instant.EPOCH.plus(Duration.ofHours(1))).build(); try { builder.setStartTime(Instant.EPOCH.plus(Duration.ofSeconds(1))).build(); <START> fail(); <END> } catch (final ConstraintsViolatedException e) { } }</code><technical_language>add a failure message "Expected ConstraintsViolatedException"</technical_language>

Target:
public void testTaskValidation() { final ConsistencyChecker.Task.Builder builder = new ConsistencyChecker.Task.Builder() .setSourceMetricName("my_metric") .setRollupMetricName("my_metric_1h") .setPeriod(RollupPeriod.HOURLY) .setTrigger(ConsistencyChecker.Task.Trigger.ON_DEMAND); builder.setStartTime(Instant.EPOCH).build(); builder.setStartTime(Instant.EPOCH.plus(Duration.ofHours(1))).build(); try { builder.setStartTime(Instant.EPOCH.plus(Duration.ofSeconds(1))).build(); fail("expected ConstraintsViolatedException"); } catch (final ConstraintsViolatedException e) { } }
Source:
<code>private boolean skipLoad(FlagAffectedCommand cmd, Object key, InvocationContext ctx) { if (!shouldAttemptLookup(ctx.lookupEntry(key))) { if (trace) { log.tracef("Skip load for command %s. Entry already exists in context.", cmd); } return true; } if (!canLoad(key)) { if (trace) { log.tracef("Skip load for command %s. Cannot load the key.", cmd); } return true; } boolean skip = false; if (cmd instanceof GetKeyValueCommand) { skip = hasSkipLoadFlag(cmd); if (trace) { log.tracef("Skip load for read command %s? %s", cmd, skip); } } else if (cmd instanceof WriteCommand) { skip = skipLoadForWriteCommand((WriteCommand) cmd, key, ctx); if (trace) { log.tracef("Skip load for write command %s? %s", cmd, skip); } } else { if (trace) { <START> log.tracef("Unknown command type %s. Don't skip load.", cmd); <END> } } return skip; }</code><technical_language>need this if/else/else, enough check if command implements FlagAffectedCommand. Edit: Scratch that, I write command block calling a separate method</technical_language>

Target:
private boolean skipLoad(FlagAffectedCommand cmd, Object key, InvocationContext ctx) { if (!shouldAttemptLookup(ctx.lookupEntry(key))) { if (trace) { log.tracef("Skip load for command %s. Entry already exists in context.", cmd); } return true; } if (!canLoad(key)) { if (trace) { log.tracef("Skip load for command %s. Cannot load the key.", cmd); } return true; } boolean skip; if (cmd instanceof WriteCommand) { skip = skipLoadForWriteCommand((WriteCommand) cmd, key, ctx); if (trace) { log.tracef("Skip load for write command %s? %s", cmd, skip); } } else { skip = hasSkipLoadFlag(cmd); if (trace) { log.tracef("Skip load for command %s?. %s", cmd, skip); } } return skip; }
Source:
<code>private IProject getSingleProject() { IProject first= null; for (Object <START> fElement : <END> fElements) { IProject project= null; if (fElement instanceof IJavaElement) { project= ((IJavaElement) fElement).getJavaProject().getProject(); } else if (fElement instanceof IResource) { project= ((IResource) fElement).getProject(); } if (project != null) { if (first == null) first= project; else if (!project.equals(first)) return null; } } return first; }</code><technical_language>rename element</technical_language>

Target:
private IProject getSingleProject() { IProject first= null; for (Object javaElement : fElements) { IProject project= null; if (javaElement instanceof IJavaElement) { project= ((IJavaElement) javaElement).getJavaProject().getProject(); } else if (javaElement instanceof IResource) { project= ((IResource) javaElement).getProject(); } if (project != null) { if (first == null) first= project; else if (!project.equals(first)) return null; } } return first; }
Source:
<code><START> public boolean isExistingLabel(PickerLabel targetLabel) { <END> return allLabels.stream() .filter(label -> issue.getLabels().contains(targetLabel.getActualName())) .count() > 0; }</code><technical_language>is this somewhere</technical_language>

Target:
private boolean isExistingLabel(PickerLabel targetLabel) { return isExistingLabel(targetLabel.getActualName()); }
Source:
<code>@Override public void onResponse(Call<AnnouncementList> call, Response<AnnouncementList> response) { if (response.isSuccessful()) { List<Card> cards = <START> new ArrayList<>(); <END> AnnouncementList content = response.body(); if (content != null && content.items() != null) { cards = buildCards(content.items()); } cb.success(cards); } else { L.v(response.message()); cb.error(new IOException(response.message())); } }</code><technical_language>If cards immutable, consider Collections.emptyList(). If not, consider cards.addAll(buildCards()) in conditional block a lines down</technical_language>

Target:
@Override public void onResponse(Call<AnnouncementList> call, Response<AnnouncementList> response) { if (response.isSuccessful()) { List<Card> cards = new ArrayList<>(); AnnouncementList content = response.body(); if (content != null) { cards.addAll(buildCards(content.items())); } cb.success(cards); } else { L.v(response.message()); cb.error(new IOException(response.message())); } }
Source:
<code><START> public Secret getPassword() { <END> return secretPassword; }</code><technical_language>I tell, Secret migrate automatically String. main incompatibility if calls this method Jelly similar</technical_language>

Target:
public String getPassword() { return Secret.toString(secretPassword); }
Source:
<code>public DiskProfile getProfile() { if (profile == null) { if (getParameters().getProfile() != null) { profile = getParameters().getProfile(); } <START> else if (getParameters().getProfileId() != null) { <END> profile = getProfileDao().get(getParameters().getProfileId()); } else { log.error("couldn't find disk profile"); } } return profile; }</code><technical_language>please move else a line</technical_language>

Target:
public DiskProfile getProfile() { if (profile == null) { if (getParameters().getProfile() != null) { profile = getParameters().getProfile(); } else if (getParameters().getProfileId() != null) { profile = getProfileDao().get(getParameters().getProfileId()); } } return profile; }
Source:
<code>public AbstractCppGenerator getGenerator ( CppCodeGenerator.Kind kind, CppCodePattern cpp, NamedElement element, NamedElement context ) { switch( kind ) { case Structural: return new CompositionGenerator .Factory() .create( cpp, (Capsule) element, null ); case StateMachine: return new StateMachineGenerator .Factory() <START> .create( cpp, (StateMachine) element, (Capsule)context ); <END> default: return super.getGenerator( kind, cpp, element, context ); } }</code><technical_language>instanceof check casting Capsule</technical_language>

Target:
public AbstractCppGenerator getGenerator ( CppCodeGenerator.Kind kind, CppCodePattern cpp, NamedElement element, NamedElement context ) { if (element == null) return null; switch( kind ) { case Structural: if (!(element instanceof Capsule)) return null; return new CompositionGenerator .Factory() .create( cpp, (Capsule) element, null ); case StateMachine: if (!(element instanceof StateMachine) || !(context instanceof Capsule)) return null; return new StateMachineGenerator .Factory() .create( cpp, (StateMachine) element, (Capsule)context ); default: return super.getGenerator( kind, cpp, element, context ); } }
Source:
<code>public void accept(List<Span> spans, Callback<Void> callback) { if (spans.isEmpty()) { callback.onSuccess(null); return; } metrics.incrementSpans(spans.size()); List<Span> sampled = sample(spans); if (sampled.isEmpty()) { callback.onSuccess(null); return; } try { record(sampled, acceptSpansCallback(sampled)); callback.onSuccess(null); } catch (RuntimeException | Error e) { <START> handleStorageError(spans, e, callback); <END> } }</code><technical_language>Technically speaking, this a "Collector error" this point? record() is async, "storage error" happen later. Arguably, want handle I wanted bring potential issue in case</technical_language>

Target:
public void accept(List<Span> spans, Callback<Void> callback) { if (spans.isEmpty()) { callback.onSuccess(null); return; } metrics.incrementSpans(spans.size()); List<Span> sampledSpans = sample(spans); if (sampledSpans.isEmpty()) { callback.onSuccess(null); return; } Callback<Void> logOnErrorCallback = storeSpansCallback(sampledSpans); try { store(sampledSpans, logOnErrorCallback); callback.onSuccess(null); } catch (RuntimeException | Error e) { handleStorageError(spans, e, callback); } }
Source:
<code><START> private boolean sendMessagesForChangedEntries(String url, SyndFeed cachedFeed, SyndFeed fetchedFeed, String regex) { <END> boolean anyChanges = false; for (SyndEntry fetchedEntry : fetchedFeed.getEntries()) { boolean foundInCache = false; for (SyndEntry cachedEntry : cachedFeed.getEntries()) { if (fetchedEntry.getUri().equals(cachedEntry.getUri())) { foundInCache = true; if (areEntriesDifferent(fetchedEntry, cachedEntry)) { sendMessageForFeedEntry(url, fetchedEntry, regex); anyChanges = true; } } } if (!foundInCache) { sendMessageForFeedEntry(url, fetchedEntry, regex); anyChanges = true; } } return anyChanges; }</code><technical_language>a good method add loggers in - entries in cache if changes</technical_language>

Target:
private boolean sendMessagesForChangedEntries(String url, SyndFeed cachedFeed, SyndFeed fetchedFeed, String regex) { boolean anyChanges = false; for (SyndEntry fetchedEntry : fetchedFeed.getEntries()) { boolean foundInCache = false; for (SyndEntry cachedEntry : cachedFeed.getEntries()) { if (fetchedEntry.getUri().equals(cachedEntry.getUri())) { foundInCache = true; if (areEntriesDifferent(fetchedEntry, cachedEntry)) { LOGGER.debug("Sending message for changed entry in feed {}", fetchedEntry.getUri(), url); sendMessageForFeedEntry(url, fetchedEntry, regex); anyChanges = true; } } } if (!foundInCache) { LOGGER.debug("Sending message for new entry in feed {}", fetchedEntry.getUri(), url); sendMessageForFeedEntry(url, fetchedEntry, regex); anyChanges = true; } } if (anyChanges == false) { LOGGER.debug("No changes detected in feed {}", url); } return anyChanges; }
Source:
<code>public Ds3TypeMapperParserImpl() throws IOException { objectMapper = new ObjectMapper(); objectMapper.registerModule(new GuavaModule()); final InputStream inputStream = Ds3TypeMapperParserImpl.class.getResourceAsStream("/typeMap.json"); <START> jsonData = ByteStreams.toByteArray(inputStream); <END> }</code><technical_language>confused this. convert TypeMap in a private static method? change jsonData typeMapper a method this get initial Ds3TypeMap object: java private static Ds3TypeMapper initTypeMapper() { final ObjectMapper objectMapper = new ObjectMapper(); objectMapper.registerModule(new GuavaModule()); final InputStream inputStream = Ds3TypeMapperParserImpl.class.getResourceAsStream("/typeMap.json"); return toMap(objectMapper.readValue(inputStream, TypeMap.class)) } constructor becomes: java public Ds3TypeMapperParserImpl() throws IOException { this.typeMapper = initTypeMapper(); }</technical_language>

Target:
public Ds3TypeMapperParserImpl() throws IOException { this.ds3TypeMapper = initDs3TypeMapper(); }
Source:
<code>KafkaProducerWrapper(String logSuffix, Properties props, String metricsNamesPrefix) { _log = LoggerFactory.getLogger(String.format("%s:%s", KafkaTransportProvider.class, logSuffix)); if (!props.containsKey(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG)) { throw new RuntimeException("Bootstrap servers are not set"); } VerifiableProperties transportProviderProperties = new VerifiableProperties(props); _dynamicMetricsManager = DynamicMetricsManager.getInstance(); _metricsNamesPrefix = metricsNamesPrefix == null ? CLASS_NAME : metricsNamesPrefix + CLASS_NAME; _dynamicMetricsManager.registerGauge(_metricsNamesPrefix, AGGREGATE, PRODUCER_COUNT, PRODUCER_GAUGE); _clientId = transportProviderProperties.getProperty(ProducerConfig.CLIENT_ID_CONFIG); <START> if (_clientId == null || _clientId.isEmpty()) { <END> _log.warn("Client ID is either null or empty"); } _sendFailureRetryWaitTimeMs = transportProviderProperties.getLong(CFG_SEND_FAILURE_RETRY_WAIT_MS, DEFAULT_SEND_FAILURE_RETRY_WAIT_MS); _rateLimiter = RateLimiter.create(transportProviderProperties.getDouble(CFG_RATE_LIMITER_CFG, DEFAULT_RATE_LIMITER)); _props = props; String kafkaProducerFactoryName = transportProviderProperties.getString(CFG_KAFKA_PRODUCER_FACTORY, SimpleKafkaProducerFactory.class.getCanonicalName()); _producerFactory = ReflectionUtils.createInstance(kafkaProducerFactoryName); populateDefaultProducerConfigs(); }</code><technical_language>nit: StringUtils</technical_language>

Target:
KafkaProducerWrapper(String logSuffix, Properties props, String metricsNamesPrefix) { _log = LoggerFactory.getLogger(String.format("%s:%s", KafkaTransportProvider.class, logSuffix)); if (!props.containsKey(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG)) { throw new RuntimeException("Bootstrap servers are not set"); } VerifiableProperties transportProviderProperties = new VerifiableProperties(props); _dynamicMetricsManager = DynamicMetricsManager.getInstance(); _metricsNamesPrefix = metricsNamesPrefix == null ? CLASS_NAME : metricsNamesPrefix + CLASS_NAME; _dynamicMetricsManager.registerGauge(_metricsNamesPrefix, AGGREGATE, PRODUCER_COUNT, PRODUCER_GAUGE); _clientId = transportProviderProperties.getProperty(ProducerConfig.CLIENT_ID_CONFIG); if (StringUtils.isEmpty(_clientId)) { _log.warn("Client ID is either null or empty"); } _sendFailureRetryWaitTimeMs = transportProviderProperties.getLong(CFG_SEND_FAILURE_RETRY_WAIT_MS, DEFAULT_SEND_FAILURE_RETRY_WAIT_MS); _rateLimiter = RateLimiter.create(transportProviderProperties.getDouble(CFG_RATE_LIMITER_CFG, DEFAULT_RATE_LIMITER)); _props = props; String kafkaProducerFactoryName = transportProviderProperties.getString(CFG_KAFKA_PRODUCER_FACTORY, SimpleKafkaProducerFactory.class.getCanonicalName()); _producerFactory = ReflectionUtils.createInstance(kafkaProducerFactoryName); populateDefaultProducerConfigs(); }
Source:
<code>public void pre(FMLPreInitializationEvent event) { ModelLoader.setCustomModelResourceLocation(DIAMOND_SHIELD, 0, new ModelResourceLocation("minecraft:shield", "inventory")); ModelLoader.setCustomModelResourceLocation(HEAVY_DIAMOND_SWORD, 0, new ModelResourceLocation("minecraft:diamond_sword", "inventory")); TileEntityRendererDispatcher.instance.mapSpecialRenderers.put(TileEntityCustomShield.class, new TileEntitySpecialRenderer<TileEntityCustomShield>() { @Override public void renderTileEntityAt(TileEntityCustomShield entity, double x, double y, double z, float partialTicks, int destroyStage) { Minecraft.getMinecraft().getTextureManager().bindTexture(BannerTextures.SHIELD_BASE_TEXTURE); GlStateManager.pushMatrix(); GlStateManager.scale(1.0F, -1.0F, -1.0F); modelShield.render(); GlStateManager.popMatrix(); } }); <START> ForgeHooksClient.registerTESRItemStack(DIAMOND_SHIELD, 0, TileEntityCustomShield.class); <END> }</code><technical_language>is this a TESR all..</technical_language>

Target:
public void pre(FMLPreInitializationEvent event) { ModelLoader.setCustomModelResourceLocation(DIAMOND_SHIELD, 0, new ModelResourceLocation("shield_test:diamond_shield", "inventory")); ModelLoader.setCustomModelResourceLocation(HEAVY_DIAMOND_SWORD, 0, new ModelResourceLocation("minecraft:diamond_sword", "inventory")); }
Source:
<code>private void scheduleLocationUpdate() { Log.i(TAG, "Scheduling mock location updates"); if (locationUpdateTask != null) { locationUpdateTask.cancel(); } locationUpdateTask = new TimerTask() { @Override public void run() { for (MockLocationProvider mockLocationProvider : mockLocationProviders) { Location location = locationFactory.createLocation(mockLocationProvider.getProviderName(), Criteria.ACCURACY_FINE); Log.d(TAG, String.format("Setting location of '%s' to '%s'", mockLocationProvider.getProviderName(), location)); try { mockLocationProvider.setLocation(location); } catch (Exception e) { Log.e(TAG, String.format("Could not set location for '%s': %s", <START> mockLocationProvider.getProviderName(), e.getMessage())); <END> } } } }; locationUpdatesTimer.schedule(locationUpdateTask, 0, UPDATE_INTERVAL_MS); }</code><technical_language>pass exception a message</technical_language>

Target:
private void scheduleLocationUpdate() { Log.i(TAG, "Scheduling mock location updates"); if (locationUpdateTask != null) { locationUpdateTask.cancel(); } locationUpdateTask = new TimerTask() { @Override public void run() { for (MockLocationProvider mockLocationProvider : mockLocationProviders) { Location location = locationFactory.createLocation(mockLocationProvider.getProviderName(), Criteria.ACCURACY_FINE); Log.d(TAG, String.format("Setting location of '%s' to '%s'", mockLocationProvider.getProviderName(), location)); try { mockLocationProvider.setLocation(location); } catch (Exception e) { Log.e(TAG, String.format("Could not set location for '%s'", mockLocationProvider.getProviderName()), e); } } } }; locationUpdatesTimer.schedule(locationUpdateTask, 0, UPDATE_INTERVAL_MS); }
Source:
<code>public SignUpTask(Context context) { super(TaskProvider.TASK_ID_SIGN_UP); <START> inclusionCriteriaStep = UiManager.getInstance().getInclusionCriteriaStep(context); <END> }</code><technical_language>call inclusionCriteriaStep.setOptional(false) users skip (issue #126)</technical_language>

Target:
public SignUpTask(Context context) { super(TaskProvider.TASK_ID_SIGN_UP); inclusionCriteriaStep = UiManager.getInstance().getInclusionCriteriaStep(context); inclusionCriteriaStep.setOptional(false); }
Source:
<code>public void logoutFunctionTest() { <START> find("#repoOwnerField"); <END> selectAll(); type("dummy").push(KeyCode.TAB); type("dummy").push(KeyCode.TAB); type("test").push(KeyCode.TAB); type("test"); click("Sign in"); sleep(2000); click("File"); click("Logout"); File testConfig = new File(configFileDirectory, testConfigFileName); if (!(testConfig.exists() && testConfig.isFile())) fail(); Preferences testPref = new Preferences(true); assertEquals("", testPref.getLastLoginUsername()); assertEquals("", testPref.getLastLoginPassword()); }</code><technical_language>This needed, click it</technical_language>

Target:
public void logoutFunctionTest() { selectAll(); type("dummy").push(KeyCode.TAB); type("dummy").push(KeyCode.TAB); type("test").push(KeyCode.TAB); type("test"); click("Sign in"); sleep(2000); click("File"); click("Logout"); File testConfig = new File(configFileDirectory, testConfigFileName); if (!(testConfig.exists() && testConfig.isFile())) fail(); Preferences testPref = new Preferences(true); assertEquals("", testPref.getLastLoginUsername()); assertEquals("", testPref.getLastLoginPassword()); }
Source:
<code>public int hashCode() { int result = hashCode; if(result == 0) { <START> result = 31 * result + size(); <END> result = 31 * result + set.hashCode(); hashCode = result; } return result; }</code><technical_language>do include size of binding set part of hash code</technical_language>

Target:
public int hashCode() { int result = hashCode; if(result == 0) { result = 31 * result + set.hashCode(); hashCode = result; } return result; }
Source:
<code>public List<String> getIP(ClaudiaData claudiaData, String tierName, int replica, VM vm, String region) throws InfrastructureException { List<String> ips = new ArrayList<String>(); <START> String response =""; <END> try { String token = claudiaData.getUser().getToken(); String vdc = claudiaData.getVdc(); response = openStackUtil.getServer(vm.getVmid(), region, token, vdc); JSONObject jsonNodeServers = new JSONObject(response).getJSONObject("server"); JSONObject jsonAddress = jsonNodeServers.getJSONObject("addresses"); java.util.Iterator iter = jsonAddress.keys(); while(iter.hasNext()){ String key = (String)iter.next(); org.json.JSONArray value = jsonAddress.getJSONArray(key); for (int i = 0; i < value.length(); i++) { JSONObject childJSONObject = value.getJSONObject(i); ips.add(childJSONObject.getString("addr")); } } } catch (OpenStackException oes) { String errorMessage = "Error interacting getting ip from OpenStack "; log.error(errorMessage); throw new InfrastructureException(errorMessage); } catch (JSONException e) { String errorMessage = "Error with Json "; log.error(errorMessage); } return ips; }</code><technical_language>String response = "";</technical_language>

Target:
public List<String> getIP(ClaudiaData claudiaData, String tierName, int replica, VM vm, String region) throws InfrastructureException { List<String> ips = new ArrayList<String>(); String response = ""; try { String token = claudiaData.getUser().getToken(); String vdc = claudiaData.getVdc(); response = openStackUtil.getServer(vm.getVmid(), region, token, vdc); JSONObject jsonNodeServers = new JSONObject(response).getJSONObject("server"); JSONObject jsonAddress = jsonNodeServers.getJSONObject("addresses"); java.util.Iterator iter = jsonAddress.keys(); while(iter.hasNext()){ String key = (String)iter.next(); org.json.JSONArray value = jsonAddress.getJSONArray(key); for (int i = 0; i < value.length(); i++) { JSONObject childJSONObject = value.getJSONObject(i); ips.add(childJSONObject.getString("addr")); } } } catch (OpenStackException oes) { String errorMessage = "Error interacting getting ip from OpenStack "; log.error(errorMessage); throw new InfrastructureException(errorMessage); } catch (JSONException e) { log.error("Error with Json " + e.getMessage()); } return ips; }
Source:
<code>public boolean shouldSuppressWarnings(Tree tree, String errKey) { Collection<String> prefixes = getSuppressWarningsPrefixes(); if (prefixes.isEmpty() || (prefixes.contains(SUPPRESS_ALL_PREFIX) && prefixes.size() == 1)) { <START> throw new BugInCF( <END> "Checker must provide a SuppressWarnings prefix. Add @SuppressWarningsPrefix meta-annotation."); } @Nullable TreePath path = trees.getPath(this.currentRoot, tree); @Nullable VariableTree var = TreeUtils.enclosingVariable(path); if (var != null && shouldSuppressWarnings(TreeUtils.elementFromTree(var), errKey)) { return true; } @Nullable MethodTree method = TreeUtils.enclosingMethod(path); if (method != null) { @Nullable Element elt = TreeUtils.elementFromTree(method); if (shouldSuppressWarnings(elt, errKey)) { return true; } if (isAnnotatedForThisCheckerOrUpstreamChecker(elt)) { return false; } } @Nullable ClassTree cls = TreeUtils.enclosingClass(path); if (cls != null) { @Nullable Element elt = TreeUtils.elementFromTree(cls); if (shouldSuppressWarnings(elt, errKey)) { return true; } if (isAnnotatedForThisCheckerOrUpstreamChecker(elt)) { return false; } } if (useConservativeDefault("source")) { return true; } return false; }</code><technical_language>This does't right advice. If is @SuppressWarningsPrefix annotation, implementation chooses a checker name. I problem is checker override getSuppressWarningsPrefixes incorrectly, message checker override correctly, override it</technical_language>

Target:
public boolean shouldSuppressWarnings(Tree tree, String errKey) { Collection<String> prefixes = getSuppressWarningsPrefixes(); if (prefixes.isEmpty() || (prefixes.contains(SUPPRESS_ALL_PREFIX) && prefixes.size() == 1)) { throw new BugInCF( "Checker must provide a SuppressWarnings prefix. SourceChecker#getSuppressWarningsPrefixes was not overridden correctly."); } @Nullable TreePath path = trees.getPath(this.currentRoot, tree); @Nullable VariableTree var = TreeUtils.enclosingVariable(path); if (var != null && shouldSuppressWarnings(TreeUtils.elementFromTree(var), errKey)) { return true; } @Nullable MethodTree method = TreeUtils.enclosingMethod(path); if (method != null) { @Nullable Element elt = TreeUtils.elementFromTree(method); if (shouldSuppressWarnings(elt, errKey)) { return true; } if (isAnnotatedForThisCheckerOrUpstreamChecker(elt)) { return false; } } @Nullable ClassTree cls = TreeUtils.enclosingClass(path); if (cls != null) { @Nullable Element elt = TreeUtils.elementFromTree(cls); if (shouldSuppressWarnings(elt, errKey)) { return true; } if (isAnnotatedForThisCheckerOrUpstreamChecker(elt)) { return false; } } if (useConservativeDefault("source")) { return true; } return false; }
Source:
<code><START> public final String toJsonWithName() { <END> return "{\"properties\":{" + toJson() + "}"; }</code><technical_language>give ability user name</technical_language>

Target:
public final String toJsonWithName() { return toJsonWithName(getJsonName()); }
Source:
<code>public RexNode visitRangeRef(RexRangeRef rangeRef) { <START> return new RexRangeRef(copy(rangeRef.getType()), rangeRef.getOffset()); <END> }</code><technical_language>Please builder.xxx(...) instead of new ...</technical_language>

Target:
public RexNode visitRangeRef(RexRangeRef rangeRef) { return builder.makeRangeReference(copy(rangeRef.getType()), rangeRef.getOffset(), false); }
Source:
<code>public synchronized void trimMemory(int level) { if (level >= android.content.ComponentCallbacks2.TRIM_MEMORY_BACKGROUND) { clearMemory(); } else if (level >= android.content.ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN) { evictToSize(maxSize / 2); <START> } else if (level == android.content.ComponentCallbacks2.TRIM_MEMORY_RUNNING_CRITICAL) { <END> evictToSize(maxSize / 2); } }</code><technical_language>|| instead of duplicating size logic</technical_language>

Target:
public synchronized void trimMemory(int level) { if (level >= android.content.ComponentCallbacks2.TRIM_MEMORY_BACKGROUND) { clearMemory(); } else if (level >= android.content.ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN || level == android.content.ComponentCallbacks2.TRIM_MEMORY_RUNNING_CRITICAL) { evictToSize(maxSize / 2); } }
Source:
<code>private FileDescriptor getDescriptor(String name) throws DescriptorValidationException { if (fileDescriptorMap.containsKey(name)) { return fileDescriptorMap.get(name); } <START> if (!fdProtoMap.containsKey(name)) { <END> throw new SerializerException("DynamicProtobuf type "+name+" was never seen in registry"); } List<FileDescriptor> fileDescriptorList = new ArrayList<>(); for (String s : fdProtoMap.get(name).getDependencyList()) { FileDescriptor descriptor = getDescriptor(s); fileDescriptorList.add(descriptor); } FileDescriptor[] fileDescriptors = fileDescriptorList.toArray(new FileDescriptor[fileDescriptorList.size()]); FileDescriptor fileDescriptor = FileDescriptor.buildFrom(fdProtoMap.get(name), fileDescriptors); fileDescriptorMap.putIfAbsent(name, fileDescriptor); return fileDescriptor; }</code><technical_language>Is collapse this fileDescriptorMap? a bit strange call getFullyQualifiedTableName(CORFU_SYSTEM_NAMESPACE, REGISTRY_TABLE_NAME) constructor I feel cleaner open map extract serializers a higher layer</technical_language>

Target:
private FileDescriptor getDescriptor(String name) throws DescriptorValidationException { if (fileDescriptorMap.containsKey(name)) { return fileDescriptorMap.get(name); } if (!fdProtoMap.containsKey(name)) { log.error("DynamicProtobufSerializer failed to deserialize unknown file {}", name); log.error(this.toString()); throw new SerializerException( "DynamicProtobufSerializer file " + name + " was never seen in registry"); } List<FileDescriptor> fileDescriptorList = new ArrayList<>(); for (String s : fdProtoMap.get(name).getDependencyList()) { FileDescriptor descriptor = getDescriptor(s); fileDescriptorList.add(descriptor); } FileDescriptor[] fileDescriptors = fileDescriptorList.toArray(new FileDescriptor[fileDescriptorList.size()]); FileDescriptor fileDescriptor = FileDescriptor.buildFrom(fdProtoMap.get(name), fileDescriptors); fileDescriptorMap.putIfAbsent(name, fileDescriptor); return fileDescriptor; }
Source:
<code>public void menuDetected(MenuDetectEvent e) { fPendingMenuDetectEvent = e; <START> return; <END> }</code><technical_language>This prevents menuDetected triggered Menu key (e.detail == SWT.MENU_KEYBOARD), mouseUp follow (neither keyReleased)</technical_language>

Target:
public void menuDetected(MenuDetectEvent e) { if (null == _timeProvider) { return; } if (e.detail == SWT.MENU_MOUSE) { if (fPendingMenuDetectEvent == null) { fPendingMenuDetectEvent = e; return; } fPendingMenuDetectEvent = null; if (_dragState != DRAG_ZOOM || _dragX != _dragX0) { return; } } else { if (_dragState != DRAG_NONE) { return; } } Point p = toControl(e.x, e.y); int idx = getItemIndexAtY(p.y); if (idx >= 0 && idx < _data._expandedItems.length) { Item item = _data._expandedItems[idx]; ITimeGraphEntry entry = item._trace; if (entry.hasTimeEvents()) { ITimeEvent event = Utils.findEvent(entry, getTimeAtX(p.x), 2); if (event != null) { e.data = event; fireMenuEventOnTimeEvent(e); return; } } e.data = entry; fireMenuEventOnTimeGraphEntry(e); } }
Source:
<code>private void testDone(ExecutorService service, long beforeSetDelay, final long beforeExecuteDelay) throws InterruptedException, ExecutionException { final NotifyingFutureImpl<Integer> nf = new NotifyingFutureImpl<Integer>(); Future<Integer> f = service.submit(new Callable<Integer>() { @Override public Integer call() throws Exception { Thread.sleep(beforeExecuteDelay); int retval = 42; nf.notifyDone(retval); return retval; } }); try { int check = f.get(0, TimeUnit.NANOSECONDS); <START> assert check == 42; <END> } catch (TimeoutException e) { } Thread.sleep(beforeSetDelay); nf.setFuture(f); try { int check = nf.get(0, TimeUnit.NANOSECONDS); assert check == 42; } catch (TimeoutException e) { } final AtomicInteger retval = new AtomicInteger(-1); final CountDownLatch latch = new CountDownLatch(1); nf.attachListener(new FutureListener<Integer>() { @Override public void futureDone(Future<Integer> future) { try { retval.set(future.get()); } catch (Exception e) { e.printStackTrace(); } finally { latch.countDown(); } } }); latch.await(); assert nf.isDone(); assert !nf.isCancelled(); assert f.isDone(); assert !f.isCancelled(); assert retval.get() == 42; assert nf.get() == 42; assert f.get() == 42; }</code><technical_language>assertEquals() instead of assert keyword :)</technical_language>

Target:
private void testDone(ExecutorService service, long beforeSetDelay, final long beforeExecuteDelay) throws InterruptedException, ExecutionException { final NotifyingFutureImpl<Integer> nf = new NotifyingFutureImpl<Integer>(); Future<Integer> f = service.submit(new Callable<Integer>() { @Override public Integer call() throws Exception { Thread.sleep(beforeExecuteDelay); int retval = 42; nf.notifyDone(retval); return retval; } }); try { assertEquals(Integer.valueOf(42), f.get(0, TimeUnit.NANOSECONDS)); } catch (TimeoutException e) { } Thread.sleep(beforeSetDelay); nf.setFuture(f); try { assertEquals(Integer.valueOf(42), f.get(0, TimeUnit.NANOSECONDS)); } catch (TimeoutException e) { } final AtomicInteger retval = new AtomicInteger(-1); final CountDownLatch latch = new CountDownLatch(1); nf.attachListener(new FutureListener<Integer>() { @Override public void futureDone(Future<Integer> future) { try { retval.set(future.get()); } catch (Exception e) { e.printStackTrace(); } finally { latch.countDown(); } } }); latch.await(); assertTrue(nf.isDone()); assertFalse(nf.isCancelled()); assertTrue(f.isDone()); assertFalse(f.isCancelled()); assertEquals(42, retval.get()); assertEquals(Integer.valueOf(42), nf.get()); assertEquals(Integer.valueOf(42), f.get()); }
Source:
<code>public FreeStyleProject newInstance(Branch branch) { FreeStyleProject job = new FreeStyleProject(getOwner(), branch.getName()); job.onCreatedFromScratch(); FreeStyleProject spied = spy(job); <START> when(spied.scheduleBuild()).thenReturn(false); <END> setBranch(spied, branch); return spied; }</code><technical_language>do this mocks a custom Project subclass overrides scheduleBuild</technical_language>

Target:
public FreeStyleProject newInstance(Branch branch) { FreeStyleProject job = new FreeStyleProject(getOwner(), branch.getName()); FreeStyleProject spied = spy(job); when(spied.scheduleBuild()).thenReturn(false); setBranch(spied, branch); return spied; }
Source:
<code>public void verifyAllPinTypesIsUncheck() { try { waitForElementVisibleByElement(mapFrame); driver.switchTo().frame(mapFrame); waitForElementVisibleByElement(allPinTypes); if (!allPinTypes.getAttribute("class").contains("enabled")) { PageObjectLogging.log("verifyAllPointTypesIsUnCheck", "All pin types were unchecked", true); } driver.switchTo().defaultContent(); }catch (Exception e) { <START> PageObjectLogging.log("verifyAllPointTypesIsUnCheck", "All pin types were checked", false); <END> } }</code><technical_language>log error stack instead</technical_language>

Target:
public void verifyAllPinTypesIsUncheck() { waitForElementVisibleByElement(mapFrame); driver.switchTo().frame(mapFrame); waitForElementVisibleByElement(allPinTypes); if (!allPinTypes.getAttribute("class").contains("enabled")) { PageObjectLogging.log("verifyAllPointTypesIsUnCheck", "All pin types were unchecked", true); }else { PageObjectLogging.log("verifyAllPointTypesIsUnCheck", "All pin types were checked", false); } driver.switchTo().defaultContent(); }
Source:
<code>public void testGetParentDocumentFromPathReference() { DocumentModel root = session.getRootDocument(); DocumentModel shouldBeNull = session.getParentDocument(new PathRef(root.getPathAsString())); assertNull(shouldBeNull); String name = "folder#" + generateUnique(); DocumentModel parentFolder = session.createDocumentModel(root.getPathAsString(), name, "Folder"); DocumentModel shouldBeRoot = session.getParentDocument(parentFolder.getRef()); assertEquals(root.getPathAsString(), shouldBeRoot.getPathAsString()); parentFolder = session.createDocument(parentFolder); <START> session.save(); <END> String name2 = "file#" + generateUnique(); DocumentModel childFile = session.createDocumentModel(parentFolder.getPathAsString(), name2, "File"); DocumentModel shouldBeFolder = session.getParentDocument(childFile.getRef()); assertEquals(parentFolder.getPathAsString(), shouldBeFolder.getPathAsString()); DocumentRef shouldBeRootRef = session.getParentDocumentRef(parentFolder.getRef()); assertEquals(root.getRef(), shouldBeRootRef); DocumentRef shouldBeFolderRef = session.getParentDocumentRef(childFile.getRef()); assertEquals(parentFolder.getRef(), shouldBeFolderRef); }</code><technical_language>I this call is useless</technical_language>

Target:
public void testGetParentDocumentFromPathReference() { DocumentRef rootRef = new PathRef("/"); assertNull(session.getParentDocument(rootRef)); assertNull(session.getParentDocumentRef(rootRef)); String name = "folder#" + generateUnique(); DocumentModel parentFolder = session.createDocumentModel("/", name, "Folder"); DocumentModel shouldBeRoot = session.getParentDocument(parentFolder.getRef()); assertEquals("/", shouldBeRoot.getPathAsString()); parentFolder = session.createDocument(parentFolder); String name2 = "file#" + generateUnique(); DocumentModel childFile = session.createDocumentModel(parentFolder.getPathAsString(), name2, "File"); DocumentModel shouldBeFolder = session.getParentDocument(childFile.getRef()); assertEquals(parentFolder.getPathAsString(), shouldBeFolder.getPathAsString()); DocumentRef shouldBeRootRef = session.getParentDocumentRef(parentFolder.getRef()); assertEquals(session.getRootDocument().getRef(), shouldBeRootRef); DocumentRef shouldBeFolderRef = session.getParentDocumentRef(childFile.getRef()); assertEquals(parentFolder.getRef(), shouldBeFolderRef); }
Source:
<code>public Collection<ItemStack> getDrops(GlowBlock block) { <START> if (random.nextFloat() < 12.5) { <END> return Collections.unmodifiableList(Arrays.asList(new ItemStack(Material.SEEDS, 1))); } return Collections.unmodifiableList(Arrays.asList(new ItemStack[0])); }</code><technical_language>I nextFloat() returns a in range [0, 1), want check < .125 instead</technical_language>

Target:
public Collection<ItemStack> getDrops(GlowBlock block) { if (random.nextFloat() < .125) { return Collections.unmodifiableList(Arrays.asList(new ItemStack(Material.SEEDS, 1))); } return Collections.unmodifiableList(Arrays.asList(new ItemStack[0])); }
Source:
<code>public void migrateMetadata() { migrateWorkflow = false; try { allProjects = ServiceManager.getProjectService().getAll(); projectListShown = true; } catch (DAOException e) { <START> Helper.setErrorMessage("Error during database access"); <END> } }</code><technical_language>remove logger e parameters method call? / helpful information get lost</technical_language>

Target:
public void migrateMetadata() { try { allProjects = ServiceManager.getProjectService().getAll(); projectListShown = true; metadataShown = true; workflowShown = false; } catch (DAOException e) { Helper.setErrorMessage("Error during database access", e.getLocalizedMessage(), logger, e); } }
Source:
<code>private boolean initAutoscaler( AutoScaler autoScaler, String category, DefaultWorkerBehaviorConfig workerConfig, Map<String, Set<String>> currentlyProvisioningMap ) { <START> currentlyProvisioningMap.putIfAbsent( category, new HashSet<>() ); Set<String> currentlyProvisioning = currentlyProvisioningMap.get(category); <END> return doProvision( category, Collections.emptyList(), Collections.emptyList(), workerConfig, currentlyProvisioning, autoScaler ); }</code><technical_language>nit: replacement avoids instantiation of a new HashSet object call this method. suggestion Set<String> currentlyProvisioning = currentlyProvisioningMap.computeIfAbsent( category, -> new HashSet<>() );</technical_language>

Target:
private boolean initAutoscaler( AutoScaler autoScaler, String category, DefaultWorkerBehaviorConfig workerConfig, Map<String, Set<String>> currentlyProvisioningMap ) { Set<String> currentlyProvisioning = currentlyProvisioningMap.computeIfAbsent( category, ignored -> new HashSet<>() ); return doProvision( category, Collections.emptyList(), Collections.emptyList(), workerConfig, currentlyProvisioning, autoScaler ); }
Source:
<code>public Predicate<ChangeData> rewrite(Predicate<ChangeData> in, int start) throws QueryParseException { ChangeIndex index = indexes.getSearchIndex(); in = basicRewrites.rewrite(in); int limit = <START> Objects.firstNonNull(ChangeQueryBuilder.getLimit(in), DEFAULT_MAX_LIMIT); <END> limit += start; limit = Math.max(limit, 1); Predicate<ChangeData> out = rewriteImpl(in, index, limit); if (in == out || out instanceof IndexPredicate) { return new IndexedChangeQuery(index, out, limit); } else if (out == null ) { return in; } else { return out; } }</code><technical_language>Good catch. behavior observe is due adding a limit predicate in QueryProcessor.parseQuery, is called rewriting predicate. I a simpler fix is kill constant in this class use: int limit = checkNotNull(ChangeQueryBuilder.getLimit(in), "expected limit rewriting: %s", in);</technical_language>

Target:
public Predicate<ChangeData> rewrite(Predicate<ChangeData> in, int start) throws QueryParseException { ChangeIndex index = indexes.getSearchIndex(); in = basicRewrites.rewrite(in); int limit = Objects.firstNonNull(ChangeQueryBuilder.getLimit(in), DEFAULT_MAX_QUERY_LIMIT); limit += start; limit = Math.max(limit, 1); Predicate<ChangeData> out = rewriteImpl(in, index, limit); if (in == out || out instanceof IndexPredicate) { return new IndexedChangeQuery(index, out, limit); } else if (out == null ) { return in; } else { return out; } }
Source:
<code>public String toString() { String domainName = staticData.getName() == null ? "null" : staticData.getName(); <START> String domainId = staticData.getId() == null ? "null" : staticData.getId().toString(); <END> return "StorageDomain[" + domainName + ", " + domainId + "]"; }</code><technical_language>need this. "+" operator this for you</technical_language>

Target:
public String toString() { String domainName = staticData == null ? "null" : staticData.getName(); Guid domainId = staticData == null ? null : staticData.getId(); return "StorageDomain[" + domainName + ", " + domainId + "]"; }
Source:
<code>public static ServiceName deploymentSchedulerServiceName(ClassLoader deploymentClassLoader) { if (deploymentClassLoader == null) { deploymentClassLoader = SecurityActions.getContextClassLoader(); } if (deploymentClassLoader instanceof ModuleClassLoader) { ModuleClassLoader moduleClassLoader = (ModuleClassLoader) deploymentClassLoader; <START> final String DEPLOYMEND_CL_NAME_PREFIX = "deployment."; <END> final String clName = moduleClassLoader.getName(); if (clName.startsWith(DEPLOYMEND_CL_NAME_PREFIX)) { final String deploymentName = clName.substring(DEPLOYMEND_CL_NAME_PREFIX.length()); final int earInfixPos = deploymentName.indexOf(EAR_INFIX); if (earInfixPos >= 0) { final String earName = deploymentName.substring(0, earInfixPos + EAR_INFIX.length() - 1); final String warName = deploymentName.substring(earInfixPos + EAR_INFIX.length()); return ServiceName.of("jboss", "deployment", "subunit", earName, warName, SERVICE_NAME); } else { return ServiceName.of("jboss", "deployment", "unit", deploymentName, SERVICE_NAME); } } else { throw new IllegalStateException(String.format("Expected a %s name starting with '%s'; found %s", ModuleClassLoader.class.getName(), DEPLOYMEND_CL_NAME_PREFIX, clName)); } } else { throw new IllegalStateException(String.format("Expected a %s; found %s", ModuleClassLoader.class.getName(), deploymentClassLoader)); } }</code><technical_language>Typo DEPLOYMEND</technical_language>

Target:
public static ServiceName deploymentSchedulerServiceName(ClassLoader deploymentClassLoader) { if (deploymentClassLoader == null) { deploymentClassLoader = SecurityActions.getContextClassLoader(); } if (deploymentClassLoader instanceof ModuleClassLoader) { ModuleClassLoader moduleClassLoader = (ModuleClassLoader) deploymentClassLoader; final String clName = moduleClassLoader.getName(); if (clName.startsWith(DEPLOYMENT_CL_NAME_PREFIX)) { if (clName.endsWith(WAR_SUFFIX)) { final String deploymentName = clName.substring(DEPLOYMENT_CL_NAME_PREFIX.length()); final int earInfixPos = deploymentName.indexOf(EAR_INFIX); if (earInfixPos >= 0) { final String earName = deploymentName.substring(0, earInfixPos + EAR_INFIX.length() - 1); final String warName = deploymentName.substring(earInfixPos + EAR_INFIX.length()); return ServiceName.of("jboss", "deployment", "subunit", earName, warName, SERVICE_NAME); } else { return ServiceName.of("jboss", "deployment", "unit", deploymentName, SERVICE_NAME); } } else { throw new IllegalStateException(String.format("Expected a %s name ending with '%s'; found %s", ModuleClassLoader.class.getName(), WAR_SUFFIX, clName)); } } else { throw new IllegalStateException(String.format("Expected a %s name starting with '%s'; found %s", ModuleClassLoader.class.getName(), DEPLOYMENT_CL_NAME_PREFIX, clName)); } } else { throw new IllegalStateException( String.format("Expected a %s; found %s", ModuleClassLoader.class.getName(), deploymentClassLoader)); } }
Source:
<code><START> protected void initCommandsAndReturnValues(ArrayList<VdcReturnValueBase> returnValues) { <END> VdcReturnValueBase returnValue; for (VdcActionParametersBase parameter : getParameters()) { parameter.setMultipleAction(true); returnValue = ExecutionHandler.evaluateCorrelationId(parameter); if (returnValue == null) { CommandBase<?> command = isInternal ? CommandsFactory.createCommand(actionType, parameter, commandContext.clone() .withoutCompensationContext()) : CommandsFactory.createCommand(actionType, parameter); command.setInternalExecution(isInternal); getCommands().add(command); } else { returnValues.add(returnValue); } } }</code><technical_language>please this method private</technical_language>

Target:
private void initCommandsAndReturnValues(ArrayList<VdcReturnValueBase> returnValues) { VdcReturnValueBase returnValue; for (VdcActionParametersBase parameter : getParameters()) { parameter.setMultipleAction(true); returnValue = ExecutionHandler.evaluateCorrelationId(parameter); if (returnValue == null) { CommandBase<?> command = isInternal ? CommandsFactory.createCommand(actionType, parameter, commandContext.clone() .withoutCompensationContext()) : CommandsFactory.createCommand(actionType, parameter); command.setInternalExecution(isInternal); getCommands().add(command); } else { returnValues.add(returnValue); } } }
Source:
<code>void startConsumer() { if (topicPartitions2Offset.size() <= 0) { LOG.warn("Consumer is not subscribed to any SSPs", this); } topicPartitions2Offset.forEach((tp, startingOffsetString) -> { long startingOffset = Long.valueOf(startingOffsetString); try { synchronized (kafkaConsumer) { END_OFFSET kafkaConsumer.seek(tp, startingOffset); } } catch (Exception e) { <START> LOG.error("Got Exception while seeking to " + startingOffsetString + " for " + tp, e); <END> throw new SamzaException(e); } LOG.info("Changing consumer's starting offset for tp = " + tp + " to " + startingOffsetString); proxy.addTopicPartition(topicPartitions2SSP.get(tp), startingOffset); }); if (proxy != null && !proxy.isRunning()) { LOG.info("Starting proxy: " + proxy); proxy.start(); } }</code><technical_language>Log consumer ID for context. message in exception for traceability</technical_language>

Target:
void startConsumer() { if (topicPartitionsToOffset.size() <= 0) { LOG.error ("{}: Consumer is not subscribed to any SSPs", this); } topicPartitionsToOffset.forEach((tp, startingOffsetString) -> { long startingOffset = Long.valueOf(startingOffsetString); try { synchronized (kafkaConsumer) { kafkaConsumer.seek(tp, startingOffset); } } catch (Exception e) { String msg = String.format("%s: Got Exception while seeking to %s for partition %s", this, startingOffsetString, tp); LOG.error(msg, e); throw new SamzaException(msg, e); } LOG.info("{}: Changing consumer's starting offset for tp = %s to %s", this, tp, startingOffsetString); proxy.addTopicPartition(topicPartitionsToSSP.get(tp), startingOffset); }); if (proxy != null && !proxy.isRunning()) { LOG.info("{}: Starting proxy {}", this, proxy); proxy.start(); } }
Source:
<code>protected CommandBase(T parameters, CommandContext cmdContext) { if (cmdContext == null) { cmdContext = new CommandContext(new EngineContext().setSessionId(parameters.getSessionId())) <START> .setExecutionContext(new ExecutionContext()); <END> } this.context = cmdContext; _parameters = parameters; DbUser user = SessionDataContainer.getInstance().getUser(cmdContext.getEngineContext().getSessionId(), true); if (user != null) { setCurrentUser(user); } ExecutionContext executionContext = cmdContext.getExecutionContext(); if (executionContext.getJob() != null) { setJobId(executionContext.getJob().getId()); } else if (executionContext.getStep() != null) { setJobId(executionContext.getStep().getJobId()); } Guid commandIdFromParameters = parameters.getCommandId(); if (commandIdFromParameters == null) { commandIdFromParameters = Guid.newGuid(); getParameters().setCommandId(commandIdFromParameters); } commandId = commandIdFromParameters; taskHandlers = initTaskHandlers(); setCorrelationId(parameters.getCorrelationId()); }</code><technical_language>this is bit hard follow. extract EngineContext local variable: EngineContext engineContext = new EngineContext().withSessionId(parameters.getSessionId()); cmdContext = new CommandContext() .with(engineContext) .with(new ExecutionContext());</technical_language>

Target:
protected CommandBase(T parameters, CommandContext cmdContext) { if (cmdContext == null) { cmdContext = new CommandContext(new EngineContext().withSessionId(parameters.getSessionId())) .withExecutionContext(new ExecutionContext()); } this.context = cmdContext; _parameters = parameters; DbUser user = SessionDataContainer.getInstance().getUser(cmdContext.getEngineContext().getSessionId(), true); if (user != null) { setCurrentUser(user); } ExecutionContext executionContext = cmdContext.getExecutionContext(); if (executionContext.getJob() != null) { setJobId(executionContext.getJob().getId()); } else if (executionContext.getStep() != null) { setJobId(executionContext.getStep().getJobId()); } Guid commandIdFromParameters = parameters.getCommandId(); if (commandIdFromParameters == null) { commandIdFromParameters = Guid.newGuid(); getParameters().setCommandId(commandIdFromParameters); } commandId = commandIdFromParameters; taskHandlers = initTaskHandlers(); setCorrelationId(parameters.getCorrelationId()); }