auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static void generateFile(File outputDir, Version version, int rev, String buildDate) { String path = PACKAGE_NAME.replaceAll("\\.", "/"); File pkgdir = new File(outputDir, path); if (!pkgdir.exists()) { boolean ret = pkgdir.mkdirs(); if (!ret) { System.out.println("Cannnot create directory: " + path); System.exit(1); } } else if (!pkgdir.isDirectory()) { System.out.println(path + " is not a directory."); System.exit(1); } <START> try (FileWriter w = new FileWriter(new File(pkgdir, TYPE_NAME + ".java"));) { <END> w.write(" + ".version.util.VerGen.\n"); w.write(" \n"); w.write("\n"); w.write("package " + PACKAGE_NAME + ";\n\n"); w.write("public interface " + TYPE_NAME + " {\n"); w.write(" public static final int MAJOR=" + version.maj + ";\n"); w.write(" public static final int MINOR=" + version.min + ";\n"); w.write(" public static final int MICRO=" + version.micro + ";\n"); w.write(" public static final String QUALIFIER=" + (version.qualifier == null ? null : "\"" + version.qualifier + "\"") + ";\n"); if (rev < 0) { System.out.println("Unknown REVISION number, using " + rev); } w.write(" public static final int REVISION=" + rev + ";\n"); w.write(" public static final String BUILD_DATE=\"" + buildDate + "\";\n"); w.write("}\n"); } catch (IOException e) { System.out.println("Unable to generate version.Info file: " + e.getMessage()); System.exit(1); } }</code><technical_language>nit: spurious ";"</technical_language>

Target:
public static void generateFile(File outputDir, Version version, int rev, String buildDate) { String path = PACKAGE_NAME.replaceAll("\\.", "/"); File pkgdir = new File(outputDir, path); if (!pkgdir.exists()) { boolean ret = pkgdir.mkdirs(); if (!ret) { System.out.println("Cannnot create directory: " + path); System.exit(1); } } else if (!pkgdir.isDirectory()) { System.out.println(path + " is not a directory."); System.exit(1); } try (FileWriter w = new FileWriter(new File(pkgdir, TYPE_NAME + ".java"))) { w.write(" + ".version.util.VerGen.\n"); w.write(" \n"); w.write("\n"); w.write("package " + PACKAGE_NAME + ";\n\n"); w.write("public interface " + TYPE_NAME + " {\n"); w.write(" public static final int MAJOR=" + version.maj + ";\n"); w.write(" public static final int MINOR=" + version.min + ";\n"); w.write(" public static final int MICRO=" + version.micro + ";\n"); w.write(" public static final String QUALIFIER=" + (version.qualifier == null ? null : "\"" + version.qualifier + "\"") + ";\n"); if (rev < 0) { System.out.println("Unknown REVISION number, using " + rev); } w.write(" public static final int REVISION=" + rev + ";\n"); w.write(" public static final String BUILD_DATE=\"" + buildDate + "\";\n"); w.write("}\n"); } catch (IOException e) { System.out.println("Unable to generate version.Info file: " + e.getMessage()); System.exit(1); } }
Source:
<code>private void handleExternalLaunch() { CommCareApplication.instance().getSession().proceedWithSavedSessionIfNeeded(() -> { if (getIntent().hasExtra(SESSION_REQUEST)) { String sessionRequest = this.getIntent().getStringExtra(SESSION_REQUEST); SessionStateDescriptor ssd = new SessionStateDescriptor(); ssd.fromBundle(sessionRequest); CommCareApplication.instance().getCurrentSessionWrapper().loadFromStateDescription(ssd); Intent i = new Intent(this, StandardHomeActivity.class); i.putExtra(WAS_EXTERNAL, true); startActivityForResult(i, HOME_SCREEN); } else if (getIntent().hasExtra(SESSION_ENDPOINT_ID)) { String sessionEndpointId = this.getIntent().getStringExtra(SESSION_ENDPOINT_ID); <START> ArrayList<String> args = this.getIntent().getStringArrayListExtra(SESSION_ENDPOINT_ARGUMENTS); <END> Intent i = new Intent(this, StandardHomeActivity.class); i.putExtra(WAS_EXTERNAL, true); i.putExtra(SESSION_ENDPOINT_ID, sessionEndpointId); i.putStringArrayListExtra(SESSION_ENDPOINT_ARGUMENTS, args); startActivityForResult(i, HOME_SCREEN); } } ); }</code><technical_language>arguments need a Map (name value) a list</technical_language>

Target:
private void handleExternalLaunch() { CommCareApplication.instance().getSession().proceedWithSavedSessionIfNeeded(() -> { if (getIntent().hasExtra(SESSION_REQUEST)) { String sessionRequest = this.getIntent().getStringExtra(SESSION_REQUEST); SessionStateDescriptor ssd = new SessionStateDescriptor(); ssd.fromBundle(sessionRequest); CommCareApplication.instance().getCurrentSessionWrapper().loadFromStateDescription(ssd); Intent i = new Intent(this, StandardHomeActivity.class); i.putExtra(WAS_EXTERNAL, true); startActivityForResult(i, HOME_SCREEN); } else if (getIntent().hasExtra(SESSION_ENDPOINT_ID)) { String sessionEndpointId = this.getIntent().getStringExtra(SESSION_ENDPOINT_ID); Bundle args = this.getIntent().getBundleExtra(SESSION_ENDPOINT_ARGUMENTS_BUNDLE); ArrayList<String> argsList = this.getIntent().getStringArrayListExtra(SESSION_ENDPOINT_ARGUMENTS_LIST); Intent i = new Intent(this, StandardHomeActivity.class); i.putExtra(WAS_EXTERNAL, true); i.putExtra(SESSION_ENDPOINT_ID, sessionEndpointId); i.putExtra(SESSION_ENDPOINT_ARGUMENTS_BUNDLE, args); i.putStringArrayListExtra(SESSION_ENDPOINT_ARGUMENTS_LIST, argsList); startActivityForResult(i, HOME_SCREEN); } } ); }
Source:
<code>ExecutionPlan getExecutionPlan(StreamApplication app, String runId) throws Exception { app.init(graphSpec, config); OperatorSpecGraph specGraph = graphSpec.getOperatorSpecGraph(); Map<String, String> cfg = new HashMap<>(config); if (StringUtils.isNoneEmpty(runId)) { cfg.put(ApplicationConfig.APP_RUN_ID, runId); } StreamConfig streamConfig = new StreamConfig(config); Set<String> inputStreams = new HashSet<>(specGraph.getInputOperators().keySet()); inputStreams.removeAll(specGraph.getOutputStreams().keySet()); ApplicationMode mode = inputStreams.stream().allMatch(streamConfig::getIsBounded) ? ApplicationMode.BATCH : ApplicationMode.STREAM; cfg.put(ApplicationConfig.APP_MODE, mode.name()); <START> Config config = new MapConfig(cfg); <END> StreamManager streamManager = buildAndStartStreamManager(config); try { ExecutionPlanner planner = new ExecutionPlanner(config, streamManager); return planner.plan(specGraph); } finally { streamManager.stop(); } }</code><technical_language>trivial: a member-variable named "config" in this class a bit confusing disambiguate local variable. name specific reflect usage here</technical_language>

