auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public ResourceGroupConfigurationManager create(Map<String, String> config, ResourceGroupConfigurationManagerContext context) { try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(classLoader)) { Bootstrap app = new Bootstrap( new JsonModule(), new DbResourceGroupsModule(), <START> binder -> binder.bind(ResourceGroupConfigurationManagerContext.class).toInstance(context), <END> binder -> binder.bind(ClusterMemoryPoolManager.class).toInstance(context.getMemoryPoolManager())); Injector injector = app .strictConfig() .doNotInitializeLogging() .setRequiredConfigurationProperties(config) .initialize(); return injector.getInstance(DbResourceGroupConfigurationManager.class); } catch (Exception e) { throw Throwables.propagate(e); } }</code><technical_language>reason annotation is avoid binding configuration context. Bind string this: java binder.bind(String.class).annotatedWith(ForEnvironment.class).toInstance(context.getEnvironment()) remove provides method</technical_language>

Target:
public ResourceGroupConfigurationManager create(Map<String, String> config, ResourceGroupConfigurationManagerContext context) { try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(classLoader)) { Bootstrap app = new Bootstrap( new JsonModule(), new DbResourceGroupsModule(), binder -> binder.bind(String.class).annotatedWith(ForEnvironment.class).toInstance(context.getEnvironment()), binder -> binder.bind(ClusterMemoryPoolManager.class).toInstance(context.getMemoryPoolManager())); Injector injector = app .strictConfig() .doNotInitializeLogging() .setRequiredConfigurationProperties(config) .initialize(); return injector.getInstance(DbResourceGroupConfigurationManager.class); } catch (Exception e) { throw Throwables.propagate(e); } }
Source:
<code>public void setUp() throws IOException { <START> MockitoAnnotations.initMocks(this); <END> downloadDir = temp.newFolder(); when(updateCenterMatrixFactory.getUpdateCenter(anyBoolean())).thenReturn(Optional.of(updateCenter)); when(fs.getDownloadedEditionPluginsDir()).thenReturn(downloadDir); downloader = new EditionPluginDownloader(updateCenterMatrixFactory, httpDownloader, fs); }</code><technical_language>long time usage of MockitoAnnotations. trend in SQ's code. I personally useless compared writing mock(Foo.class) MockitoAnnotation saves writing a setup method is other need for (not case here)</technical_language>

Target:
public void setUp() throws IOException { MockitoAnnotations.initMocks(this); downloadDir = temp.newFolder(); when(updateCenterMatrixFactory.getUpdateCenter(anyBoolean())).thenReturn(Optional.of(updateCenter)); when(fs.getEditionDownloadedPluginsDir()).thenReturn(downloadDir); downloader = new EditionPluginDownloader(updateCenterMatrixFactory, httpDownloader, fs); }
Source:
<code>public TmfRawEventViewer(Composite parent, int style) { super(parent, style & (~SWT.H_SCROLL) & (~SWT.V_SCROLL)); GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 2; gridLayout.horizontalSpacing = 0; gridLayout.verticalSpacing = 0; gridLayout.marginWidth = 0; gridLayout.marginHeight = 0; setLayout(gridLayout); createTextArea(style & SWT.H_SCROLL); createSlider(style & SWT.V_SCROLL); setTabList(new Control[] { fScrolledComposite }); addDisposeListener(new DisposeListener() { <START> @Override <END> public void widgetDisposed(DisposeEvent e) { if (fBottomContext != null) { fBottomContext.dispose(); } PlatformUI.getWorkbench().getThemeManager().removePropertyChangeListener(TmfRawEventViewer.this); } }); }</code><technical_language>lambda</technical_language>

Target:
public TmfRawEventViewer(Composite parent, int style) { super(parent, style & (~SWT.H_SCROLL) & (~SWT.V_SCROLL)); GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 2; gridLayout.horizontalSpacing = 0; gridLayout.verticalSpacing = 0; gridLayout.marginWidth = 0; gridLayout.marginHeight = 0; setLayout(gridLayout); createTextArea(style & SWT.H_SCROLL); createSlider(style & SWT.V_SCROLL); setTabList(new Control[] { fScrolledComposite }); addDisposeListener((e) -> { if (fBottomContext != null) { fBottomContext.dispose(); } PlatformUI.getWorkbench().getThemeManager().removePropertyChangeListener(TmfRawEventViewer.this); }); }
Source:
<code>public boolean matches(Map<String, Construct> prefilter, BindableEvent e) throws PrefilterNonMatchException { if(e instanceof MCEntityTargetEvent){ MCEntityTargetEvent ple = (MCEntityTargetEvent) e; if (ple.getTarget() instanceof Player) { return true; <START> } <END> } return false; }</code><technical_language>Nope, this work, need check if player's name is same, if instance of a player</technical_language>

Target:
public boolean matches(Map<String, Construct> prefilter, BindableEvent e) throws PrefilterNonMatchException { if(e instanceof MCEntityTargetEvent){ MCEntityTargetEvent ete = (MCEntityTargetEvent) e; if (ete.getTarget() instanceof Player) { Prefilters.match(prefilter, "player", ((Player)ete.getTarget()).getName(), Prefilters.PrefilterType.MACRO); return true; } } return false; }
Source:
<code>public void setup() throws Exception { super.setup(); KubernetesTestUtils.createTemporyFile("some data", flinkConfDir, "logback.xml"); KubernetesTestUtils.createTemporyFile("some data", flinkConfDir, "log4j.properties"); flinkConfig.set(KubernetesConfigOptionsInternal.ENTRY_POINT_CLASS, ENTRY_POINT_CLASS); flinkConfig.set(KubernetesConfigOptions.JOB_MANAGER_SERVICE_ACCOUNT, SERVICE_ACCOUNT_NAME); <START> setHadoopConfDirEnv(); <END> generateHadoopConfFileItems(); this.kubernetesJobManagerSpecification = KubernetesJobManagerFactory.createJobManagerComponent(kubernetesJobManagerParameters); }</code><technical_language>possibly a subclass of this test class pollute global settings. test existing hadoop conf case empty local hadoop conf case</technical_language>

