auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static DataPartition[] createPartitions(DFUFilePartWrapper[] dfuparts, ClusterRemapper clusterremapper, int max_parts, FileFilter filter, String fileAccessBlob, FileType fileType) throws HpccFileException { DataPartition[] rslt = new DataPartition[dfuparts.length]; try { for (int i = 0; i < dfuparts.length; i++) { int numCopies = dfuparts[i].getCopies().length; String[] copyPaths = new String[numCopies]; for (int j = 0; j < numCopies; j++) { copyPaths[j] = dfuparts[i].getCopies()[j].getCopyPath(); } DataPartition new_dp = new DataPartition(clusterremapper.reviseIPs(dfuparts[i].getCopies()), copyPaths, dfuparts[i].getPartIndex(), dfuparts.length, clusterremapper.revisePort(null), clusterremapper.getUsesSSLConnection(null), filter, fileAccessBlob, fileType); <START> new_dp.isTLK = dfuparts[i].getKind() == DFUFilePartWrapper.FilePartKind.TLK; <END> rslt[i] = new_dp; } } catch (Exception e) { throw new HpccFileException("Could not create DataPartition!\n" + e.getMessage()); } return rslt; }</code><technical_language>offline discussion, istlk() based this change: <LINK_0></technical_language>

Target:
public static DataPartition[] createPartitions(DFUFilePartWrapper[] dfuparts, ClusterRemapper clusterremapper, int max_parts, FileFilter filter, String fileAccessBlob, FileType fileType) throws HpccFileException { DataPartition[] rslt = new DataPartition[dfuparts.length]; try { for (int i = 0; i < dfuparts.length; i++) { int numCopies = dfuparts[i].getCopies().length; String[] copyPaths = new String[numCopies]; for (int j = 0; j < numCopies; j++) { copyPaths[j] = dfuparts[i].getCopies()[j].getCopyPath(); } DataPartition new_dp = new DataPartition(clusterremapper.reviseIPs(dfuparts[i].getCopies()), copyPaths, dfuparts[i].getPartIndex(), dfuparts.length, clusterremapper.revisePort(null), clusterremapper.getUsesSSLConnection(null), filter, fileAccessBlob, fileType); new_dp.isTLK = dfuparts[i].isTopLevelKey(); rslt[i] = new_dp; } } catch (Exception e) { throw new HpccFileException("Could not create DataPartition!\n" + e.getMessage()); } return rslt; }
Source:
<code>protected SoftwareDescription(int id, @Nullable String longDescription, @Nullable String manufacturer, @Nullable String name, int operatingSystem, @Nullable String referenceCode, @Nullable String requiredUser, @Nullable String version, int controlPanel, @Nullable String upgradeSoftwareDescriptionId, @Nullable String upgradeSwDescId, @Nullable String virtualLicense, @Nullable String virtualizationPlatform) { <START> this.id = checkNotNull(id, "id"); <END> this.longDescription = longDescription; this.manufacturer = manufacturer; this.name = name; this.operatingSystem = operatingSystem; this.referenceCode = referenceCode; this.requiredUser = requiredUser; this.version = version; this.controlPanel = controlPanel; this.upgradeSoftwareDescriptionId = upgradeSoftwareDescriptionId; this.upgradeSwDescId = upgradeSwDescId; this.virtualLicense = virtualLicense; this.virtualizationPlatform = virtualizationPlatform; }</code><technical_language>need check for null in primitives</technical_language>

Target:
protected SoftwareDescription(int id, @Nullable String longDescription, @Nullable String manufacturer, @Nullable String name, int operatingSystem, @Nullable String referenceCode, @Nullable String requiredUser, @Nullable String version, int controlPanel, @Nullable String upgradeSoftwareDescriptionId, @Nullable String upgradeSwDescId, @Nullable String virtualLicense, @Nullable String virtualizationPlatform) { this.id = id; this.longDescription = longDescription; this.manufacturer = manufacturer; this.name = name; this.operatingSystem = operatingSystem; this.referenceCode = referenceCode; this.requiredUser = requiredUser; this.version = version; this.controlPanel = controlPanel; this.upgradeSoftwareDescriptionId = upgradeSoftwareDescriptionId; this.upgradeSwDescId = upgradeSwDescId; this.virtualLicense = virtualLicense; this.virtualizationPlatform = virtualizationPlatform; }
Source:
<code>public void install() { Maybe<Object> url = getEntity().getConfigRaw(SoftwareProcess.DOWNLOAD_URL, true); if (url.isPresentAndNonNull()) { DownloadResolver resolver = Entities.newDownloader(this); List<String> urls = resolver.getTargets(); downloadedFilename = resolver.getFilename(); List<String> commands = new LinkedList<String>(); commands.addAll(BashCommands.commandsToDownloadUrlsAs(urls, downloadedFilename)); commands.addAll(ArchiveUtils.installCommands(downloadedFilename)); int result = newScript(INSTALLING) .failOnNonZeroResultCode(false) .body.append(commands) .execute(); if (result!=0) { for (String urlI: urls) { result = ArchiveUtils.install(getMachine(), urlI, Urls.mergePaths(getInstallDir(), downloadedFilename)); if (result==0) break; } if (result != 0) throw new IllegalStateException("Error installing archive: " + downloadedFilename); } } <START> else { <END> String installCommand = getEntity().getConfig(VanillaSoftwareProcess.INSTALL_COMMAND); if (!StringUtils.isBlank(installCommand)) { newScript(INSTALLING) .failOnNonZeroResultCode() .body.append(installCommand) .execute(); } } }</code><technical_language>'else'? i do this</technical_language>