Target:
ExecutionPlan getExecutionPlan(StreamApplication app, String runId) throws Exception { app.init(graphSpec, config); OperatorSpecGraph specGraph = graphSpec.getOperatorSpecGraph(); Map<String, String> cfg = new HashMap<>(config); if (StringUtils.isNoneEmpty(runId)) { cfg.put(ApplicationConfig.APP_RUN_ID, runId); } StreamConfig streamConfig = new StreamConfig(config); Set<String> inputStreams = new HashSet<>(specGraph.getInputOperators().keySet()); inputStreams.removeAll(specGraph.getOutputStreams().keySet()); ApplicationMode mode = inputStreams.stream().allMatch(streamConfig::getIsBounded) ? ApplicationMode.BATCH : ApplicationMode.STREAM; cfg.put(ApplicationConfig.APP_MODE, mode.name()); Config generatedConfig = new MapConfig(cfg); StreamManager streamManager = buildAndStartStreamManager(generatedConfig); try { ExecutionPlanner planner = new ExecutionPlanner(generatedConfig, streamManager); return planner.plan(specGraph); } finally { streamManager.stop(); } }
Source:
<code>public PDataType getDataType() { <START> return getStrExpression().getDataType(); <END> }</code><technical_language>Change this PDataType.VARBINARY, evaluate method returns</technical_language>

Target:
public PDataType getDataType() { return PDataType.BINARY; }
Source:
<code>protected boolean shouldValidate() { ConfigurationService cs = Framework.getService(ConfigurationService.class); <START> if (cs.isBooleanPropertyTrue("studio.snapshot.disablePkgValidation")) { <END> return false; } return validate; }</code><technical_language>useful factor out this constant, is org.nuxeo.connect.client.jsf.AppCenterViewsManager.shouldValidateStudioSnapshot</technical_language>

Target:
protected boolean shouldValidate() { ConfigurationService cs = Framework.getService(ConfigurationService.class); if (cs.isBooleanPropertyTrue(ConnectClientComponent.STUDIO_SNAPSHOT_DISABLE_VALIDATION_PROPERTY)) { return false; } return validate; }
Source:
<code>public List<Guid> getHostIdsForClusterAndStatus(Guid clusterId, VDSStatus hostStatus) { <START> final String sql = "select vds_static.vds_id \n" <END> + "from vds_static \n" + "join vds_dynamic on vds_static.vds_id = vds_dynamic.vds_id \n" + "where vds_static.cluster_id = :v_clusterId \n" + "and vds_dynamic.status = :v_status"; final MapSqlParameterSource customMapSqlParameterSource = getCustomMapSqlParameterSource() .addValue("clusterId", clusterId) .addValue("status", hostStatus); return getNamedParameterJdbcTemplate().query(sql, customMapSqlParameterSource, createGuidMapper()); }</code><technical_language>introducing change in this fashion. 1. defies project standards. If wishes change a standard, a discussion devel@ovirt.org. 2. If change a column in future, enough modify views file publish upgrade script. require changing java code (one more) SQL logic is spread source files of types. 3.The stored procedures obey a formatting styling determined Eli aligned for sql files. change takes a step backward, in unified styling. 4. I review this java code, is syntax highlighting for SQL part. 5. This is a query language (i.e. JQL anyother), this is SQL java file. means if is a mistake in SQL, I rebuild entire application. bad for development cycle. Eli, share opinion</technical_language>

Target:
public List<Guid> getHostIdsForClusterAndStatus(Guid clusterId, VDSStatus hostStatus) { final String sql = "select vds_static.vds_id \n" + "from vds_static \n" + "join vds_dynamic on vds_static.vds_id = vds_dynamic.vds_id \n" + "where vds_static.cluster_id = :v_cluster_id \n" + "and vds_dynamic.status = :v_status"; final MapSqlParameterSource customMapSqlParameterSource = getCustomMapSqlParameterSource() .addValue("cluster_id", clusterId) .addValue("status", hostStatus); return getNamedParameterJdbcTemplate().query(sql, customMapSqlParameterSource, createGuidMapper()); }
Source:
<code>public void errorEventShouldBePublishedIfDevMachineFailedToStart() throws Exception { WorkspaceImpl workspace = createWorkspace(); when(envEngine.start(anyString(), anyString(), any(Environment.class), anyBoolean(), any())) .thenReturn(singletonList(createMachine(false))); try { runtimes.start(workspace, workspace.getConfig().getDefaultEnv(), false); } catch (Exception e) { <START> DtoFactory.newDto(WorkspaceStatusEvent.class) <END> .withWorkspaceId(workspace.getId()) .withEventType(EventType.ERROR) .withPrevStatus(WorkspaceStatus.STARTING); } }</code><technical_language>forgot verification</technical_language>

Target:
public void errorEventShouldBePublishedIfDevMachineFailedToStart() throws Exception { WorkspaceImpl workspace = createWorkspace(); when(envEngine.start(anyString(), anyString(), any(Environment.class), anyBoolean(), any())) .thenReturn(singletonList(createMachine(false))); try { runtimes.start(workspace, workspace.getConfig().getDefaultEnv(), false); } catch (Exception e) { verify(eventService).publish(DtoFactory.newDto(WorkspaceStatusEvent.class) .withWorkspaceId(workspace.getId()) .withEventType(EventType.ERROR) .withPrevStatus(WorkspaceStatus.STARTING)); } }
Source:
<code>public ContainerRequest filter(ContainerRequest request) { final ResourceAction resourceAction = new ResourceAction( <START> new Resource("security", ResourceType.CONFIG), <END> getAction(request) ); final Access authResult = AuthorizationUtils.authorizeResourceAction( getReq(), resourceAction, getAuthorizerMapper() ); if (!authResult.isAllowed()) { throw new WebApplicationException( Response.status(Response.Status.FORBIDDEN) .entity(StringUtils.format("Access-Check-Result: %s", authResult.toString())) .build() ); } return request; }</code><technical_language>expose security a static variable? I for readability</technical_language>