Target:
public void setup() throws Exception { super.setup(); KubernetesTestUtils.createTemporyFile("some data", flinkConfDir, "logback.xml"); KubernetesTestUtils.createTemporyFile("some data", flinkConfDir, "log4j.properties"); flinkConfig.set(KubernetesConfigOptionsInternal.ENTRY_POINT_CLASS, ENTRY_POINT_CLASS); flinkConfig.set(KubernetesConfigOptions.JOB_MANAGER_SERVICE_ACCOUNT, SERVICE_ACCOUNT_NAME); this.kubernetesJobManagerSpecification = KubernetesJobManagerFactory.createJobManagerComponent(kubernetesJobManagerParameters); }
Source:
<code>private Visualization getVisualizationInternal(String identifier) { <START> return visualizationCache.computeIfAbsent(identifier, (s) -> { <END> StepEngineSettings.VisualizationSetting settings = visualizationSettingsMap.get(s); String visualizationClassName = settings.getVisualizationClassName(); return StreamSupport.stream(ServiceLoader.load(Visualization.Factory.class).spliterator(), false) .filter(factory -> visualizationClassName.equals(factory.getVisualizationClass().getName())) .findFirst().orElseThrow(() -> new RuntimeException("Failed: No Visualization.Factory found for " + s + " and " + visualizationClassName) ).create(settings); }); }</code><technical_language>unnecessary braces suggestion return visualizationCache.computeIfAbsent(identifier, s -> {</technical_language>

Target:
private Visualization getVisualizationInternal(String identifier) { return visualizationCache.computeIfAbsent(identifier, s -> { StepEngineSettings.VisualizationSetting settings = visualizationSettingsMap.get(s); String visualizationClassName = settings.getVisualizationClassName(); return getVisualizationFactory(identifier, visualizationClassName).create(settings); }); }
Source:
<code>public Task<String> ensurePathExists(String path) { return exists(path).flatMap(stat -> { if (!stat.isPresent()) { <START> Task<String> createAndIgnoreNodeExistsException = <END> create(path, null, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT) .recoverWith("recover from NodeExistsException", e -> { if (e instanceof KeeperException.NodeExistsException) { return Task.value(path); } else { return Task.failure(e); } }); String parent = path.substring(0, path.lastIndexOf('/')); if (parent.isEmpty()) { return createAndIgnoreNodeExistsException; } else { return ensurePathExists(parent).flatMap(unused -> createAndIgnoreNodeExistsException); } } else { return Task.value(path); } }); }</code><technical_language>createIfAbsent</technical_language>

Target:
public Task<String> ensurePathExists(String path) { return exists(path).flatMap(stat -> { if (!stat.isPresent()) { Task<String> createIfAbsent = create(path, null, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT) .recoverWith("recover from NodeExistsException", e -> { if (e instanceof KeeperException.NodeExistsException) { return Task.value(path); } else { return Task.failure(e); } }); String parent = path.substring(0, path.lastIndexOf('/')); if (parent.isEmpty()) { return createIfAbsent; } else { return ensurePathExists(parent).flatMap(unused -> createIfAbsent); } } else { return Task.value(path); } }); }
Source:
<code>public static void initInternal(Context context) { SalesforceSDKUpgradeManager.getInstance().upgrade(); Encryptor.init(context); HttpAccess.init(context, INSTANCE.getUserAgent()); final RuntimeConfig runtimeConfig = RuntimeConfig.getRuntimeConfig(context); final String idpAppUrlScheme = runtimeConfig.getString(RuntimeConfig.ConfigKey.IDPAppURLScheme); if (!TextUtils.isEmpty(idpAppUrlScheme)) { INSTANCE.idpAppURIScheme = idpAppUrlScheme; } (new Thread(new Runnable() { @Override public void run() { <START> final String loginServer = SalesforceSDKManager.getInstance().getLoginServerManager().getSelectedLoginServer().url; <END> final AuthConfigUtil.SSOAuthConfig authConfig = AuthConfigUtil.getSSOAuthConfig(loginServer); boolean browserLoginEnabled = false; if (authConfig != null) { browserLoginEnabled = authConfig.isBrowserLoginEnabled(); } SalesforceSDKManager.getInstance().setBrowserLoginEnabled(browserLoginEnabled); } })).start(); }</code><technical_language>wait for call complete? code AuthConfigTask</technical_language>

Target:
public static void initInternal(Context context) { SalesforceSDKUpgradeManager.getInstance().upgrade(); Encryptor.init(context); HttpAccess.init(context, INSTANCE.getUserAgent()); final RuntimeConfig runtimeConfig = RuntimeConfig.getRuntimeConfig(context); final String idpAppUrlScheme = runtimeConfig.getString(RuntimeConfig.ConfigKey.IDPAppURLScheme); if (!TextUtils.isEmpty(idpAppUrlScheme)) { INSTANCE.idpAppURIScheme = idpAppUrlScheme; } }
Source:
<code><START> public CacheConfiguration getCache() { <END> return cache; }</code><technical_language>@Restricted - want this API leak other plugins</technical_language>

Target:
public CacheConfiguration getCache() { if (cache != null && (cache.getSize() == 0 || cache.getTtl() == 0)) { return null; } return cache; }
Source:
<code>CommandLineOptions build() { return new CommandLineOptions( this.files.build(), this.inPlace, this.lines.build(), this.offsets.build(), this.lengths.build(), this.aosp, this.version, this.help, this.stdin, this.fixImportsOnly, this.removeJavadocOnlyImports, this.validationMode <START> ); <END> }</code><technical_language>I this bracket previous line</technical_language>

Target:
CommandLineOptions build() { return new CommandLineOptions( this.files.build(), this.inPlace, this.lines.build(), this.offsets.build(), this.lengths.build(), this.aosp, this.version, this.help, this.stdin, this.fixImportsOnly, this.removeJavadocOnlyImports, this.sortImports, this.removeUnusedImports, this.dryRun, this.setExitIfChanged); }
Source:
<code>public void update() { for (Integer rank = this.minRank; rank <= this.maxRank; rank++) { LOGGER.info(String.format("Starting rank %d", rank)); for (Map<String, Object> sector : getIndexSectors(rank)) for (UpdateRow place : getIndexSectorPlaces(rank, (Integer) sector.get("geometry_sector"))) { template.update("update placex set indexed_status = 0 where place_id = ?", place.getPlaceId()); final List<PhotonDoc> updatedDocs = exporter.getByPlaceId(place.getPlaceId()); for (PhotonDoc updatedDoc : updatedDocs) { switch (place.getIndexdStatus()) { case 1: if (updatedDoc.isUsefulForIndex()) updater.create(updatedDoc); break; case 2: if (!updatedDoc.isUsefulForIndex()) { updater.delete(place.getPlaceId()); break; } updater.updateOrCreate(updatedDoc); break; case 100: updater.delete(place.getPlaceId()); break; default: LOGGER.error(String.format("Unknown index status %d", place.getIndexdStatus())); break; <START> } <END> } } } updater.finish(); }</code><technical_language>this again, cases need a bit more consideration. For 'case 100' (object deleted), export.getByPlaceId() called placeID exist anymore. (That wrong is worth fixing while changing this code.) More importantly, for 'case 2', code catch a housenumber deleted batch of housenumbers for placeID code updates exist update. simple solution is call a delete a subsequent create for case 2. I performance impact of a solution be. In case, delete() in 'case 2' moved out of loop. isUsefulForIndex() evaluates for elements of updatesDocs calling delete() multiple times for placeID is inefficient, if harmful</technical_language>

Target:
public void update() { for (Integer rank = this.minRank; rank <= this.maxRank; rank++) { LOGGER.info(String.format("Starting rank %d", rank)); for (Map<String, Object> sector : getIndexSectors(rank)) for (UpdateRow place : getIndexSectorPlaces(rank, (Integer) sector.get("geometry_sector"))) { template.update("update placex set indexed_status = 0 where place_id = ?", place.getPlaceId()); if (place.getIndexdStatus() == 100) { updater.delete(place.getPlaceId()); continue; } final List<PhotonDoc> updatedDocs = exporter.getByPlaceId(place.getPlaceId()); for (PhotonDoc updatedDoc : updatedDocs) { switch (place.getIndexdStatus()) { case 1: if (updatedDoc.isUsefulForIndex()) updater.create(updatedDoc); break; case 2: if (!updatedDoc.isUsefulForIndex()) { updater.delete(place.getPlaceId()); break; } updater.updateOrCreate(updatedDoc); break; default: LOGGER.error(String.format("Unknown index status %d", place.getIndexdStatus())); break; } } } } updater.finish(); }
Source:
<code>private String sendAvroMessage(SpecificRecord message) throws ProducerException { try { GenericRecord avroRecord = addForkliftPropertiesToAvroObject(message); ProducerRecord record = new ProducerRecord<String, GenericRecord>(topic, null, avroRecord); try { RecordMetadata result = (RecordMetadata)kafkaProducer.send(record).get(); return result.topic() + "-" + result.partition() + "-" + result.offset(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ProducerException("Error sending Kafka Message", e); } catch (ExecutionException e) { <START> throw new ProducerException("Error creating Kafka Message", e); <END> } } catch (IOException e) { throw new ProducerException("Error creating Kafka Message", e); } }</code><technical_language>This exception message sense; message is completely created try block</technical_language>

Target:
private String sendAvroMessage(SpecificRecord message) throws ProducerException { try { ProducerRecord record = null; if(this.properties.size() > 0){ GenericRecord avroRecord = addForkliftPropertiesToAvroObject(message); record = new ProducerRecord<String, GenericRecord>(topic, null, avroRecord); } else{ record = new ProducerRecord<String, SpecificRecord>(topic, null, message); } try { RecordMetadata result = (RecordMetadata)kafkaProducer.send(record).get(); return result.topic() + "-" + result.partition() + "-" + result.offset(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new ProducerException("Error sending Kafka Message", e); } catch (ExecutionException e) { throw new ProducerException("Error sending Kafka Message", e); } } catch (IOException e) { throw new ProducerException("Error creating Kafka Message", e); } }
Source:
<code>protected void rebuild() { try (FlowScopeLog parentLogger = new FlowScopeLogBuilder(LOGGER, Level.FINE, "TimeGraphView:Rebuilding").setCategory(getViewId()).build()) { <START> setStartTime(fTrace.getStartTime().toNanos()); setEndTime(fTrace.getEndTime().toNanos()); refresh(); <END> ITmfTrace viewTrace = fTrace; if (viewTrace == null) { return; } resetView(viewTrace); List<IMarkerEventSource> markerEventSources = new ArrayList<>(); synchronized (fBuildJobMap) { for (ITmfTrace trace : getTracesToBuild(viewTrace)) { if (trace == null) { break; } List<@NonNull IMarkerEventSource> adapters = TmfTraceAdapterManager.getAdapters(trace, IMarkerEventSource.class); markerEventSources.addAll(adapters); Job buildJob = new Job(getTitle() + Messages.AbstractTimeGraphView_BuildJob) { @Override protected IStatus run(IProgressMonitor monitor) { new BuildRunnable(trace, viewTrace, parentLogger).run(monitor); monitor.done(); return Status.OK_STATUS; } }; fBuildJobMap.put(trace, buildJob); buildJob.schedule(); } } fMarkerEventSourcesMap.put(viewTrace, markerEventSources); } }</code><technical_language>this same. extractificate</technical_language>

Target:
protected void rebuild() { try (FlowScopeLog parentLogger = new FlowScopeLogBuilder(LOGGER, Level.FINE, "TimeGraphView:Rebuilding").setCategory(getViewId()).build()) { setTimeBoundsAndRefresh(); ITmfTrace viewTrace = fTrace; if (viewTrace == null) { return; } resetView(viewTrace); List<IMarkerEventSource> markerEventSources = new ArrayList<>(); synchronized (fBuildJobMap) { for (ITmfTrace trace : getTracesToBuild(viewTrace)) { if (trace == null) { break; } List<@NonNull IMarkerEventSource> adapters = TmfTraceAdapterManager.getAdapters(trace, IMarkerEventSource.class); markerEventSources.addAll(adapters); Job buildJob = new Job(getTitle() + Messages.AbstractTimeGraphView_BuildJob) { @Override protected IStatus run(IProgressMonitor monitor) { new BuildRunnable(trace, viewTrace, parentLogger).run(monitor); monitor.done(); return Status.OK_STATUS; } }; fBuildJobMap.put(trace, buildJob); buildJob.schedule(); } } fMarkerEventSourcesMap.put(viewTrace, markerEventSources); } }
Source:
<code>public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof ImplementNetworkVspCommand)) return false; if (!super.equals(o)) return false; ImplementNetworkVspCommand that = (ImplementNetworkVspCommand) o; <START> if (_dhcpOption != null ? !_dhcpOption.equals(that._dhcpOption) : that._dhcpOption != null) return false; <END> if (_network != null ? !_network.equals(that._network) : that._network != null) return false; return true; }</code><technical_language>Please consider simplifying this if block Guava's Objects.equals</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof ImplementNetworkVspCommand)) { return false; } ImplementNetworkVspCommand that = (ImplementNetworkVspCommand) o; return super.equals(that) && Objects.equals(_dhcpOption, that._dhcpOption) && Objects.equals(_network, that._network); }
Source:
<code><START> static String getRequireBundleValue(File manifestFile) { <END> String bundleValue; try (FileInputStream manifestStream = new FileInputStream(manifestFile)) { Manifest manifest = new Manifest(manifestStream); bundleValue = manifest.getMainAttributes().getValue(REQUIRE_BUNDLE_KEY); } catch (IOException e) { throw new GradleException( "Unable to determine the bundle dependencies defined in manifest: " + manifestFile.getAbsolutePath(), e); } return bundleValue; }</code><technical_language>private IntelliJ code inspection</technical_language>

Target:
private static String getRequireBundleValue(File manifestFile) { String bundleValue; try (FileInputStream manifestStream = new FileInputStream(manifestFile)) { Manifest manifest = new Manifest(manifestStream); bundleValue = manifest.getMainAttributes().getValue(REQUIRE_BUNDLE_KEY); } catch (IOException e) { throw new GradleException( "Unable to determine the bundle dependencies defined in manifest: " + manifestFile.getAbsolutePath(), e); } return bundleValue; }
Source:
<code>public void testMetadataUpdaterBinary() throws Exception { context.getRouteDefinition("FcrepoSerializationBinaryUpdater").adviceWith(context, new AdviceWithRouteBuilder() { @Override public void configure() throws Exception { replaceFromWith("direct:start"); mockEndpointsAndSkip("*"); } }); context.start(); <START> getMockEndpoint("mock:file:mock:direct:binary_file").expectedMessageCount(0); <END> final String body = IOUtils.toString(ObjectHelper.loadResourceAsStream("binary.rdf"), "UTF-8"); final Map<String, Object> headers = ImmutableMap.of( BASE_URL, baseURL, IDENTIFIER, "foo"); template.sendBodyAndHeaders(body, headers); assertMockEndpointsSatisfied(); }</code><technical_language>This is a strange formulation. I mock here, is, incorrect</technical_language>

Target:
public void testMetadataUpdaterBinary() throws Exception { context.getRouteDefinition("FcrepoSerializationBinaryUpdater").adviceWith(context, new AdviceWithRouteBuilder() { @Override public void configure() throws Exception { replaceFromWith("direct:start"); mockEndpointsAndSkip("*"); } }); context.start(); getMockEndpoint("mock:file:binary_file").expectedMessageCount(0); final String body = IOUtils.toString(ObjectHelper.loadResourceAsStream("binary.rdf"), "UTF-8"); final Map<String, Object> headers = ImmutableMap.of( BASE_URL, baseURL, IDENTIFIER, "foo"); template.sendBodyAndHeaders(body, headers); assertMockEndpointsSatisfied(); }
Source:
<code>public ObjectFilter withParameters(Map<String, Object> namedParameters) { if (namedParameters == null) { throw new IllegalArgumentException("namedParameters argument cannot be null"); } for (String paramName : getParameterNames()) { if (namedParameters.get(paramName) == null) { <START> throw new IllegalArgumentException("Query parameter '" + paramName + "' was not set"); <END> } } return new RejectObjectFilter<>(namedParameters, parsingResult); }</code><technical_language>well. 3rd time this loop - extract somehow</technical_language>

Target:
public ObjectFilter withParameters(Map<String, Object> namedParameters) { validateParameters(namedParameters); return new RejectObjectFilter<>(namedParameters, parsingResult); }
Source:
<code>public String commitMessage(GitRepositoryManager repoManager, Provider<ReviewDb> db) throws IOException, OrmException { if (commitMessage == null) { PatchSet.Id psId = change(db).currentPatchSetId(); String sha1 = db.get().patchSets().get(psId).getRevision().get(); Project.NameKey name = change.getProject(); Repository repo = repoManager.openRepository(name); <START> RevWalk walk = new RevWalk(repo); <END> try { RevCommit c = walk.parseCommit(ObjectId.fromString(sha1)); commitMessage = c.getFullMessage(); } finally { walk.release(); repo.close(); } } return commitMessage; }</code><technical_language>I concerned this is unsafe, if this throws a runtime exception, repo get closed</technical_language>

Target:
public String commitMessage(GitRepositoryManager repoManager, Provider<ReviewDb> db) throws IOException, OrmException { if (commitMessage == null) { PatchSet.Id psId = change(db).currentPatchSetId(); String sha1 = db.get().patchSets().get(psId).getRevision().get(); Project.NameKey name = change.getProject(); Repository repo = repoManager.openRepository(name); try { RevWalk walk = new RevWalk(repo); try { RevCommit c = walk.parseCommit(ObjectId.fromString(sha1)); commitMessage = c.getFullMessage(); } finally { walk.release(); } } finally { repo.close(); } } return commitMessage; }
Source:
<code>private void createAndDispatchGDBFocusChangedEvent() { assert fCurrentThreadCtx != null; <START> fCommandControl.getSession().dispatchEvent(new GDBFocusChangedEvent(fCurrentThreadCtx), <END> fCommandControl.getProperties()); }</code><technical_language>thread focus changes? send specific context? sending frame, receiver frame parent thread is stored in context hierarchy</technical_language>

Target:
private void createAndDispatchGDBFocusChangedEvent() { assert fCurrentGDBFocus != null; fGdbcontrol.getSession().dispatchEvent(new GDBFocusChangedEvent(fCurrentGDBFocus), fGdbcontrol.getProperties()); }
Source:
<code>public void init() { if (!init) { for (String mapName : store.getMapNames()) { if (mapName.startsWith(UNDO_LOG_NAME_PREFIX)) { if (mapName.equals(UNDO_LOG_NAME_PREFIX)) { <START> if (!store.hasData(mapName) || store.isReadOnly()) { <END> store.removeMap(mapName); } continue; } boolean committed = mapName.charAt(UNDO_LOG_NAME_PREFIX.length()) == UNDO_LOG_COMMITTED; if (store.hasData(mapName) || committed) { int transactionId = Integer.parseInt(mapName.substring(UNDO_LOG_NAME_PREFIX.length() + 1)); VersionedBitSet openTxBitSet = openTransactions.get(); if (!openTxBitSet.get(transactionId)) { Object[] data = preparedTransactions.get(transactionId); int status; String name; if (data == null) { status = Transaction.STATUS_OPEN; name = null; } else { status = (Integer) data[0]; name = (String) data[1]; } if (committed) { status = Transaction.STATUS_COMMITTED; } MVMap<Long, Object[]> undoLog = store.openMap(mapName, undoLogBuilder); undoLogs[transactionId] = undoLog; Long lastUndoKey = undoLog.lastKey(); assert committed || lastUndoKey != null; assert committed || getTransactionId(lastUndoKey) == transactionId; long logId = lastUndoKey == null ? 0 : getLogId(lastUndoKey) + 1; registerTransaction(transactionId, status, name, logId, timeoutMillis, 0, RollbackListener.NONE); } } } } init = true; } }</code><technical_language>&& !store.isReadOnly()</technical_language>

Target:
public void init() { if (!init) { for (String mapName : store.getMapNames()) { if (mapName.startsWith(UNDO_LOG_NAME_PREFIX)) { if (mapName.equals(UNDO_LOG_NAME_PREFIX)) { if (!store.hasData(mapName) && !store.isReadOnly()) { store.removeMap(mapName); } continue; } boolean committed = mapName.charAt(UNDO_LOG_NAME_PREFIX.length()) == UNDO_LOG_COMMITTED; if (store.hasData(mapName) || committed) { int transactionId = Integer.parseInt(mapName.substring(UNDO_LOG_NAME_PREFIX.length() + 1)); VersionedBitSet openTxBitSet = openTransactions.get(); if (!openTxBitSet.get(transactionId)) { Object[] data = preparedTransactions.get(transactionId); int status; String name; if (data == null) { status = Transaction.STATUS_OPEN; name = null; } else { status = (Integer) data[0]; name = (String) data[1]; } if (committed) { status = Transaction.STATUS_COMMITTED; } MVMap<Long, Object[]> undoLog = store.openMap(mapName, undoLogBuilder); undoLogs[transactionId] = undoLog; Long lastUndoKey = undoLog.lastKey(); assert committed || lastUndoKey != null; assert committed || getTransactionId(lastUndoKey) == transactionId; long logId = lastUndoKey == null ? 0 : getLogId(lastUndoKey) + 1; registerTransaction(transactionId, status, name, logId, timeoutMillis, 0, RollbackListener.NONE); } } } } init = true; } }
Source:
<code>public void testDateTimeChannelCalendarDefaultTimeZoneUpdate() { Configuration configuration = new Configuration(); initialize(configuration, NtpBindingConstants.CHANNEL_DATE_TIME, ACCEPTED_ITEM_TYPE_DATE_TIME, null, null); ZoneOffset timeZoneIdFromItemRegistry = ((DateTimeType) getItemState(ACCEPTED_ITEM_TYPE_DATE_TIME)) .getZonedDateTime().getOffset(); assertThat("The dateTime channel calendar was not updated with the right timezone", timeZoneIdFromItemRegistry, <START> is(equalTo(ZoneOffset.of("+03:00")))); <END> }</code><technical_language>do assume build server sits in EEST</technical_language>

Target:
public void testDateTimeChannelCalendarDefaultTimeZoneUpdate() { Configuration configuration = new Configuration(); initialize(configuration, NtpBindingConstants.CHANNEL_DATE_TIME, ACCEPTED_ITEM_TYPE_DATE_TIME, null, null); ZonedDateTime timeZoneIdFromItemRegistry = ((DateTimeType) getItemState(ACCEPTED_ITEM_TYPE_DATE_TIME)) .getZonedDateTime(); ZoneOffset expectedOffset; if (timeZoneIdFromItemRegistry.getZone().getRules().isDaylightSavings(timeZoneIdFromItemRegistry.toInstant())) { expectedOffset = ZoneOffset.of("+03:00"); } else { expectedOffset = ZoneOffset.of("+02:00"); } assertThat("The dateTime channel calendar was not updated with the right timezone", timeZoneIdFromItemRegistry.getOffset(), is(equalTo(expectedOffset))); }
Source:
<code>public void mergeWith(UnweightedDoubleReservoirSample other) { <START> checkArgument(samples.length == other.samples.length, "Max samples must be equal"); <END> if (other.count < other.samples.length) { other.stream().forEach(o -> add(o)); return; } if (count < samples.length) { final UnweightedDoubleReservoirSample target = ((UnweightedDoubleReservoirSample) other.clone()); stream().forEach(o -> target.add(o)); count = target.count; samples = target.samples; return; } shuffleArray(samples); shuffleArray(other.samples); int nextIndex = 0; int otherNextIndex = 0; double[] merged = new double[samples.length]; for (int i = 0; i < samples.length; ++i) { if (ThreadLocalRandom.current().nextLong(0, count + other.count) < count) { merged[i] = samples[nextIndex++]; } else { merged[i] = other.samples[otherNextIndex++]; } } count += other.count; samples = merged; }</code><technical_language>* Max samples -> Maximum number of samples for consistency * add actual values error message debugging checkArgument(samples.length == other.samples.length, "Maximum number of samples equal: " + samples.length + " != " + other.samples.length);</technical_language>

Target:
public void mergeWith(UnweightedDoubleReservoirSample other) { checkArgument( samples.length == other.samples.length, format("Maximum number of samples %s must be equal to that of other %s", samples.length, other.samples.length)); if (other.seenCount < other.samples.length) { for (int i = 0; i < other.seenCount; i++) { add(other.samples[i]); } return; } if (seenCount < samples.length) { UnweightedDoubleReservoirSample target = ((UnweightedDoubleReservoirSample) other.clone()); for (int i = 0; i < seenCount; i++) { target.add(samples[i]); } seenCount = target.seenCount; samples = target.samples; return; } shuffleArray(samples); shuffleArray(other.samples); int nextIndex = 0; int otherNextIndex = 0; double[] merged = new double[samples.length]; for (int i = 0; i < samples.length; i++) { if (ThreadLocalRandom.current().nextLong(0, seenCount + other.seenCount) < seenCount) { merged[i] = samples[nextIndex++]; } else { merged[i] = other.samples[otherNextIndex++]; } } seenCount += other.seenCount; samples = merged; }
Source:
<code>public OperationAction createOperationAction() { <START> OperationActionImpl operationAction = new OperationActionImpl(); <END> return operationAction; }</code><technical_language>Lost @not-generated code</technical_language>

Target:
public OperationAction createOperationAction() { OperationActionImpl operationAction = new OperationActionImpl(); ContainerViewVariable containerViewVariable = this.createContainerViewVariable(); containerViewVariable.setName("views"); InitialOperation initalOperation = this.createInitialOperation(); operationAction.setView(containerViewVariable); operationAction.setInitialOperation(initalOperation); return operationAction; }
Source:
<code>protected void writeItem(@NonNull final File rootFolder, @NonNull final AssetItem item, @NonNull WaitableExecutor executor) throws IOException { if (item.isTouched()) { executor.execute(new Callable() { @Override public Object call() throws Exception { AssetFile assetFile = item.getSource(); File fromFile = assetFile.getFile(); File toFile = new File(rootFolder, <START> item.getKey().replaceAll("/", File.separator)); <END> toFile.getParentFile().mkdirs(); Files.copy(fromFile, toFile); return null; } }); } }</code><technical_language>Instead of replaceAll, takes a string regexp, do .replace('/', File.separatorChar) (it replace character occurrences)</technical_language>

Target:
protected void writeItem(@NonNull final File rootFolder, @NonNull final AssetItem item, @NonNull WaitableExecutor executor) throws IOException { if (item.isTouched()) { executor.execute(new Callable() { @Override public Object call() throws Exception { AssetFile assetFile = item.getSource(); File fromFile = assetFile.getFile(); File toFile = new File(rootFolder, item.getKey().replace('/', File.separatorChar)); toFile.getParentFile().mkdirs(); Files.copy(fromFile, toFile); return null; } }); } }
Source:
<code>private boolean getValue(FutureVDSCall<VDSReturnValue> task, Guid hostId) { try { VDSReturnValue vdsReturnValue = task.get(Config.<Integer> getValue(ConfigValues.SetupNetworksPollingTimeout), TimeUnit.SECONDS); return vdsReturnValue.getSucceeded(); } catch (TimeoutException e) { return false; } catch (VDSRecoveringException e) { <START> LOGGER.trace("Failed <END> to poll host - it's in recovery mode.", hostId, e); return false; } }</code><technical_language>trace ? excessive. printed time in case of a specific error. I suggest increase level DEBUG</technical_language>

Target:
private boolean getValue(FutureVDSCall<VDSReturnValue> task, Guid hostId) { try { VDSReturnValue vdsReturnValue = task.get(Config.<Integer> getValue(ConfigValues.SetupNetworksPollingTimeout), TimeUnit.SECONDS); return vdsReturnValue.getSucceeded(); } catch (TimeoutException e) { return false; } catch (VDSRecoveringException e) { LOGGER.debug("Failed to poll host - it's in recovery mode.", hostId, e); return false; } }
Source:
<code>public List<String> getURLsFromPage(Document page) { Elements elements = page.select("#post-list .thumb a,#pool-show .thumb a"); List<String> res = new ArrayList<String>(elements.size()); if (page.getElementById("pool-show") != null) { int index = 0; Element e = page.getElementById("paginator"); <START> if (e != null && (e = e.getElementsByClass("current").first()) != null) <END> index = (Integer.parseInt(e.text()) - 1) * POOL_IMAGES_PER_PAGE; for (Element e_ : elements) res.add(e_.absUrl("href") + "#" + ++index); } else { for (Element e : elements) res.add(e.absUrl("href") + "#" + e.child(0).attr("id").substring(1)); } return res; }</code><technical_language>Please assignment if-statement, reading maintaining code more difficult. Nested if-statements fine. Please wrap if-statement for-loop bodies in braces</technical_language>

Target:
public List<String> getURLsFromPage(Document page) { Elements elements = page.select("#post-list .thumb a,#pool-show .thumb a"); List<String> res = new ArrayList<String>(elements.size()); if (page.getElementById("pool-show") != null) { int index = 0; Element e = page.getElementById("paginator"); if (e != null) { e = e.getElementsByClass("current").first(); if (e != null) { index = (Integer.parseInt(e.text()) - 1) * POOL_IMAGES_PER_PAGE; } } for (Element e_ : elements) { res.add(e_.absUrl("href") + "#" + ++index); } } else { for (Element e : elements) { res.add(e.absUrl("href") + "#" + e.child(0).attr("id").substring(1)); } } return res; }
Source:
<code>public void testExecuteAndPostProcess() throws Exception{ InstructorAttributes instructor = dataBundle.instructors.get("teammates.test.instructor2"); String instructorId = instructor.googleId; gaeSimulation.loginAsInstructor(instructorId); ______TS("Successful case"); InstructorFeedbackEditCopyPageAction a = getAction(); AjaxResult r = getAjaxResult(a); assertFalse(r.isError); InstructorFeedbackEditCopyPageData pageData = (InstructorFeedbackEditCopyPageData) r.data; <START> assertEquals(4, pageData.courses.size()); <END> }</code><technical_language>more test cases? case fail? this check archived courses/courses edit permission omitted</technical_language>

Target:
public void testExecuteAndPostProcess() throws Exception{ InstructorAttributes instructor = dataBundle.instructors.get("teammates.test.instructor2"); String instructorId = instructor.googleId; gaeSimulation.loginAsInstructor(instructorId); ______TS("Successful case"); InstructorFeedbackEditCopyPageAction a = getAction(); AjaxResult r = getAjaxResult(a); assertFalse(r.isError); InstructorFeedbackEditCopyPageData pageData = (InstructorFeedbackEditCopyPageData) r.data; assertEquals(4, pageData.courses.size()); List<String> idOfCourses = new ArrayList<String>(); for (CourseAttributes course: pageData.courses) { idOfCourses.add(course.id); } assertFalse(idOfCourses.contains("FeedbackEditCopy.CS1101")); assertFalse(idOfCourses.contains("FeedbackEditCopy.CS2107")); assertTrue(idOfCourses.contains("FeedbackEditCopy.CS2102")); assertTrue(idOfCourses.contains("FeedbackEditCopy.CS2103")); assertTrue(idOfCourses.contains("FeedbackEditCopy.CS2103R")); assertTrue(idOfCourses.contains("FeedbackEditCopy.CS2104")); }
Source:
<code><START> protected static String propertyValue(String propertyFile, String propertyName) throws ParserConfigurationException, SAXException, IOException, URISyntaxException{ <END> String configLocation = System.getenv("HADOOP_CONF_DIR"); File file = new File(configLocation+"/"+propertyFile); DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory .newInstance(); DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); Document document = documentBuilder.parse(file); document.getDocumentElement().normalize(); Element docElement = document.getDocumentElement(); NodeList nodeList = docElement.getElementsByTagName("property"); ArrayList<String> names = new ArrayList<String>(); ArrayList<String> values = new ArrayList<String>(); if (nodeList != null) { int length = nodeList.getLength(); for (int i = 0; i < length; i++) { if (nodeList.item(i).getNodeType() == Node.ELEMENT_NODE) { Element element = (Element) nodeList.item(i); if (element.getNodeName().contains("property")) { names.add( element.getElementsByTagName("name").item(0).getTextContent()); values.add( element.getElementsByTagName("value").item(0).getTextContent()); } } } } String[] nameslist = names.toArray(new String[names.size()]); String[] valueslist = values.toArray(new String[values.size()]); int valuePosition = Arrays.asList(nameslist).indexOf(propertyName); String propertyValue = valueslist[valuePosition].toString(); return propertyValue; }</code><technical_language>methods protected static? Why</technical_language>