Target:
public void install() { Maybe<Object> url = getEntity().getConfigRaw(SoftwareProcess.DOWNLOAD_URL, true); if (url.isPresentAndNonNull()) { DownloadResolver resolver = Entities.newDownloader(this); List<String> urls = resolver.getTargets(); downloadedFilename = resolver.getFilename(); List<String> commands = new LinkedList<String>(); commands.addAll(BashCommands.commandsToDownloadUrlsAs(urls, downloadedFilename)); commands.addAll(ArchiveUtils.installCommands(downloadedFilename)); int result = newScript(INSTALLING) .failOnNonZeroResultCode(false) .body.append(commands) .execute(); if (result!=0) { for (String urlI: urls) { result = ArchiveUtils.install(getMachine(), urlI, Urls.mergePaths(getInstallDir(), downloadedFilename)); if (result==0) break; } if (result != 0) throw new IllegalStateException("Error installing archive: " + downloadedFilename); } } String installCommand = getEntity().getConfig(VanillaSoftwareProcess.INSTALL_COMMAND); if (Strings.isNonBlank(installCommand)) { newScript(INSTALLING) .failOnNonZeroResultCode() .body.append(installCommand) .execute(); } }
Source:
<code>private static void gotoRank(IEditorPart editor, int rank) { IEditorInput editorInput = editor.getEditorInput(); if (editorInput instanceof IFileEditorInput) { IFile file = ((IFileEditorInput) editorInput).getFile(); try { final IMarker marker = file.createMarker(IMarker.MARKER); marker.setAttribute(IMarker.LOCATION, (Integer) rank); IDE.gotoMarker(editor, marker); marker.delete(); } catch (CoreException e) { <START> GdbTraceCorePlugin.logError(CORE_EXCEPTION, e); <END> } } }</code><technical_language>e.getMessage()</technical_language>

Target:
private static void gotoRank(IEditorPart editor, int rank) { IEditorInput editorInput = editor.getEditorInput(); if (editorInput instanceof IFileEditorInput) { IFile file = ((IFileEditorInput) editorInput).getFile(); try { final IMarker marker = file.createMarker(IMarker.MARKER); marker.setAttribute(IMarker.LOCATION, (Integer) rank); IDE.gotoMarker(editor, marker); marker.delete(); } catch (CoreException e) { GdbTraceCorePlugin.logError(e.getMessage(), e); } } }
Source:
<code>public static DebugTarget createDebugTarget(String name, EObject context) { final DebugTarget res = DebugPackage.eINSTANCE.getDebugFactory().createDebugTarget(); if (name == null) { <START> throw new IllegalArgumentException("the debug target name can't be null."); <END> } if (context == null) { throw new IllegalArgumentException("the debug target context can't be null."); } res.setName(name); res.setContext(context); res.setState(DebugTargetState.CONNECTED); return res; }</code><technical_language>necessary fixed, NullPointerExceptions, shortened res.setName(Objects.requireNotNull(name))</technical_language>

Target:
public static DebugTarget createDebugTarget(String name, EObject context) { final DebugTarget res = DebugPackage.eINSTANCE.getDebugFactory().createDebugTarget(); Objects.requireNonNull(name, "the debug target name can't be null."); Objects.requireNonNull(context, "the debug target context can't be null."); res.setName(name); res.setContext(context); res.setState(DebugTargetState.CONNECTED); return res; }
Source:
<code>public Map<String, Object> values() { return values.entrySet() .stream() <START> .filter(e -> !isNonbinding(e.getKey())) <END> .collect(toMap(Map.Entry::getKey, Map.Entry::getValue)); }</code><technical_language>before: logic of filtering out NonBinding attributes external this implementation</technical_language>

Target:
public Map<String, Object> values() { return Collections.unmodifiableMap(values); }
Source:
<code>public void onReceive(Context context, Intent intent) { Utils.setContext(context); if (intent != null && intent.getAction() != null) { if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) { Intent serviceStart = new Intent(context, EncryptionService.class); context.startService(serviceStart); <START> } else { <END> String pin = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER); if (pin != null && !pin.isEmpty() && PinManager.get().hasPin() && HomeActivity.launch(context, pin)) { setResultData(null); } } } }</code><technical_language>Run formatter</technical_language>

Target:
public void onReceive(Context context, Intent intent) { Utils.setContext(context); if (intent != null && intent.getAction() != null) { if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) { Intent serviceStart = new Intent(context, EncryptionService.class); context.startService(serviceStart); } else { String pin = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER); if (LaunchManager.isDialerEnabled() && DialerManager.getLaunchCode().equals(pin)) { PinActivity.launch(context); setResultData(null); } } } }
Source:
<code>public BuildImageParams withFiles(@NotNull File... files) { requireNonNull(files); requireNonEmptyArray(files); <START> if (remote != null) { <END> throw new IllegalStateException("Remote parameter is already set. Remote and files parameters are mutually exclusive."); } this.files = new ArrayList<>(files.length + 1); return addFiles(files); }</code><technical_language>I this check performed previous checks</technical_language>

Target:
public BuildImageParams withFiles(@NotNull File... files) { if (remote != null) { throw new IllegalStateException("Remote parameter is already set. Remote and files parameters are mutually exclusive."); } requireNonNull(files); requireNonEmptyArray(files); this.files = new ArrayList<>(files.length + 1); return addFiles(files); }
Source:
<code>public Config buildCoordinatorStreamConfig(Config config) { JobConfig jobConfig = new JobConfig(config); <START> String jobName = jobConfig.getName().toString(); <END> String jobId = jobConfig.getJobId(); Map<String, String> map = config.subset(String.format(SystemConfig.SYSTEM_ID_PREFIX, jobConfig.getCoordinatorSystemName()), false); Map<String, String> addConfig = new HashMap<>(); addConfig.put(JobConfig.JOB_NAME, jobName); addConfig.put(jobConfig.JOB_ID, jobId); addConfig.put(JobConfig.JOB_COORDINATOR_SYSTEM, jobConfig.getCoordinatorSystemName()); addConfig.put(jobConfig.MONITOR_PARTITION_CHANGE_FREQUENCY_MS, String.valueOf(jobConfig.getMonitorPartitionChangeFrequency())); addConfig.putAll(map); return new MapConfig(addConfig); }</code><technical_language>jobConfig.getName() returns Optional<String>. calling toString() is give incorrect value. need of Optional</technical_language>

