auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void registerReceivers() { this.broadcastRegistrar = new BroadcastRegistrar(); this.broadcastRegistrar .addLocalAction(ConnectionService.ACTION_HOST_CONNECTED, new IBroadcastActionHandler() { @Override public void onReceiveAction(Context context, Intent intent) { joinView.setEnabled(true); joinView.findViewById(R.id.searching).setVisibility(View.INVISIBLE); Transitions.transitionToHome((CoreActivity)getActivity()); ((CoreActivity)getActivity()).enableSlidingMenu(); ((CoreActivity)getActivity()).showPlaybar(); } }) .addGlobalAction(BluetoothAdapter.ACTION_SCAN_MODE_CHANGED, new IBroadcastActionHandler() { @Override public void onReceiveAction(Context context, Intent intent) { int mode = intent.getIntExtra( BluetoothAdapter.EXTRA_SCAN_MODE, BluetoothAdapter.SCAN_MODE_NONE); if(joinView != null){ switch(mode){ <START> case BluetoothAdapter.SCAN_MODE_NONE: <END> isSearching = false; setJoinToDefaultState(); break; case BluetoothAdapter.SCAN_MODE_CONNECTABLE: isSearching = false; setJoinToDefaultState(); break; case BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE: isSearching = true; setJoinToSearchingState(); break; default: Log.wtf(TAG, "Recieved scan mode changed with unknown mode"); break; } } } }) .register(this.getActivity()); }</code><technical_language>If SCAN_MODE_NONE SCAN_MODE_CONNECTABLE code fall break</technical_language>

Target:
private void registerReceivers() { this.broadcastRegistrar = new BroadcastRegistrar(); this.broadcastRegistrar .addLocalAction(ConnectionService.ACTION_HOST_CONNECTED, new IBroadcastActionHandler() { @Override public void onReceiveAction(Context context, Intent intent) { joinView.setEnabled(true); joinView.findViewById(R.id.searching).setVisibility(View.INVISIBLE); Transitions.transitionToHome((CoreActivity)getActivity()); ((CoreActivity)getActivity()).enableSlidingMenu(); ((CoreActivity)getActivity()).showPlaybar(); } }) .addGlobalAction(BluetoothAdapter.ACTION_SCAN_MODE_CHANGED, new IBroadcastActionHandler() { @Override public void onReceiveAction(Context context, Intent intent) { int mode = intent.getIntExtra( BluetoothAdapter.EXTRA_SCAN_MODE, BluetoothAdapter.SCAN_MODE_NONE); if(joinView != null){ switch(mode){ case BluetoothAdapter.SCAN_MODE_NONE: case BluetoothAdapter.SCAN_MODE_CONNECTABLE: isSearching = false; setJoinToDefaultState(); break; case BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE: isSearching = true; setJoinToSearchingState(); break; default: Log.wtf(TAG, "Recieved scan mode changed with unknown mode"); break; } } } }) .register(this.getActivity()); }
Source:
<code>private RenderChunk getRenderChunkOffset(BlockPos playerPos, RenderChunk renderChunkBase, EnumFacing facing) { BlockPos blockpos = renderChunkBase.getBlockPosOffset16(facing); return MathHelper.abs(playerPos.getX() - blockpos.getX()) > this.renderDistanceChunks * Cube.SIZE ? null : MathHelper.abs(playerPos.getY() - blockpos.getY()) > this.renderDistanceChunks * Cube.SIZE ? null : <START> MathHelper.abs(playerPos.getZ() - blockpos.getZ()) > this.renderDistanceChunks * Cube.SIZE ? null : <END> this.viewFrustum.getRenderChunk(blockpos); }</code><technical_language>While removes a magic constant here, I this part allow for this changed. Rendering stay 16x16x16 bigger add noticeable delays. in mind. 32x32x32 cubes is changing a constant, need VANILLA_SIZE=16 SIZE=32, VANILLA_SIZE</technical_language>

Target:
private RenderChunk getRenderChunkOffset(BlockPos playerPos, RenderChunk renderChunkBase, EnumFacing facing) { BlockPos blockpos = renderChunkBase.getBlockPosOffset16(facing); return MathHelper.abs(playerPos.getX() - blockpos.getX()) > this.renderDistanceChunks * 16 ? null : MathHelper.abs(playerPos.getY() - blockpos.getY()) > this.renderDistanceChunks * 16 ? null : MathHelper.abs(playerPos.getZ() - blockpos.getZ()) > this.renderDistanceChunks * 16 ? null : this.viewFrustum.getRenderChunk(blockpos); }
Source:
<code>public void testInsert() throws Exception { <START> int key = UUID.randomUUID().hashCode(); <END> StatementProvider stmt = of("INSERT INTO " + TEST_DML_TABLE + "(_key, _val) VALUES (" + key + ", 0);"); assertAuthorizationFailed(stmt, EMPTY_PERMS_USER); assertAuthorizationFailed(stmt, CACHE_READ_USER); assertAuthorizationFailed(stmt, CACHE_REMOVE_USER); execute(stmt, CACHE_PUT_USER); }</code><technical_language>Key is related UUID (Random.nextInt() for random). in case static AtomicInteger (instead of UUID.randomUUID().hashCode() in class) increment key time, avoid collisions random keys</technical_language>

Target:
public void testInsert() throws Exception { int key = KEY_CNTR.getAndIncrement(); String sql = "INSERT INTO " + TEST_DML_TABLE + "(_key, _val) VALUES (" + key + ", 0);"; assertAuthorizationFailed(sql, EMPTY_PERMS_USER); assertAuthorizationFailed(sql, CACHE_READ_USER); assertAuthorizationFailed(sql, CACHE_REMOVE_USER); execute(sql, CACHE_PUT_USER); }
Source:
<code><START> public ArgumentSplitter(String arguments) { <END> this.arguments = arguments; }</code><technical_language>is point exposing this constructor if is a single public method. methods private (except for static, require a constructor used)</technical_language>

Target:
private ArgumentSplitter(String arguments) { this.arguments = arguments; }
Source:
<code>public Map<String, String> getprop() throws IOException, JadbException { BufferedReader bufferedReader = null; <START> try { <END> bufferedReader = new BufferedReader(new InputStreamReader(device.executeShell("getprop"))); return parseProp(bufferedReader); } finally { if (bufferedReader != null) { bufferedReader.close(); } } }</code><technical_language>try-with-resources please</technical_language>