Target:
public ContainerRequest filter(ContainerRequest request) { final ResourceAction resourceAction = new ResourceAction( new Resource(SECURITY_RESOURCE_NAME, ResourceType.CONFIG), getAction(request) ); final Access authResult = AuthorizationUtils.authorizeResourceAction( getReq(), resourceAction, getAuthorizerMapper() ); if (!authResult.isAllowed()) { throw new WebApplicationException( Response.status(Response.Status.FORBIDDEN) .entity(StringUtils.format("Access-Check-Result: %s", authResult.toString())) .build() ); } return request; }
Source:
<code>public AudioPlayer() { cAudioChangedSubject = new Subject(); cPreferences = Gdx.app.getPreferences("AUDIO"); cAudioEnabled = cPreferences.getBoolean("ENABLED", true); cDefaultMusic = Gdx.audio.newMusic(Gdx.files.internal("music/Summer Day.mp3")); cEventStartedSound = Gdx.audio.newSound(Gdx.files.internal("sounds/eventOccured.mp3")); <START> cTaskCompletedSound = Gdx.audio.newSound(Gdx.files.internal("sounds/completedTask.wav")); <END> cEventCompletedSound = Gdx.audio.newSound(Gdx.files.internal("sounds/eventCompleted.mp3")); cDefaultMusic.setLooping(true); setLastPlayed(cDefaultMusic); playAudio(cDefaultMusic); }</code><technical_language>Assets, loading properly them</technical_language>

Target:
public AudioPlayer() { cAudioChangedSubject = new Subject(); cPreferences = Gdx.app.getPreferences("AUDIO"); cAudioEnabled = cPreferences.getBoolean("ENABLED", true); cDefaultMusic = Gdx.audio.newMusic(Gdx.files.internal("music/Summer Day.mp3")); cEventStartedSound = Assets.getInstance().getSound("sounds/eventOccured.mp3"); cTaskCompletedSound = Assets.getInstance().getSound("sounds/completedTask.wav"); cEventCompletedSound = Assets.getInstance().getSound("sounds/eventCompleted.mp3"); cDefaultMusic.setLooping(true); setLastPlayed(cDefaultMusic); playAudio(cDefaultMusic); }
Source:
<code>public List<T> accumulate(List<T> accumulatedValue, T input) { if (comparator == null) { throw new RuntimeException("Comparator not provided, Tuple cannot be compared"); } Comparator<T> accComparator = sortDesc ? descComparator : comparator; <START> int index = Collections.binarySearch(accumulatedValue, input, accComparator); <END> index = index >= 0 ? index : (-index - 1); accumulatedValue.add(index, input); return accumulatedValue; }</code><technical_language>Next 3 lines is common piece of code in accumulate merge.. create a method, lets insertElement(T input, List<T> accumulation) call this method 2 places</technical_language>

Target:
public List<T> accumulate(List<T> accumulatedValue, T input) { if (comparator == null) { throw new RuntimeException("Comparator not provided, Tuple cannot be compared"); } Comparator<T> accComparator = reverseSort ? reverseComparator : comparator; insertElement(accumulatedValue, input, accComparator); return accumulatedValue; }
Source:
<code><START> public void waitForStaleTransactions() throws Exception <END> { for(int i=0; i<60; i++) { try (ResultSet rs = methodWatcher.executeQuery( "call SYSCS_UTIL.SYSCS_GET_ACTIVE_TRANSACTION_IDS()")) { String actual = TestUtils.FormattedResult.ResultFactory.toString(rs); if( actual.equals("") ) return; Thread.sleep(1000); System.out.println("VacuumIT: Waiting for active transactions:\n" + actual); } } Assert.fail("VacuumIT can't run with active transactions still happening. This is a bug in other " + "tests failing to close their transactions."); }</code><technical_language>create a JIRA remove this reference here</technical_language>

Target:
public void waitForStaleTransactions() throws Exception { for(int i=0; i<60; i++) { try (ResultSet rs = methodWatcher.executeQuery( "call SYSCS_UTIL.SYSCS_GET_ACTIVE_TRANSACTION_IDS()")) { String actual = TestUtils.FormattedResult.ResultFactory.toString(rs); if( actual.equals("") ) return; Thread.sleep(1000); LOG.info("VacuumIT: Waiting for active transactions:\n" + actual); } } Assert.fail("VacuumIT can't run with active transactions still happening. This is a bug in other " + "tests failing to close their transactions."); }
Source:
<code>public GridCacheTestContext(GridTestKernalContext ctx) throws Exception { super( ctx, new GridCacheSharedContext<>( ctx, new IgniteTxManager(), new GridCacheVersionManager(), new GridCacheMvccManager(), null, null, new WalStateManager(null), new IgniteCacheDatabaseSharedManager(), <START> null, END> new IgniteCacheSnapshotManager(), new GridCacheDeploymentManager<K, V>(), new GridCachePartitionExchangeManager<K, V>(), new CacheAffinitySharedManager<K, V>(), new GridCacheIoManager(), new GridCacheSharedTtlCleanupManager(), new PartitionsEvictManager(), new CacheNoopJtaManager(), null, null, null, new CacheDiagnosticManager() ), defaultCacheConfiguration(), null, CacheType.USER, AffinityTopologyVersion.ZERO, IgniteUuid.randomUuid(), true, true, false, false, new CacheCompressionManager(), new GridCacheEventManager(), new CacheOsStoreManager(null, new CacheConfiguration()), new GridCacheEvictionManager(), new GridCacheLocalQueryManager<K, V>(), new CacheContinuousQueryManager(), new CacheDataStructuresManager(), new GridCacheTtlManager(), new GridOsCacheDrManager(), new CacheOsConflictResolutionManager<K, V>(), new CachePluginManager(ctx, new CacheConfiguration()), new GridCacheAffinityManager() ); store().initialize(null, new IdentityHashMap<CacheStore, ThreadLocal>()); }</code><technical_language>Do need a snapshot manager here? I necessary. Please remove TODO</technical_language>