Target:
public Config buildCoordinatorStreamConfig(Config config) { JobConfig jobConfig = new JobConfig(config); String jobName = jobConfig.getName().orElseThrow(() -> new ConfigException("Missing required config: job.name")); String jobId = jobConfig.getJobId(); Map<String, String> map = config.subset(String.format(SystemConfig.SYSTEM_ID_PREFIX, jobConfig.getCoordinatorSystemName()), false); Map<String, String> addConfig = new HashMap<>(); addConfig.put(JobConfig.JOB_NAME, jobName); addConfig.put(JobConfig.JOB_ID, jobId); addConfig.put(JobConfig.JOB_COORDINATOR_SYSTEM, jobConfig.getCoordinatorSystemName()); addConfig.put(JobConfig.MONITOR_PARTITION_CHANGE_FREQUENCY_MS, String.valueOf(jobConfig.getMonitorPartitionChangeFrequency())); addConfig.putAll(map); return new MapConfig(addConfig); }
Source:
<code>public void setup() throws Exception { HostIdGenerator.useTemporaryHostId(); hostId = HostIdGenerator.getHostId(); config = <START> config.withValue("zookeeper.use_new_stack", ConfigValueFactory.fromAnyRef(backendEnabled)); <END> injector = Guice.createInjector(new SerializationModule(), new TestModule()); zkManager = injector.getInstance(ZkManager.class); hostZkManager = injector.getInstance(HostZkManager.class); store = injector.getInstance(MidonetBackend.class).ownershipStore(); versionPath = injector.getInstance(PathBuilder.class) .getHostVersionPath(hostId, DataWriteVersion.CURRENT); alivePath = injector.getInstance(PathBuilder.class) .getHostPath(hostId) + "/alive"; hostName = InetAddress.getLocalHost().getHostName(); store.registerClass(Topology.Host.class, OwnershipType.Exclusive()); store.build(); }</code><technical_language>this zookeeper.root_key is configured</technical_language>

Target:
public void setup() throws Exception { HostIdGenerator.useTemporaryHostId(); hostId = HostIdGenerator.getHostId(); injector = Guice.createInjector(new SerializationModule(), new TestModule()); zkManager = injector.getInstance(ZkManager.class); hostZkManager = injector.getInstance(HostZkManager.class); store = injector.getInstance(MidonetBackend.class).ownershipStore(); versionPath = injector.getInstance(PathBuilder.class) .getHostVersionPath(hostId, DataWriteVersion.CURRENT); alivePath = injector.getInstance(PathBuilder.class) .getHostPath(hostId) + "/alive"; hostName = InetAddress.getLocalHost().getHostName(); store.registerClass(Topology.Host.class, OwnershipType.Exclusive()); store.build(); }
Source:
<code>CosmosAsyncContainer(String id, CosmosAsyncDatabase database) { this.id = id; this.database = database; this.link = getParentLink() + "/" + getURIPathSegment() + "/" + getId(); this.replaceContainerSpanName = "replaceContainer." + this.id; this.deleteContainerSpanName = "deleteContainer." + this.id; this.replaceProvisionedThroughputSpanName = "replaceProvisionedThroughput." + this.id; this.readProvisionedThroughputSpanName = "readProvisionedThroughput." + this.id; this.replaceThroughputSpanName = "replaceThroughput." + this.id; this.readThroughputSpanName = "readThroughput." + this.id; this.readContainerSpanName = "readContainer." + this.id; this.upsertItemSpanName = "upsertItem." + this.id; this.deleteItemSpanName = "deleteItem." + this.id; this.replaceItemSpanName = "replaceItem." + this.id; this.createItemSpanName = "createItem." + this.id; this.readAllItemsSpanName = "readAllItems." + this.id; this.queryItemsSpanName = "queryItems." + this.id; this.readAllConflictsSpanName = "readAllConflicts." + this.id; <START> this.queryConflictsSpanName = "queryConflicts." + this.id; <END> }</code><technical_language>"readItem" span name here</technical_language>

Target:
CosmosAsyncContainer(String id, CosmosAsyncDatabase database) { this.id = id; this.database = database; this.link = getParentLink() + "/" + getURIPathSegment() + "/" + getId(); this.replaceContainerSpanName = "replaceContainer." + this.id; this.deleteContainerSpanName = "deleteContainer." + this.id; this.replaceThroughputSpanName = "replaceThroughput." + this.id; this.readThroughputSpanName = "readThroughput." + this.id; this.readContainerSpanName = "readContainer." + this.id; this.readItemSpanName = "readItem." + this.id; this.upsertItemSpanName = "upsertItem." + this.id; this.deleteItemSpanName = "deleteItem." + this.id; this.replaceItemSpanName = "replaceItem." + this.id; this.createItemSpanName = "createItem." + this.id; this.readAllItemsSpanName = "readAllItems." + this.id; this.queryItemsSpanName = "queryItems." + this.id; this.readAllConflictsSpanName = "readAllConflicts." + this.id; this.queryConflictsSpanName = "queryConflicts." + this.id; }
Source:
<code>private void createCacheWithCacheConfiguration() { <START> manager.administration().getOrCreateCache("CacheWithConfigurationTemplate", "MyDistCachecConfig"); <END> System.out.println("Cache with template exists or is created"); manager.administration().withFlags(AdminFlag.VOLATILE).getOrCreateCache("TemporaryCacheWithConfigurationTemplate", "MyDistCachecConfig"); System.out.println("Temporary cache with template exists or is created"); }</code><technical_language>I call this more "create cache configuration template"</technical_language>

Target:
private void createCacheWithCacheConfiguration() { manager.administration().getOrCreateCache("CacheWithConfigurationTemplate", "MyDistCachecConfig"); System.out.println("Cache with template exists or is created."); manager.administration().withFlags(AdminFlag.VOLATILE).getOrCreateCache("TemporaryCacheWithConfigurationTemplate", "org.infinispan.DIST_SYNC"); System.out.println("Temporary cache with template exists or is created."); }
Source:
<code>private EntityRef addLog(Vector3i location, Block log, boolean force, EntityRef root) { EntityRef logEntity = addLog(location, log, force); <START> if(logEntity != null && logEntity != EntityRef.NULL) { <END> LogComponent logComponent = new LogComponent(); logComponent.location = location; if(root == EntityRef.NULL) { logComponent.root = logEntity; } else { logComponent.root = root; } logEntity.addOrSaveComponent(logComponent); } return logEntity; }</code><technical_language>need null checks here. null EntityRef.NULL. Ideally latter</technical_language>