Target:
public Map<String, String> getprop() throws IOException, JadbException { try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(device.executeShell("getprop")))) { return parseProp(bufferedReader); } }
Source:
<code>private List<GlusterVolumeEntity> getAllGlusterVolumesWithMasterCompatibleVersion(Guid masterVolumeId) { GlusterVolumeEntity masterVolume = getGlusterVolumeDao().getById(masterVolumeId); VDSGroup masterCluster = getVdsGroupDao().get(masterVolume.getClusterId()); List<VDSGroup> clusters = getVdsGroupDao().getClustersByServiceAndCompatibilityVersion(true, false, masterCluster.getcompatibility_version().getValue()); List<GlusterVolumeEntity> volumes = new ArrayList<GlusterVolumeEntity>(); if(clusters != null) { <START> for(VDSGroup currentCluster : clusters) { <END> volumes.addAll(getGlusterVolumeDao().getByClusterId(currentCluster.getId())); } } volumes.remove(masterVolume); return volumes; }</code><technical_language>filter out cluster master volume belongs too</technical_language>

Target:
private List<GlusterVolumeEntity> getAllGlusterVolumesWithMasterCompatibleVersion(Guid masterVolumeId) { GlusterVolumeEntity masterVolume = getGlusterVolumeDao().getById(masterVolumeId); VDSGroup masterCluster = getVdsGroupDao().get(masterVolume.getClusterId()); List<VDSGroup> clusters = getVdsGroupDao().getGeoRepEligibleVdsGroups(masterCluster.getId(), masterCluster.getcompatibility_version().getValue()); List<GlusterVolumeEntity> volumes = new ArrayList<GlusterVolumeEntity>(); if(clusters != null) { for(VDSGroup currentCluster : clusters) { volumes.addAll(getGlusterVolumeDao().getByClusterId(currentCluster.getId())); } } return volumes; }
Source:
<code>private Long determineImageInitialSize(Image sourceImage, VolumeFormat destFormat, Guid storagePoolId, Guid srcDomain, Guid dstDomain, Guid imageGroupID) { if (storageDomainDao.get(dstDomain).getStorageType().isBlockDomain() && Guid.Empty.equals(sourceImage.getParentId())) { MeasureVolumeParameters parameters = new MeasureVolumeParameters(storagePoolId, srcDomain, imageGroupID, sourceImage.getId(), destFormat.getValue()); parameters.setEndProcedure(EndProcedure.COMMAND_MANAGED); parameters.setParentCommand(getActionType()); ActionReturnValue actionReturnValue = runInternalAction(ActionType.MeasureVolume, parameters); if (!actionReturnValue.getSucceeded()) { throw new RuntimeException("Could not measure volume"); } return actionReturnValue.getActionReturnValue(); } if (imagesHandler.isInitialSizeSupportedForFormat(destFormat, dstDomain)) { DiskImage imageInfoFromStorage = imagesHandler.getVolumeInfoFromVdsm(storagePoolId, srcDomain, imageGroupID, sourceImage.getId()); return <START> imagesHandler.computeCowImageNeededSize(sourceImage.getVolumeFormat(), <END> imageInfoFromStorage.getActualSizeInBytes()); } return null; }</code><technical_language>computeCowImageNeededSize is static, ImagesHandler</technical_language>

Target:
private Long determineImageInitialSize(Image sourceImage, VolumeFormat destFormat, Guid storagePoolId, Guid srcDomain, Guid dstDomain, Guid imageGroupID) { if (storageDomainDao.get(dstDomain).getStorageType().isBlockDomain() && Guid.Empty.equals(sourceImage.getParentId())) { MeasureVolumeParameters parameters = new MeasureVolumeParameters(storagePoolId, srcDomain, imageGroupID, sourceImage.getId(), destFormat.getValue()); parameters.setEndProcedure(EndProcedure.COMMAND_MANAGED); parameters.setParentCommand(getActionType()); ActionReturnValue actionReturnValue = runInternalAction(ActionType.MeasureVolume, parameters); if (!actionReturnValue.getSucceeded()) { throw new RuntimeException("Could not measure volume"); } return actionReturnValue.getActionReturnValue(); } if (imagesHandler.isInitialSizeSupportedForFormat(destFormat, dstDomain)) { DiskImage imageInfoFromStorage = imagesHandler.getVolumeInfoFromVdsm(storagePoolId, srcDomain, imageGroupID, sourceImage.getId()); return ImagesHandler.computeCowImageNeededSize(sourceImage.getVolumeFormat(), imageInfoFromStorage.getActualSizeInBytes()); } return null; }
Source:
<code>private static boolean isLog4jOrSpringAssertNotNull(Symbol symbol) { Type ownerType = symbol.owner().type(); return (ownerType.is("org.apache.logging.log4j.core.util.Assert") && "requireNonNull".equals(symbol.name())) <START> || (ownerType.is("org.springframework.util.Assert") && "notNull".equals(symbol.name())); <END> }</code><technical_language>spring framework Assert class methods isNull() notEmpty() covered in opinion</technical_language>

Target:
private static boolean isLog4jOrSpringAssertNotNull(Symbol symbol) { Type ownerType = symbol.owner().type(); return (ownerType.is("org.apache.logging.log4j.core.util.Assert") && "requireNonNull".equals(symbol.name())) || (ownerType.is("org.springframework.util.Assert") && ("notNull".equals(symbol.name()) || "notEmpty".equals(symbol.name()))); }
Source:
<code>public List<Kind> nodesToVisit() { <START> return ImmutableList.of(Tree.Kind.CLASS); <END> }</code><technical_language>functional question : this check applied ENUM INTERFACE ANNOTATION_TYPE ? (which classTree)</technical_language>

Target:
public List<Kind> nodesToVisit() { return ImmutableList.of(Tree.Kind.CLASS, Tree.Kind.ENUM, Tree.Kind.ANNOTATION_TYPE); }
Source:
<code>private List<TopMenu.MenuItem> my(ProjectState allProjects) { List<TopMenu.MenuItem> my = new <START> ArrayList<TopMenu.MenuItem>(); <END> Config cfg = allProjects.getConfig(PREFERENCES, REFS_META_USER).get(); for (String subsection : cfg.getSubsections(MY)) { my.add(new TopMenu.MenuItem(subsection, my(cfg, subsection, KEY_URL, "#/"), my(cfg, subsection, KEY_TARGET, null), my(cfg, subsection, KEY_ID, null))); } if (my.isEmpty()) { my.add(new TopMenu.MenuItem("Changes", "#/", "")); my.add(new TopMenu.MenuItem("Drafts", "#/q/is:draft", "")); my.add(new TopMenu.MenuItem("Draft Comments", "#/q/has:draft", "")); my.add(new TopMenu.MenuItem("Watched Changes", "#/q/is:watched+is:open", "")); my.add(new TopMenu.MenuItem("Starred Changes", "#/q/is:starred", "")); } return my; }</code><technical_language>needed</technical_language>