Target:
public GridCacheTestContext(GridTestKernalContext ctx) throws Exception { super( ctx, new GridCacheSharedContext<>( ctx, new IgniteTxManager(), new GridCacheVersionManager(), new GridCacheMvccManager(), null, null, new WalStateManager(null), new IgniteCacheDatabaseSharedManager(), null, new IgniteCacheSnapshotManager(), new GridCacheDeploymentManager<K, V>(), new GridCachePartitionExchangeManager<K, V>(), new CacheAffinitySharedManager<K, V>(), new GridCacheIoManager(), new GridCacheSharedTtlCleanupManager(), new PartitionsEvictManager(), new CacheNoopJtaManager(), null, null, null, new CacheDiagnosticManager() ), defaultCacheConfiguration(), null, CacheType.USER, AffinityTopologyVersion.ZERO, IgniteUuid.randomUuid(), true, true, false, false, new CacheCompressionManager(), new GridCacheEventManager(), new CacheOsStoreManager(null, new CacheConfiguration()), new GridCacheEvictionManager(), new GridCacheLocalQueryManager<K, V>(), new CacheContinuousQueryManager(), new CacheDataStructuresManager(), new GridCacheTtlManager(), new GridOsCacheDrManager(), new CacheOsConflictResolutionManager<K, V>(), new CachePluginManager(ctx, new CacheConfiguration()), new GridCacheAffinityManager(), null ); store().initialize(null, new IdentityHashMap<CacheStore, ThreadLocal>()); }
Source:
<code>protected void addVmInterfaces() { VmInterfaceManager vmInterfaceManager = new VmInterfaceManager(); VnicProfileHelper vnicProfileHelper = new VnicProfileHelper(getVm().getVdsGroupId(), getStoragePoolId(), getVdsGroup().getcompatibility_version(), AuditLogType.IMPORTEXPORT_IMPORT_VM_INVALID_INTERFACES); List<VmNetworkInterface> nics = getVm().getInterfaces(); vmInterfaceManager.sortVmNics(nics, getVm().getStaticData().getManagedDeviceMap()); if (getParameters().isImportAsNewEntity()) { List<String> macAddresses = MacPoolManager.getInstance().allocateMacAddresses(nics.size()); for (int i = 0; i < nics.size(); ++i) { <START> VmNetworkInterface iface = nics.get(i); <END> iface.setMacAddress(macAddresses.get(i)); } } for (int i = 0; i < nics.size(); ++i) { VmNetworkInterface iface = nics.get(i); initInterface(iface); vnicProfileHelper.updateNicWithVnicProfileForUser(iface, getCurrentUser()); vmInterfaceManager.add(iface, getCompensationContext(), !getParameters().isImportAsNewEntity(), getVm().getOs(), getVdsGroup().getcompatibility_version()); macsAdded.add(iface.getMacAddress()); } vnicProfileHelper.auditInvalidInterfaces(getVmName()); }</code><technical_language>This variable inlined, i.e. nics.get(i).setMacAddress(macAddresses.get(i));</technical_language>

Target:
protected void addVmInterfaces() { VmInterfaceManager vmInterfaceManager = new VmInterfaceManager(); VnicProfileHelper vnicProfileHelper = new VnicProfileHelper(getVm().getVdsGroupId(), getStoragePoolId(), getVdsGroup().getcompatibility_version(), AuditLogType.IMPORTEXPORT_IMPORT_VM_INVALID_INTERFACES); List<VmNetworkInterface> nics = getVm().getInterfaces(); vmInterfaceManager.sortVmNics(nics, getVm().getStaticData().getManagedDeviceMap()); if (getParameters().isImportAsNewEntity()) { List<String> macAddresses = MacPoolManager.getInstance().allocateMacAddresses(nics.size()); for (int i = 0; i < nics.size(); ++i) { nics.get(i).setMacAddress(macAddresses.get(i)); } } for (VmNetworkInterface iface : getVm().getInterfaces()) { initInterface(iface); vnicProfileHelper.updateNicWithVnicProfileForUser(iface, getCurrentUser()); vmInterfaceManager.add(iface, getCompensationContext(), !getParameters().isImportAsNewEntity(), getVm().getOs(), getVdsGroup().getcompatibility_version()); macsAdded.add(iface.getMacAddress()); } vnicProfileHelper.auditInvalidInterfaces(getVmName()); }
Source:
<code>private RuleKey getParsingErrorRuleKey() { List<RuleKey> keys = checks.all().stream() .filter(check -> check instanceof ParsingErrorCheck) <START> .map(check -> checks.ruleKeyFor((ParsingErrorCheck) check)) <END> .collect(Collectors.toList()); return keys.isEmpty() ? null : keys.get(0); }</code><technical_language>@ivandalbosco casting ParsingErrorCheck is useless</technical_language>

Target:
private RuleKey getParsingErrorRuleKey() { List<RuleKey> keys = checks.all().stream() .filter(check -> check instanceof ParsingErrorCheck) .map(checks::ruleKeyFor) .collect(Collectors.toList()); return keys.isEmpty() ? null : keys.get(0); }
Source:
<code>public IpUtil() { <START> <END> ipAddressMatcherCache = new HashSet<IpAddressMatcher>(); for (String proxyIp : trustedProxies) { String sanitizedProxyIp = proxyIp.trim(); try { IpAddressMatcher matcher = new IpAddressMatcher(sanitizedProxyIp); ipAddressMatcherCache.add(matcher); } catch (IllegalArgumentException e) { throw new RuntimeException("Invalid entry '" + proxyIp + "' found in the default trusted proxies list", e); } } }</code><technical_language>Nit: Empty line beginning of method</technical_language>

Target:
public IpUtil() { ipAddressMatcherCache = new HashSet<IpAddressMatcher>(); for (String proxyIp : trustedProxies) { String trimmedProxyIp = proxyIp.trim(); try { IpAddressMatcher matcher = new IpAddressMatcher(trimmedProxyIp); ipAddressMatcherCache.add(matcher); } catch (IllegalArgumentException e) { throw new RuntimeException("Invalid entry '" + proxyIp + "' " + "found in the default trusted proxies list", e); } } }
Source:
<code>public void close() { <START> _zkClient.close(); <END> }</code><technical_language>please add a null check isClosed() check (if available)</technical_language>

Target:
public void close() { if (_zkClient != null) { _zkClient.close(); } }
Source:
<code>private void executeIrreversibleMetastoreOperations() { List<String> failedIrreversibleOperationDescriptions = new ArrayList<>(); List<Throwable> suppressedExceptions = new ArrayList<>(); boolean anySucceeded = false; for (IrreversibleMetastoreOperation irreversibleMetastoreOperation : metastoreDeleteOperations) { try { irreversibleMetastoreOperation.run(); anySucceeded = true; } catch (Throwable t) { failedIrreversibleOperationDescriptions.add(irreversibleMetastoreOperation.getDescription()); if (suppressedExceptions.size() < 5) { suppressedExceptions.add(t); } } } if (!suppressedExceptions.isEmpty()) { StringBuilder message = new StringBuilder(); if (deleteOnly && !anySucceeded) { message.append("The following metastore delete operations failed: "); } else { message.append("The transaction didn't commit cleanly. All operations other than the following delete operations were completed: "); } <START> message.append(failedIrreversibleOperationDescriptions.stream() <END> .collect(Collectors.joining("; "))); PrestoException prestoException = new PrestoException( HIVE_METASTORE_ERROR, message.toString()); suppressedExceptions.forEach(prestoException::addSuppressed); throw prestoException; } }</code><technical_language>put this line is action. is short if static import: java message.append(failedIrreversibleOperationDescriptions.stream().collect(joining("; "))); Joiner, supports StringBuilder: Joiner.on("; ").appendTo(message, failedIrreversibleOperationDescriptions);</technical_language>