Target:
private EntityRef addLog(Vector3i location, Block log, boolean force, EntityRef root) { EntityRef logEntity = addLog(location, log, force); if(logEntity != EntityRef.NULL) { LogComponent logComponent = new LogComponent(); logComponent.location = location; if(root == EntityRef.NULL) { logComponent.root = logEntity; } else { logComponent.root = root; } logEntity.addOrSaveComponent(logComponent); } return logEntity; }
Source:
<code>private void nonBlockingCheckAndRethrow() { <START> if (this.currentTask != null && this.currentTask.isDone()) { this.checkAndRethrow(); } <END> }</code><technical_language>suggestion if (this.currentTask != null && this.currentTask.isDone()) checkAndRethrow();</technical_language>

Target:
private void nonBlockingCheckAndRethrow() { if (this.currentTask != null && this.currentTask.isDone()) checkAndRethrow(); }
Source:
<code>public static GameMap loadMap(String mapName, File mapDir) throws IOException { final GameMap result; if (mapName.endsWith(".xml")) { <START> mapName = mapName.substring(0, mapName.indexOf('.')); <END> } final File mapFile = new File(mapDir, mapName + ".xml"); if (mapFile.exists()) { result = loadMap(new FileInputStream(mapFile)); } else { final InputStream backupStream = BACKUP_LOADER.getResourceAsStream(DEFAULT_MAP_PACKAGE + mapName + ".xml"); if (backupStream == null) { throw new IOException("Can't load map: " + mapName + " from dir " + mapDir + " or default maps."); } result = loadMap(backupStream); } if (!result.getMapName().equals(mapName)) { throw new IOException("Invalid map: name (" + result.getMapName() + ") does not match filename (" + mapName + ".xml)" ); } return result; }</code><technical_language>mapName.lastIndexOf('.')</technical_language>

Target:
public static GameMap loadMap(String mapName, File mapDir) throws IOException { final GameMap result; if (mapName.endsWith(".xml")) { mapName = mapName.substring(0, mapName.lastIndexOf('.')); } final File mapFile = new File(mapDir, mapName + ".xml"); if (mapFile.exists()) { result = loadMap(new FileInputStream(mapFile)); } else { final InputStream backupStream = BACKUP_LOADER.getResourceAsStream(DEFAULT_MAP_PACKAGE + mapName + ".xml"); if (backupStream == null) { throw new IOException("Can't load map: " + mapName + " from dir " + mapDir + " or default maps."); } result = loadMap(backupStream); } if (!result.getMapName().equals(mapName)) { throw new IOException("Invalid map: name (" + result.getMapName() + ") does not match filename (" + mapName + ".xml)" ); } return result; }
Source:
<code>public SlackSlashCommand() throws IOException, GeneralSecurityException { kgClient = new Kgsearch.Builder( GoogleNetHttpTransport.newTrustedTransport(), new JacksonFactory(), null).build(); <START> Path configPath = Path.of(System.getProperty("user.dir"), "config.json"); <END> JsonObject configJson = (new Gson()).fromJson(Files.readString(configPath), JsonObject.class); SLACK_SECRET = configJson.get("SLACK_SECRET").getAsString(); API_KEY = configJson.get("KG_API_KEY").getAsString(); verifier = new SlackSignature.Verifier(new SlackSignature.Generator(SLACK_SECRET)); }</code><technical_language>OK, this 12 factor? (Shouldn't config EnvVar's)</technical_language>

Target:
public SlackSlashCommand() throws IOException, GeneralSecurityException { kgClient = new Kgsearch.Builder( GoogleNetHttpTransport.newTrustedTransport(), new JacksonFactory(), null).build(); verifier = new SlackSignature.Verifier(new SlackSignature.Generator(SLACK_SECRET)); }
Source:
<code>public RsBuffered(final Response res) { super( <START> new RsOf( <END> res::head, () -> new BufferedInputStream(res.body()) ) ); }</code><technical_language>@fanifieiev above</technical_language>

Target:
public RsBuffered(final Response res) { super( new ResponseOf( res::head, () -> new BufferedInputStream(res.body()) ) ); }
Source:
<code>static public void main(String[] args) throws IOException { if (args.length < 3) { System.err.println("This executable requires four arguments:\n" + " OntonotesTreebankReader <OntoNotes Directory> <language> <output_directory>"); System.exit(-1); } String topdir = args[0]; OntonotesTreebankReader otr = new OntonotesTreebankReader(topdir, args[1]); int count = 0; while (otr.hasNext()) { TextAnnotation ta = otr.next(); String json = SerializationHelper.serializeToJson(ta); String outfile = otr.currentfile.replace(topdir, args[2]); File outputfile = new File(outfile); outputfile.getParentFile().mkdirs(); try (PrintWriter out = new PrintWriter(outputfile)) { out.print(json); } count++; if ((count % 10) == 0) System.out.println("Completed "+count+" of "+otr.filelist.size()); } <START> System.out.println("Processed a total of "+count+" of "+otr.filelist.size()+" treebanks."); <END> }</code><technical_language>a TreeBank refers entire corpus; is this intended unit here</technical_language>

Target:
static public void main(String[] args) throws IOException { if (args.length < 3) { System.err.println("This executable requires four arguments:\n" + " OntonotesTreebankReader <OntoNotes Directory> <language> <output_directory>"); System.exit(-1); } String topdir = args[0]; OntonotesTreebankReader otr = new OntonotesTreebankReader(topdir, args[1]); int count = 0; while (otr.hasNext()) { TextAnnotation ta = otr.next(); String json = SerializationHelper.serializeToJson(ta); String outfile = otr.currentfile.replace(topdir, args[2]); File outputfile = new File(outfile); outputfile.getParentFile().mkdirs(); try (PrintWriter out = new PrintWriter(outputfile)) { out.print(json); } count++; if ((count % 100) == 0) System.out.println("Completed "+count+" of "+otr.filelist.size()); } System.out.println(otr.generateReport()); }
Source:
<code>protected ReactiveAuthenticationManager getAuthenticationManager() { <START> if (this.authenticationManager == null) { <END> ReactiveJwtDecoder jwtDecoder = getJwtDecoder(); ReactiveAuthenticationManager authenticationManager = new JwtReactiveAuthenticationManager(jwtDecoder); return authenticationManager; } return this.authenticationManager; }</code><technical_language>is easier read if is code indented. Instead of a large if block extract this a create method if (this.authenticationManager != null) return this.authenticationManager</technical_language>