Target:
private List<TopMenu.MenuItem> my(ProjectState allProjects) { List<TopMenu.MenuItem> my = new ArrayList<>(); Config cfg = allProjects.getConfig(PREFERENCES, REFS_META_USER).get(); for (String subsection : cfg.getSubsections(MY)) { my.add(new TopMenu.MenuItem(subsection, my(cfg, subsection, KEY_URL, "#/"), my(cfg, subsection, KEY_TARGET, null), my(cfg, subsection, KEY_ID, null))); } if (my.isEmpty()) { my.add(new TopMenu.MenuItem("Changes", "#/", "")); my.add(new TopMenu.MenuItem("Drafts", "#/q/is:draft", "")); my.add(new TopMenu.MenuItem("Draft Comments", "#/q/has:draft", "")); my.add(new TopMenu.MenuItem("Watched Changes", "#/q/is:watched+is:open", "")); my.add(new TopMenu.MenuItem("Starred Changes", "#/q/is:starred", "")); } return my; }
Source:
<code>public <K, V> TransactionContext<K, V> enlist(TransactionalRemoteCacheImpl<K, V> txRemoteCache, Transaction tx) { <START> SynchronizationAdapter adapter = registeredTransactions.computeIfAbsent(tx, this::createSynchronizationAdapter); <END> TransactionContext<K, V> context = adapter.registerCache(txRemoteCache); if (trace) { log.tracef("Xid=%s retrieving context: %s", adapter.xid, context); } return context; }</code><technical_language>bug uncached method references..</technical_language>

Target:
public <K, V> TransactionContext<K, V> enlist(TransactionalRemoteCacheImpl<K, V> txRemoteCache, Transaction tx) { SynchronizationAdapter adapter = registeredTransactions.computeIfAbsent(tx, constructor); TransactionContext<K, V> context = adapter.registerCache(txRemoteCache); if (trace) { log.tracef("Xid=%s retrieving context: %s", adapter.xid, context); } return context; }
Source:
<code>private void performDiskUpdate(final boolean unlockImage) { if (isMetaDataPropertiesChangedForDiskImage()) { updateMetaDataDescription((DiskImage) getNewDisk()); <START> } <END> final Disk disk = getDiskDao().get(getParameters().getDiskId()); applyUserChanges(disk); TransactionSupport.executeInNewTransaction(new TransactionMethod<Object>() { @Override public Object runInTransaction() { getVmStaticDAO().incrementDbGeneration(getVm().getId()); updateDeviceProperties(); getBaseDiskDao().update(disk); if (disk.getDiskStorageType() == DiskStorageType.IMAGE) { DiskImage diskImage = (DiskImage) disk; diskImage.setQuotaId(getQuotaId()); if (unlockImage && diskImage.getImageStatus() == ImageStatus.LOCKED) { diskImage.setImageStatus(ImageStatus.OK); } getImageDao().update(diskImage.getImage()); updateQuota(diskImage); updateDiskProfile(); } reloadDisks(); updateBootOrder(); setSucceeded(true); return null; } private void updateDeviceProperties() { if (updateReadOnlyRequested()) { vmDeviceForVm.setIsReadOnly(getNewDisk().getReadOnly()); getVmDeviceDao().update(vmDeviceForVm); } if (getOldDisk().getDiskInterface() != getNewDisk().getDiskInterface()) { getVmDeviceDao().clearDeviceAddress(getOldDisk().getId()); } } }); }</code><technical_language>this command executes vdsm call, disk locked in db</technical_language>

Target:
private void performDiskUpdate(final boolean unlockImage) { if (shouldPerformMetadataUpdate()) { updateMetaDataDescription((DiskImage) getNewDisk()); } final Disk disk = getDiskDao().get(getParameters().getDiskId()); applyUserChanges(disk); TransactionSupport.executeInNewTransaction(new TransactionMethod<Object>() { @Override public Object runInTransaction() { getVmStaticDAO().incrementDbGeneration(getVm().getId()); updateDeviceProperties(); getBaseDiskDao().update(disk); if (disk.getDiskStorageType() == DiskStorageType.IMAGE) { DiskImage diskImage = (DiskImage) disk; diskImage.setQuotaId(getQuotaId()); if (unlockImage && diskImage.getImageStatus() == ImageStatus.LOCKED) { diskImage.setImageStatus(ImageStatus.OK); } getImageDao().update(diskImage.getImage()); updateQuota(diskImage); updateDiskProfile(); } reloadDisks(); updateBootOrder(); setSucceeded(true); return null; } private void updateDeviceProperties() { if (updateReadOnlyRequested()) { vmDeviceForVm.setIsReadOnly(getNewDisk().getReadOnly()); getVmDeviceDao().update(vmDeviceForVm); } if (getOldDisk().getDiskInterface() != getNewDisk().getDiskInterface()) { getVmDeviceDao().clearDeviceAddress(getOldDisk().getId()); } } }); }
Source:
<code>@Override public void load(Request request, int networkPolicy, Callback callback) { try { InputStream is = getInputStream(request); if (is == null) { callback.onError(new IOException("no contact found")); } else { callback.onSuccess(new Result(Okio.source(is), DISK)); } } catch (Exception e) { <START> callback.onError(e); <END> } }</code><technical_language>if callback.onError() throws, this calls callback.onError(). need do separate call callback 1x. a signalledCallback in OkHttp solve this <LINK_0></technical_language>

Target:
@Override public void load(Request request, int networkPolicy, Callback callback) { boolean signaledCallback = false; try { InputStream is = getInputStream(request); if (is == null) { signaledCallback = true; callback.onError(new IOException("no contact found")); } else { signaledCallback = true; callback.onSuccess(new Result(Okio.source(is), DISK)); } } catch (Exception e) { if (!signaledCallback) { callback.onError(e); } } }
Source:
<code>public boolean isApplicableForMlx(CloudSubnet cloudSubnet) { return cloudSubnet.getType() == null || PUBLIC.equals(cloudSubnet.getType()) <START> || SubnetType.PRIVATE.equals(cloudSubnet.getType()) <END> || SubnetType.MLX.equals(cloudSubnet.getType()); }</code><technical_language>Nit: SubnetType. qualifier is needed anymore</technical_language>