Target:
static String propertyValue(String propertyFile, String propertyName) throws ParserConfigurationException, SAXException, IOException, URISyntaxException { String configLocation = System.getenv("HADOOP_CONF_DIR"); File file = new File(configLocation + "/" + propertyFile); DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory .newInstance(); DocumentBuilder documentBuilder = documentBuilderFactory .newDocumentBuilder(); Document document = documentBuilder.parse(file); document.getDocumentElement().normalize(); Element docElement = document.getDocumentElement(); NodeList nodeList = docElement.getElementsByTagName("property"); ArrayList<String> names = new ArrayList<String>(); ArrayList<String> values = new ArrayList<String>(); if (nodeList != null) { int length = nodeList.getLength(); for (int i = 0; i < length; i++) { if (nodeList.item(i).getNodeType() == Node.ELEMENT_NODE) { Element element = (Element) nodeList.item(i); if (element.getNodeName().contains("property")) { names.add(element.getElementsByTagName("name").item(0) .getTextContent()); values.add(element.getElementsByTagName("value") .item(0).getTextContent()); } } } } String[] nameslist = names.toArray(new String[names.size()]); String[] valueslist = values.toArray(new String[values.size()]); int valuePosition = Arrays.asList(nameslist).indexOf(propertyName); String propertyValue = valueslist[valuePosition].toString(); return propertyValue; }
Source:
<code>public ConstraintEventsIterator(String dumpDirectory, HiveConf hiveConf) throws IOException { Path path = new Path(dumpDirectory); fs = path.getFileSystem(hiveConf); dbDirs = fs.listStatus(new Path(dumpDirectory), EximUtil.getDirectoryFilter(fs)); currentDbIndex = 0; if (dbDirs.length != 0) { <START> currentConstraintIndex = 0; <END> constraintFiles = listConstraintFilesInDBDir(fs, dbDirs[0].getPath()); } }</code><technical_language>Constraint files listing for 0th Db done hasNext avoid duplicate code here</technical_language>