Target:
private void executeIrreversibleMetastoreOperations() { List<String> failedIrreversibleOperationDescriptions = new ArrayList<>(); List<Throwable> suppressedExceptions = new ArrayList<>(); boolean anySucceeded = false; for (IrreversibleMetastoreOperation irreversibleMetastoreOperation : metastoreDeleteOperations) { try { irreversibleMetastoreOperation.run(); anySucceeded = true; } catch (Throwable t) { failedIrreversibleOperationDescriptions.add(irreversibleMetastoreOperation.getDescription()); if (suppressedExceptions.size() < 5) { suppressedExceptions.add(t); } } } if (!suppressedExceptions.isEmpty()) { StringBuilder message = new StringBuilder(); if (deleteOnly && !anySucceeded) { message.append("The following metastore delete operations failed: "); } else { message.append("The transaction didn't commit cleanly. All operations other than the following delete operations were completed: "); } Joiner.on("; ").appendTo(message, failedIrreversibleOperationDescriptions); PrestoException prestoException = new PrestoException(HIVE_METASTORE_ERROR, message.toString()); suppressedExceptions.forEach(prestoException::addSuppressed); throw prestoException; } }
Source:
<code>public int ifHit(Vector<Bullet> shipBullets) { <START> Iterator iteralien = ConcreteAggregate.createIterator(shipBullets); <END> while (iteralien.hasNext()) { Bullet bullet = (Bullet) iteralien.next(); if (bullet.getY() > ypos - 12 && bullet.getY() < ypos + 16) { if (bullet.getX() > xpos - 6 && bullet.getX() < xpos + 16) { Game.logfile.writeHit("Alien", xpos, ypos); health--; return iteralien.position(); } } } return -1; }</code><technical_language>iteralien -> iterShipBullets (better for readability)</technical_language>

Target:
public int ifHit(Vector<Bullet> shipBullets) { Iterator iterShipBullets = ConcreteAggregate.createIterator(shipBullets); while (iterShipBullets.hasNext()) { Bullet bullet = (Bullet) iterShipBullets.next(); if (bullet.getY() > ypos - 12 && bullet.getY() < ypos + 16) { if (bullet.getX() > xpos - 6 && bullet.getX() < xpos + 16) { Game.logfile.writeHit("Alien", xpos, ypos); health--; return iterShipBullets.position(); } } } return -1; }
Source:
<code>protected void startDebugger(final DebugSessionDto debugSessionDto) { List<BreakpointDto> breakpoints = new ArrayList<>(); for (Breakpoint b : breakpointManager.getBreakpointList()) { LocationDto locationDto = dtoFactory.createDto(LocationDto.class); locationDto.setLineNumber(b.getLineNumber() + 1); locationDto.setResourcePath(b.getPath()); <START> locationDto.setResourceProjectPath(b.getFile().getProject().getProjectConfig().getPath()); <END> String target = pathToFqn(b.getFile()); if (target != null) { locationDto.setTarget(target); BreakpointDto breakpointDto = dtoFactory.createDto(BreakpointDto.class); breakpointDto.setLocation(locationDto); breakpointDto.setEnabled(true); breakpoints.add(breakpointDto); } } StartActionDto action = dtoFactory.createDto(StartActionDto.class); action.setType(Action.TYPE.START); action.setBreakpoints(breakpoints); service.start(debugSessionDto.getId(), action); }</code><technical_language>mb dtoFactory.createDto(LocationDto.class); .withLineNumber(b.getLineNumber() + 1); .withResourcePath(b.getPath()); .withResourceProjectPath(b.getFile().getProject().getProjectConfig().getPath());</technical_language>

Target:
protected void startDebugger(final DebugSessionDto debugSessionDto) { List<BreakpointDto> breakpoints = new ArrayList<>(); for (Breakpoint breakpoint : breakpointManager.getBreakpointList()) { LocationDto locationDto = dtoFactory.createDto(LocationDto.class) .withLineNumber(breakpoint.getLineNumber() + 1) .withResourcePath(breakpoint.getPath()) .withResourceProjectPath(getProject(breakpoint.getFile()).getPath()); String target = pathToFqn(breakpoint.getFile()); if (target != null) { locationDto.setTarget(target); BreakpointDto breakpointDto = dtoFactory.createDto(BreakpointDto.class); breakpointDto.setLocation(locationDto); breakpointDto.setEnabled(true); breakpoints.add(breakpointDto); } } StartActionDto action = dtoFactory.createDto(StartActionDto.class); action.setType(Action.TYPE.START); action.setBreakpoints(breakpoints); service.start(debugSessionDto.getId(), action); }
Source:
<code>public void addProjectId(ProjectId projectId) { <START> projectIds.add(projectId); <END> }</code><technical_language>cloned</technical_language>

Target:
public void addProjectId(ProjectId projectId) { projectIds.add(ModelUtil.clone(projectId)); }
Source:
<code>public ByteCountingLRUMap( final int initialSize, final int logEvictionCount, final long sizeInBytes ) { super(initialSize, 0.75f, true); this.logEvictionCount = logEvictionCount; this.sizeInBytes = sizeInBytes; if (sizeInBytes <= 0) { <START> Throwables.propagate(new ISE("sizeInBytes should be greater than 0.")); <END> } logEvictions = logEvictionCount != 0; numBytes = 0; evictionCount = 0; }</code><technical_language>throw ISE instead of wrapping it</technical_language>