Target:
public boolean isApplicableForMlx(CloudSubnet cloudSubnet) { return cloudSubnet.getType() == null || PUBLIC.equals(cloudSubnet.getType()) || PRIVATE.equals(cloudSubnet.getType()) || MLX.equals(cloudSubnet.getType()); }
Source:
<code>private List<AbstractNode> getPrecedingSiblings() { <START> final List<AbstractNode> siblings = new ArrayList<>(); <END> for (int i = positionAmongSiblings - 1; i >= 0; i--) { final AbstractNode preceding = parent.getChildren().get(i); siblings.add(preceding); } return siblings; }</code><technical_language>verfied, done</technical_language>

Target:
private List<AbstractNode> getPrecedingSiblings() { final List<AbstractNode> siblings = parent.getChildren(); return siblings.subList(0, indexAmongSiblings); }
Source:
<code>public int hashCode() { <START> return Objects.hash(storageDomainId, imageGroupId, baseImageId, topImageId, baseImageGeneration, baseImage, topImage); <END> }</code><technical_language>break this line please</technical_language>

Target:
public int hashCode() { return Objects.hash(storageDomainId, imageGroupId, baseImageGeneration, baseImage, topImage); }
Source:
<code>public BodyPart addPart(String mimeType, Object content) { if (content instanceof BodyPart) { try { Multipart multipart = getMultipart(); multipart.addBodyPart((BodyPart) content); } catch (Exception e) { setError(e); return null; } <START> return (BodyPart) content; <END> } return addPart(mimeType, content, Collections.<String, Object>emptyMap()); }</code><technical_language>put "if" in wrong method. put in specific method (the parameters) calling other method handle BodyPart input..</technical_language>

Target:
public BodyPart addPart(String mimeType, Object content) { return addPart(mimeType, content, Collections.<String, Object>emptyMap()); }
Source:
<code><START> public static TmfXmlScenarioHistoryBuilder getInstance() { <END> TmfXmlReadWriteScenarioHistoryBuilder instance = fInstance; if (instance == null) { instance = new TmfXmlReadWriteScenarioHistoryBuilder(); fInstance = instance; } return instance; }</code><technical_language>synchronized call this in factory</technical_language>

Target:
public static synchronized TmfXmlScenarioHistoryBuilder getInstance() { TmfXmlReadWriteScenarioHistoryBuilder instance = INSTANCE; if (instance == null) { instance = new TmfXmlReadWriteScenarioHistoryBuilder(); INSTANCE = instance; } return instance; }
Source:
<code>public String param(String key) { WebService.Param definition = action.param(key); String rawValue = readParam(key, definition); validateRequiredValue(key, definition, rawValue); <START> String valueOrDefault = defaultString(rawValue, definition.defaultValue()); <END> String value = valueOrDefault == null ? null : CharMatcher.WHITESPACE.trimFrom(valueOrDefault); if (value == null) { return null; } validatePossibleValues(key, value, definition); validateMaximumLength(key, definition, valueOrDefault); validateMinimumLength(key, definition, valueOrDefault); validateMaximumValue(key, definition, value); return value; }</code><technical_language>line 78</technical_language>

Target:
public String param(String key) { WebService.Param definition = action.param(key); String rawValue = readParam(key, definition); String rawValueOrDefault = defaultString(rawValue, definition.defaultValue()); String value = rawValueOrDefault == null ? null : CharMatcher.WHITESPACE.trimFrom(rawValueOrDefault); validateRequiredValue(key, definition, rawValue); if (value == null) { return null; } validatePossibleValues(key, value, definition); validateMaximumLength(key, definition, rawValueOrDefault); validateMinimumLength(key, definition, rawValueOrDefault); validateMaximumValue(key, definition, value); return value; }
Source:
<code>public StructField getStructField(String columnName) { <START> return DataTypes.createStructField(columnName, DataTypes.BinaryType, true); <END> }</code><technical_language>right DataTypes.BinaryType here. For native spark execution path, of defloat type fail for case: create table t1 (a1 decfloat, b1 int); create table t2 (a2 decfloat, b2 int); insert t1 values (3,3); insert t2 values (3,3); select * t1, t2 --splice-properties useSpark=true, joinStrategy=broadcast > a1=a2; ERROR SE001: Splice Engine exception: unexpected exception ERROR XJ001: Java exception: 'java.lang.RuntimeException: java.math.BigDecimal is a valid external type for schema of binary: java.io.IOException'. ERROR XJ001: Java exception: 'java.math.BigDecimal is a valid external type for schema of binary: java.lang.RuntimeException'</technical_language>

Target:
public StructField getStructField(String columnName) { return DataTypes.createStructField(columnName, DataTypes.StringType, true); }
Source:
<code>public void setPluginSettingsProperties(List<ConfigurationProperty> configurationProperties) { <START> settingsMap.addAll(configurationProperties); <END> }</code><technical_language>a set call, want settingsMap.clear() settingsMap.addAll(), effectively a addPluginSettingsProperties</technical_language>

Target:
public void setPluginSettingsProperties(List<ConfigurationProperty> configurationProperties) { settingsMap.clear(); settingsMap.addAll(configurationProperties); }
Source:
<code>public static int getAndroidVersionNumber() { if (sAndroidSdkVersion != null) { try { return Integer.parseInt(sAndroidSdkVersion); } catch (NumberFormatException ex) { log.warning("The android sdk version seems to be invalid: " + sAndroidSdkVersion); } } if (androidSdkFolder() != null) { String versionString = androidSdkFolder().getName(); log.info("Android SDK folder name is: " + versionString); <START> Pattern p = Pattern.compile("(android-)(\\d{2})"); <END> Matcher matcher = p.matcher(versionString); if (matcher.matches()) { return Integer.parseInt(matcher.group(2)); } else { log.warning("Could not parse Android SDK version number " + "from the sdk folder name !"); } } return -1; }</code><technical_language>PLATFORM_VERSION_REGEX instead of harcoded regex</technical_language>