Target:
private ReactiveAuthenticationManager getAuthenticationManager() { if (this.authenticationManager != null) { return this.authenticationManager; } ReactiveJwtDecoder jwtDecoder = getJwtDecoder(); ReactiveAuthenticationManager authenticationManager = new JwtReactiveAuthenticationManager(jwtDecoder); return authenticationManager; }
Source:
<code>private void format(FIXMessage message) { <START> message.addField(BeginString); <END> message.addField(BodyLength).setInt(74); message.addField(MsgType).setChar(OrderSingle); message.addField(SenderCompID).setString("initiator"); message.addField(TargetCompID).setString("acceptor"); message.addField(MsgSeqNum).setInt(2); message.addField(ClOrdID).setString("123"); message.addField(HandlInst).setChar(FIX42Enumerations.HandlInstValues.AutomatedExecutionNoIntervention); message.addField(Symbol).setString("FOO"); message.addField(Side).setChar(FIX42Enumerations.SideValues.Buy); message.addField(OrdType).setChar(FIX42Enumerations.OrdTypeValues.Limit); message.addField(Price).setFloat(150.25, 2); message.addField(CheckSum).setCheckSum(162); }</code><technical_language>set field for FIX 4.2: java message.addField(BeginString).setString("FIX.4.2");</technical_language>

Target:
private void format(FIXMessage message) { message.addField(BeginString).setString("FIX.4.2"); message.addField(BodyLength).setInt(74); message.addField(MsgType).setChar(OrderSingle); message.addField(SenderCompID).setString("initiator"); message.addField(TargetCompID).setString("acceptor"); message.addField(MsgSeqNum).setInt(2); message.addField(ClOrdID).setString("123"); message.addField(HandlInst).setChar(HandlInstValues.AutomatedExecutionNoIntervention); message.addField(Symbol).setString("FOO"); message.addField(Side).setChar(SideValues.Buy); message.addField(OrdType).setChar(OrdTypeValues.Limit); message.addField(Price).setFloat(150.25, 2); message.addField(CheckSum).setCheckSum(75); }
Source:
<code>public void abort(Throwable e) { List<Entry<?>> values; synchronized (this) { values = new ArrayList<Entry<?>>(table.values()); } for (Entry<?> v : values) { if (v.object instanceof ErrorPropagatingOutputStream) { try { ((ErrorPropagatingOutputStream)v.object).error(e); <START> } catch (IOException x) { <END> LOGGER.log(INFO, "Failed to propagate a channel termination error",x); } } } synchronized (this) { table.clear(); reverse.clear(); } }</code><technical_language>catch Exception? propagation stops</technical_language>

Target:
void abort(Throwable e) { List<Entry<?>> values; synchronized (this) { values = new ArrayList<Entry<?>>(table.values()); } for (Entry<?> v : values) { if (v.object instanceof ErrorPropagatingOutputStream) { try { ((ErrorPropagatingOutputStream)v.object).error(e); } catch (Throwable x) { LOGGER.log(INFO, "Failed to propagate a channel termination error",x); } } } synchronized (this) { table.clear(); reverse.clear(); } }
Source:
<code>public void start() { super.onInitialized(); liteNodeNetworkService.start(); if (walletsSetup.isDownloadComplete()) { setupWalletBestBlockListener(); <START> } else { if (blockDownloadListener == null) { blockDownloadListener = (observable, oldValue, newValue) -> { if ((double) newValue == 1) { setupWalletBestBlockListener(); UserThread.execute(() -> walletsSetup.downloadPercentageProperty().removeListener(blockDownloadListener)); } }; <END> walletsSetup.downloadPercentageProperty().addListener(blockDownloadListener); } } }</code><technical_language>suggestion } else if (blockDownloadListener == null) { blockDownloadListener = (observable, oldValue, newValue) -> { if ((double) newValue == 1) { setupWalletBestBlockListener(); UserThread.execute(() -> walletsSetup.downloadPercentageProperty().removeListener(blockDownloadListener)); } }; walletsSetup.downloadPercentageProperty().addListener(blockDownloadListener); }</technical_language>

Target:
public void start() { super.onInitialized(); liteNodeNetworkService.start(); if (walletsSetup.isDownloadComplete()) { setupWalletBestBlockListener(); } else { walletsSetup.downloadPercentageProperty().addListener(blockDownloadListener); } }
Source:
<code><START> public List<CaptureConfig> onDisableSession() { <END> return new ArrayList<>(); }</code><technical_language>Is a reason this is a list instead of a CaptureConfig? a usage perspective, sense issue a single config</technical_language>

Target:
public CaptureConfig onDisableSession() { return null; }
Source:
<code>static public <A, B> F<A, P1<B>> lazy(final F<A, B> f) { return a -> new P1<B>(){ public B _1() { return f.f(a); } <START> }; <END> }</code><technical_language>Please P.lazy(u -> f.f(a)</technical_language>

Target:
static public <A, B> F<A, P1<B>> lazy(final F<A, B> f) { return a -> P.lazy(u -> f.f(a)); }
Source:
<code>private TreeMap<Event, List<EntryDTO>> buildEventEntryDTOMap(List<EntryDTO> entryDTOS) { return entryDTOS.stream().collect(Collectors.groupingBy(EntryDTO::getEvent, <START> () -> new TreeMap<>(Comparator.comparing(Event::getExternalId).thenComparing(Event::getWhenOccured)), Collectors.toList())); <END> }</code><technical_language>suggestion () -> new TreeMap<>(Comparator.comparing(Event::getWhenOccured).thenComparing(Event::getExternalId)), Collectors.toList()));</technical_language>

Target:
private TreeMap<Event, List<EntryDTO>> buildEventEntryDTOMap(List<EntryDTO> entryDTOS) { return entryDTOS.stream().collect(Collectors.groupingBy(EntryDTO::getEvent, () -> new TreeMap<>(Comparator.comparing(Event::getWhenOccured).thenComparing(Event::getExternalId)), Collectors.toList())); }
Source:
<code>public void test_canBeOrExtend() { assertThat(or(a, b).canBeOrExtend("a")).isTrue(); ClassSymbolImpl x1 = new ClassSymbolImpl("x1", "x1"); ClassSymbolImpl x2 = new ClassSymbolImpl("x2", "x2"); x2.addSuperClass(x1); assertThat(or(a, new RuntimeType(x2)).canBeOrExtend("x1")).isTrue(); <START> } <END></code><technical_language>case canBeOrExtend returns false</technical_language>