Target:
public ByteCountingLRUMap( final int initialSize, final int logEvictionCount, final long sizeInBytes ) { super(initialSize, 0.75f, true); this.logEvictionCount = logEvictionCount; this.sizeInBytes = sizeInBytes; if (sizeInBytes <= 0) { log.warn("The cache is DISABLED."); } logEvictions = logEvictionCount != 0; numBytes = 0; evictionCount = 0; }
Source:
<code>public Object execute(ExecutionEvent aEvent) throws ExecutionException { final GerritTableView reviewTableView = GerritTableView.getActiveView(); final TableViewer viewer = reviewTableView.getTableViewer(); final ISelection tableSelection = viewer.getSelection(); <START> if (tableSelection.isEmpty()) { <END> GerritUi.Ftracer.traceInfo("Selected table selection is EMPTY "); return null; } final Job job = new Job(COMMAND_MESSAGE) { @Override protected IStatus run(IProgressMonitor monitor) { if (tableSelection instanceof IStructuredSelection) { Object obj = ((IStructuredSelection) tableSelection) .getFirstElement(); if (obj instanceof GerritTask) { item = (GerritTask) obj; try { reviewTableView.setStarred(item.getTaskId(), !item.getStarred(), monitor); item.setAttribute( GerritTask.IS_STARRED, Boolean.toString(!Boolean.valueOf(item .getAttribute(GerritTask.IS_STARRED)))); } catch (CoreException e) { UIUtils.showErrorDialog(e.getMessage(), e .getStatus().getException().getMessage()); } Display.getDefault().asyncExec(new Runnable() { public void run() { viewer.update(item, null); } }); } } return Status.OK_STATUS; } }; job.setUser(false); job.schedule(); return null; }</code><technical_language>I meant. I command right-clicking in empty Dashboard. there. disabled</technical_language>

Target:
public Object execute(ExecutionEvent aEvent) throws ExecutionException { final GerritTableView reviewTableView = GerritTableView.getActiveView(); final TableViewer viewer = reviewTableView.getTableViewer(); final ISelection tableSelection = viewer.getSelection(); if (tableSelection.isEmpty()) { GerritUi.Ftracer.traceInfo("Selected table selection is EMPTY "); return null; } final Job job = new Job(COMMAND_MESSAGE) { @Override protected IStatus run(IProgressMonitor monitor) { if (tableSelection instanceof IStructuredSelection) { Object obj = ((IStructuredSelection) tableSelection) .getFirstElement(); if (obj instanceof GerritTask) { item = (GerritTask) obj; try { reviewTableView.setStarred(item.getTaskId(), !Boolean.valueOf(item.getAttribute(GerritTask.IS_STARRED)), monitor); item.setAttribute( GerritTask.IS_STARRED, Boolean.toString(!Boolean.valueOf(item .getAttribute(GerritTask.IS_STARRED)))); } catch (CoreException e) { UIUtils.showErrorDialog(e.getMessage(), e .getStatus().getException().getMessage()); } Display.getDefault().asyncExec(new Runnable() { public void run() { viewer.update(item, null); } }); } } return Status.OK_STATUS; } }; job.setUser(false); job.schedule(); return null; }
Source:
<code>SlotMapper(BBContainer mapBuff, int cursorBufferSize) { ByteBuffer buff = mapBuff.b(); buff.position(8); m_opaqueDataSize = buff.getInt(); buff.position(buff.position() + m_opaqueDataSize); short fileVersion = buff.getShort(); assert(fileVersion == FILE_VERSION); short partitionCount = buff.getShort(); assert(buff.remaining() >= (partitionCount * 2) + 4); m_cursorSpace = cursorBufferSize; m_slotBlockSize = CURSOR_SIZE * partitionCount; int offset = 0; ImmutableSortedMap.Builder<Integer, Integer> builder = ImmutableSortedMap.<Integer, Integer>naturalOrder(); for (int ii = 0; ii < partitionCount; ii++) { builder.put(new Integer(buff.getShort()), offset++); } m_localPartitionIds = builder.build(); m_maxStreams = buff.getInt(); assert((m_cursorSpace - FILE_HEADER_SIZE) / m_slotBlockSize == m_maxStreams); assert(buff.remaining() >= m_maxStreams * 4); Map<Integer, Integer> slotsToLen = new TreeMap<>(); for (int ii = 0; ii < m_maxStreams; ii++) { <START> Integer nameLen = new Integer(buff.getInt()); <END> if (nameLen == -1) { m_freeSlots.add(ii); } else { slotsToLen.put(ii, nameLen); } } byte[] name = new byte[1024]; for (Entry<Integer, Integer> e : slotsToLen.entrySet()) { Integer len = e.getValue(); buff.get(name, 0, len); String cursorName = new String(name, 0, len, Constants.UTF8ENCODING); m_streamnameToSlotBlock.put(cursorName, e.getKey()); m_slotBlockToStreamname.put(e.getKey(), cursorName); } buff.position(0); m_slotMapBuffer = mapBuff; }</code><technical_language>avoid new Integer in favor of Integer.valueOf</technical_language>

Target:
SlotMapper(BBContainer mapBuff, int cursorBufferSize) { ByteBuffer buff = mapBuff.b(); buff.position(8); m_opaqueDataSize = buff.getInt(); m_latestOpaque = new byte[m_opaqueDataSize]; buff.get(m_latestOpaque); short fileVersion = buff.getShort(); assert(fileVersion == FILE_VERSION); short partitionCount = buff.getShort(); assert(buff.remaining() >= (partitionCount * 2) + 4); m_cursorSpace = cursorBufferSize; m_slotBlockSize = CURSOR_SIZE * partitionCount; int offset = 0; ImmutableSortedMap.Builder<Integer, Integer> builder = ImmutableSortedMap.<Integer, Integer>naturalOrder(); for (int ii = 0; ii < partitionCount; ii++) { builder.put(new Integer(buff.getShort()), offset++); } m_localPartitionIds = builder.build(); m_maxStreams = buff.getInt(); m_freeSlots = new BitSet(m_maxStreams); m_sparseStreamCount = buff.getInt(); assert((m_cursorSpace - FILE_HEADER_SIZE) / m_slotBlockSize == m_maxStreams); assert(buff.remaining() >= m_sparseStreamCount * 4); Map<Integer, Integer> slotsToLen = new TreeMap<>(); for (int ii = 0; ii < m_sparseStreamCount; ii++) { Integer nameLen = new Integer(buff.getInt()); if (nameLen == -1) { m_freeSlots.set(ii); } else { slotsToLen.put(ii, nameLen); } } m_nonNamesTrailerSize = buff.position(); byte[] name = new byte[1024]; for (Entry<Integer, Integer> e : slotsToLen.entrySet()) { Integer len = e.getValue(); buff.get(name, 0, len); String cursorName = new String(name, 0, len, Constants.UTF8ENCODING); m_streamnameToSlotBlock.put(cursorName, e.getKey()); m_slotBlockToStreamname.put(e.getKey(), cursorName); } buff.position(0); m_slotMapBuffer = mapBuff; }
Source:
<code><T> void uninstallSubscriber(Class<T> type, Subscriber<T> subscriber) { Map<Subscriber, Subscriber> subscribers = subscribersByType.get(type); if (subscribers != null) { Subscriber original = subscribers.remove(subscriber); if (original != null) { original.invalidate(); <START> return; <END> } } throw new IllegalArgumentException( "Missing subscriber for an annotated method. Is " + type + " registered?"); }</code><technical_language>return line below. sample app crashes (wrong missing subscriber exception) soon pause app</technical_language>