Target:
public ConstraintEventsIterator(String dumpDirectory, HiveConf hiveConf) throws IOException { path = new Path(dumpDirectory); fs = path.getFileSystem(hiveConf); }
Source:
<code>private void setUpAudioPlayer() { audioPlayer = <START> ExoPlayerFactory.newSimpleInstance( <END> getApplicationContext(), new DefaultTrackSelector(), new DefaultLoadControl()); audioPlayer.addListener(this); audioPlayer.setPlayWhenReady(true); audioPlayer.setVolume(1.0f); }</code><technical_language>newSimpleInstance(Context, TrackSelector, LoadControl) is deprecated, newSimpleInstance(RenderersFactory, TrackSelector, LoadControl)</technical_language>

Target:
private void setUpAudioPlayer() { audioPlayer = ExoPlayerFactory.newSimpleInstance(new DefaultRenderersFactory(this), new DefaultTrackSelector(), new DefaultLoadControl()); audioPlayer.addListener(this); audioPlayer.setPlayWhenReady(true); audioPlayer.setVolume(1.0f); }
Source:
<code>private ClusterCacheStatus initCacheStatusIfAbsent(String cacheName) { return cacheStatusMap.computeIfAbsent(cacheName, (name) -> { Configuration cacheConfiguration = cacheManager.getCacheConfiguration(cacheName); AvailabilityStrategy availabilityStrategy; if (cacheConfiguration != null && cacheConfiguration.clustering().partitionHandling().enabled()) { availabilityStrategy = new PreferConsistencyStrategy(eventLogManager); } else { availabilityStrategy = new PreferAvailabilityStrategy(eventLogManager); } <START> Optional<GlobalStateManager> globalStateManager = cacheManager.getGlobalComponentRegistry().getOptionalComponent(GlobalStateManager.class); <END> Optional<ScopedPersistentState> persistedState = globalStateManager.flatMap(gsm -> { return gsm.readScopedState(cacheName); }); return new ClusterCacheStatus(cacheName, availabilityStrategy, this, transport, persistedState); }); }</code><technical_language>injection</technical_language>