Target:
public void test_canBeOrExtend() { assertThat(or(a, b).canBeOrExtend("a")).isTrue(); assertThat(or(a, b).canBeOrExtend("c")).isFalse(); ClassSymbolImpl x1 = new ClassSymbolImpl("x1", "x1"); ClassSymbolImpl x2 = new ClassSymbolImpl("x2", "x2"); x2.addSuperClass(x1); assertThat(or(a, new RuntimeType(x2)).canBeOrExtend("x1")).isTrue(); }
Source:
<code>public <T> T[] toArray(T[] newArray) { Class<?> componentType = newArray.getClass().getComponentType(); T[] returnArray = newArray; int size = fInnerElements.size(); if (returnArray.length < size) { returnArray = (T[]) Array.newInstance(componentType, size); } for (int i = size; i < returnArray.length; i++) { returnArray[i] = null; } Iterator<E> iterator = iterator(); for (int i = 0; i < size; i++) { @Nullable E next = null; while (iterator.hasNext() && next == null) { next = iterator.next(); } if (next != null) { Class<? extends @NonNull Object> elementClass = next.getClass(); if (!Objects.equals(elementClass, componentType) && !elementClass.isInstance(componentType)) { throw new ArrayStoreException("Cannot convert from <START> (" + <END> elementClass + " to " + newArray.getClass().getComponentType()); } } returnArray[i] = (T) next; } return returnArray; }</code><technical_language>closing ), below</technical_language>

Target:
public <T> T[] toArray(T[] newArray) { Class<?> componentType = newArray.getClass().getComponentType(); T[] returnArray = newArray; int size = fInnerElements.size(); if (returnArray.length < size) { returnArray = (T[]) Array.newInstance(componentType, size); } Iterator<E> iterator = iterator(); for (int i = 0; i < size; i++) { @Nullable E next = null; while (iterator.hasNext() && next == null) { next = iterator.next(); } returnArray[i] = (T) next; } return returnArray; }
Source:
<code>public void testConvertToLambdaInFieldInitializerWithFinalFieldReference() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test", false, null); <START> StringBuilder buf= new StringBuilder(); <END> buf.append("package test;\n"); buf.append("public class C1 {\n"); buf.append(" final String s;\n"); buf.append(" Runnable run1 = new Runnable() {\n"); buf.append(" @Override\n"); buf.append(" public void run() {\n"); buf.append(" System.out.println(s);\n"); buf.append(" }\n"); buf.append(" };\n"); buf.append(" public C1() {\n"); buf.append(" s = \"abc\";\n"); buf.append(" };\n"); buf.append("}\n"); String original= buf.toString(); ICompilationUnit cu= pack1.createCompilationUnit("C1.java", original, false, null); enable(CleanUpConstants.CONVERT_FUNCTIONAL_INTERFACES); enable(CleanUpConstants.USE_LAMBDA); assertRefactoringHasNoChange(new ICompilationUnit[] { cu }); }</code><technical_language>Hi, I suggest strings instead of StringBuilder, is done in CleanUpTest1d5.java . improves readability performance. A concatenation of literals is compiled a literal faster</technical_language>

Target:
public void testConvertToLambdaInFieldInitializerWithFinalFieldReference() throws Exception { IPackageFragment pack1= fSourceFolder.createPackageFragment("test", false, null); String buf= "" + "package test;\n" + "public class C1 {\n" + " final String s;\n" + " Runnable run1 = new Runnable() {\n" + " @Override\n" + " public void run() {\n" + " System.out.println(s\n" + " }\n" + " };\n" + " public C1() {\n" + " s = \"abc\";\n" + " };\n" + "}\n"; ICompilationUnit cu= pack1.createCompilationUnit("C1.java", buf, false, null); enable(CleanUpConstants.CONVERT_FUNCTIONAL_INTERFACES); enable(CleanUpConstants.USE_LAMBDA); assertRefactoringHasNoChange(new ICompilationUnit[] { cu }); }
Source:
<code>public AuditEvent(long start, AuditEventType auditEventType, boolean isTrackingChangesEnabled, FormIndex formIndex, String oldValue) { this.start = start; this.auditEventType = auditEventType; this.isTrackingChangesEnabled = isTrackingChangesEnabled; this.formIndex = formIndex; this.oldValue = oldValue == null ? "" : oldValue; <START> this.node = formIndex == null || formIndex.getReference() == null ? "" : formIndex.getReference().toString(); <END> }</code><technical_language>need node a field, right? move this a local variable in toString formIndex in other places forms need identified. I expect print extra multiplicity identifier ([1]) end of reference code <LINK_0> needed. Is case? Again, put in toString</technical_language>

Target:
public AuditEvent(long start, AuditEventType auditEventType, boolean isTrackingChangesEnabled, FormIndex formIndex, String oldValue) { this.start = start; this.auditEventType = auditEventType; this.isTrackingChangesEnabled = isTrackingChangesEnabled; this.formIndex = formIndex; this.oldValue = oldValue == null ? "" : oldValue; }
Source:
<code>public CompletionStage<Boolean> commit(LocalTransaction localTransaction, boolean isOnePhase) { if (trace) log.tracef("Committing transaction %s", localTransaction.getGlobalTransaction()); LocalTxInvocationContext ctx = icf.running().createTxInvocationContext(localTransaction); if (isOnePhaseCommit(localTransaction) || isOnePhase) { CompletionStage<Boolean> markRollbackStage = validateNotMarkedForRollback(localTransaction); if (markRollbackStage != null) { return markRollbackStage; } if (trace) log.trace("Doing an 1PC prepare call on the interceptor chain"); List<WriteCommand> modifications = localTransaction.getModifications(); PrepareCommand command = commandCreator.createPrepareCommand(localTransaction.getGlobalTransaction(), modifications, true); try { return CompletionStages.handleAndCompose(invoker.running().invokeAsync(ctx, command), (ignore, t) -> { if (t != null) { return handleCommitFailure(t, true, ctx); } return CompletableFutures.completedTrue(); }); } catch (Throwable e) { <START> return handleCommitFailure(e, true, ctx); <END> } } else if (!localTransaction.isReadOnly()) { return commitInternal(ctx); } return CompletableFutures.completedFalse(); }</code><technical_language>need for try..catch</technical_language>