Target:
<T> void uninstallSubscriber(Class<T> type, Subscriber<T> subscriber) { Map<Subscriber, Subscriber> subscribers = subscribersByType.get(type); if (subscribers != null) { Subscriber original = subscribers.remove(subscriber); if (original != null) { original.invalidate(); } return; } throw new IllegalArgumentException( "Missing subscriber for an annotated method. Is " + type + " registered?"); }
Source:
<code><START> public synchronized boolean compareAndSetState(final String expectedCurrentState, final String state) { <END> final boolean compared = currentState.name.equals(expectedCurrentState); if (compared) { setState(state); } return compared; }</code><technical_language>I this CAS operation, check requested transition is valid not, is of important motivation of StateMachine I think. Also, is checkAndSetState is similar this method, throws RuntimeException states do match in predefined legal transitions. allowing users configure StateMachine for action invalid transition occurs? choices I imagine for now: 1) Throw RuntimeException, 2) Proceed leaving WARNING log message. introduce a boolean (e.g., failsOnIllegalTransition), argument of StateMachine.Builder. changing return type checkAndSetState() boolean, internal logic of boolean field, method while achieving goals of methods. sound</technical_language>

Target:
public synchronized boolean compareAndSetState(final String expectedCurrentState, final String state) { final boolean compared = currentState.name.equals(expectedCurrentState); if (compared) { setState(state); } else { LOG.log(Level.FINE, "The expected current state [" + expectedCurrentState + "] is different from the actual state [" + currentState.name + "]"); } return compared; }
Source:
<code>protected void handleAgentIfNotConnected(HostVO host, boolean vmsMigrating) { final boolean isAgentOnHost = host.getHypervisorType() == HypervisorType.KVM || host.getHypervisorType() == HypervisorType.LXC; if (isAgentOnHost) { <START> final boolean sshToAgent = Boolean.parseBoolean(_configDao.getValue(Config.KvmSshToAgentEnabled.key())); <END> if (!vmsMigrating && host.getStatus() != Status.Up) { if (sshToAgent) { Pair<String, String> credentials = getHostCredentials(host); connectAndRestartAgentOnHost(host, credentials.first(), credentials.second()); } else { throw new CloudRuntimeException("SSH access is disabled, cannot cancel maintenance mode as " + "host agent is not connected"); } } } }</code><technical_language>move Config ConfigKey instead</technical_language>

Target:
protected void handleAgentIfNotConnected(HostVO host, boolean vmsMigrating) { final boolean isAgentOnHost = host.getHypervisorType() == HypervisorType.KVM || host.getHypervisorType() == HypervisorType.LXC; if (!isAgentOnHost || vmsMigrating || host.getStatus() == Status.Up) { return; } final boolean sshToAgent = Boolean.parseBoolean(_configDao.getValue(KvmSshToAgentEnabled.key())); if (sshToAgent) { Pair<String, String> credentials = getHostCredentials(host); connectAndRestartAgentOnHost(host, credentials.first(), credentials.second()); } else { throw new CloudRuntimeException("SSH access is disabled, cannot cancel maintenance mode as " + "host agent is not connected"); } }
Source:
<code>static long calculateDirSizeAndSave(final File dir) throws IOException { final Path path = Paths.get(dir.getPath(), FlowPreparer.PROJECT_DIR_SIZE_FILE_NAME); if (!Files.exists(path)) { final long sizeInByte = FileUtils.sizeOfDirectory(dir); FileIOUtils.dumpNumberToFile(path, sizeInByte); } <START> return FileIOUtils.readNumberFromFile(path); <END> }</code><technical_language>Return sizeInByte instead, if available</technical_language>

Target:
static long calculateDirSizeAndSave(final File dir) throws IOException { final Path path = Paths.get(dir.getPath(), FlowPreparer.PROJECT_DIR_SIZE_FILE_NAME); if (!Files.exists(path)) { final long sizeInByte = FileUtils.sizeOfDirectory(dir); FileIOUtils.dumpNumberToFile(path, sizeInByte); return sizeInByte; } else { return FileIOUtils.readNumberFromFile(path); } }
Source:
<code>private static String asText(JsonNode node) { <START> Preconditions.checkState(node.isValueNode()); <END> return node.isNull() ? null : node.asText(); }</code><technical_language>static import</technical_language>

Target:
private static String asText(JsonNode node) { checkState(node.isValueNode()); return node.isNull() ? null : node.asText(); }
Source:
<code>public void testSelectWithNestedPdxFieldAccess() { calciteAssert() .query("select primaryAddress['city'] as city from geode.BookCustomer limit 2") .returnsCount(2) <START> .returns("city=TOPEKA\n" <END> + "city=SAN FRANCISCO\n") .explainContains("PLAN=GeodeToEnumerableConverter\n" + " GeodeProject(city=[ITEM($3, 'city')])\n" + " GeodeSort(fetch=[2])\n" + " GeodeTableScan(table=[[geode, BookCustomer]])\n"); }</code><technical_language>discussed, original data change (in zips-mini.json)</technical_language>

Target:
public void testSelectWithNestedPdxFieldAccess() { calciteAssert() .query("select primaryAddress['city'] as city from geode.BookCustomer limit 2") .returnsCount(2) .returns("city=Topeka\n" + "city=San Francisco\n") .explainContains("PLAN=GeodeToEnumerableConverter\n" + " GeodeProject(city=[ITEM($3, 'city')])\n" + " GeodeSort(fetch=[2])\n" + " GeodeTableScan(table=[[geode, BookCustomer]])\n"); }
Source:
<code>public SetupNetworksEditBondModel(final CreateOrUpdateBond bond, boolean doesBondHaveVmNetworkAttached) { super(doesBondHaveVmNetworkAttached); setTitle(ConstantsManager.getInstance() .getMessages() .editBondInterfaceTitle(bond.getName())); getBond().setIsChangeable(false); List<String> bondName = Arrays.asList(bond.getName()); getBond().setItems(bondName); getBond().setSelectedItem(bond.getName()); String bondOptions = bond.getBondOptions(); List<Map.Entry<String, EntityModel<String>>> items = (List<Map.Entry<String, EntityModel<String>>>) getBondingOptions().getItems(); boolean found = false; Map.Entry<String, EntityModel<String>> customItem = null; for (Map.Entry<String, EntityModel<String>> pair : items) { String key = pair.getKey(); if (key.equals(bondOptions)) { getBondingOptions().setSelectedItem(pair); found = true; break; } else if ("custom".equals(key)) { customItem = pair; } } if (!found) { EntityModel<String> value = new EntityModel<>(); value.setEntity(bondOptions); customItem.setValue(value); getBondingOptions().setSelectedItem(customItem); <START> getCustomBondEditor().setEntity(bondOptions); <END> } }</code><technical_language>'SetupNetworksBondPopupView.updateBondOptions()' should've done work. a bug, updates of 'customBondEditor' manually view. Setting manually view fire event, therefore, model is updated "thinks" is null (although actual is displayed). fix be, moving 'SetupNetworksBondPopupView.updateBondOptions()' registration 'getBondingOptions().getSelectedItemChangedEvent()' model ('SetupNetworksBondModel'). Notice - manipulate editor is enabled (in model side), 'setIsChangeable(..)' method</technical_language>