Target:
public static int getAndroidVersionNumber() { if (androidSdkFolder() != null) { String versionString = androidSdkFolder().getName(); log.info("Android SDK folder name is: " + versionString); Pattern p = Pattern.compile(PLATFORM_VERSION_REGEX); Matcher matcher = p.matcher(versionString); if (matcher.matches()) { return Integer.parseInt(matcher.group(1)); } else { log.warning("Could not identify Android SDK version number " + "from the sdk folder name !"); } } throw new SelendroidException("Could not identify the Android SDK version number"); }
Source:
<code>public static Object safeEGet(EObject object, EStructuralFeature feature) { final EClass clazz = object.eClass(); if (clazz.getEPackage() == feature.getEContainingClass().getEPackage()) { return object.eGet(feature, false); } <START> EStructuralFeature clazzFeature = clazz.getEStructuralFeature(feature.getName()); <END> if (clazzFeature == null && object instanceof AnyType) { for (Entry entry : ((AnyType)object).getAnyAttribute()) { if (entry.getEStructuralFeature().getName().equals(feature.getName())) { return entry.getValue(); } } return feature.getDefaultValue(); } return object.eGet(clazzFeature, false); }</code><technical_language>final Btw, enabled checkstyle? pretty checkstyle complained save actions set final</technical_language>

Target:
public static Object safeEGet(EObject object, EStructuralFeature feature) { final EClass clazz = object.eClass(); if (clazz.getEPackage() == feature.getEContainingClass().getEPackage()) { return object.eGet(feature, false); } final EStructuralFeature clazzFeature = clazz.getEStructuralFeature(feature.getName()); if (clazzFeature == null && object instanceof AnyType) { for (Entry entry : ((AnyType)object).getAnyAttribute()) { if (entry.getEStructuralFeature().getName().equals(feature.getName())) { return entry.getValue(); } } return feature.getDefaultValue(); } return object.eGet(clazzFeature, false); }
Source:
<code>public AdminCommand create( Path homeDir, Path configDir, OutsideWorld outsideWorld ) { LogProvider logProvider = NullLogProvider.getInstance(); Monitors monitors = new Monitors(); OnlineBackupContextLoader onlineBackupContextLoader = new OnlineBackupContextLoader( new BackupCommandArgumentHandler(), new OnlineBackupCommandConfigLoader( homeDir, configDir ) ); BackupModuleResolveAtRuntime backupModuleResolveAtRuntime = new BackupModuleResolveAtRuntime( outsideWorld, logProvider, monitors ); return new OnlineBackupCommand( outsideWorld, onlineBackupContextLoader, <START> BackupSupportingClassesFactoryProvider.findBestProvider().get().getFactory( backupModuleResolveAtRuntime ), <END> new BackupFlowFactory( backupModuleResolveAtRuntime ) ); }</code><technical_language>If Optional returned findBestProvider present clearer explicitly throw exception if is not</technical_language>

Target:
public AdminCommand create( Path homeDir, Path configDir, OutsideWorld outsideWorld ) { LogProvider logProvider = NullLogProvider.getInstance(); Monitors monitors = new Monitors(); OnlineBackupContextLoader onlineBackupContextLoader = new OnlineBackupContextLoader( new BackupCommandArgumentHandler(), new OnlineBackupCommandConfigLoader( homeDir, configDir ) ); BackupModuleResolveAtRuntime backupModuleResolveAtRuntime = new BackupModuleResolveAtRuntime( outsideWorld, logProvider, monitors ); return new OnlineBackupCommand( outsideWorld, onlineBackupContextLoader, BackupSupportingClassesFactoryProvider.findBestProvider() .orElseThrow( noProviderException() ) .getFactory( backupModuleResolveAtRuntime ), new BackupFlowFactory( backupModuleResolveAtRuntime ) ); }
Source:
<code>private static void startNominatimImport(CommandLineArgs args, Server esServer, Client esNodeClient) { try { esServer.recreateIndex(); } catch (IOException e) { throw new RuntimeException("cannot setup index, elastic search config files not readable", e); } log.info("starting import from nominatim to photon with languages: " + args.getLanguages()); de.komoot.photon.elasticsearch.Importer importer = new de.komoot.photon.elasticsearch.Importer(esNodeClient, args.getLanguages()); NominatimConnector nominatimConnector = new NominatimConnector(args.getHost(), args.getPort(), args.getDatabase(), args.getUser(), args.getPassword()); nominatimConnector.setImporter(importer); try { nominatimConnector.readEntireDatabase(); } catch (Exception e) { <START> throw new RuntimeException("error importing from nominatim: " + e.getMessage()); <END> } log.info("imported data from nominatim to photon with languages: " + args.getLanguages()); }</code><technical_language>remove entire try-catch block. readEntireDatabase() throws RuntimeExceptions in place</technical_language>

Target:
private static void startNominatimImport(CommandLineArgs args, Server esServer, Client esNodeClient) { try { esServer.recreateIndex(); } catch (IOException e) { throw new RuntimeException("cannot setup index, elastic search config files not readable", e); } log.info("starting import from nominatim to photon with languages: " + args.getLanguages()); de.komoot.photon.elasticsearch.Importer importer = new de.komoot.photon.elasticsearch.Importer(esNodeClient, args.getLanguages()); NominatimConnector nominatimConnector = new NominatimConnector(args.getHost(), args.getPort(), args.getDatabase(), args.getUser(), args.getPassword()); nominatimConnector.setImporter(importer); nominatimConnector.readEntireDatabase(args.getCountryCodes().split(",")); log.info("imported data from nominatim to photon with languages: " + args.getLanguages()); }
Source:
<code>public void refresh(boolean fullRefresh, IProgressMonitor monitor) { try { monitor.beginTask("Refresh tree", 4); if (ctx.getModelAccessor().getPermissionAuthority().canEditInstance(container)) { <START> if (container != null && container.getTarget() != null) { ctx.getInterpreter().setVariable(IInterpreterSiriusVariables.CONTAINER_VIEW, container.eContainer()); ctx.getInterpreter().setVariable(IInterpreterSiriusVariables.CONTAINER, container.getTarget()); ctx.getInterpreter().setVariable(IInterpreterSiriusVariables.VIEW, container); } <END> MappingHiearchyTable hierarchy = new MappingHiearchyTable(); SignatureProvider signProvider = new TreeSignatureProvider(hierarchy); SemanticPartitionProvider semProvider = new SemanticPartitionProvider(this.ctx); final TreeMappingProvider provider = new TreeMappingProvider(semProvider); Iterable<Mapping> providedMappings = Iterables.transform(mappings, new Function<TreeItemMapping, Mapping>() { public Mapping apply(TreeItemMapping from) { return provider.getOrCreate(from); } }); monitor.worked(1); hierarchy.compute(Lists.newArrayList(providedMappings)); monitor.worked(1); DTreePreRefreshStatus pre = new DTreePreRefreshStatus(ctx, provider); ModelToModelSynchronizer refresher = new ModelToModelSynchronizer(this.invalidator, hierarchy, pre, signProvider); CreatedOutput cDiag = buildOutput(provider); monitor.worked(1); refresher.update(cDiag, fullRefresh); monitor.worked(1); } } finally { if (container != null) { ctx.getInterpreter().unSetVariable(IInterpreterSiriusVariables.CONTAINER_VIEW); ctx.getInterpreter().unSetVariable(IInterpreterSiriusVariables.CONTAINER); ctx.getInterpreter().unSetVariable(IInterpreterSiriusVariables.VIEW); } monitor.done(); } }</code><technical_language>Initalize container containerView for Tree refresh.. tree semantic target container. . Wrong values for tree items (all levels) . variables expected for precontiion titles expressions of a TreeDescription</technical_language>