Target:
private ClusterCacheStatus initCacheStatusIfAbsent(String cacheName) { return cacheStatusMap.computeIfAbsent(cacheName, (name) -> { Configuration cacheConfiguration = cacheManager.getCacheConfiguration(cacheName); AvailabilityStrategy availabilityStrategy; if (cacheConfiguration != null && cacheConfiguration.clustering().partitionHandling().enabled()) { availabilityStrategy = new PreferConsistencyStrategy(eventLogManager, persistentUUIDManager); } else { availabilityStrategy = new PreferAvailabilityStrategy(eventLogManager, persistentUUIDManager); } Optional<GlobalStateManager> globalStateManager = cacheManager.getGlobalComponentRegistry().getOptionalComponent(GlobalStateManager.class); Optional<ScopedPersistentState> persistedState = globalStateManager.flatMap(gsm -> { return gsm.readScopedState(cacheName); }); return new ClusterCacheStatus(cacheName, availabilityStrategy, this, transport, persistedState, persistentUUIDManager); }); }
Source:
<code>public void sortingShouldIgnoreCase() { assertSortedLike("a", "b", "z"); <START> assertSortedLike("a", "B"); <END> }</code><technical_language>add another upper case character prove point</technical_language>

Target:
public void sortingShouldIgnoreCase() { assertSortedLike("a", "b", "z"); assertSortedLike("a", "B", "c", "D"); }
Source:
<code>private static void checkValidStep(long start, long stop, long step) { checkCondition( step != 0, INVALID_FUNCTION_ARGUMENT, "step must not be zero"); checkCondition( step > 0 ? stop >= start : stop <= start, INVALID_FUNCTION_ARGUMENT, <START> "sequence stop value should be greater than or equal to start value if step is greater than zero otherwise stop should be less than or equal start"); <END> }</code><technical_language>equal</technical_language>