Target:
public CompletionStage<Boolean> commit(LocalTransaction localTransaction, boolean isOnePhase) { if (trace) log.tracef("Committing transaction %s", localTransaction.getGlobalTransaction()); LocalTxInvocationContext ctx = icf.running().createTxInvocationContext(localTransaction); if (isOnePhaseCommit(localTransaction) || isOnePhase) { CompletionStage<Boolean> markRollbackStage = validateNotMarkedForRollback(localTransaction); if (markRollbackStage != null) { return markRollbackStage; } if (trace) log.trace("Doing an 1PC prepare call on the interceptor chain"); List<WriteCommand> modifications = localTransaction.getModifications(); PrepareCommand command = commandCreator.createPrepareCommand(localTransaction.getGlobalTransaction(), modifications, true); return CompletionStages.handleAndCompose(invoker.running().invokeAsync(ctx, command), (ignore, t) -> { if (t != null) { return handleCommitFailure(t, true, ctx); } return CompletableFutures.completedTrue(); }); } else if (!localTransaction.isReadOnly()) { return commitInternal(ctx); } return CompletableFutures.completedFalse(); }
Source:
<code>public static Link getPostOpenAppEventLink(UUID userId, UUID deviceId) { try { ControllerLinkBuilder linkBuilder = linkTo( methodOn(DeviceController.class).postOpenAppEvent(Optional.empty(), userId, deviceId, null)); return linkBuilder.withRel("postOpenAppEvent"); } <START> catch (SecurityException e) <END> { throw YonaException.unexpected(e); } }</code><technical_language>this give a SecurityException</technical_language>

Target:
public static Link getPostOpenAppEventLink(UUID userId, UUID deviceId) { ControllerLinkBuilder linkBuilder = linkTo( methodOn(DeviceController.class).postOpenAppEvent(Optional.empty(), userId, deviceId, null)); return linkBuilder.withRel("postOpenAppEvent"); }
Source:
<code>protected void prepareBuffer() { bufferToSend = PooledByteBufAllocator.DEFAULT.heapBuffer(sizeExcludingBlobAndCrcSize()); writeHeader(); int crcStart = bufferToSend.writerIndex(); bufferToSend.writeBytes(blobId.toBytes()); BlobPropertiesSerDe.serializeBlobProperties(bufferToSend, properties); bufferToSend.writeInt(usermetadata.capacity()); bufferToSend.writeBytes(usermetadata); bufferToSend.writeShort((short) blobType.ordinal()); short keyLength = blobEncryptionKey == null ? 0 : (short) blobEncryptionKey.remaining(); bufferToSend.writeShort(keyLength); if (keyLength > 0) { bufferToSend.writeBytes(blobEncryptionKey); } bufferToSend.writeLong(blobSize); crc.update(bufferToSend.array(), bufferToSend.arrayOffset() + crcStart, bufferToSend.writerIndex() - crcStart); for (ByteBuffer bb : blob.nioBuffers()) { crc.update(bb); bb.position(0); } crcByteBuf.writeLong(crc.getValue()); CompositeByteBuf compositeByteBuf = bufferToSend.alloc().compositeHeapBuffer(2 + blob.nioBufferCount()); compositeByteBuf.addComponent(true, bufferToSend); if (blob instanceof CompositeByteBuf) { <START> Iterator<ByteBuf> iter = ((CompositeByteBuf) blob).iterator(); <END> while (iter.hasNext()) { compositeByteBuf.addComponent(true, iter.next()); } } else { compositeByteBuf.addComponent(true, blob); } compositeByteBuf.addComponent(true, crcByteBuf); blob = null; crcByteBuf = null; bufferToSend = compositeByteBuf; }</code><technical_language>explicitly compositeHeapBuffer? I thought blob direct buffers, no</technical_language>

Target:
protected void prepareBuffer() { bufferToSend = PooledByteBufAllocator.DEFAULT.ioBuffer(sizeExcludingBlobAndCrcSize()); writeHeader(); int crcStart = bufferToSend.writerIndex(); bufferToSend.writeBytes(blobId.toBytes()); BlobPropertiesSerDe.serializeBlobProperties(bufferToSend, properties); bufferToSend.writeInt(usermetadata.capacity()); bufferToSend.writeBytes(usermetadata); bufferToSend.writeShort((short) blobType.ordinal()); short keyLength = blobEncryptionKey == null ? 0 : (short) blobEncryptionKey.remaining(); bufferToSend.writeShort(keyLength); if (keyLength > 0) { bufferToSend.writeBytes(blobEncryptionKey); } bufferToSend.writeLong(blobSize); crc.update(bufferToSend.nioBuffer(crcStart, bufferToSend.writerIndex() - crcStart)); for (ByteBuffer bb : blob.nioBuffers()) { crc.update(bb); bb.position(0); } crcByteBuf.writeLong(crc.getValue()); CompositeByteBuf compositeByteBuf = bufferToSend.alloc().compositeHeapBuffer(2 + blob.nioBufferCount()); compositeByteBuf.addComponent(true, bufferToSend); if (blob instanceof CompositeByteBuf) { Iterator<ByteBuf> iter = ((CompositeByteBuf) blob).iterator(); while (iter.hasNext()) { compositeByteBuf.addComponent(true, iter.next()); } } else { compositeByteBuf.addComponent(true, blob); } compositeByteBuf.addComponent(true, crcByteBuf); blob = null; crcByteBuf = null; bufferToSend = compositeByteBuf; }
Source:
<code><START> @Override public void onGoogleSignupError(String msg) { <END> BasicFragmentDialog dialog = new BasicFragmentDialog(); dialog.initialize(GOOGLE_ERROR_DIALOG_TAG, getString(R.string.error), msg, getString(org.wordpress.android.login.R.string.login_error_button), null, null); dialog.show(this.getSupportFragmentManager(), GOOGLE_ERROR_DIALOG_TAG); }</code><technical_language>@Override annotation a separate line onGoogleSignupError method for code consistency</technical_language>