Target:
public void refresh(boolean fullRefresh, IProgressMonitor monitor) { try { monitor.beginTask("Refresh tree", 4); if (ctx.getModelAccessor().getPermissionAuthority().canEditInstance(container)) { MappingHiearchyTable hierarchy = new MappingHiearchyTable(); SignatureProvider signProvider = new TreeSignatureProvider(hierarchy); SemanticPartitionProvider semProvider = new SemanticPartitionProvider(this.ctx); final TreeMappingProvider provider = new TreeMappingProvider(semProvider); Iterable<Mapping> providedMappings = Iterables.transform(mappings, new Function<TreeItemMapping, Mapping>() { public Mapping apply(TreeItemMapping from) { return provider.getOrCreate(from); } }); monitor.worked(1); hierarchy.compute(Lists.newArrayList(providedMappings)); monitor.worked(1); DTreePreRefreshStatus pre = new DTreePreRefreshStatus(ctx, provider); ModelToModelSynchronizer refresher = new ModelToModelSynchronizer(this.invalidator, hierarchy, pre, signProvider); CreatedOutput cDiag = buildOutput(provider); monitor.worked(1); refresher.update(cDiag, fullRefresh); monitor.worked(1); } } finally { monitor.done(); } }
Source:
<code>public void testParceling() { RouteInfo r; r = new RouteInfo(Prefix("::/0"), Address("2001:db8::"), null); assertParcelingIsLossless(r); r = new RouteInfo(Prefix("192.0.2.0/24"), null, "wlan0"); <START> assertParcelingIsLossless(r); <END> }</code><technical_language>assertParcelSane</technical_language>

Target:
public void testParceling() { RouteInfo r; r = new RouteInfo(Prefix("::/0"), Address("2001:db8::"), null); assertParcelingIsLossless(r); r = new RouteInfo(Prefix("192.0.2.0/24"), null, "wlan0"); assertParcelSane(r, 6); }
Source:
<code>public void assertNotNull(AssertionInfo info, Object actual, String label) { <START> if (actual != null) { <END> return; } throw failures.failure(info, ShouldNotBeNull.of(label)); }</code><technical_language>code lighter, invert condition throw failure: if (actual != null) throw failures.failure(info, ShouldNotBeNull.of(label));</technical_language>

Target:
public void assertNotNull(AssertionInfo info, Object actual, String label) { if (actual == null) { throw failures.failure(info, shouldNotBeNull(label)); } }
Source:
<code><START> public void setFieldNames(String header) throws FormattedException <END> { try { setFieldNames(splitter.split(header)); } catch (Exception e) { Throwables.propagateIfInstanceOf(e, FormattedException.class); throw new FormattedException.Builder() .withErrorCode(FormattedException.ErrorCode.UNPARSABLE_HEADER) .withMessage(e.getMessage()) .build(); } }</code><technical_language>FormattedException is a runtime exception, need declare it</technical_language>

Target:
public void setFieldNames(String header) { try { setFieldNames(splitter.split(header)); } catch (Exception e) { Throwables.propagateIfInstanceOf(e, FormattedException.class); throw new FormattedException.Builder() .withErrorCode(FormattedException.ErrorCode.UNPARSABLE_HEADER) .withMessage(e.getMessage()) .build(); } }
Source:
<code>public PCollection<IndexedRecord> expand(PBegin in) { ElasticsearchIO.Read esRead = ElasticsearchIO.read() .withConnectionConfiguration(createConnectionConf(properties.getDatasetProperties())); if (properties.query.getValue() != null) { esRead = esRead.withQuery(properties.query.getValue()); } PCollection<String> readFromElasticsearch = in.apply("ReadFromElasticsearch", esRead); PCollection<GenericRecord> elasticsearchDataAsAvro = readFromElasticsearch.apply("ElasticsearchDataAsAvro", ParDo.of(new DoFn<String, GenericRecord>() { @ProcessElement public void processElement(ProcessContext c) { if (jsonGenericRecordConverter == null) { JsonSchemaInferrer jsonSchemaInferrer = new JsonSchemaInferrer(new ObjectMapper()); Schema jsonSchema = jsonSchemaInferrer.inferSchema(c.element().toString()); jsonGenericRecordConverter = new JsonGenericRecordConverter(jsonSchema); } GenericRecord outputRecord = jsonGenericRecordConverter.convertToAvro(c.element().toString()); c.output(outputRecord); } })); <START> return elasticsearchDataAsAvro.apply(ConvertToIndexedRecord.<GenericRecord>of()); <END> }</code><technical_language>ConvertToIndexedRecord.<GenericRecord>of() is unnecessary if a PCollection of ? extends IndexedRecord! If get java generics errors, PCollection<IndexedRecord> elasticsearchDataAsAvro</technical_language>