Target:
public SetupNetworksEditBondModel(final CreateOrUpdateBond bond, boolean doesBondHaveVmNetworkAttached) { super(doesBondHaveVmNetworkAttached); setTitle(ConstantsManager.getInstance() .getMessages() .editBondInterfaceTitle(bond.getName())); getBond().setIsChangeable(false); List<String> bondName = Arrays.asList(bond.getName()); getBond().setItems(bondName); getBond().setSelectedItem(bond.getName()); String bondOptions = bond.getBondOptions(); List<Map.Entry<String, EntityModel<String>>> items = (List<Map.Entry<String, EntityModel<String>>>) getBondingOptions().getItems(); boolean found = false; Map.Entry<String, EntityModel<String>> customItem = null; for (Map.Entry<String, EntityModel<String>> pair : items) { String key = pair.getKey(); if (key.equals(bondOptions)) { getBondingOptions().setSelectedItem(pair); found = true; break; } else if ("custom".equals(key)) { customItem = pair; } } if (!found) { EntityModel<String> value = new EntityModel<>(); value.setEntity(bondOptions); customItem.setValue(value); getBondingOptions().setSelectedItem(customItem); } }
Source:
<code>InfiniumFileTOC[] getTableOfContents() throws IOException { InfiniumFileTOC[] tableOfContents = new InfiniumFileTOC[getNumberOfEntries()]; for (int i = 0; i < getNumberOfEntries(); i++) { <START> InfiniumFileTOC toc = new InfiniumFileTOC(); <END> toc.setTableOfContentsId(Short.reverseBytes(stream.readShort())); toc.setOffset(Integer.reverseBytes(stream.readInt())); tableOfContents[i] = toc; } return tableOfContents; }</code><technical_language>finals</technical_language>

Target:
InfiniumFileTOC[] getTableOfContents() throws IOException { final InfiniumFileTOC[] tableOfContents = new InfiniumFileTOC[getNumberOfEntries()]; for (int i = 0; i < getNumberOfEntries(); i++) { final InfiniumFileTOC toc = new InfiniumFileTOC(); toc.setTableOfContentsId(Short.reverseBytes(stream.readShort())); toc.setOffset(Integer.reverseBytes(stream.readInt())); tableOfContents[i] = toc; } return tableOfContents; }
Source:
<code><START> private boolean isNumericObjectInspector(ObjectInspector oi) { <END> if (!(oi.getCategory().equals(ObjectInspector.Category.PRIMITIVE))) { return false; } switch(((PrimitiveObjectInspector) oi).getPrimitiveCategory()) { case BYTE: case SHORT: case INT: case LONG: case FLOAT: case DOUBLE: return true; default: return false; } }</code><technical_language>I need include Hive Decimal (org.apache.hadoop.hive.common.type.HiveDecimal)</technical_language>

Target:
private boolean isNumericObjectInspector(ObjectInspector oi) { if (!(oi.getCategory().equals(ObjectInspector.Category.PRIMITIVE))) { return false; } switch(((PrimitiveObjectInspector) oi).getPrimitiveCategory()) { case BYTE: case SHORT: case INT: case LONG: case FLOAT: case DOUBLE: case DECIMAL: return true; default: return false; } }
Source:
<code>public void createProject() throws ProjectCreationFailedException { validateParameters(); try { <START> nameKey = createProjectArgs.getProject(); <END> final String head = createProjectArgs.permissionsOnly ? GitRepositoryManager.REF_CONFIG : createProjectArgs.branch; final Repository repo = repoManager.createRepository(nameKey); try { rq.replicateNewProject(nameKey, head); final RefUpdate u = repo.updateRef(Constants.HEAD); u.disableRefLog(); u.link(head); createProjectConfig(); if (!createProjectArgs.permissionsOnly && createProjectArgs.createEmptyCommit) { createEmptyCommit(repo, nameKey, createProjectArgs.branch); } } finally { repo.close(); } } catch (IllegalStateException e) { handleRepositoryExistsException(nameKey, e); } catch (RepositoryCaseMismatchException ee) { handleRepositoryExistsException(ee.getNameOfExistingProject(), ee); } catch (RepositoryNotFoundException e) { throw new ProjectCreationFailedException("Repository not exists", e); } catch (IOException e) { throw new ProjectCreationFailedException("IO error", e); } catch (ConfigInvalidException e) { throw new ProjectCreationFailedException("Configuration error", e); } }</code><technical_language>[optional] I 'nameKey' local variable instead of class member variable. For createProjectConfig method simply pass parameter (same done for createEmptyCommit method)</technical_language>

Target:
public void createProject() throws ProjectCreationFailedException { validateParameters(); try { final Project.NameKey nameKey = createProjectArgs.getProject(); final String head = createProjectArgs.permissionsOnly ? GitRepositoryManager.REF_CONFIG : createProjectArgs.branch; final Repository repo = repoManager.createRepository(nameKey); try { rq.replicateNewProject(nameKey, head); final RefUpdate u = repo.updateRef(Constants.HEAD); u.disableRefLog(); u.link(head); createProjectConfig(); if (!createProjectArgs.permissionsOnly && createProjectArgs.createEmptyCommit) { createEmptyCommit(repo, nameKey, createProjectArgs.branch); } } finally { repo.close(); } } catch (IllegalStateException e) { handleRepositoryExistsException(createProjectArgs.getProject(), e); } catch (RepositoryCaseMismatchException ee) { handleRepositoryExistsException(ee.getNameOfExistingProject(), ee); } catch (Exception e) { throw new ProjectCreationFailedException("Cannot create " + createProjectArgs.getProject(), e); } }