Target:
public void onGoogleSignupError(String msg) { BasicFragmentDialog dialog = new BasicFragmentDialog(); dialog.initialize(GOOGLE_ERROR_DIALOG_TAG, getString(R.string.error), msg, getString(org.wordpress.android.login.R.string.login_error_button), null, null); dialog.show(this.getSupportFragmentManager(), GOOGLE_ERROR_DIALOG_TAG); }
Source:
<code>public void setGenerateDroolsTestOnError(Boolean generateDroolsTestOnError) { if (BooleanUtils.isTrue(generateDroolsTestOnError)) { System.setProperty(GENERATE_DROOLS_TEST_ON_ERROR_PROPERTY_NAME, "true"); } else { System.clearProperty(GENERATE_DROOLS_TEST_ON_ERROR_PROPERTY_NAME); } <START> this.generateDroolsTestOnError = generateDroolsTestOnError; <END> }</code><technical_language>This a simple setter (that is deprecated). mess system property, in favor of is deprecated, System.setProperty() is dangerous: presume a single JVM process runs 2 solver configs, constructed java (not xml) calls setGenerateDroolsTestOnError(true), doesn't. feel too. => remove if-else block</technical_language>

Target:
public void setGenerateDroolsTestOnError(Boolean generateDroolsTestOnError) { this.generateDroolsTestOnError = generateDroolsTestOnError; }
Source:
<code>SearchResults search(final SearchRequest searchRequest) { SearchResponse searchResponse; try { searchResponse = executeSearch(searchRequest); } catch (Exception e) { LOGGER.error("Search failed", e); return SearchResults.noHits(); } if (searchResponse.getHits().getHits().length == 0) { LOGGER.debug("No results found for " + searchRequest); return SearchResults.noHits(); } SearchHit[] hits = searchResponse.getHits().getHits(); List<SearchableObject> results = new ArrayList<>(); for (SearchHit searchHit : hits) { try { String stringRepresentation = searchHit.toString(); if (stringRepresentation.contains("\"type\" : \"" + FullTextSearch.SCENARIO + "\"")) { results.add(parseScenario(searchHit)); } else if (stringRepresentation.contains("\"type\" : \"" + FullTextSearch.USECASE + "\"")) { results.add(parseUseCase(searchHit)); <START> } else if (stringRepresentation.contains("\"type\" : \"" + FullTextSearch.STEP + "\"")) { <END> results.add(parseStep(searchHit)); } else { LOGGER.error("No type mapping for " + stringRepresentation + " known."); } } catch (IOException e) { LOGGER.error("Could not parse entry " + searchHit.getSourceAsString(), e); } } return new SearchResults(results, hits.length, searchResponse.getHits().getTotalHits().value); }</code><technical_language>if do proper parsing of type - error prone for setups version changes</technical_language>

Target:
SearchResults search(final SearchRequest searchRequest) { SearchResponse searchResponse; try { searchResponse = executeSearch(searchRequest); } catch (Exception e) { LOGGER.error("Search failed", e); return SearchResults.noHits(); } if (searchResponse.getHits().getHits().length == 0) { LOGGER.debug("No results found for " + searchRequest); return SearchResults.noHits(); } SearchHit[] hits = searchResponse.getHits().getHits(); List<SearchableObject> results = new ArrayList<>(); for (SearchHit searchHit : hits) { try { SearchableObjectType type = getType(searchHit); switch (type) { case SCENARIO: results.add(parseScenario(searchHit)); break; case USECASE: results.add(parseUseCase(searchHit)); break; case STEP: results.add(parseStep(searchHit)); break; default: LOGGER.error("No type mapping for " + type + " known."); } } catch (IOException e) { LOGGER.error("Could not parse entry " + searchHit.getSourceAsString(), e); } } return new SearchResults(results, hits.length, searchResponse.getHits().getTotalHits().value); }
Source:
<code>public void configure(Binder binder) { if (isEnabled()) { Calcites.setSystemProperties(); binder.bind(ViewManager.class).to(NoopViewManager.class).in(LazySingleton.class); <START> binder.install(new DruidCalciteSchemaModule()); <END> binder.install(new DruidSqlCalcitePlannerModule()); binder.install(new AggregationModule()); SqlBindings.addOperatorConversion(binder, QueryLookupOperatorConversion.class); if (isJsonOverHttpEnabled()) { binder.install(new SqlHttpModule()); } if (isAvaticaEnabled()) { binder.install(new AvaticaModule()); } } }</code><technical_language>wondering wanted split up? nice core SQL-related bindings in file</technical_language>

Target:
public void configure(Binder binder) { if (isEnabled()) { Calcites.setSystemProperties(); binder.bind(ViewManager.class).to(NoopViewManager.class).in(LazySingleton.class); binder.install(new DruidCalciteSchemaModule()); binder.install(new CalcitePlannerModule()); binder.install(new SqlAggregationModule()); binder.install(new DruidViewModule()); SqlBindings.addOperatorConversion(binder, QueryLookupOperatorConversion.class); if (isJsonOverHttpEnabled()) { binder.install(new SqlHttpModule()); } if (isAvaticaEnabled()) { binder.install(new AvaticaModule()); } } }
Source:
<code>public void configure() { super.configure(); <START> HTTPConduit conduit = getHttpConduit(); <END> TLSClientParameters tlsCP = tlsClientFactory.getTLSClientParameters(); conduit.setTlsClientParameters(tlsCP); }</code><technical_language>inline method call here</technical_language>

Target:
public void configure() { super.configure(); getHttpConduit().setTlsClientParameters(tlsClientFactory.getTLSClientParameters()); }
Source:
<code>public static Node createInvalidMinLength(int minLength, Node node) { if (node.getParent() == null) return new ErrorNode("Expected min length " + minLength + " for value \"" + node.toString() + "\""); <START> Node field = node.getParent().getChildren().get(0); <END> return new ErrorNode("Expected min length " + minLength + " for field \"" + field.toString() + "\", but got \"" + node.toString() + "\""); }</code><technical_language>Another get field node, a more readable one, is casting parent node KeyValueNode ask for key, this: KeyValueNode parent = (KeyValueNode) node.getParent(); Node field = parent.getKey();</technical_language>

Target:
public static Node createInvalidMinLength(int minLength, Node node) { if (node.getParent() == null) return new ErrorNode("Expected min length " + minLength + " for value \"" + node.toString() + "\""); KeyValueNode parent = (KeyValueNode) node.getParent(); Node field = parent.getKey(); return new ErrorNode("Expected min length " + minLength + " for field \"" + field.toString() + "\", but got \"" + node.toString() + "\""); }