Target:
public PCollection<IndexedRecord> expand(PBegin in) { ElasticsearchIO.Read esRead = ElasticsearchIO.read() .withConnectionConfiguration(createConnectionConf(properties.getDatasetProperties())); if (properties.query.getValue() != null) { esRead = esRead.withQuery(properties.query.getValue()); } PCollection<String> readFromElasticsearch = in.apply("ReadFromElasticsearch", esRead); PCollection<IndexedRecord> elasticsearchDataAsAvro = readFromElasticsearch.apply("ElasticsearchDataAsAvro", ParDo.of(new DoFn<String, IndexedRecord>() { @ProcessElement public void processElement(ProcessContext c) { if (jsonGenericRecordConverter == null) { JsonSchemaInferrer jsonSchemaInferrer = new JsonSchemaInferrer(new ObjectMapper()); Schema jsonSchema = jsonSchemaInferrer.inferSchema(c.element().toString()); jsonGenericRecordConverter = new JsonGenericRecordConverter(jsonSchema); } GenericRecord outputRecord = jsonGenericRecordConverter.convertToAvro(c.element().toString()); c.output(outputRecord); } })); return elasticsearchDataAsAvro; }
Source:
<code>private Enum reverseLookup(Class enumClass, String enumValue) { try { Method reverseLookupMethod = enumClass.getMethod("reverseLookup", String.class); <START> if (reverseLookupMethod != null) { <END> Enum e = (Enum) reverseLookupMethod.invoke(null, enumValue); return e; } } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e1) { } return null; }</code><technical_language>I suppose null check is irrelevant, getMethod thrown exception a missing method already</technical_language>

Target:
private Enum reverseLookup(Class enumClass, String enumValue) { try { Method reverseLookupMethod = enumClass.getMethod("reverseLookup", String.class); Enum e = (Enum) reverseLookupMethod.invoke(null, enumValue); return e; } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e1) { } return null; }
Source:
<code>public String getStateTypeName(ITimeGraphEntry entry) { if (entry instanceof TimeGraphEntry) { <START> ITimeGraphEntryModel model = ((TimeGraphEntry) entry).getModel(); <END> if (model instanceof TraceEntryModel) { return Messages.TraceEntry_StateTypeName; } else if (model instanceof ModuleEntryModel) { return Messages.ModuleEntry_StateTypeName; } else if (model instanceof StateSystemEntryModel) { return Messages.StateSystemEntry_StateTypeName; } } return Messages.AttributeEntry_StateTypeName; }</code><technical_language>deprecated, this ITmfTreeDataModel model = ((TimeGraphEntry) entry).getEntryModel();</technical_language>

Target:
public String getStateTypeName(ITimeGraphEntry entry) { if (entry instanceof TimeGraphEntry) { ITmfTreeDataModel model = ((TimeGraphEntry) entry).getEntryModel(); if (model instanceof TraceEntryModel) { return Messages.TraceEntry_StateTypeName; } else if (model instanceof ModuleEntryModel) { return Messages.ModuleEntry_StateTypeName; } else if (model instanceof StateSystemEntryModel) { return Messages.StateSystemEntry_StateTypeName; } } return Messages.AttributeEntry_StateTypeName; }
Source:
<code>public void addDecoration(final DDiagramElement element, final DecorationDescription decorationDescription) { for (final Decoration decoration : new <START> ArrayList<Decoration>(element.getDecorations())) <END> { if (EcoreUtil.equals(decorationDescription, decoration.getDescription())) { return; } } if (checkDecoratorPrecondition(element.getTarget(), (DSemanticDecorator) element.eContainer(), decorationDescription)) { final Decoration decoration = ViewpointFactory.eINSTANCE.createDecoration(); decoration.setDescription(decorationDescription); if (decorationDescription.eContainer().eContainer() instanceof TransientLayer) { element.getTransientDecorations().add(decoration); } else { element.getDecorations().add(decoration); } } }</code><technical_language>i guess test getTransientDecorations</technical_language>

Target:
public void addDecoration(final DDiagramElement element, final DecorationDescription decorationDescription) { for (final Decoration decoration : new ArrayList<Decoration>(element.getDecorations())) { if (EcoreUtil.equals(decorationDescription, decoration.getDescription())) { return; } } for (final Decoration decoration : new ArrayList<Decoration>(element.getTransientDecorations())) { if (EcoreUtil.equals(decorationDescription, decoration.getDescription())) { return; } } if (checkDecoratorPrecondition(element.getTarget(), (DSemanticDecorator) element.eContainer(), decorationDescription)) { final Decoration decoration = ViewpointFactory.eINSTANCE.createDecoration(); decoration.setDescription(decorationDescription); if (decorationDescription.eContainer().eContainer() instanceof TransientLayer) { element.getTransientDecorations().add(decoration); } else { element.getDecorations().add(decoration); } } }
Source:
<code>private String getRawFormatDisksWithBackupEnabled() { Snapshot snapshot = getSelectedItem(); List<Snapshot> snapshots = (List<Snapshot>) <START> getItems(); <END> int snapshotIndex = snapshots.indexOf(snapshot); Snapshot parentSnapshot = snapshots.get(snapshotIndex - 1); List<Guid> backupEnabledDisksIds = snapshotsMap.get(parentSnapshot.getId()).getDisks() .stream() .filter(diskImage -> diskImage.getBackup().equals(DiskBackup.Incremental)) .map(DiskImage::getId) .collect(Collectors.toList()); if (backupEnabledDisksIds.isEmpty()) { return null; } String diskList = snapshotsMap.get(snapshot.getId()).getDisks() .stream() .filter(diskImage -> backupEnabledDisksIds.contains(diskImage.getId())) .filter(diskImage -> diskImage.getVolumeFormat() == VolumeFormat.RAW) .map(DiskImage::getName) .collect(Collectors.joining(", ")); return diskList.isEmpty() ? null : diskList; }</code><technical_language>getItems() null</technical_language>

Target:
private String getRawFormatDisksWithBackupEnabled() { Snapshot snapshot = getSelectedItem(); List<Snapshot> snapshots = (List<Snapshot>) getItems(); int snapshotIndex = snapshots.indexOf(snapshot); Snapshot parentSnapshot = snapshots.get(snapshotIndex - 1); List<Guid> backupEnabledDisksIds = snapshotsMap.get(parentSnapshot.getId()).getDisks() .stream() .filter(diskImage -> diskImage.getBackup().equals(DiskBackup.Incremental)) .map(DiskImage::getId) .collect(Collectors.toList()); if (backupEnabledDisksIds.isEmpty()) { return ""; } return snapshotsMap.get(snapshot.getId()).getDisks() .stream() .filter(diskImage -> backupEnabledDisksIds.contains(diskImage.getId())) .filter(diskImage -> diskImage.getVolumeFormat() == VolumeFormat.RAW) .map(DiskImage::getName) .collect(Collectors.joining(", ")); }
Source:
<code>private void createWorkspace(String organizationName, String workspaceName) { dashboard.selectWorkspacesItemOnDashboard(); dashboard.waitToolbarTitleName("Workspaces"); workspaces.clickOnAddWorkspaceBtn(); newWorkspace.waitToolbar(); newWorkspace.openOrganizationsList(); newWorkspace.selectOrganizationFromList(organizationName); newWorkspace.selectStack(JAVA.getId()); newWorkspace.typeWorkspaceName(workspaceName); newWorkspace.clickOnCreateButtonAndEditWorkspace(); <START> WaitUtils.sleepQuietly(2); <END> }</code><technical_language>IMHO checking if workspace list is opened explicitly is more reliable sleeping 2 seconds in hope opened workspace list time</technical_language>