Target:
private static void checkValidStep(long start, long stop, long step) { checkCondition( step != 0, INVALID_FUNCTION_ARGUMENT, "step must not be zero"); checkCondition( step > 0 ? stop >= start : stop <= start, INVALID_FUNCTION_ARGUMENT, "sequence stop value should be greater than or equal to start value if step is greater than zero otherwise stop should be less than or equal to start"); }
Source:
<code>public Object visitPutMapCommand(InvocationContext ctx, PutMapCommand command) throws Throwable { <START> Object returnValue = super.visitPutMapCommand(ctx, command); <END> if (shouldUpdateOnWriteCommand(command)) { Set<Object> keys = command.getMap().keySet(); Set<Object> toInvalidate = new HashSet<Object>(keys.size()); for (Object k : keys) { if (cdl.localNodeIsPrimaryOwner(k)) { toInvalidate.add(k); } } if (!toInvalidate.isEmpty()) { getLog().tracef("Sending additional invalidation for requestors if necessary."); l1Manager.flushCache(toInvalidate, ctx.getOrigin(), true); } } return returnValue; }</code><technical_language>invokeNext instead of super.visitPutMapCommand</technical_language>

Target:
public Object visitPutMapCommand(InvocationContext ctx, PutMapCommand command) throws Throwable { Object returnValue = invokeNextInterceptor(ctx, command); if (shouldUpdateOnWriteCommand(command)) { Set<Object> keys = command.getMap().keySet(); Set<Object> toInvalidate = new HashSet<Object>(keys.size()); for (Object k : keys) { if (cdl.localNodeIsPrimaryOwner(k)) { toInvalidate.add(k); } } if (!toInvalidate.isEmpty()) { if (trace) { log.trace("Sending additional invalidation for requestors if necessary."); } l1Manager.flushCache(toInvalidate, ctx.getOrigin(), true); } } return returnValue; }
Source:
<code>private void initRenderingSupport() { dynamicFBM = new DynamicFBM(); staticFBM = new StaticFBM(); shadowMapResolutionDependentFBM = new ShadowMapResolutionDependentFBM(); context.put(DynamicFBM.class, dynamicFBM); context.put(StaticFBM.class, staticFBM); <START> context.put(ShadowMapResolutionDependentFBM.class, shadowMapResolutionDependentFBM); <END> postProcessor = new PostProcessor(dynamicFBM); context.put(PostProcessor.class, postProcessor); dynamicFBM.setPostProcessor(postProcessor); dynamicFBM.initialise(); staticFBM.initialise(); shadowMapResolutionDependentFBM.initialise(); shaderManager.initShaders(); initMaterials(); context.put(WorldRenderer.class, this); context.put(RenderQueuesHelper.class, renderQueues); context.put(RenderableWorld.class, renderableWorld); initRenderGraph(); }</code><technical_language>convinced public context. In opinion objects working renderer obtain them, i.e. constructor injection</technical_language>