Target:
private void createWorkspace(String organizationName, String workspaceName) { dashboard.selectWorkspacesItemOnDashboard(); dashboard.waitToolbarTitleName("Workspaces"); workspaces.clickOnAddWorkspaceBtn(); newWorkspace.waitToolbar(); newWorkspace.openOrganizationsList(); newWorkspace.selectOrganizationFromList(organizationName); newWorkspace.selectStack(JAVA.getId()); newWorkspace.typeWorkspaceName(workspaceName); newWorkspace.clickOnCreateButtonAndEditWorkspace(); try { workspaceDetails.waitToolbarTitleName(workspaceName); } catch (TimeoutException ex) { fail("Known issue <LINK_0>"); } }
Source:
<code><START> public Value setCallbackOperation( Value request ) { <END> operationName = request.getFirstChild( "operationName" ).strValue(); return Value.create(); }</code><technical_language>void return type</technical_language>

Target:
public void setCallbackOperation( Value request ) { operationName = request.getFirstChild( "operationName" ).strValue(); }
Source:
<code>public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; if (!FiltersHelper.isAuthenticated(req)) { String headerValue = req.getHeader("Authorization"); if (headerValue != null && headerValue.startsWith("Basic ")) { String[] creds = null; try { creds = new String( Base64.decodeBase64(headerValue.substring("Basic".length())), Charset.forName("UTF-8") ).split(":", 2); <START> } catch (Throwable th) { <END> log.error("Error in decoding ", th); } if (creds != null && creds.length == 2) { handleCredentials(req, creds[0], creds[1]); } else { log.error("Error in parsing basic authorization information"); } } } chain.doFilter(request, response); }</code><technical_language>juan suggest catch Exception for Throwable catch class such</technical_language>

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; if (!FiltersHelper.isAuthenticated(req)) { String headerValue = req.getHeader("Authorization"); if (headerValue != null && headerValue.startsWith("Basic ")) { String[] creds = new String( Base64.decodeBase64(headerValue.substring("Basic".length())), Charset.forName("UTF-8") ).split(":", 2); if (creds != null && creds.length == 2) { handleCredentials(req, creds[0], creds[1]); } else { log.error("Error in parsing basic authorization information"); } } } chain.doFilter(request, response); }
Source:
<code><START> public void init(String param, ClassLoader classLoader) { <END> PropertyHelper.setProperties(this, Utils.parseParams(param), false, false); try { clazz = classLoader.loadClass(this.clazzName); Class<?>[] params = new Class<?>[numInts]; fields = new Field[numInts]; for (int i = 0; i < params.length; ++i) { params[i] = int.class; fields[i] = clazz.getDeclaredField("int" + i); fields[i].setAccessible(true); } ctor = clazz.getConstructor(params); } catch (Exception e) { throw new IllegalStateException(e); } }</code><technical_language>long missing anything, reasonable add a check min <= max throw exception if eventually</technical_language>

Target:
public void init(String param, ClassLoader classLoader) { PropertyHelper.setProperties(this, Utils.parseParams(param), false, false); if (max > min) throw new IllegalArgumentException(String.format("min (%d) must be <= max (%d)", min, max)); try { clazz = classLoader.loadClass(this.clazzName); Class<?>[] params = new Class<?>[numInts]; fields = new Field[numInts]; for (int i = 0; i < params.length; ++i) { params[i] = int.class; fields[i] = clazz.getDeclaredField("int" + i); fields[i].setAccessible(true); } ctor = clazz.getConstructor(params); } catch (Exception e) { throw new IllegalArgumentException(e); } }
Source:
<code>public static void registerAlias(String name, Enchantment enchantment) { <START> if(ENCHANTMENTS.containsKey(name) || ALIASENCHANTMENTS.containsKey(name) || !ENCHANTMENTS.containsValue(enchantment)) return; <END> ALIASENCHANTMENTS.put(name, enchantment); }</code><technical_language>suggestion if (ENCHANTMENTS.containsKey(name) || ALIASENCHANTMENTS.containsKey(name) || !ENCHANTMENTS.containsValue(enchantment)) { return; }</technical_language>

Target:
public static void registerAlias(String name, Enchantment enchantment) { if (ENCHANTMENTS.containsKey(name) || ALIASENCHANTMENTS.containsKey(name) || !ENCHANTMENTS.containsValue(enchantment)) { return; } ALIASENCHANTMENTS.put(name, enchantment); }
Source:
<code>public CompletableFuture<Object> invokeAsync() throws Throwable { RemoteTxInvocationContext ctx = createContext(); if (ctx == null) { return CompletableFutures.completedNull(); } if (trace) log.tracef("Invoking remotely originated prepare: %s with invocation context: %s", this, ctx); CompletionStage<Void> stage = null; if (notifier.hasListener(TransactionRegistered.class)) { <START> stage = notifier.notifyTransactionRegistered(ctx.getGlobalTransaction(), false); <END> } if (stage == null || CompletionStages.isComplete(stage)) { return invoker.invokeAsync(ctx, this); } else { return stage.thenCompose(v -> invoker.invokeAsync(ctx, this)).toCompletableFuture(); } }</code><technical_language>notifyTransactionRegistered checks for registered listeners work, remove hasListener check additional work before</technical_language>

Target:
public CompletableFuture<Object> invokeAsync() throws Throwable { RemoteTxInvocationContext ctx = createContext(); if (ctx == null) { return CompletableFutures.completedNull(); } if (trace) log.tracef("Invoking remotely originated prepare: %s with invocation context: %s", this, ctx); CompletionStage<Void> stage = notifier.notifyTransactionRegistered(ctx.getGlobalTransaction(), false); if (CompletionStages.isCompletedSuccessfully(stage)) { return invoker.invokeAsync(ctx, this); } else { return stage.thenCompose(v -> invoker.invokeAsync(ctx, this)).toCompletableFuture(); } }