Target:
private void initRenderingSupport() { screenGrabber = new ScreenGrabber(context); context.put(ScreenGrabber.class, screenGrabber); displayResolutionDependentFBOs = new DisplayResolutionDependentFBOs(context); immutableFBOs = new ImmutableFBOs(); shadowMapResolutionDependentFBOs = new ShadowMapResolutionDependentFBOs(); context.put(DisplayResolutionDependentFBOs.class, displayResolutionDependentFBOs); context.put(ImmutableFBOs.class, immutableFBOs); context.put(ShadowMapResolutionDependentFBOs.class, shadowMapResolutionDependentFBOs); shaderManager.initShaders(); initMaterials(); context.put(WorldRenderer.class, this); context.put(RenderQueuesHelper.class, renderQueues); context.put(RenderableWorld.class, renderableWorld); initRenderGraph(); }
Source:
<code>private void writeCSV(){ try { for (int i = 0; i < this.usersIdArray.size()-1; i++) { Integer idUser = this.mapUsers.inverse().get(this.usersIdArray.get(i)); <START> this.fileWriter.append(String.valueOf(idUser)); <END> this.fileWriter.append(","); Integer idProduct = this.mapProducts.inverse().get(this.productsIdArray.get(i)); this.fileWriter.append(String.valueOf(idProduct)); this.fileWriter.append(","); this.fileWriter.append(String.valueOf(this.reviewsArray.get(i))); this.fileWriter.append('\n'); } } catch (IOException e) { e.printStackTrace(); } }</code><technical_language>I consider construct entire line append :)</technical_language>

Target:
private void writeCSV(){ try { String lineToAppend; for (int i = 0; i < this.usersIdArray.size()-1; i++) { Integer idUser = this.mapUsers.inverse().get(this.usersIdArray.get(i)); Integer idProduct = this.mapProducts.inverse().get(this.productsIdArray.get(i)); lineToAppend = idUser + "," + idProduct + "," + this.reviewsArray.get(i) + "\n"; this.fileWriter.append(lineToAppend); } } catch (IOException e) { e.printStackTrace(); } }